|  |  | 
 |  |  | <!DOCTYPE html> | 
 |  |  | <html lang="en"> | 
 |  |  | <head> | 
 |  |  |     <meta charset="utf-8"> | 
 |  |  |     <title></title> | 
 |  |  |     <meta name="renderer" content="webkit"> | 
 |  |  |     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
 |  |  |     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
 |  |  |     <link rel="stylesheet" href="../../static/wms/layui/css/layui.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/wms/css/cool.css" media="all"> | 
 |  |  |     <link rel="stylesheet" href="../../static/wms/css/common.css" media="all"> | 
 |  |  | </head> | 
 |  |  | <body> | 
 |  |  | <!-- 搜索栏 --> | 
 |  |  | <div id="search-box" class="layui-form layui-card-header"> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="id" placeholder="指令编号" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="wrk_no" id="wrkNo" placeholder="任务号" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |     <div class="layui-inline"> | 
 |  |  |         <div class="layui-input-inline"> | 
 |  |  |             <input class="layui-input" type="text" name="wms_wrk_no" id="wmsWrkNo" placeholder="WMS任务号" autocomplete="off"> | 
 |  |  |         </div> | 
 |  |  |     </div> | 
 |  |  |  | 
 |  |  |     <!-- 待添加 --> | 
 |  |  |     <div id="data-search-btn" class="layui-btn-container layui-form-item"> | 
 |  |  |         <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> | 
 |  |  |         <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> | 
 |  |  |     </div> | 
 |  |  | </div> | 
 |  |  |    <head> | 
 |  |  |       <meta charset="UTF-8"> | 
 |  |  |       <title>指令管理</title> | 
 |  |  |       <link rel="stylesheet" href="../../static/wcs/css/element.css"> | 
 |  |  |       <script type="text/javascript" src="../../static/wcs/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  |       <script type="text/javascript" src="../../static/wms/layui/layui.js"></script> | 
 |  |  |       <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> | 
 |  |  |  | 
 |  |  | <!-- 表格 --> | 
 |  |  | <div class="layui-form"> | 
 |  |  |     <table class="layui-hide" id="commandManage" lay-filter="commandManage"></table> | 
 |  |  | </div> | 
 |  |  | <script type="text/html" id="toolbar"> | 
 |  |  |     <div class="layui-btn-container"> | 
 |  |  |         <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button> | 
 |  |  |     </div> | 
 |  |  | </script> | 
 |  |  |    <body> | 
 |  |  |       <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;"> | 
 |  |  |          <div style="width: 100%;"> | 
 |  |  |             <el-card class="box-card"> | 
 |  |  |                <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline"> | 
 |  |  |                   <el-form-item label=""> | 
 |  |  |                      <el-input v-model="tableSearchParam.task_no" placeholder="任务号"></el-input> | 
 |  |  |                   </el-form-item> | 
 |  |  |                   <el-form-item label=""> | 
 |  |  |                      <el-select v-model="tableSearchParam.command_status" placeholder="指令状态"> | 
 |  |  |                         <el-option label="创建" value="1"></el-option> | 
 |  |  |                         <el-option label="执行" value="2"></el-option> | 
 |  |  |                         <el-option label="完成" value="3"></el-option> | 
 |  |  |                      </el-select> | 
 |  |  |                   </el-form-item> | 
 |  |  |                   <el-form-item label=""> | 
 |  |  |                      <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号"></el-input> | 
 |  |  |                   </el-form-item> | 
 |  |  |                   <el-form-item> | 
 |  |  |                      <el-button type="primary" @click="getTableData">查询</el-button> | 
 |  |  |                      <el-button type="primary" @click="resetParam">重置</el-button> | 
 |  |  |                   </el-form-item> | 
 |  |  |                </el-form> | 
 |  |  |                <el-table border 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 property="id" label="#ID"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="wrkNo" label="工作号"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="taskNo" label="任务号"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="commandStatus$" label="指令状态"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column show-overflow-tooltip property="durationTime" label="持续时长"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="commandType$" label="指令类型"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="device" label="设备"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="deviceLog" label="设备执行信息"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column property="commandDesc" label="命令描述"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column show-overflow-tooltip property="startTime$" label="开始时间"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <el-table-column show-overflow-tooltip property="executeTime$" label="执行时间"> | 
 |  |  |                   </el-table-column> | 
 |  |  |                   <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> | 
 |  |  |  | 
 |  |  | <script type="text/html" id="operate"> | 
 |  |  |     <a class="layui-btn layui-btn-xs btn-detlShow" id="btn-wrkMastShow" lay-event="wrkMastShow">任务</a> | 
 |  |  | </script> | 
 |  |  |                <div style="margin-top: 10px;"> | 
 |  |  |                   <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" | 
 |  |  |                      :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize" | 
 |  |  |                      layout="total, sizes, prev, pager, next, jumper" :total="pageTotal"> | 
 |  |  |                   </el-pagination> | 
 |  |  |                </div> | 
 |  |  |             </el-card> | 
 |  |  |          </div> | 
 |  |  |       </div> | 
 |  |  |       <script> | 
 |  |  |          var $layui = layui.config({ | 
 |  |  |             base: baseUrl + "/static/wms/layui/lay/modules/" | 
 |  |  |          }).use(['layer', 'form'], function() {}) | 
 |  |  |  | 
 |  |  | <script type="text/javascript" src="../../static/wms/js/jquery/jquery-3.3.1.min.js"></script> | 
 |  |  | <script type="text/javascript" src="../../static/wms/layui/layui.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/wms/js/common.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/wms/js/cool.js" charset="utf-8"></script> | 
 |  |  | <script type="text/javascript" src="../../static/wms/js/commandManage/commandManage.js" charset="utf-8"></script> | 
 |  |  |          var app = new Vue({ | 
 |  |  |             el: '#app', | 
 |  |  |             data: { | 
 |  |  |                tableData: [], | 
 |  |  |                currentPage: 1, | 
 |  |  |                pageSizes: [16, 30, 50, 100, 150, 200], | 
 |  |  |                pageSize: 16, | 
 |  |  |                pageTotal: 0, | 
 |  |  |                tableSearchParam: { | 
 |  |  |                   task_no: null, | 
 |  |  |                   status: null, | 
 |  |  |                   wrk_no: null | 
 |  |  |                }, | 
 |  |  |                commandStep: -1 | 
 |  |  |             }, | 
 |  |  |             created() { | 
 |  |  |                this.init() | 
 |  |  |             }, | 
 |  |  |             watch: { | 
 |  |  |  | 
 |  |  | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> | 
 |  |  |             }, | 
 |  |  |             methods: { | 
 |  |  |                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) | 
 |  |  |  | 
 |  |  | </body> | 
 |  |  |                   this.getTableData() | 
 |  |  |                }, | 
 |  |  |                getTableData() { | 
 |  |  |                   let that = this; | 
 |  |  |                   let data = this.tableSearchParam | 
 |  |  |                   data.curr = this.currentPage | 
 |  |  |                   data.limit = this.pageSize | 
 |  |  |                   $.ajax({ | 
 |  |  |                      url: baseUrl + "/commandInfo/list/auth", | 
 |  |  |                      headers: { | 
 |  |  |                         'token': localStorage.getItem('token') | 
 |  |  |                      }, | 
 |  |  |                      data: data, | 
 |  |  |                      dataType: 'json', | 
 |  |  |                      contentType: 'application/json;charset=UTF-8', | 
 |  |  |                      method: 'GET', | 
 |  |  |                      success: function(res) { | 
 |  |  |                         if (res.code == 200) { | 
 |  |  |                            that.tableData = res.data.records | 
 |  |  |                            that.pageTotal = res.data.total | 
 |  |  |                         } else if (res.code === 403) { | 
 |  |  |                            top.location.href = baseUrl + "/"; | 
 |  |  |                         } else { | 
 |  |  |                            that.$message({ | 
 |  |  |                               message: res.msg, | 
 |  |  |                               type: 'error' | 
 |  |  |                            }); | 
 |  |  |                         } | 
 |  |  |                      } | 
 |  |  |                   }); | 
 |  |  |                }, | 
 |  |  |                handleSizeChange(val) { | 
 |  |  |                   console.log(`每页 ${val} 条`); | 
 |  |  |                   this.pageSize = val | 
 |  |  |                   this.getTableData() | 
 |  |  |                }, | 
 |  |  |                handleCurrentChange(val) { | 
 |  |  |                   console.log(`当前页: ${val}`); | 
 |  |  |                   this.currentPage = val | 
 |  |  |                   this.getTableData() | 
 |  |  |                }, | 
 |  |  |                resetParam() { | 
 |  |  |                   this.tableSearchParam = { | 
 |  |  |                      task_no: null, | 
 |  |  |                      status: null, | 
 |  |  |                      wrk_no: null | 
 |  |  |                   } | 
 |  |  |                   this.getTableData() | 
 |  |  |                }, | 
 |  |  |                tableRowClassName({row, rowIndex}) { | 
 |  |  |                   if (rowIndex === this.commandStep) { | 
 |  |  |                      return 'success-row'; | 
 |  |  |                   } | 
 |  |  |                   return ''; | 
 |  |  |                }, | 
 |  |  |                handleCommand(command, row) { | 
 |  |  |                   switch (command) { | 
 |  |  |                      case "showTask": | 
 |  |  |                         //查看任务 | 
 |  |  |                         this.showTask(row) | 
 |  |  |                         break; | 
 |  |  |                      case "executeCommand": | 
 |  |  |                         //执行指令 | 
 |  |  |                         this.executeCommand(row) | 
 |  |  |                         break; | 
 |  |  |                      case "completeCommand": | 
 |  |  |                         //完成指令 | 
 |  |  |                         this.completeCommand(row) | 
 |  |  |                         break; | 
 |  |  |                   } | 
 |  |  |                }, | 
 |  |  |                showTask(row) { | 
 |  |  |                   let wrkNo = row.wrkNo == null ? "" : row.wrkNo | 
 |  |  |                   console.log(wrkNo) | 
 |  |  |                   //查看指令 | 
 |  |  |                   $layui.layer.open({ | 
 |  |  |                      type: 2, | 
 |  |  |                      title: '任务管理', | 
 |  |  |                      maxmin: true, | 
 |  |  |                      area: [top.detailWidth, top.detailHeight], | 
 |  |  |                      shadeClose: true, | 
 |  |  |                      content: '../taskWrk/taskWrk.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo, | 
 |  |  |                      success: function(layero, index) {} | 
 |  |  |                   }); | 
 |  |  |                }, | 
 |  |  |                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' | 
 |  |  |                            }); | 
 |  |  |                         } | 
 |  |  |                      } | 
 |  |  |                   }); | 
 |  |  |                }, | 
 |  |  |             } | 
 |  |  |          }) | 
 |  |  |       </script> | 
 |  |  |    </body> | 
 |  |  |  | 
 |  |  | </html> | 
 |  |  |  |