From a144a18ab582fd3a8c945cba60bc364dbe7f31e8 Mon Sep 17 00:00:00 2001 From: zhuzhuanzhuan Date: 星期四, 28 三月 2024 16:59:55 +0800 Subject: [PATCH] 1、新增点击设备运行状态图标跳转至设备监控页面并根据状态及当前层级筛选页面对应数据 2、新增点击设备利用率的横向柱状图跳转至统计分析页面并根据所点击层级筛选页面对应数据 3、解决router.push以及router.replace跳转后报错 --- src/views/mdc/base/DeviceBaseInfo.vue | 167 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 86 insertions(+), 81 deletions(-) diff --git a/src/views/mdc/base/DeviceBaseInfo.vue b/src/views/mdc/base/DeviceBaseInfo.vue index cded000..0649db2 100644 --- a/src/views/mdc/base/DeviceBaseInfo.vue +++ b/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> @@ -96,11 +73,11 @@ allNumber: 0, url: { list: '/mdc/mdcEquipment/queryEquipmentMonitorList', - updateEquipmentStatus:'/mdc/mdcEquipment/updateEquipmentStatus' + updateEquipmentStatus: '/mdc/mdcEquipment/updateEquipmentStatus' }, - param:{}, - timer:null, - timerzhun:null, + param: {}, + timer: null, + timerzhun: null, deviceStatusList: [ { label: '鍏虫満', @@ -127,19 +104,22 @@ 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); }, methods: { - equipmentStatistics(param,resopnse={key:false}) { + equipmentStatistics(param, resopnse = { key: false }) { getAction(this.url.list, param).then((res) => { this.dataList = [] if (res.success) { - if(res.result.length != 0){ + if (res.result.length != 0) { this.standbyNumber = 0 this.offNumber = 0 this.warningNumber = 0 @@ -148,64 +128,89 @@ this.dataList = res.result // console.log(this.dataList) this.allNumber = this.dataList.length - if(resopnse.key){ + if (resopnse.key) { this.$notification.success({ - key:'equipmentStatus', + 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 } } - }else{ + + // 绛涢�変粠杞︽澘璺宠浆杩囨潵鐨勯渶姹傛暟鎹� + 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:"姝よ溅闂翠笅闈㈡棤璁惧锛侊紒" - }); + message: '娑堟伅', + description: '姝よ溅闂翠笅闈㈡棤璁惧锛侊紒' + }) } } else { // this.$message.warn(res.message) this.$notification.warning({ - message:'娑堟伅', - description:res.message - }); + 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); + this.param.key = val.key + clearInterval(this.timerzhun) this.timerzhun = null this.equipmentStatistics(this.param) this.timer = setInterval(() => { - setTimeout( this.equipmentStatistics(this.param),0) - },1000*10) - }else{ - this.param.key=val.parentId - clearInterval(this.timerzhun); + setTimeout(this.equipmentStatistics(this.param), 0) + }, 1000 * 10) + } else { + this.param.key = val.parentId + clearInterval(this.timerzhun) this.timerzhun = null this.equipmentStatistics(this.param) this.timer = setInterval(() => { - setTimeout( this.equipmentStatistics(this.param),0) - },1000*10) + setTimeout(this.equipmentStatistics(this.param), 0) + }, 1000 * 10) } }, @@ -213,30 +218,30 @@ * 鍗曞嚮鐘舵�佸弽棣堝悗瑙﹀彂 * @param record */ - editEquipmentStatus(record){ - console.log('瀛愮粍浠秗ecord',record.id) - const _this=this + editEquipmentStatus(record) { + console.log('瀛愮粍浠秗ecord', record.id) + const _this = this this.$notification.info({ - key:'equipmentStatus', + 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{ + 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 - }); + message: '娑堟伅', + description: res.message + }) } }) - .catch(err=>{ + .catch(err => { this.$notification.error({ - message:'娑堟伅', - description:err.message - }); + 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() + mounted() { + this.equipmentStatistics(this.param) // this.timerzhun = setInterval(() => { // setTimeout( this.equipmentStatistics(),0) // },1000*10) }, - beforeDestroy(){ - clearInterval(this.timer); + beforeDestroy() { + clearInterval(this.timer) this.timer = null } } -- Gitblit v1.9.3