|
@@ -51,7 +51,7 @@
|
|
|
</div>
|
|
|
<div class="item-info__el" v-if="item?.weight">
|
|
|
<div class="distance">
|
|
|
- {{ item?.weight?.value }}
|
|
|
+ {{ item?.weight?.value??'--' }}
|
|
|
<span style="font-size: 12px">{{ item.weight?.unit || item.weight?.unitName }}</span>
|
|
|
</div>
|
|
|
<div class="text">
|
|
@@ -85,14 +85,14 @@
|
|
|
<div class="item-info3__el" v-for="el in item?.matchVariables">
|
|
|
<div class="text">{{ el.variableName }}</div>
|
|
|
<div class="g-fx" style="align-items: center">
|
|
|
- <div>{{ el.value??'' + el.unitName }}</div>
|
|
|
+ <div>{{ (el.value ?? '--') + el.unitName }}</div>
|
|
|
<div style="margin-left: 10px" class="line" :style="{ background: getMatchBgColor(el) }"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="item-info3__el" v-for="el in item?.valueVariables">
|
|
|
<div class="text">{{ el.variableName }}</div>
|
|
|
<div class="g-fx" style="align-items: center">
|
|
|
- <div>{{ el.value??'' + el.unitName }}</div>
|
|
|
+ <div>{{ (el.value ?? '--') + el.unitName }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -149,7 +149,7 @@ const dataSource = useRequest(() => getGroupAndVariables({ deviceId: deviceId.va
|
|
|
const getDeviceInfo = async (id: string) => {
|
|
|
const data = await fetchDeviceInfoAll(id)
|
|
|
equipmentInfo.value = data
|
|
|
-
|
|
|
+
|
|
|
onSubscribe([`Json/${equipmentInfo.value.code}`], (topic: string, payload: any) => {
|
|
|
parseData(payload)
|
|
|
})
|
|
@@ -205,7 +205,6 @@ const parseData = (payload: any) => {
|
|
|
variable.value = mqttValue === 'true' || mqttValue === true ? '开启' : '闭合'
|
|
|
} else {
|
|
|
let value = formatValue(mqttValue, variable.translate)
|
|
|
- console.log("variable解析",value)
|
|
|
variable.value = evaluateFormula(value, variable.formula)
|
|
|
}
|
|
|
return
|
|
@@ -266,7 +265,7 @@ const evaluateFormula = (value: any, formula: any) => {
|
|
|
if (formula == null || formula == undefined || formula === '') {
|
|
|
return value
|
|
|
}
|
|
|
- console.log("函数计算",formula)
|
|
|
+ console.log("函数计算", formula)
|
|
|
//函数模板
|
|
|
const array = formula.split(",")
|
|
|
//字符串模本
|
|
@@ -277,7 +276,7 @@ const evaluateFormula = (value: any, formula: any) => {
|
|
|
const result = eval(func)
|
|
|
templete = templete.replace(`{${index}}`, Math.floor(parseFloat(result)))
|
|
|
})
|
|
|
- console.log("函数计算",templete)
|
|
|
+ console.log("函数计算", templete)
|
|
|
return templete
|
|
|
}
|
|
|
|