src/views/mdc/base/DeviceBaseInfo.vue
@@ -7,39 +7,29 @@
      <a-col :md="24-5" :sm="24">
        <div class="device-status-info">
          <a-space v-for="item in deviceStatusList" :key="item.value" class="single-status-info">
            <template v-if="item.value!=99">
              <div>{{ item.label }}</div>
              <div class="status-square" :style="{ backgroundColor: item.color }"></div>
            <div v-if="item.value!=99" class="status-square" :style="{ backgroundColor: item.color }"></div>
              <div>{{getDeviceNumberByStatus(item.value) }}</div>
            </template>
            <template v-else>
              <div>{{ item.label }}</div>
              <div>{{getDeviceNumberByStatus(item.value) }}</div>
            </template>
          </a-space>
        </div>
        <div>
          <a-tabs default-active-key="1">
            <a-tab-pane key="1" tab="布局图">
              <equipment-layout :dataList="dataList" :equipmentId="selectEquipmentId"
                                :node="selectEquipment"></equipment-layout>
              <equipment-layout :dataList="dataList" :equipmentId="selectEquipmentId" :node="selectEquipment"/>
            </a-tab-pane>
            <a-tab-pane key="2" tab="列表" force-render>
              <equipment-list :dataSource="dataList" @editEquipmentStatus="editEquipmentStatus"></equipment-list>
              <equipment-list :dataSource="dataList"/>
            </a-tab-pane>
          </a-tabs>
        </div>
      </a-col>
    </a-row>
  </a-card>
</template>
<script>
  import { putAction, getAction } from '@/api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getAction } from '@/api/manage'
  import BaseTree from '../common/BaseTree'
  import EquipmentLayout from './modules/DeviceBaseInfo/EquipmentLayout'
  import EquipmentList from './modules/DeviceBaseInfo/EquipmentList'
@@ -58,14 +48,8 @@
        selectEquipment: {},
        equipmentStatisticsInfo: {},
        dataList: [],
        standbyNumber: 0,
        offNumber: 0,
        warningNumber: 0,
        workNumber: 0,
        allNumber: 0,
        url: {
          list: '/mdc/mdcEquipment/queryEquipmentMonitorList',
          updateEquipmentStatus: '/mdc/mdcEquipment/updateEquipmentStatus'
          list: '/mdc/mdcEquipment/queryEquipmentMonitorList'
        },
        param: {},
        timer: null,
@@ -91,9 +75,9 @@
            color: '#FF0000'
          },
          {
            label: '异常',
            value: 33,
            color: '#FFA200'
            label: '故障',
            value: 5,
            color: '#C11900'
          },
          {
            label: '总数',
@@ -109,42 +93,18 @@
    },
    methods: {
      equipmentStatistics(param, resopnse = { key: false }) {
        getAction(this.url.list, param).then((res) => {
        getAction(this.url.list, param)
          .then((res) => {
          this.dataList = []
          if (res.success) {
            if (res.result.length != 0) {
              this.standbyNumber = 0
              this.offNumber = 0
              this.warningNumber = 0
              this.workNumber = 0
              this.allNumber = 0
              this.dataList = res.result
              this.allNumber = this.dataList.length
              if (resopnse.key) {
                this.$notification.success({
                  key: 'equipmentStatus',
                  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.workNumber = this.workNumber + 1
                    break
                  case '关机' :
                    this.offNumber = this.offNumber + 1
                    break
                  case '报警' :
                    this.warningNumber = this.warningNumber + 1
                    break
                  default:
                    break
                }
              }
              // 筛选从车板跳转过来的需求数据
@@ -158,7 +118,8 @@
                description: '此车间下面无设备!!'
              })
            }
          } else {
            }
            else {
            this.$notification.warning({
              message: '消息',
              description: res.message
@@ -169,7 +130,7 @@
      /**
       * 筛选满足从看板跳转过来时的条件的数据
       * @param record
       * @param signageData
       */
      filterDataList(signageData) {
        this.dataList = this.dataList.filter(item => item.oporationDict === signageData.name)
@@ -182,49 +143,12 @@
        this.selectEquipment = val.equipmentId
        clearInterval(this.timer)
        this.timer = null
        if (!val.equipmentId) {
          this.param.key = val.key
        if (!val.equipmentId) this.param.key = val.key
        else this.param.key = val.parentId
          this.equipmentStatistics(this.param)
          this.timer = setInterval(() => {
            setTimeout(this.equipmentStatistics(this.param), 0)
          }, 1000 * 10)
        } else {
          this.param.key = val.parentId
          this.equipmentStatistics(this.param)
          this.timer = setInterval(() => {
            setTimeout(this.equipmentStatistics(this.param), 0)
          }, 1000 * 10)
        }
      },
      /**
       * 单击状态反馈后触发
       * @param record
       */
      editEquipmentStatus(record) {
        const _this = this
        this.$notification.info({
          key: 'equipmentStatus',
          message: '消息',
          description: '反馈中...'
        })
        getAction(this.url.updateEquipmentStatus, { id: record.id })
          .then(res => {
            if (res.success) {
              _this.equipmentStatistics(this.param, { key: true, message: res.message })
            } else {
              this.$notification.warning({
                message: '消息',
                description: res.message
              })
            }
          })
          .catch(err => {
            this.$notification.error({
              message: '消息',
              description: err.message
            })
          })
      },
      /**
@@ -269,22 +193,6 @@
    display: inline-block;
    width: 15px;
    height: 15px;
  }
  .equipMessage table td .equipShutdown {
    background-color: #808080;
  }
  .equipMessage table td .standbyNumber {
    background-color: #ffbf37;
  }
  .equipMessage table td .equipRun {
    background-color: #19FE01;
  }
  .equipMessage table td .equipAlarm {
    background-color: #FD0008;
  }
  .device-status-info {