|
@@ -204,6 +204,7 @@
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
<div class="right_top">
|
|
|
+
|
|
|
<div style="display: flex;justify-content: space-between;align-items: center;">
|
|
|
<div style="display: flex;align-items: center;">
|
|
|
<div style="width: 8px;height: 8px;background-color: #02803A;margin-right: 15px;" />
|
|
@@ -212,7 +213,7 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
<span style="margin-top: 5px;color: #608BF3;font-size: 18px;font-family: Alibaba-PuHuiTi-R;">
|
|
|
- {{ dutyCycleData.currentDuration }}
|
|
|
+ {{ currentDurationData.value }}
|
|
|
</span>
|
|
|
</div>
|
|
|
<div style="display: flex;justify-content: space-between;align-items: center;border-top:0.5px solid #152844;">
|
|
@@ -223,7 +224,7 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
<span style="margin-top: 5px;color: #608BF3;font-size: 18px;font-family: Alibaba-PuHuiTi-R;">
|
|
|
- {{ dutyCycleData.totalDuration }}
|
|
|
+ {{ totalDurationData.value }}
|
|
|
</span>
|
|
|
</div>
|
|
|
<div style="display: flex;justify-content: space-between;align-items: center;border-top:0.5px solid #152844;">
|
|
@@ -234,7 +235,7 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
<span style="margin-top: 5px;color: #608BF3;font-size: 18px;font-family: Alibaba-PuHuiTi-R;">
|
|
|
- {{ dutyCycleData.totalCount+' 次' }}
|
|
|
+ {{ totalCountData.value+' 次' }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -396,8 +397,12 @@
|
|
|
const hoistSwitchVariablesData: any = ref([])
|
|
|
//总配电变量
|
|
|
const otherSwitchData: any = ref([])
|
|
|
+ //本次工作
|
|
|
+ const currentDurationData: any = ref({})
|
|
|
+ //累计工作
|
|
|
+ const totalDurationData: any = ref({})
|
|
|
//工作循环
|
|
|
- const dutyCycleData: any = ref({})
|
|
|
+ const totalCountData: any = ref({})
|
|
|
//报警集合
|
|
|
const alarmRecordArr: any = ref([]);
|
|
|
|
|
@@ -510,8 +515,12 @@
|
|
|
hoistSwitchVariablesData.value = chunkArray(hoistData.value.switchVariables,12)
|
|
|
//总配电开关量
|
|
|
otherSwitchData.value = chunkArray(deviceData.value.otherSwitchData,6)
|
|
|
- //工作云环
|
|
|
- dutyCycleData.value = deviceData.value.dutyCycle
|
|
|
+ //本次工作
|
|
|
+ currentDurationData.value = deviceData.value.dutyCycle.currentDuration
|
|
|
+ //累计工作
|
|
|
+ totalDurationData.value = deviceData.value.dutyCycle.totalDuration
|
|
|
+ //工作循环
|
|
|
+ totalCountData.value = deviceData.value.dutyCycle.totalCount
|
|
|
//获取报警信息
|
|
|
const record = await getAlertRecordsByDevice({ deviceId: deviceId.value, maxCount: 10 })
|
|
|
alarmRecordArr.value = record
|
|
@@ -708,6 +717,32 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ //本次工作
|
|
|
+ const currentDuration = currentDurationData.value
|
|
|
+ if(currentDuration){
|
|
|
+ if (currentDuration.code == Code) {
|
|
|
+ let value = formatValue(Value, currentDuration.translate)
|
|
|
+ currentDuration.value = evaluateFormula(value, currentDuration.formula)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //累计工作
|
|
|
+ const totalDuration = totalDurationData.value
|
|
|
+ if(totalDuration){
|
|
|
+ if (totalDuration.code == Code) {
|
|
|
+ let value = formatValue(Value, totalDuration.translate)
|
|
|
+ totalDuration.value = evaluateFormula(value, totalDuration.formula)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //工作循环
|
|
|
+ const totalCount = totalCountData.value
|
|
|
+ if(totalCount){
|
|
|
+ if (totalCount.code == Code) {
|
|
|
+ totalCount.value = formatValue(Value, totalCount.translate)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -719,8 +754,25 @@
|
|
|
router.go(-1)
|
|
|
}
|
|
|
|
|
|
+ const evaluateFormula = (value: any, formula: any) => {
|
|
|
+ if (formula == null || formula == undefined || formula === '') {
|
|
|
+ return value
|
|
|
+ }
|
|
|
+ //函数模板
|
|
|
+ const array = formula.split(",")
|
|
|
+ //字符串模本
|
|
|
+ var templete = array[0]
|
|
|
+ const formulaArray = array.slice(1)
|
|
|
+ formulaArray.forEach((item: any, index: number) => {
|
|
|
+ const func = item.replace("{Value}", value)
|
|
|
+ const result = eval(func)
|
|
|
+ templete = templete.replace(`{${index}}`, Math.floor(parseFloat(result)))
|
|
|
+ })
|
|
|
+ return templete
|
|
|
+ }
|
|
|
+
|
|
|
const formatStr = (value:string) => {
|
|
|
- return value.replace('大车','').replace('副小车','').replace('主起升','').replace('配电','')
|
|
|
+ return value.replace('大车','').replace('副小车','').replace('主起升','').replace('配电','').replace('起升','').replace('小车','')
|
|
|
}
|
|
|
</script>
|
|
|
|