From e2fdfe540eaf160dc7d063c60667041edcc64e86 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期二, 05 十一月 2024 22:55:14 +0800
Subject: [PATCH] 处理显示名称

---
 src/views/mdc/station-live.vue |   60 ++++++++++++++++++++++++++++++++++--------------------------
 1 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/src/views/mdc/station-live.vue b/src/views/mdc/station-live.vue
index 1744fc6..e13026e 100644
--- a/src/views/mdc/station-live.vue
+++ b/src/views/mdc/station-live.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-06 22:46:49
+ * @LastEditTime: 2024-10-23 10:34:29
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -14,7 +14,7 @@
 		</div>
 		<div class="aposcope-right">
 			<div class="content-machine-box">
-				<div class="content-machine-img"><img src="./station.png" alt=""></div>
+				<div class="content-machine-img"><img :src="stationForm.avatar" alt=""></div>
 				<div class="content-machine-detail">
 					<div class="content-machine-name">{{stationForm.machineName}}</div>
 					<el-form :model="stationForm" ref="dialogForm" label-width="80px" label-position="center" style="width: 100%;">
@@ -46,7 +46,7 @@
 						</div>
 					</div>
 					<div class="fact-analysis-card" v-for="item in dmpList" v-if="dmpList.length != 0">
-						<div class="card-name" :style="{'background-color': item.color}">{{item.description}}</div>
+						<div class="card-name" :style="{'background-color': item.color}">{{item.dpLabel}}</div>
 						<div :class="{'card-value': true,'card-value-bg1':item.name != 'Alarm','card-value-bg2':item.name == 'Alarm'}">{{item.codeName}}</div>
 					</div>
 				</div>
@@ -124,6 +124,7 @@
 	<save-dialog v-if="dialog.save" ref="saveDialog"  @success="addfeedbackSuccess" :workstationId="lastLevelId" @closed="dialog.save=false"></save-dialog>
 </template>
 <script>
+	import station from "./station.png";
 	import moment from 'moment'
 	import * as echarts from 'echarts';
 	import saveDialog from './add-station-status'
