¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-card :bordered="false"> |
| | | <a-row type="flex" :gutter="16"> |
| | | <a-col :md="5" :sm="24"> |
| | | <base-tree @sendSelectBaseTree="changeSelection" @getCurrSelected="changeSelectionNode"></base-tree> |
| | | </a-col> |
| | | <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>{{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> |
| | | </a-tab-pane> |
| | | <a-tab-pane key="2" tab="å表" force-render> |
| | | <equipment-list :dataSource="dataList" @editEquipmentStatus="editEquipmentStatus" :equipmentId="this.param.key"></equipment-list> |
| | | </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 BaseTree from '../common/BaseTree' |
| | | import EquipmentLayout from './modules/DeviceBaseInfo/EquipmentLayout' |
| | | import EquipmentList from './modules/DeviceBaseInfo/EquipmentList' |
| | | |
| | | export default { |
| | | name: 'DeviceBaseInfo', |
| | | components: { |
| | | BaseTree, |
| | | EquipmentLayout, |
| | | EquipmentList |
| | | }, |
| | | data() { |
| | | return { |
| | | description: '设å¤ä¿¡æ¯', |
| | | selectEquipmentId: '', |
| | | selectEquipment: {}, |
| | | equipmentStatisticsInfo: {}, |
| | | dataList: [], |
| | | standbyNumber: 0, |
| | | offNumber: 0, |
| | | warningNumber: 0, |
| | | workNumber: 0, |
| | | allNumber: 0, |
| | | url: { |
| | | list: '/mdc/mdcEquipment/queryEquipmentMonitorList', |
| | | updateEquipmentStatus: '/mdc/mdcEquipment/updateEquipmentStatus' |
| | | }, |
| | | param: {}, |
| | | timer: null, |
| | | deviceStatusList: [ |
| | | { |
| | | label: 'å
³æº', |
| | | value: 0, |
| | | color: '#A8A8A8' |
| | | }, |
| | | { |
| | | label: 'å¾
æº', |
| | | value: 2, |
| | | color: '#FFFF00' |
| | | }, |
| | | { |
| | | label: 'è¿è¡', |
| | | value: 3, |
| | | color: '#00EE00' |
| | | }, |
| | | { |
| | | label: 'æ¥è¦', |
| | | value: 22, |
| | | color: '#FF0000' |
| | | }, |
| | | { |
| | | label: 'æ»æ°', |
| | | value: 99, |
| | | color: '#fff' |
| | | } |
| | | ]// 设å¤ç¶ææç¤ºç¯åè¡¨ï¼ |
| | | } |
| | | }, |
| | | created() { |
| | | const { productionId } = this.$route.params |
| | | if (productionId) this.param.key = productionId |
| | | }, |
| | | methods: { |
| | | equipmentStatistics(param, resopnse = { key: false }) { |
| | | 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 |
| | | } |
| | | } |
| | | |
| | | // çéä»è½¦æ¿è·³è½¬è¿æ¥çéæ±æ°æ® |
| | | const { signageData } = this.$route.params |
| | | console.log('signageData', signageData) |
| | | if (!signageData) return |
| | | else this.filterDataList(signageData) |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: 'æ¤è½¦é´ä¸é¢æ 设å¤ï¼ï¼' |
| | | }) |
| | | } |
| | | } else { |
| | | this.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * çéæ»¡è¶³ä»çæ¿è·³è½¬è¿æ¥æ¶çæ¡ä»¶çæ°æ® |
| | | * @param record |
| | | */ |
| | | filterDataList(signageData) { |
| | | this.dataList = this.dataList.filter(item => item.oporationDict === signageData.name) |
| | | }, |
| | | |
| | | changeSelection(val) { |
| | | this.selectEquipmentId = val |
| | | }, |
| | | changeSelectionNode(val) { |
| | | this.selectEquipment = val.equipmentId |
| | | clearInterval(this.timer) |
| | | this.timer = null |
| | | if (!val.equipmentId) { |
| | | this.param.key = val.key |
| | | 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 |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * æ ¹æ®è®¾å¤ç¶æå¼è·å对åºè®¾å¤æ°é |
| | | * @param value 设å¤ç¶æå¼ |
| | | * @returns {number} è®¾å¤æ°é |
| | | */ |
| | | 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.param) |
| | | }, |
| | | beforeDestroy() { |
| | | clearInterval(this.timer) |
| | | this.timer = null |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped lang="less"> |
| | | @import '~@assets/less/common.less'; |
| | | |
| | | .equipMessage { |
| | | width: 100%; |
| | | height: 20px; |
| | | } |
| | | |
| | | .equipMessage table { |
| | | width: 60%; |
| | | height: 100%; |
| | | line-height: 50%; |
| | | float: right; |
| | | } |
| | | |
| | | .equipMessage table td { |
| | | text-align: center; |
| | | } |
| | | |
| | | .equipMessage table td span { |
| | | 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 { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | align-items: center; |
| | | |
| | | .single-status-info { |
| | | margin: 10px; |
| | | .status-square { |
| | | width: 20px; |
| | | height: 20px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 3px; |
| | | } |
| | | } |
| | | } |
| | | </style> |