lixing 11 months ago
parent
commit
2276474c20

+ 0 - 1
.eslintrc.js

@@ -1,7 +1,6 @@
 {
   "globals": {
     "EffectScope": true,
-    "ElMessage": true,
     "_mqttMessageCallback": true,
     "acceptHMRUpdate": true,
     "computed": true,

+ 4 - 4
src/views/equipment-center/real-time-data/european-gourd.vue

@@ -42,7 +42,7 @@
             <div class="item" v-if="currentData?.stroke">
               <div>
                 <div class="text1">
-                  {{ currentData?.stroke.value??'' }}
+                  {{ currentData?.stroke.value ?? '--' }}
                   <span style="font-weight: 400; font-size: 16px">{{ currentData?.stroke.unit }}</span>
                 </div>
                 <div class="text2">
@@ -64,7 +64,7 @@
             <div class="item" v-if="currentData?.weight">
               <div>
                 <div class="text1">
-                  {{ currentData?.weight.value??'' }}
+                  {{ currentData?.weight.value ?? '--' }}
                   <span style="font-weight: 400; font-size: 16px">{{ currentData?.weight.unit }}</span>
                 </div>
                 <div class="text2">
@@ -95,7 +95,7 @@
         <div class="g-fx-j right__item" v-for="(el, i) in currentData?.matchVariables" :key="i">
           <div class="text">{{ el.name }}</div>
           <div class="text2">
-            {{ el.vValue??'' + el.unitName }}
+            {{ (el.vValue ?? '--') + el.unitName }}
             <div :style="{ backgroundColor: getMatchBgColor(el) }"></div>
           </div>
         </div>
@@ -103,7 +103,7 @@
         <div class="g-fx-j right__item" v-for="(el, i) in currentData?.valueVariables" :key="i">
           <div class="text">{{ el.variableName }}</div>
           <div class="text2">
-            {{ el.value??'' + el.unitName }}
+            {{ (el.value ?? '--') + el.unitName }}
           </div>
         </div>
       </div>

+ 6 - 7
src/views/equipment-center/real-time-data/index.vue

@@ -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
 }