@@ -319,7 +320,7 @@
 				this.alarmsearchBtn();
 			},
 			alarmsearchBtn() {
-				this.$HTTP.get(`/api/blade-mdc/work-station-analysis/alarm/${this.lastLevelId}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
+				this.$HTTP.get(`/api/mdc/work-station-analysis/alarm/${this.lastLevelId}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
 					if(res.code == 200) {
 						this.alarmtableData = res.data.records;
 						this.alarmtotal = res.data.total;
@@ -339,7 +340,7 @@
 					humanFeedback: this.humanFeedback,
 					workstationId: this.lastLevelId
 				}
-				this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
+				this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
 					if(res.code == 200) {
 						var defaultValues = {  
 							oee: 0,  
@@ -415,7 +416,7 @@
 					humanFeedback: this.humanFeedback,
 					workstationId: this.lastLevelId
 				}
-				this.$HTTP.post(`/api/blade-mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
+				this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
 					if(res.code == 200) {
 						var yAxisData = [];
 						var newData = [];
@@ -563,7 +564,7 @@
 					humanFeedback: this.humanFeedback,
 					workstationId: this.lastLevelId
 				}
-				this.$HTTP.post(`/api/blade-mdc/status-record/time-distribution`,obj).then(res=> {
+				this.$HTTP.post(`/api/mdc/status-record/time-distribution`,obj).then(res=> {
 					if(res.code == 200) {
 						var myChart = echarts.init(document.getElementById('wcs-left')); 
 						var wcsOption = JSON.parse(JSON.stringify(this.wcsBeginOption));
@@ -586,7 +587,7 @@
 				})
 			},
 			getwcsLcolor() {
-				this.$HTTP.get(`/api/blade-cps/global_wcs/list?code=&name=`).then(res=> {
+				this.$HTTP.get(`/api/smis/global_wcs/list?code=&name=`).then(res=> {
 					if(res.code == 200) {
 						res.data.forEach(item=> {
 							item.itemStyle = {color: item.color};
@@ -602,7 +603,7 @@
 					humanFeedback: this.humanFeedback,
 					workstationId: this.lastLevelId
 				}
-				this.$HTTP.post(`/api/blade-mdc/status-record/equipment-efficiency`,obj).then(res=> {
+				this.$HTTP.post(`/api/mdc/status-record/equipment-efficiency`,obj).then(res=> {
 					if(res.code == 200) {
 						var myChart = echarts.init(document.getElementById('wcs-right')); 
 						res.data.forEach(item=> {
@@ -629,8 +630,11 @@
 			handleNodeClick(data) {
 				if(data.code) {
 					this.lastLevelId = data.id;
-					this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
+					this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
 						if(res.code == 200) {
+							if(res.data.avatar == "") {
+								res.data.avatar = station;
+							}
 							this.stationForm = res.data;
 							this.getdmp(this.lastLevelId,this.stationForm.machineId);
 							//this.newDate();  //鑾峰彇褰撳墠鏃ユ湡
@@ -644,7 +648,7 @@
 				}
 			},
 			getdmp(lastLevelId,machineId) {
-				this.$HTTP.get(`/api/blade-cps/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
+				this.$HTTP.get(`/api/smis/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
 					if(res.code == 200) {
 						this.dmpList = [];
 						var that = this;
@@ -660,8 +664,9 @@
 						this.$TOOL.socket.sendDataToWebSocket(obj);  //鍙戦��
 						this.$TOOL.socket.websocket.onmessage = function(event) {  
 							var JSONData = JSON.parse(res.data.dpConfig);
+							var eventData = JSON.parse(event.data);
+							if(Object.keys(eventData.data).length == 0) return;
 					        JSONData.forEach((item,index)=> {  //绗竴姝ユ妸v鏀惧埌code閲�
-					        	var eventData = JSON.parse(event.data);
 							    if(item.dpName == "DeviceStatus") {  //鏈哄櫒鐘舵��
 									if(eventData.data[item.dpName]) {
 										item.code = eventData.data[item.dpName].v;
@@ -669,11 +674,7 @@
 							        that.allwcs.forEach((item1)=> {
 							        	if(item.code == item1.code) {
 							        		item.codeName = item1.name;    //绗簩姝ユ妸v鐨刢ode鍜岃繍琛屽搴�
-							        		if(item.code == "2") {
-							        			item.color = "#73D13D";
-							        		}else {
-							        			item.color = "#75C0C0";
-							        		}
+							        		item.color = item1.color;
 							        	}
 							        })
 							    }else {
@@ -684,22 +685,26 @@
 												if(v.length == 0) {
 													JSONData.splice(index,1);
 												}else {
-													item.description = v[0].code;
 													item.codeName = v[0].msg;
-													item.color = "#370C0D";
 												}
 											}else {
-												item.description = v.code;
 												item.codeName = v.msg;
-												item.color = "#370C0D";
 											}
 										}
 							    	}else {
 										if(eventData.data[item.dpName]) {
 											item.codeName = eventData.data[item.dpName].v;
+										}else {
+											item.codeName = "";
 										}
-										item.color = "#75C0C0";
 							    	}
+									that.allwcs.forEach((item1)=> {
+							        	if(item.code == item1.code) {
+							        		item.color = item1.color;
+							        	}else {
+											item.color = "#7FC0C0";
+										}
+							        })
 							    }
 							});
 							that.dmpList = JSONData;
@@ -767,7 +772,7 @@
 					groupCategory: 1,
 					groupType: "group_workstation"
 				}
-				this.$HTTP.post("/api/blade-cps/group/groupWorkstation/type",obj).then(res=> {
+				this.$HTTP.post("/api/smis/group/groupWorkstation/type",obj).then(res=> {
 					if(res.code == 200) {
 						if (res.code == 200) {
 							var treeDisabled = this.addTreeDisable(res.data);
@@ -793,7 +798,7 @@
 				})
 			},
 			getachievements() { //鐝鐘舵�佽褰曢噰闆嗙姸鎬�
-				this.$HTTP.get(`/api/blade-cps/global_wcs/wcs-achievements`).then(res=> {
+				this.$HTTP.get(`/api/smis/global_wcs/wcs-achievements`).then(res=> {
 					if(res.code == 200) {
 						var achievements = [];//閲囬泦鐘舵��
 						var collectionstatus = [];  //浜哄伐鍙嶉鐘舵��
@@ -812,8 +817,11 @@
 				})
 			},
 			getlist() {
-				this.$HTTP.get(`/api/blade-cps/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
-					if(res.code == 200) {
+				this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.lastLevelId}`).then(res=> {
+					if(res.code == 200) { 
+						if(res.data.avatar == "") {
+							res.data.avatar = station;
+						}
 						this.stationForm = res.data;
 						this.getdmp(this.lastLevelId,this.stationForm.machineId);
 					}

--
Gitblit v1.9.3