From 0e9686edc067b0779562bfa2452d49daf4cb7b18 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 10 八月 2023 14:59:33 +0800
Subject: [PATCH] 指令

---
 src/main/webapp/views/commandManage/commandManage.html |   94 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 90 insertions(+), 4 deletions(-)

diff --git a/src/main/webapp/views/commandManage/commandManage.html b/src/main/webapp/views/commandManage/commandManage.html
index b5d5949..fe8ee81 100644
--- a/src/main/webapp/views/commandManage/commandManage.html
+++ b/src/main/webapp/views/commandManage/commandManage.html
@@ -10,6 +10,11 @@
 		<script type="text/javascript" src="../../static/wcs/js/common.js"></script>
 		<script type="text/javascript" src="../../static/wcs/js/vue.min.js"></script>
 		<script type="text/javascript" src="../../static/wcs/js/element.js"></script>
+		<style>
+			.el-table .success-row {
+				background: #d5ffc0;
+			}
+		</style>
 	</head>
 
 	<body>
@@ -35,13 +40,15 @@
 							<el-button type="primary" @click="resetParam">閲嶇疆</el-button>
 						</el-form-item>
 					</el-form>
-					<el-table ref="singleTable" :data="tableData" style="width: 100%;">
+					<el-table ref="singleTable" :data="tableData" style="width: 100%;" :row-class-name="tableRowClassName">
 						<el-table-column label="鎿嶄綔" width="100">
 							<template slot-scope="scope">
 								<el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
 									<el-button icon="el-icon-more" size="mini" type="primary"></el-button>
 									<el-dropdown-menu slot="dropdown">
 										<el-dropdown-item command="showTask">鏌ョ湅浠诲姟</el-dropdown-item>
+										<el-dropdown-item command="executeCommand">鎵ц鎸囦护</el-dropdown-item>
+										<el-dropdown-item command="completeCommand">瀹屾垚鎸囦护</el-dropdown-item>
 									</el-dropdown-menu>
 								</el-dropdown>
 							</template>
@@ -66,9 +73,11 @@
 						</el-table-column>
 						<el-table-column show-overflow-tooltip property="startTime$" label="寮�濮嬫椂闂�">
 						</el-table-column>
-						<el-table-column show-overflow-tooltip property="endTime$" label="缁撴潫鏃堕棿">
+						<el-table-column show-overflow-tooltip property="executeTime$" label="鎵ц鏃堕棿">
 						</el-table-column>
-						<el-table-column show-overflow-tooltip property="command" label="鍛戒护鎶ユ枃">
+						<el-table-column show-overflow-tooltip property="completeTime$" label="瀹屾垚鏃堕棿">
+						</el-table-column>
+						<el-table-column show-overflow-tooltip property="command" label="鍛戒护鎶ユ枃" width="250">
 						</el-table-column>
 					</el-table>
 
@@ -98,7 +107,8 @@
 						task_no: null,
 						status: null,
 						wrk_no: null
-					}
+					},
+					commandStep: -1
 				},
 				created() {
 					this.init()
@@ -110,12 +120,14 @@
 					init() {
 						let taskNo = getQueryVariable('taskNo')
 						let wrkNo = getQueryVariable('wrkNo')
+						let commandStep = getQueryVariable('commandStep')
 						if (taskNo != false) {
 							this.tableSearchParam.task_no = taskNo
 						}
 						if (wrkNo != false) {
 							this.tableSearchParam.wrk_no = wrkNo
 						}
+						this.commandStep = parseInt(commandStep)
 
 						this.getTableData()
 					},
@@ -172,6 +184,14 @@
 								//鏌ョ湅浠诲姟
 								this.showTask(row)
 								break;
+							case "executeCommand":
+								//鎵ц鎸囦护
+								this.executeCommand(row)
+								break;
+							case "completeCommand":
+								//瀹屾垚鎸囦护
+								this.completeCommand(row)
+								break;
 						}
 					},
 					showTask(row) {
@@ -185,6 +205,72 @@
 							content: '../taskWrk/taskWrk.html?taskNo=' + row.taskNo + "&wrkNo=" + row.wrkNo,
 							success: function(layero, index) {}
 						});
+					},
+					tableRowClassName({row, rowIndex}) {
+						if (rowIndex === this.commandStep) {
+							return 'success-row';
+						}
+						return '';
+					},
+					executeCommand(row) {
+						//鎵ц鎸囦护
+						let that = this
+						$.ajax({
+							url: baseUrl + "/commandInfo/executeCommand",
+							headers: {
+								'token': localStorage.getItem('token')
+							},
+							data: {
+								id: row.id
+							},
+							method: 'POST',
+							success: function(res) {
+								if (res.code == 200) {
+									that.$message({
+										message: "鎵ц鎴愬姛",
+										type: 'success'
+									});
+									that.getTableData()
+								} else if (res.code === 403) {
+									top.location.href = baseUrl + "/";
+								} else {
+									that.$message({
+										message: res.msg,
+										type: 'error'
+									});
+								}
+							}
+						});
+					},
+					completeCommand(row) {
+						//瀹屾垚鎸囦护
+						let that = this
+						$.ajax({
+							url: baseUrl + "/commandInfo/completeCommand",
+							headers: {
+								'token': localStorage.getItem('token')
+							},
+							data: {
+								id: row.id
+							},
+							method: 'POST',
+							success: function(res) {
+								if (res.code == 200) {
+									that.$message({
+										message: "瀹屾垚鎴愬姛",
+										type: 'success'
+									});
+									that.getTableData()
+								} else if (res.code === 403) {
+									top.location.href = baseUrl + "/";
+								} else {
+									that.$message({
+										message: res.msg,
+										type: 'error'
+									});
+								}
+							}
+						});
 					}
 				}
 			})

--
Gitblit v1.9.1