zjj
2024-04-23 acacdfa1b6b5dc0ac0c444c53fcbd05f8552ff3c
src/main/webapp/views/taskWrk/taskWrk.html
@@ -17,58 +17,79 @@
         <div style="width: 100%;">
            <el-card class="box-card">
               <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline">
                  <el-form-item label="">
                  <el-form-item style="width: 100px;" 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-form-item style="width: 100px;" 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-form-item style="width: 100px;" label="">
                     <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号"></el-input>
                  </el-form-item>
                  <el-form-item label="">
                     <el-input v-model="tableSearchParam.barcode" 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-form-item>
               </el-form>
               <el-table ref="singleTable" :data="tableData" style="width: 100%;">
                  <el-table-column label="操作" width="100">
               <el-table border ref="singleTable" :data="tableData" style="width: 100%;">
                  <el-table-column sortable align="center" property="taskNo" label="任务号" width="90">
                  </el-table-column>
                  <el-table-column sortable align="center" property="status$" label="任务状态" width="110">
                  </el-table-column>
                  <el-table-column sortable align="center" property="wrkNo" label="工作号" width="90">
                  </el-table-column>
                  <el-table-column sortable align="center" property="createTime$" label="任务时间" width="170">
                  </el-table-column>
<!--                  <el-table-column sortable align="center" property="durationTime" label="持续时长">-->
<!--                  </el-table-column>-->
                  <el-table-column sortable align="center" property="ioType$" label="任务类型">
                  </el-table-column>
                  <el-table-column sortable align="center" property="startPoint" label="起点位置">
                  </el-table-column>
                  <el-table-column sortable align="center" property="targetPoint" label="终点位置">
                  </el-table-column>
                  <el-table-column sortable align="center" property="wrkSts$" label="工作状态">
                  </el-table-column>
                  <el-table-column sortable align="center" property="barcode" label="托盘码">
                  </el-table-column>
                  <el-table-column sortable align="center" property="crnNo" label="堆垛机号">
                  </el-table-column>
                  <el-table-column sortable align="center" property="ioPri$" label="优先级">
                  </el-table-column>
                  <el-table-column label="操作" width="100" align="center">
                     <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="upIoPri">增加优先级</el-dropdown-item>
                              <el-dropdown-item command="downIoPri">降低优先级</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-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="crnNo" label="堆垛机号">
                  </el-table-column>
               </el-table>
@@ -80,6 +101,22 @@
               </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>
      </div>
      <script>
         var $layui = layui.config({
@@ -97,8 +134,14 @@
               tableSearchParam: {
                  task_no: null,
                  status: null,
                  wrk_no: null
               }
                  wrk_no: null,
                  datetime: null,
                  barcode:null
               },
               taskWrkFormVisible: false,
               taskWrkForm: {},
               taskWrkFormLabelWidth: '80px',
               taskWrkFormTitle: ''
            },
            created() {
               this.init()
@@ -118,9 +161,13 @@
               },
               getTableData() {
                  let that = this;
                  let data = this.tableSearchParam
                  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: {
@@ -169,6 +216,18 @@
                        //查看指令
                        this.showCommand(row)
                        break;
                     case "upIoPri":
                        //查看指令
                        this.upIoPri(row)
                        break;
                     case "downIoPri":
                        //查看指令
                        this.downIoPri(row)
                        break;
                     case "changeCommand":
                        //修改指令
                        this.changeCommand(row);
                        break
                     case "assign":
                        //派发任务
                        this.assignWrk(row)
@@ -195,6 +254,70 @@
                     content: 'commandManage.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo,
                     success: function(layero, index) {}
                  });
               },
               upIoPri(row) {
                  let that = this
                  $.ajax({
                     url: baseUrl + "/taskWrk/upIoPri",
                     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'
                           });
                        }
                     }
                  });
               },
               downIoPri(row) {
                  let that = this
                  $.ajax({
                     url: baseUrl + "/taskWrk/downIoPri",
                     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'
                           });
                        }
                     }
                  });
               },
               changeCommand(row) {
                  //修改指令
                  this.taskWrkFormVisible = true
                  this.taskWrkFormTitle = "任务:" + row.taskNo
                  this.taskWrkForm = row
               },
               assignWrk(row){
                  //派发任务
@@ -227,7 +350,7 @@
                  });
               },
               completeWrk(row){
                  //派发任务
                  //完成任务
                  let that = this
                  $.ajax({
                     url: baseUrl + "/taskWrk/complete/auth",
@@ -285,6 +408,39 @@
                        }
                     }
                  });
               },
               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'
                           });
                        }
                     }
                  });
               }
            }
         })