From 8edd1467e836501162115ef00b51cfbbafa5599c Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期五, 08 十一月 2024 16:45:43 +0800
Subject: [PATCH] 1

---
 src/views/mdc/status-record.vue                 |    5 +
 src/views/mdc/components/recordChartsByDate.vue |    1 
 src/views/mdc/station-live.vue                  |  135 +++++++++++++--------------------------------
 3 files changed, 43 insertions(+), 98 deletions(-)

diff --git a/src/views/mdc/components/recordChartsByDate.vue b/src/views/mdc/components/recordChartsByDate.vue
index 9d87f86..5e4bfd3 100644
--- a/src/views/mdc/components/recordChartsByDate.vue
+++ b/src/views/mdc/components/recordChartsByDate.vue
@@ -85,6 +85,7 @@
             return stauts;
         },
         getCharts() {
+            console.log(this.workstationInfoList,111)
             if(this.date == "") return;
             var obj = {
                 date: this.date,
diff --git a/src/views/mdc/station-live.vue b/src/views/mdc/station-live.vue
index e13026e..9ece0d4 100644
--- a/src/views/mdc/station-live.vue
+++ b/src/views/mdc/station-live.vue
@@ -2,15 +2,15 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-10-23 10:34:29
+ * @LastEditTime: 2024-11-08 15:55:24
  * @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
 -->
 <template>
 	<div class="aposcope-main">
 		<div class="aposcope-left">
-			<div class="left-title">鏌ヨ鏉′欢</div>
-			<el-tree :data="tableData" node-key="id" default-expand-all :expand-on-click-node="false" :props="defalutProps" @node-click="handleNodeClick" ref="treeRef" highlight-current />
+			<el-row style="margin: 8px;font-size: 14px;">宸ヤ綅</el-row>
+			<MYTree v-model="treeChecked" @loaded="query"></MYTree>
 		</div>
 		<div class="aposcope-right">
 			<div class="content-machine-box">
@@ -121,17 +121,19 @@
 			 </el-tabs>
 		</div>
 	</div>
-	<save-dialog v-if="dialog.save" ref="saveDialog"  @success="addfeedbackSuccess" :workstationId="lastLevelId" @closed="dialog.save=false"></save-dialog>
+	<save-dialog v-if="dialog.save" ref="saveDialog"  @success="addfeedbackSuccess" :workstationId="treeChecked.toString()" @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'
+	import saveDialog from './add-station-status';
+	import MYTree from './MYTree.vue';
 	export default {
 		name: "state-feedback",
 		data(){
 			return {
+				treeChecked: [],
 				achievements: [],
 				collectionstatus: [],
 				humanFeedback: "",
@@ -261,7 +263,6 @@
 				dialog: {
 					save: false
 				},
-				lastLevelId: "",
 				current: "1",
 				size: "15",
 				searchData: {
@@ -294,18 +295,22 @@
 		created(){
 			
 		},
+		watch: {
+			treeChecked() {
+				this.query()
+			}
+		},
 		mounted(){
 			this.newDate();  //鑾峰彇褰撳墠鏃ユ湡
-			this.getTreeList(this.$route.query.code);
 		},
 		components: {
-			saveDialog
+			saveDialog,MYTree
 	    },
 		methods: {
 			table_edit(){
 				this.dialog.save = true
 				this.$nextTick(() => {
-					this.$refs.saveDialog.open('edit').setData(this.lastLevelId);
+					this.$refs.saveDialog.open('edit').setData(this.treeChecked.toString());
 				})
 			},
 			alarmSizeChange(val) {
@@ -320,7 +325,7 @@
 				this.alarmsearchBtn();
 			},
 			alarmsearchBtn() {
-				this.$HTTP.get(`/api/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.treeChecked.toString()}?current=${this.alarmsearchData.current}&size=${this.alarmsearchData.size}`).then(res=> {
 					if(res.code == 200) {
 						this.alarmtableData = res.data.records;
 						this.alarmtotal = res.data.total;
@@ -338,7 +343,7 @@
 				var obj = {
 					date: this.wcsDate,
 					humanFeedback: this.humanFeedback,
-					workstationId: this.lastLevelId
+					workstationId: this.treeChecked.toString()
 				}
 				this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-table`,obj).then(res=> {
 					if(res.code == 200) {
@@ -414,7 +419,7 @@
 					date: this.wcsDate,
 					//date : "2024-05-15",
 					humanFeedback: this.humanFeedback,
-					workstationId: this.lastLevelId
+					workstationId: this.treeChecked.toString()
 				}
 				this.$HTTP.post(`/api/mdc/status-record/shift-index-status-record-chart`,obj).then(res=> {
 					if(res.code == 200) {
@@ -562,7 +567,7 @@
 				var obj = {
 					date: this.wcsDate,
 					humanFeedback: this.humanFeedback,
-					workstationId: this.lastLevelId
+					workstationId: this.treeChecked.toString()
 				}
 				this.$HTTP.post(`/api/mdc/status-record/time-distribution`,obj).then(res=> {
 					if(res.code == 200) {
@@ -601,7 +606,7 @@
 				var obj = {
 					date: this.wcsDate,
 					humanFeedback: this.humanFeedback,
-					workstationId: this.lastLevelId
+					workstationId: this.treeChecked.toString()
 				}
 				this.$HTTP.post(`/api/mdc/status-record/equipment-efficiency`,obj).then(res=> {
 					if(res.code == 200) {
@@ -627,35 +632,33 @@
 			addfeedbackSuccess() {
 				
 			},
-			handleNodeClick(data) {
-				if(data.code) {
-					this.lastLevelId = data.id;
-					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();  //鑾峰彇褰撳墠鏃ユ湡
-							this.getwcsR();
-							this.getwscLvalue();  //宸︿晶鍥捐〃
-							this.alarmsearchBtn();  //鏈哄櫒灞ュ巻
-							this.getrecord();  //鐝鐘舵�佽褰晅able
-							this.getlogcart();  //鐝鐘舵�佽褰昪hart
+			query() {
+				if (!this.treeChecked.toString()) return;
+				this.$HTTP.get(`/api/smis/workstation/get?workstationId=${this.treeChecked.toString()}`).then(res=> {
+					if(res.code == 200) {
+						if(res.data.avatar == "") {
+							res.data.avatar = station;
 						}
-					})
-				}
+						this.stationForm = res.data;
+						this.getdmp(this.stationForm.machineId);
+						//this.newDate();  //鑾峰彇褰撳墠鏃ユ湡
+						this.getwcsR();
+						this.getwcsLcolor();  //宸︿晶鍥捐〃
+						this.alarmsearchBtn();  //鏈哄櫒灞ュ巻
+						this.getrecord();  //鐝鐘舵�佽褰晅able
+						this.getlogcart();  //鐝鐘舵�佽褰昪hart
+					}
+				})
 			},
-			getdmp(lastLevelId,machineId) {
-				this.$HTTP.get(`/api/smis/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${lastLevelId}`).then(res=> {
+			getdmp(machineId) {
+				this.$HTTP.get(`/api/smis/workstation/listDatapointsByWorkstationId?machineId=${machineId}&workstationId=${this.treeChecked.toString()}`).then(res=> {
 					if(res.code == 200) {
 						this.dmpList = [];
 						var that = this;
 						//鍙戦�亀ebsocket
 						var obj = {
 							type: "realTimeData",
-							workstationIdList: [lastLevelId]
+							workstationIdList: this.treeChecked
 						}
 						if(res.data.dpConfig == null || res.data.dpConfig.length == 0) return;  //娌″�间笉鐢ㄥ惊鐜�
 						if(this.$TOOL.socket.websocket == null) {  //娌℃湁寤虹珛鍏堝缓绔�
@@ -712,26 +715,6 @@
 					}
 				})
 			},
-			getLastLevelIds(tree) {  
-				if (tree.length === 0) return ""; // 濡傛灉娌℃湁鏍硅妭鐐癸紝杩斿洖绌� 
-				const lastLevelIds = []; 
-				const lastLevelCodes = [];
-				function traverseTree(node) {  
-					if(!node.code) {
-						lastLevelCodes.push(node.id);
-					}
-					if (node.children.length > 0) {  
-						node.children.forEach(traverseTree); // 閫掑綊閬嶅巻瀛愯妭鐐�  
-					} else {  
-						if(node.code) {
-							lastLevelIds.push(node.id); // 鏈塩ode鎵嶈 
-						}
-					}
-				}  	
-				// 鍙亶鍘嗙涓�涓牴鑺傜偣  
-				traverseTree(tree[0]);  
-				return {lastLevelCodes,lastLevelId:lastLevelIds[0]}; // 杩斿洖lastLevelCodes锛氭病鏈塩ode鐨勬暟缁勩�俵astLevelId锛氭湁code鐨勭涓�涓猧d
-			},
 			buildTree(items) {  
 			  const idMap = {};  
 			  const tree = [];  
@@ -767,36 +750,6 @@
 				})
 				return tree;
 			},
-			getTreeList(id) {
-				var obj = {
-					groupCategory: 1,
-					groupType: "group_workstation"
-				}
-				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);
-							this.tableData = this.buildTree(treeDisabled);  //浠庢墎骞冲寲鍙樹负鏍戠姸缁撴瀯
-							this.$nextTick(()=> {
-								if(id) {
-									this.lastLevelId = id;  //鎸囧畾id
-								}else {
-									this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
-								}
-								this.$refs.treeRef.setCurrentKey(this.lastLevelId);  //绗竴涓妭鐐圭殑绗竴涓瓙鑺傜偣鏈�鍚庝竴绾ч粯璁ら�変腑
-								//浠ヤ笅鏄垵濮嬪寲鏁版嵁
-								this.getlist();  //娓叉煋璇︽儏鍜�(鐘舵�乴ist)
-								this.getwcsLcolor();  //宸︿晶鍥捐〃
-								this.getwcsR();  //鍙充晶鍥炬爣
-								this.getachievements();  //鐝鐘舵�佽褰曢噰闆嗙姸鎬�
-								this.getrecord();  //鐝鐘舵�佽褰晅able
-								this.getlogcart();  //鐝鐘舵�佽褰昪hart
-							})
-							
-						}
-					}
-				})
-			},
 			getachievements() { //鐝鐘舵�佽褰曢噰闆嗙姸鎬�
 				this.$HTTP.get(`/api/smis/global_wcs/wcs-achievements`).then(res=> {
 					if(res.code == 200) {
@@ -815,17 +768,6 @@
 						this.allwcs = res.data;
 					}
 				})
-			},
-			getlist() {
-				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);
-					}
-				})
 			}
 		}
 	}
@@ -841,6 +783,7 @@
 	margin-right: 8px;
 	padding: 4px;
 	background-color: #fff;
+	padding-top: 20px;
 }
 .aposcope-right {
 	flex: 1;
diff --git a/src/views/mdc/status-record.vue b/src/views/mdc/status-record.vue
index 30c9383..07fb412 100644
--- a/src/views/mdc/status-record.vue
+++ b/src/views/mdc/status-record.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-04-26 09:36:18
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-09-19 10:11:58
+ * @LastEditTime: 2024-11-08 16:34:22
  * @FilePath: /smart-web/src/views/mdc/status-record.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -12,7 +12,7 @@
             <el-container style="height: 100%;">
                 <el-aside width="300px" style="height: 100%;">
                     <el-container>
-                        <div class="left-title">鏌ヨ鏉′欢</div>
+                        <!-- <div class="left-title">鏌ヨ鏉′欢</div> -->
                         <el-main style="padding: 20px;">
                             <div class="left-title-col">鏃ユ湡</div>
                             <el-date-picker v-model="time" type="daterange" :shortcuts="shortcuts" range-separator="-" size="small" style="width: 100%;" value-format="YYYY-MM-DD"/>
@@ -104,6 +104,7 @@
     },
     watch: {
         treeChecked(select) {
+            console.log(select,111)
             var arr = [];
             select.forEach(item=> {
                 arr.push({id: item.id,name: item.code})

--
Gitblit v1.9.3