| <!DOCTYPE html> | 
| <html lang="en"> | 
|   | 
| <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> | 
| </head> | 
|   | 
| <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.status" placeholder="任务状态"> | 
|                         <el-option label="接收" value="1"></el-option> | 
|                         <el-option label="派发" value="2"></el-option> | 
|                         <el-option label="完结" value="3"></el-option> | 
|                         <el-option label="取消" value="4"></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 label=""> | 
|                     <el-date-picker | 
|                             v-model="tableSearchParam.datetime" | 
|                             value-format="yyyy-MM-dd HH:mm:ss" | 
|                             type="datetimerange" | 
|                             range-separator="至" | 
|                             start-placeholder="开始日期" | 
|                             end-placeholder="结束日期"> | 
|                     </el-date-picker> | 
|                 </el-form-item> | 
|                 <el-form-item> | 
|                     <el-button type="primary" @click="getTableData">查询</el-button> | 
|                     <el-button type="primary" @click="resetParam">重置</el-button> | 
|                     <el-button type="primary" @click="addTask">手动添加任务</el-button> | 
|                 </el-form-item> | 
|             </el-form> | 
|             <el-table ref="singleTable" :data="tableData" style="width: 100%;"> | 
|                 <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="showCommand">查看指令</el-dropdown-item>--> | 
|                                 <el-dropdown-item command="returnWorkingCondition">重新给堆垛机下发任务</el-dropdown-item> | 
|                                 <el-dropdown-item command="changeCommand">修改</el-dropdown-item> | 
|                                 <el-dropdown-item command="assign">跳转到输送线下发完成</el-dropdown-item> | 
|                                 <el-dropdown-item command="complete">完结</el-dropdown-item> | 
|                                 <el-dropdown-item command="cancel">取消</el-dropdown-item> | 
|                                 <el-dropdown-item command="delete">删除无需上报</el-dropdown-item> | 
|                             </el-dropdown-menu> | 
|                         </el-dropdown> | 
|                     </template> | 
|                 </el-table-column> | 
|                 <el-table-column property="taskNo" label="任务号"> | 
|                 </el-table-column> | 
|                 <el-table-column property="status$" label="任务状态"> | 
|                 </el-table-column> | 
|                 <el-table-column property="wrkNo" label="工作号"> | 
|                 </el-table-column> | 
|                 <el-table-column property="createTime$" label="任务时间"> | 
|                 </el-table-column> | 
|                 <el-table-column property="durationTime" label="持续时长"> | 
|                 </el-table-column> | 
|                 <el-table-column property="ioType$" label="任务类型"> | 
|                 </el-table-column> | 
|                 <el-table-column property="startPoint" label="起点位置"> | 
|                 </el-table-column> | 
|                 <el-table-column property="targetPoint" label="终点位置"> | 
|                 </el-table-column> | 
|                 <el-table-column property="wrkSts$" label="工作状态"> | 
|                 </el-table-column> | 
|                 <el-table-column property="barcode" label="托盘码"> | 
|                 </el-table-column> | 
|                 <el-table-column property="crnNo" label="巷道号"> | 
|                 </el-table-column> | 
|                 <el-table-column property="ioPri" label="优先级"> | 
|                 </el-table-column> | 
|             </el-table> | 
|   | 
|             <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> | 
|   | 
|     <el-dialog :title="taskWrkFormTitle" :visible.sync="taskWrkFormVisible"> | 
|         <el-form :model="taskWrkForm"> | 
|             <el-form-item label="起点位置" :label-width="taskWrkFormLabelWidth"> | 
|                 <el-input v-model="taskWrkForm.startPoint" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="终点位置" :label-width="taskWrkFormLabelWidth"> | 
|                 <el-input v-model="taskWrkForm.targetPoint" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|         </el-form> | 
|         <div slot="footer" class="dialog-footer"> | 
|             <el-button @click="taskWrkFormVisible = false">取 消</el-button> | 
|             <el-button type="primary" @click="taskWrkFormConfirm">确 定</el-button> | 
|         </div> | 
|     </el-dialog> | 
|   | 
|     <el-dialog :title="addTaskFormTitle" :visible.sync="addTaskFormVisible"> | 
|         <el-form :model="addTaskForm"> | 
|             <el-form-item label="任务号" :label-width="addTaskFormLabelWidth"> | 
|                 <el-input v-model="addTaskForm.taskNo" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="任务类型=》1:出库、2:移库、3:入库" :label-width="200"> | 
|                 <el-input v-model="addTaskForm.ioType" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="优先级" :label-width="addTaskFormLabelWidth"> | 
|                 <el-input v-model="addTaskForm.taskPriority" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="容器编码" :label-width="addTaskFormLabelWidth"> | 
|                 <el-input v-model="addTaskForm.barcode" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="起点位置" :label-width="addTaskFormLabelWidth"> | 
|                 <el-input v-model="addTaskForm.startPoint" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="终点位置" :label-width="addTaskFormLabelWidth"> | 
|                 <el-input v-model="addTaskForm.targetPoint" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|             <el-form-item label="备注" :label-width="addTaskFormLabelWidth"> | 
|                 <el-input v-model="addTaskForm.memo" autocomplete="off"></el-input> | 
|             </el-form-item> | 
|         </el-form> | 
|         <div slot="footer" class="dialog-footer"> | 
|             <el-button @click="addTaskFormVisible = false">取 消</el-button> | 
|             <el-button type="primary" @click="addTaskFormConfirm">确 定</el-button> | 
|         </div> | 
|     </el-dialog> | 
|   | 
| </div> | 
| <script> | 
|     var $layui = layui.config({ | 
|         base: baseUrl + "/static/wms/layui/lay/modules/" | 
|     }).use(['layer', 'form'], function () { | 
|     }) | 
|   | 
|     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, | 
|                 datetime: null, | 
|             }, | 
|             taskWrkFormVisible: false, | 
|             addTaskFormVisible: false, | 
|             taskWrkForm: {}, | 
|             addTaskForm: { | 
|                 taskNo:"9001", | 
|                 ioType:"0", | 
|                 taskPriority:1, | 
|                 barcode:"10000001", | 
|                 startPoint:"1000", | 
|                 targetPoint:"F-F01-01-01-01", | 
|                 memo:"cs" | 
|             }, | 
|             taskWrkFormLabelWidth: '80px', | 
|             addTaskFormLabelWidth: '80px', | 
|             taskWrkFormTitle: '', | 
|             addTaskFormTitle: '手动添加任务' | 
|         }, | 
|         created() { | 
|             this.init() | 
|         }, | 
|         methods: { | 
|             init() { | 
|                 let taskNo = getQueryVariable('taskNo') | 
|                 let wrkNo = getQueryVariable('wrkNo') | 
|                 if (taskNo != false) { | 
|                     this.tableSearchParam.task_no = taskNo | 
|                 } | 
|                 if (wrkNo != false) { | 
|                     this.tableSearchParam.wrk_no = wrkNo | 
|                 } | 
|   | 
|                 this.getTableData() | 
|             }, | 
|             getTableData() { | 
|                 let that = this; | 
|                 let data = JSON.parse(JSON.stringify(this.tableSearchParam)) | 
|                 data.curr = this.currentPage | 
|                 data.limit = this.pageSize | 
|                 if (this.tableSearchParam.datetime != null) { | 
|                     data.datetime = null | 
|                     data.create_time = this.tableSearchParam.datetime[0] + " - " + this.tableSearchParam.datetime[1] | 
|                 } | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/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() | 
|             }, | 
|             addTask() { | 
|                 this.addTaskFormVisible = true | 
|             }, | 
|             handleCommand(command, row) { | 
|                 switch (command) { | 
|                     case "returnWorkingCondition": | 
|                         //重新给堆垛机下发任务 | 
|                         this.returnWorkingConditionWrk(row) | 
|                         break; | 
|                     case "showCommand": | 
|                         //查看指令 | 
|                         this.showCommand(row) | 
|                         break; | 
|                     case "changeCommand": | 
|                         //修改指令 | 
|                         this.changeCommand(row); | 
|                         break | 
|                     case "assign": | 
|                         //派发任务 | 
|                         this.assignWrk(row) | 
|                         break; | 
|                     case "complete": | 
|                         //完结任务 | 
|                         this.completeWrk(row) | 
|                         break; | 
|                     case "cancel": | 
|                         //取消任务 | 
|                         this.cancelWrk(row) | 
|                         break; | 
|                     case "delete": | 
|                         //取消任务 | 
|                         this.deleteWrk(row) | 
|                         break; | 
|                 } | 
|             }, | 
|             showCommand(row) { | 
|                 let wrkNo = row.wrkNo == null ? "" : row.wrkNo | 
|                 //查看指令 | 
|                 $layui.layer.open({ | 
|                     type: 2, | 
|                     title: '指令管理', | 
|                     maxmin: true, | 
|                     area: [top.detailWidth, top.detailHeight], | 
|                     shadeClose: true, | 
|                     content: 'commandManage.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo, | 
|                     success: function (layero, index) { | 
|                     } | 
|                 }); | 
|             }, | 
|             changeCommand(row) { | 
|                 //修改指令 | 
|                 this.taskWrkFormVisible = true | 
|                 this.taskWrkFormTitle = "任务:" + row.taskNo | 
|                 this.taskWrkForm = row | 
|             }, | 
|             assignWrk(row) { | 
|                 //派发任务 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/assign/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: { | 
|                         taskNo: row.taskNo | 
|                     }, | 
|                     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' | 
|                             }); | 
|                         } | 
|                     } | 
|                 }); | 
|             }, | 
|             completeWrk(row) { | 
|                 //完成任务 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/complete/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: { | 
|                         taskNo: row.taskNo | 
|                     }, | 
|                     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' | 
|                             }); | 
|                         } | 
|                     } | 
|                 }); | 
|             }, | 
|             returnWorkingConditionWrk(row){ | 
|                 //重新给堆垛机下发任务 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/returnWorkingCondition/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: { | 
|                         taskNo: row.taskNo | 
|                     }, | 
|                     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' | 
|                             }); | 
|                         } | 
|                     } | 
|                 }); | 
|             }, | 
|             deleteWrk(row) { | 
|                 //取消任务 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/delete/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: { | 
|                         taskNo: row.taskNo | 
|                     }, | 
|                     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' | 
|                             }); | 
|                         } | 
|                     } | 
|                 }); | 
|             }, | 
|             cancelWrk(row) { | 
|                 //取消任务 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/cancel/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: { | 
|                         taskNo: row.taskNo | 
|                     }, | 
|                     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' | 
|                             }); | 
|                         } | 
|                     } | 
|                 }); | 
|             }, | 
|             taskWrkFormConfirm() { | 
|                 //修改指定任务数据 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/updatePoint/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: { | 
|                         taskNo: this.taskWrkForm.taskNo, | 
|                         startPoint: this.taskWrkForm.startPoint, | 
|                         targetPoint: this.taskWrkForm.targetPoint, | 
|                     }, | 
|                     method: 'POST', | 
|                     success: function (res) { | 
|                         if (res.code == 200) { | 
|                             that.taskWrkFormVisible = false | 
|                             that.$message({ | 
|                                 message: "更新成功", | 
|                                 type: 'success' | 
|                             }); | 
|                             that.getTableData() | 
|                         } else if (res.code === 403) { | 
|                             top.location.href = baseUrl + "/"; | 
|                         } else { | 
|                             that.$message({ | 
|                                 message: res.msg, | 
|                                 type: 'error' | 
|                             }); | 
|                         } | 
|                     } | 
|                 }); | 
|             }, | 
|             addTaskFormConfirm() { | 
|                 //修改指定任务数据 | 
|                 let that = this | 
|                 $.ajax({ | 
|                     url: baseUrl + "/taskWrk/addTask/auth", | 
|                     headers: { | 
|                         'token': localStorage.getItem('token') | 
|                     }, | 
|                     data: this.addTaskForm, | 
|                     method: 'POST', | 
|                     success: function (res) { | 
|                         if (res.code == 200) { | 
|                             that.addTaskFormVisible = false | 
|                             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> |