Browse Source

磁盘颜色修改,消防与环境监测消息上报内容解析

jingyuanchao 1 year ago
parent
commit
b461086d50

+ 19 - 47
src/views/menu/iot/envMonitor/detail.vue

@@ -4,19 +4,21 @@
     <van-cell-group>
     <van-cell-group>
       <van-cell :title="info.deviceName" value-class="cell-title-value" title-style="width:100%;">
       <van-cell :title="info.deviceName" value-class="cell-title-value" title-style="width:100%;">
       </van-cell>
       </van-cell>
-      <van-cell title="上报时间" :value="stateUpdateTimeText" />
-      <van-cell title="持续时长" :value="durationText" />
-      <van-cell title="设备采集值" :value="gatherText" title-style="max-width:100px" :value-class="info.state==1?'cell-gather-alarm-value':''"/>
-      <van-cell title="动环类型" :value="info.deviceTypeText" />
-      <van-cell title="所属机构" :value="info.orgName" />
+      <van-cell title="上报时间" :value="stateUpdateTimeText"/>
+      <van-cell title="持续时长" :value="durationText"/>
+      <van-cell title="设备采集值" :value="gatherText" title-style="max-width:100px"
+                :value-class="info.state==1?'cell-gather-alarm-value':''"/>
+      <van-cell title="动环类型" :value="info.deviceTypeText"/>
+      <van-cell title="所属机构" :value="info.orgName"/>
     </van-cell-group>
     </van-cell-group>
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import { detail } from '@/api/iot/donghuan.js'
+import {detail} from '@/api/iot/donghuan.js'
 import NavBar from '@/components/NavBar'
 import NavBar from '@/components/NavBar'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import {durationText} from "@/utils/date.js"
 import {durationText} from "@/utils/date.js"
+
 export default {
 export default {
   data() {
   data() {
     return {
     return {
@@ -26,7 +28,7 @@ export default {
       }
       }
     }
     }
   },
   },
-  components: { NavBar },
+  components: {NavBar},
   computed: {
   computed: {
     stateUpdateTimeText() {
     stateUpdateTimeText() {
       if (this.info.stateUpdateTime == null) {
       if (this.info.stateUpdateTime == null) {
@@ -44,44 +46,12 @@ export default {
       if (array.length === 0) {
       if (array.length === 0) {
         return '未上报'
         return '未上报'
       }
       }
+      let text = '';
+      array.forEach(item => {
+        text += `${item.name}: ${item.res}\n`;
+      });
 
 
-      let text;
-      switch (this.info.deviceType) {
-        case '4183': //温湿度
-          let temporary = array.find(i => i.name === '环境温度')
-          if (temporary) {
-            text = `温度:${temporary.val }${temporary.unit};`
-          }
-
-          let humidity = array.find(i => i.name === '环境湿度')
-          if (humidity) {
-            text += `湿度:${humidity.val}${humidity.unit};`
-          }
-
-          break
-        case '4181': //红外
-          text = `红外${(array[0].val == 0 ? '正常' : '告警')}`
-          break
-        case '4182': //烟感
-          text = `烟感${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '4184': //水浸,
-          text = `水浸${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '4160': //智能电表
-          text = `智能电表${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '41885': //燃气报警器
-          text = `燃气${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '4188': //门窗磁
-          text = `门窗磁${array[0].val == 0 ? '关门' : '开门'}`
-          break
-        case '41881': //防盗
-          text = `防盗${array[0].val == 0 ? '正常' : '告警'}`
-          break
-      }
-
+      console.log(text)
       return text;
       return text;
     },
     },
     durationText() {
     durationText() {
@@ -89,7 +59,7 @@ export default {
         return '未上报'
         return '未上报'
       }
       }
 
 
-      let minutes =dayjs().diff(this.info.stateStartTime,'minute')
+      let minutes = dayjs().diff(this.info.stateStartTime, 'minute')
       return durationText(minutes);
       return durationText(minutes);
     }
     }
   },
   },
@@ -109,10 +79,12 @@ export default {
 .cell-title-value {
 .cell-title-value {
   display: none;
   display: none;
 }
 }
+
 .detail {
 .detail {
   margin: 15px;
   margin: 15px;
 }
 }
-.cell-gather-alarm-value{
-  color:#ee0a24;
+
+.cell-gather-alarm-value {
+  color: #ee0a24;
 }
 }
 </style>
 </style>

+ 4 - 34
src/views/menu/iot/fireWarning/detail.vue

@@ -44,40 +44,10 @@ export default {
       if (array.length === 0) {
       if (array.length === 0) {
         return '未上报'
         return '未上报'
       }
       }
-
-      let text;
-      switch (this.info.deviceType) {
-        case '4183': //温湿度
-          let temporary = array.find(i => i.name === '环境温度')
-          if (temporary) {
-            text = `温度:${temporary.val }${temporary.unit};`
-          }
-
-          let humidity = array.find(i => i.name === '环境湿度')
-          if (humidity) {
-            text += `湿度:${humidity.val}${humidity.unit};`
-          }
-
-          break
-        case '4181': //红外
-          text = `红外${(array[0].val == 0 ? '正常' : '告警')}`
-          break
-        case '4182': //烟感
-          text = `烟感${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '4184': //水浸,
-          text = `水浸${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '4160': //智能电表
-          text = `智能电表${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '41885': //燃气报警器
-          text = `燃气${array[0].val == 0 ? '正常' : '告警'}`
-          break
-        case '4188': //门窗磁
-          text = `门窗磁${array[0].val == 0 ? '关门' : '开门'}`
-          break
-      }
+      let text = '';
+      array.forEach(item => {
+        text += `${item.name}: ${item.res}\n`;
+      });
 
 
       return text;
       return text;
     },
     },

+ 2 - 2
src/views/menu/iot/smartOpration/components/diskItem.vue

@@ -12,7 +12,7 @@
         <template #right-icon>
         <template #right-icon>
           <span v-if="data.diskInfos && data.diskInfos.length > 0">
           <span v-if="data.diskInfos && data.diskInfos.length > 0">
             <van-tag v-if="data.state == 0" type="success">正常</van-tag>
             <van-tag v-if="data.state == 0" type="success">正常</van-tag>
-            <van-tag v-else-if="data.state == 1" type="warning">异常</van-tag>
+            <van-tag v-else-if="data.state == 1" type="danger">异常</van-tag>
             <van-tag v-else color="#969799">未知</van-tag>
             <van-tag v-else color="#969799">未知</van-tag>
             <van-icon style="margin-left: 10px" :name="expanded ? 'arrow-up' : 'arrow-down'"  @click="onTitleClicked"></van-icon>
             <van-icon style="margin-left: 10px" :name="expanded ? 'arrow-up' : 'arrow-down'"  @click="onTitleClicked"></van-icon>
           </span>
           </span>
@@ -142,7 +142,7 @@ export default {
       if (disk.state== 0) {
       if (disk.state== 0) {
         return '#07c160'
         return '#07c160'
       }else {
       }else {
-        return '#ff976a'
+        return '#ee0a24'
       }
       }
 
 
       let rate = this.diskProgress(disk)
       let rate = this.diskProgress(disk)