src/views/mdc/base/DeviceBaseInfo.vue
@@ -5,30 +5,6 @@
        <base-tree @sendSelectBaseTree="changeSelection" @getCurrSelected="changeSelectionNode"></base-tree>
      </a-col>
      <a-col :md="24-5" :sm="24">
        <!--<div class="equipMessage">-->
          <!--<table>-->
            <!--<tr>-->
              <!--<td>关机-->
                <!--<span class="equipShutdown"></span>-->
              <!--</td>-->
              <!--<td>{{offNumber}}</td>-->
              <!--<td>待机-->
                <!--<span class="standbyNumber"></span>-->
              <!--</td>-->
              <!--<td>{{standbyNumber}}</td>-->
              <!--<td>运行-->
                <!--<span class="equipRun"></span>-->
              <!--</td>-->
              <!--<td>{{workNumber}}</td>-->
              <!--<td>报警-->
                <!--<span class="equipAlarm"></span>-->
              <!--</td>-->
              <!--<td>{{warningNumber}}</td>-->
              <!--<td>总数</td>-->
              <!--<td>{{allNumber}}</td>-->
            <!--</tr>-->
          <!--</table>-->
        <!--</div>-->
        <div class="device-status-info">
          <a-space v-for="item in deviceStatusList" :key="item.value" class="single-status-info">
@@ -47,7 +23,8 @@
        <div>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="布局图">
              <equipment-layout :dataList="dataList" :equipmentId="selectEquementId" :node="selectEquement"></equipment-layout>
              <equipment-layout :dataList="dataList" :equipmentId="selectEquementId"
                                :node="selectEquement"></equipment-layout>
            </a-tab-pane>
            <a-tab-pane key="2" tab="列表" force-render>
              <equipment-list :dataSource="dataList" @editEquipmentStatus="editEquipmentStatus"></equipment-list>
@@ -127,10 +104,13 @@
            value: 99,
            color: '#fff'
          }
        ],// 设备状态指示灯列表,
        ]// 设备状态指示灯列表,
      }
    },
    created() {
      const { productionId } = this.$route.params
      console.log('productionId', productionId)
      if (productionId) this.param.key = productionId
      // this.equipmentStatistics()
      // setInterval(this.equipmentStatistics(), 5*1000);
    },
@@ -152,47 +132,72 @@
                this.$notification.success({
                  key:'equipmentStatus',
                  message: '消息',
                  description: resopnse.message,
                });
                  description: resopnse.message
                })
              }
              for (let i = 0; i < this.dataList.length; i++) {
                let item = this.dataList[i]
                switch (item.oporationDict) {
                  case "待机" : this.standbyNumber = this.standbyNumber + 1;break;
                  case '待机' :
                    this.standbyNumber = this.standbyNumber + 1
                    break
                  // case 2 : this.standbyNumber = this.standbyNumber + 1;break;
                  case "运行" : this.workNumber = this.workNumber + 1;break;
                  case "关机" : this.offNumber = this.offNumber + 1;break;
                  case "报警" : this.warningNumber = this.warningNumber + 1;break;
                  default:break;
                  case '运行' :
                    this.workNumber = this.workNumber + 1
                    break
                  case '关机' :
                    this.offNumber = this.offNumber + 1
                    break
                  case '报警' :
                    this.warningNumber = this.warningNumber + 1
                    break
                  default:
                    break
                }
              }
              // 筛选从车板跳转过来的需求数据
              const { signageData } = this.$route.params
              console.log('signageData', signageData)
              if (!signageData) return
              else this.filterDataList(signageData)
            }else{
              // this.$message.warning("此车间下面无设备!!")
              this.$notification.warning({
                message:'消息',
                description:"此车间下面无设备!!"
              });
                description: '此车间下面无设备!!'
              })
            }
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
            })
          }
        })
      },
      /**
       * 筛选满足从看板跳转过来时的条件的数据
       * @param record
       */
      filterDataList(signageData) {
        this.dataList = this.dataList.filter(item => item.oporationDict === signageData.name)
        console.log('dataList', this.dataList)
      },
      changeSelection(val) {
        this.selectEquementId = val
      },
      changeSelectionNode(val) {
        // console.log(val)
        this.selectEquement = val.equipmentId
        clearInterval(this.timer);
        clearInterval(this.timer)
        this.timer = null
        if (!val.equipmentId) {
          this.param.key=val.key
          clearInterval(this.timerzhun);
          clearInterval(this.timerzhun)
          this.timerzhun = null
          this.equipmentStatistics(this.param)
          this.timer = setInterval(() => {
@@ -200,7 +205,7 @@
          },1000*10)
        }else{
          this.param.key=val.parentId
          clearInterval(this.timerzhun);
          clearInterval(this.timerzhun)
          this.timerzhun = null
          this.equipmentStatistics(this.param)
          this.timer = setInterval(() => {
@@ -219,8 +224,8 @@
        this.$notification.info({
          key:'equipmentStatus',
          message: '消息',
          description: '反馈中...',
        });
          description: '反馈中...'
        })
        getAction(this.url.updateEquipmentStatus,{id:record.id})
          .then(res=>{
            if(res.success) {
@@ -229,14 +234,14 @@
              this.$notification.warning({
                message:'消息',
                description:res.message
              });
              })
            }
          })
          .catch(err=>{
            this.$notification.error({
              message:'消息',
              description:err.message
            });
            })
          })
      },
@@ -248,16 +253,16 @@
      getDeviceNumberByStatus(value) {
        if (value === 99) return this.dataList.length
        return this.dataList.filter((item) => item.oporation === 1 && value === 2 || item.oporation === value).length
      },
      }
    },
    mounted(){
      this.equipmentStatistics()
      this.equipmentStatistics(this.param)
      // this.timerzhun = setInterval(() => {
      //   setTimeout( this.equipmentStatistics(),0)
      // },1000*10)
    },
    beforeDestroy(){
      clearInterval(this.timer);
      clearInterval(this.timer)
      this.timer = null
    }
  }