yangys
2025-11-18 831cfa4c439c6d073d706a82d2a439f8b1818498
src/views/mdc/realtime-status/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-09 22:11:21
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-10-31 17:27:54
 * @LastEditors: 李喆(开发组) lzhe@yxqiche.com
 * @LastEditTime: 2025-05-28 13:45:33
 * @FilePath: /cps-web/src/views/mdc/realtime-status/index.vue
 实时看板
-->
@@ -79,7 +79,7 @@
            </div>
         </div>
      </div>
      <el-dialog :title="titleMap" v-model="visible" :width="740">
      <el-dialog :title="titleMap" v-model="visible" :width="740" v-if="visible">
         <div class="dialogstyle">
            <el-table :data="timestatus[clickIndex].properties" style="width: 100%" border>
               <el-table-column prop="name" label="数据点"></el-table-column>
@@ -129,6 +129,10 @@
      this.deviceStatus = this.$route.query.currentTag ? [...this.$route.query.currentTag] : [];
      this.getstationlabelList();  //获取标签视图下的list
      this.getprocess(); //获取颜色==》获取顶部title==》设置几行几列==》ws
      //每一分钟执行一次
      var intervalId = setInterval(() => {
         this.getdevicestatus();
      }, 60000);
   },
   methods: {
      getSetting() {
@@ -175,6 +179,7 @@
            this.stationlabel = this.stationlabelList[0].groupName;
            this.workStationGroupIdList = [this.stationlabelList[0].groupId];
         }
         this.clickIndex = 0;
         this.gettimestatus();  //查询列表
      },
      showvisible(item, index) {
@@ -193,7 +198,12 @@
            item.active = false;
         })
         this.devicestatus[index].active = true;
         this.deviceStatus = [item.status];
         if(item.status == 10) {  //全部
            this.deviceStatus = [];
         }else {
            this.deviceStatus = [item.status];
         }
         this.current = "1";
         this.gettimestatus();
      },
      prev() {
@@ -202,13 +212,14 @@
         this.gettimestatus();
      },
      next() {
         if ((this.current * this.line) < this.total / this.column) {
            this.current = Number(this.current) + 1;
            this.gettimestatus();
         }
      },
      goSet() {
         this.$router.push('/mdc/configuration?isShowSearch=1');  //分析设置
         this.$router.push('/mdc/configuration?isShowSearch=1');  //分析设置(isShowSearch表示即时信息来)
      },
      gostatus(item) {
         this.$router.push('/mdc/station-live?code=' + item.id);
@@ -282,6 +293,7 @@
                        if (eventData.data.DeviceStatus) {
                           var time = moment(eventData.data.DeviceStatus.t).format('YYYY-MM-DD HH:mm:ss');
                           var preT = moment(eventData.data.DeviceStatus.preT).format('YYYY-MM-DD HH:mm:ss');
                           //console.log('time='+time+",preT="+preT);
                           var diffTime = that.changeTime(time,preT);  //转换成差值(时分秒)
                           var diffTime = diffTime;
                           item.time = diffTime;
@@ -313,7 +325,16 @@
                              };
                           } else {
                              if(eventData.data[item1.key]) {
                                 item1.code = eventData.data[item1.key].v;
                                 if(item1.key == "Alarm") {
                                    try {
                                      var vJson = JSON.parse(eventData.data[item1.key].v);
                                      item1.code = JSON.stringify(vJson[0]);
                                    } catch (e) {
                                      item1.code = eventData.data[item1.key].v;
                                    }
                                 }else {
                                    item1.code = eventData.data[item1.key].v;
                                 }
                                 item1.moment = that.timestampChangeTime(eventData.data[item1.key].t);  //时间戳转化成日期
                              }else {
                                 item1.code = "";
@@ -344,6 +365,8 @@
      getdevicestatus() {
         this.$HTTP.get(`/api/mdc/work-station-analysis/device-status-statistics`).then(res => {
            if (res.code == 200) {
               var deviceNumAll = 0;
               var newResData = [];
               res.data.forEach(item => {
                  item.active = false;
                  this.allwcs.forEach(item1 => {
@@ -354,13 +377,32 @@
                  if (this.$route.query.currentTag == item.status) {
                     item.active = true;
                  }
                  deviceNumAll += item.deviceNum;
                  /*
                  //调试 后端数据已经取消
                  if(item.statusName != '调试') {
                  }*/
                  newResData.push(item);
                  if(item.statusName == '报警') {
                     item.icon = "Position";
                  }else if(item.statusName == '待机') {
                     item.icon = "Loading";
                  }else if(item.statusName == '离线') {
                     item.icon = "Clock";
                  }else {
                     item.icon = "Odometer";
                  }
               })
               res.data[0].icon = "Position";
               res.data[1].icon = "Loading";
               res.data[2].icon = "Clock";
               res.data[3].icon = "Warning";
               res.data[4].icon = "Odometer";
               this.devicestatus = res.data;
               newResData.push({
                  active: false,
                  color: "#08f1f4",
                  deviceNum: deviceNumAll,
                  icon: "price-tag",
                  status: "10",
                  statusName: "全部",
               })
               this.devicestatus = newResData;
            }
         })
      }