自动化立体仓库 - WCS系统
Junjie
2023-08-10 0e9686edc067b0779562bfa2452d49daf4cb7b18
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'
                           });
                        }
                     }
                  });
               }
            }
         })