From dcf9c9e0410fe1186239e3f8d6f7bdc789c08010 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 05 六月 2024 18:00:39 +0800
Subject: [PATCH] 1

---
 src/views/mdc/state-feedback.vue |  372 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 358 insertions(+), 14 deletions(-)

diff --git a/src/views/mdc/state-feedback.vue b/src/views/mdc/state-feedback.vue
index e384ab3..4cd3ad1 100644
--- a/src/views/mdc/state-feedback.vue
+++ b/src/views/mdc/state-feedback.vue
@@ -1,21 +1,365 @@
 <!--
- * @Date: 2024-04-09 22:11:21
- * @LastEditors: Sneed
- * @LastEditTime: 2024-04-09 22:11:27
- * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/state-feedback.vue
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-06-05 12:03:50
+ * @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>
-        鐘舵�佸弽棣�
-    </div>
+	<el-main style="height: 100%;">
+        <el-card shadow="never" style="height: 100%;" body-style="height: 100%;padding: 0;">
+            <el-container style="height: 100%;">
+                <el-aside width="300px" style="height: 100%;">
+                    <el-container style="flex-direction: column;">
+						<div class="left-title">宸ヤ綅</div>
+                        <el-main style="padding: 12px 20px 20px;">
+							<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-main>
+                    </el-container>
+                </el-aside>
+                <el-container>
+                    <el-main>
+                        <div class="right-top">
+							<div>
+								<el-button type="primary" @click="addData">鍙嶉</el-button>
+								<el-button type="danger" plain @click="delData">鎵归噺鍒犻櫎</el-button>
+							</div>
+							<div>
+								<el-select v-model="searchData.feedBackStatus" multiple style="width: 185px;margin-right: 8px;;" @change="feedBackStatusChange">
+									<el-option v-for="item in feedBackStatusList" :key="item.code" :label="item.name" :value="item.code"/>
+								</el-select>
+								<el-date-picker v-model="searchData.date" type="datetimerange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" align="right" value-format="YYYY-MM-DD HH:mm:ss" @change="dateChange" style="vertical-align: middle;">
+								</el-date-picker>
+							</div>
+						</div>
+						<div class="right-content" v-if="searchDataList.length == 0">
+							<!-- <img src="./quesheng.bd026700.png" /> -->
+							<div style="margin-top: 120px;font-size: 16px;color: #666;">
+								<span>鏆傛棤鍙嶉鐘舵�佹暟鎹�</span>
+							</div>
+						</div>
+						<el-table ref="searchDataListRef" v-if="searchDataList.length != 0" :data="searchDataList" border style="width: 100%;margin-top: 20px;" class="multipleTableRef" @selection-change="searchHandleSelectionChange">
+							<el-table-column type="selection" width="55" />
+							<el-table-column prop="workstationName" label="宸ヤ綅鍚嶇О"></el-table-column>
+							<el-table-column prop="wcsDesc" label="鐘舵��"></el-table-column>
+							<el-table-column prop="feedbackDesc" label="鎻忚堪"></el-table-column>
+							<el-table-column prop="httpMethod" label="鎸佺画鏃堕暱">
+								<template #default="scope">
+									<span>{{sumTime(scope.row.startTime,scope.row.endTime)}}</span>
+								</template>
+							</el-table-column>
+							<el-table-column prop="scopePath" label="鐘舵�佹椂闂�">
+								<template #default="scope">
+									<span>{{scope.row.startTime}}~{{ scope.row.endTime }}</span>
+								</template>
+							</el-table-column>
+							<el-table-column fixed="right" label="鎿嶄綔">
+								<template #default="scope">
+									<el-button text type="primary" size="small" @click="table_del(scope.row, scope.$index)">鍒犻櫎</el-button>
+								</template>
+							</el-table-column>
+						</el-table>
+                    </el-main>
+                </el-container>
+            </el-container>
+        </el-card>
+    </el-main>
+	<save-dialog v-if="dialog.save" ref="saveDialog" :feedBackStatusList="feedBackStatusList" :workstationId="lastLevelId" @success="addfeedbackSuccess" @closed="dialog.save=false"></save-dialog>
 </template>
-
 <script>
-    export default {
-        
-    }
+	import { useTransitionFallthroughEmits } from 'element-plus';
+	import saveDialog from './add-feedback'
+	export default {
+		name: "state-feedback",
+		data(){
+			return {
+				dialog: {
+					save: false
+				},
+				lastLevelId: "",
+				feedBackStatusList: [],
+				current: "1",
+				size: "15",
+				searchData: {
+					feedBackStatus: [],
+					date: [],
+					endDate: "",
+					startDate: ""
+				},
+				searchDataList: [],  //鍙充晶鏁版嵁list
+				aList: [],
+				defalutProps: {
+					label: 'title',
+  					children: 'children',
+					isLeaf: 'hasChildren',
+					disabled: 'disabled'
+				},
+				parentId: "0",
+				tableData: [],
+				searchSelection: []
+			}
+		},
+		created(){
+			
+		},
+		mounted(){
+			this.getTreeList();
+			this.getfeedBackStatusList();  //鑾峰彇鐘舵�乴ist
+		},
+		components: {
+			saveDialog
+	    },
+		methods: {
+			table_del(row) {
+				this.$confirm(`纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?`, '', {
+					type: 'warning'
+				}).then(() => {
+					var arr = [row.id]
+					this.$HTTP.delete("/api/blade-cps/workstation-wcs-feedback",arr).then(res=> {
+						if(res.code == 200) {
+							this.$message.success("鎿嶄綔鎴愬姛");
+							this.getlist();
+						}
+					})
+				}).catch(() => {
+
+				})
+			},
+			addfeedbackSuccess() {
+				this.getlist();
+			},
+			getfeedBackStatusList() {
+				this.$HTTP.get("/api/blade-cps/global_wcs/wcs-achievements").then(res=> {
+					if(res.code == 200) {
+						res.data.forEach(item=> {
+							if(item.type == "4") {
+								this.feedBackStatusList.push(item);
+							}
+						})
+					}
+				})
+			},
+			feedBackStatusChange(val) {
+				this.getlist();
+			},
+			dateChange(val) {
+				this.searchData.startDate = val[0];
+				this.searchData.endDate = val[1];
+				this.getlist();
+			},
+			searchHandleSelectionChange(selection) {
+				this.searchSelection = selection;
+			},
+			handleClose(done) {
+		        done();
+		    },
+			sumTime(startTime,endTime) {
+				// 灏嗗瓧绗︿覆杞崲涓篋ate瀵硅薄  
+				var startDate = new Date(startTime);  
+				var endDate = new Date(endTime);  
+				
+				// 璁$畻鏃堕棿宸紙姣锛�  
+				var timeDiff = endDate - startDate;  
+				
+				// 灏嗘椂闂村樊杞崲涓哄ぉ鏁般�佸皬鏃舵暟銆佸垎閽熸暟鍜岀鏁�  
+				var diffDays = Math.floor(timeDiff / (1000 * 60 * 60 * 24)); // 澶�  
+				timeDiff %= 1000 * 60 * 60 * 24; // 鍓╀綑姣鏁�  
+				var diffHours = Math.floor(timeDiff / (1000 * 60 * 60)); // 灏忔椂  
+				timeDiff %= 1000 * 60 * 60; // 鍓╀綑姣鏁�  
+				var diffMinutes = Math.floor(timeDiff / (1000 * 60)); // 鍒嗛挓  
+				timeDiff %= 1000 * 60; // 鍓╀綑姣鏁�  
+				var diffSeconds = Math.floor(timeDiff / 1000); // 绉�
+				var d = diffDays == 0?"":diffDays + "澶�";
+				return d + diffHours + "灏忔椂 " + diffMinutes + "鍒嗛挓 " + diffSeconds + "绉�"
+			},
+			handleNodeClick(data) {
+				if(data.code) {
+					this.lastLevelId = data.id;
+					var obj = {
+						workstationId: this.lastLevelId,
+					}
+					if(this.searchData.feedBackStatus.length != 0) {
+						obj.feedBackStatus = this.searchData.feedBackStatus;
+					}
+					if(this.searchData.endDate) {
+						obj.endDate = this.searchData.endDate;
+					}
+					if(this.searchData.startDate) {
+						obj.startDate = this.searchData.startDate;
+					}
+					this.$HTTP.post("/api/blade-cps/workstation-wcs-feedback/page?current=1&size=15",obj).then(res=> {
+						if(res.code == 200) {
+							this.searchDataList = res.data.records;
+						}
+					})
+				}
+			},
+			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 = [];  
+			  // 绗竴姝ワ細鍒涘缓id鍒板璞$殑鏄犲皠  
+			  items.forEach(item => {  
+			    idMap[item.id] = { ...item, children: [] };  
+			  }); 
+			  // 绗簩姝ワ細鏋勫缓鏍戝舰缁撴瀯  
+			  items.forEach(item => {  
+			    const currentNode = idMap[item.id];  
+			    // 濡傛灉parentId涓�0锛岃鏄庢槸鏍硅妭鐐�  
+			    if (item.parentId === 0) {  
+			      tree.push(currentNode);  
+			    } else {  
+			      // 鍚﹀垯锛屾煡鎵剧埗鑺傜偣锛屽苟灏嗗綋鍓嶈妭鐐规坊鍔犲埌鐖惰妭鐐圭殑children鏁扮粍涓�  
+			      const parentId = item.parentId;  
+			      if (idMap[parentId]) {  
+			        idMap[parentId].children.push(currentNode);  
+			      }  
+			    }  
+			  });  
+			  return tree;  
+			},
+			addTreeDisable(treeData) {
+				var tree = [];
+				treeData.forEach(item=> {
+					if(item.code) {
+						item.disabled = false;
+					}else {
+						item.disabled = true;
+					}
+					tree.push(item);
+				})
+				return tree;
+			},
+			getTreeList(flag) {
+				var obj = {
+					groupCategory: 1,
+					groupType: "group_workstation"
+				}
+				this.$HTTP.post("/api/blade-cps/group/groupWorkstation/type",obj).then(res=> {
+					if(res.code == 200) {
+						var treeDisabled = this.addTreeDisable(res.data);
+						this.tableData = this.buildTree(treeDisabled);  //浠庢墎骞冲寲鍙樹负鏍戠姸缁撴瀯
+						this.$nextTick(()=> {
+							this.lastLevelId = this.getLastLevelIds(this.tableData).lastLevelId;
+							this.$refs.treeRef.setCurrentKey(this.lastLevelId);  //绗竴涓妭鐐圭殑绗竴涓瓙鑺傜偣鏈�鍚庝竴绾ч粯璁ら�変腑
+							this.getlist();  //娓叉煋鍙嶉鍒楄〃
+						})
+					}
+				})
+			},
+			getlist() {
+				var obj = {
+					workstationId: this.lastLevelId,
+				}
+				if(this.searchData.feedBackStatus != 0) {
+					obj.feedBackStatus = this.searchData.feedBackStatus;
+				}
+				if(this.searchData.endDate) {
+					obj.endDate = this.searchData.endDate;
+				}
+				if(this.searchData.startDate) {
+					obj.startDate = this.searchData.startDate;
+				}
+				this.$HTTP.post("/api/blade-cps/workstation-wcs-feedback/page?current=1&size=15",obj).then(res=> {
+					if(res.code == 200) {
+						this.searchDataList = res.data.records;
+					}
+				})
+			},
+			addData() {
+				this.dialog.save = true
+				this.$nextTick(() => {
+					this.$refs.saveDialog.open()
+				})
+			},
+			delData() {
+				if(this.searchSelection.length == 0) {
+					this.$message({
+			          message: '璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�',
+			          type: 'warning'
+			        });
+			        return;
+				}
+				var sel = [];
+				this.searchSelection.map(item=> {
+					sel.push(item.id);
+				})
+				var that = this;
+				this.$HTTP.delete("/api/blade-cps/workstation-wcs-feedback",sel).then(res=> {
+					if(res.code == 200) {
+						this.$message.success("鎿嶄綔鎴愬姛");
+						this.getlist();
+					}
+				})
+			}
+		}
+	}
 </script>
-
-<style lang="scss" scoped>
-
+<style scoped>
+.aposcope-main {
+	display: flex;
+	min-height: 100%;
+	margin: 8px;
+}
+.aposcope-left {
+	width: 240px;
+	margin-right: 8px;
+	padding: 4px;
+	background-color: #fff;
+}
+.aposcope-right {
+	flex: 1;
+	padding: 8px;
+	background-color: #fff;
+}
+.left-title {
+	font-size: 16px;
+    text-align: center;
+    height: 38px;
+    line-height: 38px;
+    border-bottom: 1px solid #e2e2e2;
+    background-color: #409eff;
+    color: #fff;
+    border-radius: 2px 2px 0 0;
+}
+.right-content {
+	text-align: center;
+}
+.right-content img {
+	width: 350px;
+	height: 350px;
+}
+.right-content > div {
+	font-size: 14px;;
+}
+.right-content > div span:nth-child(2) {
+	margin-left: 8px;
+	color: #409eff;
+	cursor: pointer;
+}
+.right-top {
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3