| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | </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> |
| | | |
| | |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | } |
| | | }, |
| | | commandStep: -1 |
| | | }, |
| | | created() { |
| | | this.init() |
| | |
| | | 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() |
| | | }, |
| | |
| | | //查看任务 |
| | | this.showTask(row) |
| | | break; |
| | | case "executeCommand": |
| | | //执行指令 |
| | | this.executeCommand(row) |
| | | break; |
| | | case "completeCommand": |
| | | //完成指令 |
| | | this.completeCommand(row) |
| | | break; |
| | | } |
| | | }, |
| | | showTask(row) { |
| | |
| | | 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' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |