var entrustDept = $("div[data-key='entrustRepair.entrustDept']")
entrustDept.parent().parent().css('paddingRight', '5px')
entrustDept
.parent()
.parent()
.append(
'<span οnclick="entrustDeptNameRef()" style="display:inline-block;width:16px;cursor:pointer;height:16px;float:right;position:relative;top:6px;background:url(/greenDill/static/images/origin/icon_djedit.png) no-repeat center;background-position: 0 -351px;"></div>'
)
function entrustDeptNameRef() {
ReactAPI.openReference({
id: 'newReference',
url: '/msService/BaseSet/cooperate/cooperate/cmcPartRef?clientType=mobile&isContractor=true&customConditionKey=isContractor',
type: 'Other',
onOk: function onOk(data) {
debugger
ReactAPI.getComponentAPI('Input')
.APIs('entrustRepair.entrustDept')
.setValue(data[0].name)
},
})
}
var html =
'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" class="icon-search" font-size="12px" color="#9f9f9f" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" style="color: rgb(159, 159, 159);" οnclick="rerfenceclick(this)"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path></svg>'
var grid = ReactAPI.getComponentAPI('Datagrid').APIs(
'maintenance_1.0.0_workRecord_enstustEdit__mobile__dg1659493699259'
)
var gridData = grid.getDatagridData()
$("[data-key='enstrustDept']")
.children()
.children()
.eq(-1)
.children()
.append(html)
function unitOnclick(nRow) {
ReactAPI.openReference({
id: 'newReference',
url: '/msService/BaseSet/cooperate/cooperate/cmcPartRef?clientType=mobile&isContractor=true&customConditionKey=isContractor',
type: 'Other',
onOk: function (data) {
ReactAPI.getComponentAPI('Datagrid')
.APIs(
'maintenance_1.0.0_workRecord_enstustEdit__mobile__dg1659493699259'
)
.setCellValueByKey(nRow, 'enstrustDept', data[0].name)
},
})
}
function rerfenceclick(ele) {
var rowIndex =
ele.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.getAttribute(
'data-rowindex'
)
unitOnclick(rowIndex)
}
var eamCodeDom = $("div[data-key='onOrOff.eamID.code']")
eamCodeDom.parent().parent().css('paddingRight', '25px')
eamCodeDom.parent().parent().find('i').css('right', '25px')
eamCodeDom
.parent()
.parent()
.append(
'<div style="position:absolute;right:10px;display:inline-block" onClick="window.mobilejs.scanQRCode(function(val){scanEamQRCode(val)})"><img style="vertical-align:middle" src="/msService/outagManage/images/icon_scan.png"/></div>'
)
window.scanEamQRCode = function (eamCode) {
var eamCodeObj = eval('(' + eamCode + ')')
$.ajax({
type: 'post',
async: false,
url: '/msService/EAM/baseInfo/baseInfo/eleInfoRefPart__mobile__-query',
contentType: 'application/json',
data: JSON.stringify({
fastQueryCond:
'{"viewCode":"EAM_1.0.0_baseInfo_eleInfoRefPart__mobile__","modelAlias":"baseInfo","condName":"fastCond","remark":"fastCond","subconds":[{"type":"0","columnName":"CODE","dbColumnType":"TEXT","operator":"like","paramStr":"%?%","value":"' +
eamCodeObj.code +
'"}]}',
flowBulkFlag: false,
customCondition: {},
permissionCode: 'EAM_1.0.0_baseInfo_eleInfoRefPart__mobile__',
pageNo: 1,
pageSize: 20,
paging: true,
}),
success: function (data) {
if (data.code == 200) {
if (data.data.result.length == 1) {
var eamInfo = data.data.result[0]
ReactAPI.getComponentAPI('Reference')
.APIs('onOrOff.eamID.code')
.setValue({
code: eamInfo.code,
name: eamInfo.name,
id: eamInfo.id,
areaNum: eamInfo.areaNum,
})
setTimeout(function () {
$.ajax({
type: 'get',
async: false,
url:
'/msService/outagManage/onOrOff/onOrOff/getEquipmentOffTemplate?id=' +
eamInfo.id,
success: function (res) {
if (res.code == 200) {
if (res.data && res.data.contents) {
var cts = []
for (var i = 0; i < res.data.contents.length; i++) {
cts.push({ workContent: res.data.contents[i] })
}
ReactAPI.getComponentAPI()
.Datagrid.APIs(window.contentPtCode)
.addLine(cts)
}
if (res.data && res.data.announcements) {
var announce = []
for (var i = 0; i < res.data.announcements.length; i++) {
announce.push({ caution: res.data.announcements[i] })
}
ReactAPI.getComponentAPI()
.Datagrid.APIs(window.cautionPtCode)
.addLine(announce)
}
}
},
})
}, 1000)
try {
ReactAPI.getComponentAPI('Reference')
.APIs('onOrOff.eleAreaId.areaName')
.setReadonly(true)
} catch (e) {
console.error('设备区域不可编辑出错!', e)
}
var isDisplayState = 'false'
$.ajax({
type: 'get',
async: false,
url: '/inter-api/systemconfig/v1/config/catalog/by/module',
data: {
moduleCode: 'outagManage',
key: 'outagManage.isDisplayState',
},
success: function (msg) {
isDisplayState = msg.data['outagManage.isDisplayState']
},
})
if (isDisplayState == 'false') {
ReactAPI.getComponentAPI('SystemCode')
.APIs('onOrOff.runningState')
.hide()
.row()
}
if (isDisplayState == 'true') {
$.ajax({
type: 'get',
async: false,
url: '/msService/outagManage/onOrOff/onOrOff/getRealTimeRunningStatus',
data: {
eamId: eamInfo.id,
},
success: function (msg) {
if (msg && msg.code == 200) {
switch (msg.data) {
case 1:
ReactAPI.getComponentAPI('SystemCode')
.APIs('onOrOff.runningState')
.setValue('outagManage_runStatus/on')
break
case -1:
ReactAPI.getComponentAPI('SystemCode')
.APIs('onOrOff.runningState')
.setValue('outagManage_runStatus/off')
break
default:
ReactAPI.getComponentAPI('SystemCode')
.APIs('onOrOff.runningState')
.setValue('outagManage_runStatus/none')
break
}
}
},
})
}
} else {
ReactAPI.showMessage('w', '识别不到设备!')
}
} else {
ReactAPI.showMessage('w', '识别设备出错!')
}
},
})
}