yusheng 1 неделя назад
Родитель
Сommit
2b5d554511

+ 16 - 1
src/api/recordRules/index.js

@@ -99,7 +99,14 @@ export async function recordrulesplanManualDispatchOrder(body) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-
+//多次派单
+export async function dispatchRepeatedly(body) {
+  const res = await request.put(`/pcs/recordRulesPlan/dispatchRepeatedly`, body);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 // /mes/recordrulesplan/reManualDispatchOrder
 export async function recordrulesplanReManualDispatchOrder(body) {
   const res = await request.put(`/pcs/recordrulesorder/reassign`, body);
@@ -163,6 +170,14 @@ export async function qualityInspection(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+//批量撤回工单
+export async function batchRevokeOrder(ids) {
+  const res = await request.put(`/pcs/recordRulesPlan/revokeRepeatedly`, ids);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 //固废记录统计
 export async function wasteRecord(params) {
   const res = await request.get(`/pcs/statisticalReport/wasteRecord`, { params });

+ 308 - 0
src/views/recordComponents/batchRevokeDialog.vue

@@ -0,0 +1,308 @@
+<template>
+  <ele-modal
+    title="批量撤回工单"
+    :visible.sync="visible"
+    :before-close="handleCancel"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+    :maxable="true"
+  >
+    <el-card shadow="never">
+      <seek-page
+        :seekList="seekList"
+        @search="search"
+        :maxLength="4"
+        style="margin-bottom: 15px"
+      ></seek-page>
+      <ele-pro-table
+        ref="table"
+        row-key="id"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        :cache-key="cacheKeyUrl"
+        height="calc(100vh - 520px)"
+        @selection-change="handleSelectionChange"
+        :page-size="defPageSize"
+        :initLoad="false"
+      >
+      </ele-pro-table>
+    </el-card>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="handleCancel">取消</el-button>
+      <el-button
+        type="primary"
+        :loading="revokeLoading"
+        @click="handleBatchRevoke"
+        >批量撤回</el-button
+      >
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import {
+    producetaskrulerecordQueryRecordWorkOrderPage,
+    batchRevokeOrder
+  } from '@/api/recordRules/index';
+  import { getteampage } from '@/api/main/index.js';
+  import { getFactoryarea } from '@/api/factoryModel/index';
+
+  export default {
+    props: {
+      pageName: {
+        type: String,
+        default: 'productionRecords'
+      }
+    },
+    data() {
+      return {
+        visible: false,
+        revokeLoading: false,
+        selection: [],
+        planTypeList: {
+          productionRecords: 2,
+          steamInjectionInspectionRecord: 3,
+          solidWasteRecord: 4,
+          qualityTestRecords: 5,
+          QualityInspection: 7,
+          boilerOperationRecord: 6,
+          HaulSlag: 8,
+          TransportAsh: 9
+        },
+        planCode: 0,
+        columns: [
+          {
+            type: 'selection',
+            width: 50,
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '工单单号',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planCode',
+            label: '计划单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'ruleName',
+            label: '记录规则名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'productLineName',
+            label: '场站名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'teamName',
+            label: '班组',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'createTime',
+            label: '工单生成时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: '',
+            label: '执行人',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              if (row.executeUsers) {
+                return row.executeUsers.map((i) => i.userName).join(',');
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              const statusMap = {
+                0: '未报工',
+                1: '执行中',
+                2: '已执行'
+              };
+              return statusMap[row.status] || '';
+            }
+          }
+        ],
+        cacheKeyUrl: `pcs-2511241029-${this.pageName + ''}-batchRevoke`,
+        teamList: [],
+        productLineList: []
+      };
+    },
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '关键字',
+            value: 'keyword',
+            type: 'input',
+            width: '280px',
+            placeholder: '工单单号,计划单号,记录规则名称'
+          },
+          {
+            label: '场站',
+            value: 'productLineId',
+            type: 'select',
+            planList: this.productLineList,
+            placeholder: '请选择'
+          },
+          {
+            label: '班组',
+            value: 'teamId',
+            type: 'select',
+            planList: this.teamList,
+            placeholder: '请选择'
+          },
+          {
+            label: '状态',
+            value: 'status',
+            type: 'select',
+            placeholder: '请输入',
+            planList: [
+              { value: 0, label: '未报工' },
+              { value: 1, label: '执行中' },
+              { value: 2, label: '已执行' }
+            ]
+          },
+          {
+            label: '创建时间:',
+            value: 'createTime',
+            type: 'date',
+            dateType: 'datetimerange',
+            placeholder: '',
+            width: 380,
+            valueAr: ['createTimeStart', 'createTimeEnd']
+          }
+        ];
+      }
+    },
+    created() {
+      getteampage({
+        pageNum: 1,
+        size: -1
+      }).then((res) => {
+        this.teamList =
+          res.list.map((item) => {
+            return {
+              value: item.id,
+              label: item.name
+            };
+          }) || [];
+      });
+      getFactoryarea({
+        pageNum: 1,
+        size: 999,
+        type: 4
+      }).then((res) => {
+        this.productLineList =
+          res.list.map((item) => {
+            return {
+              value: item.id,
+              label: item.name
+            };
+          }) || [];
+      });
+    },
+    methods: {
+      open(planCode) {
+        this.visible = true;
+        this.selection = [];
+        this.planCode = planCode;
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+        });
+      },
+      reload(where = {}) {
+        this.$refs.table.reload({ where });
+      },
+      datasource({ page, limit, where, order }) {
+        const body = {
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit,
+          keyword: this.planCode,
+          status: 1,
+          planType: this.planTypeList[this.pageName]
+        };
+        return producetaskrulerecordQueryRecordWorkOrderPage(body);
+      },
+      search(where) {
+        if (where.time) {
+          where.createTimeStart = where.time[0];
+          where.createTimeEnd = where.time[1];
+          where.time = null;
+        }
+        this.reload(where);
+      },
+      handleSelectionChange(selection) {
+        this.selection = selection;
+      },
+      handleCancel() {
+        this.visible = false;
+        this.selection = [];
+      },
+      async handleBatchRevoke() {
+        if (!this.selection.length) {
+          this.$message.warning('请至少选择一条工单');
+          return;
+        }
+        try {
+          this.revokeLoading = true;
+          const ids = this.selection.map((item) => item.id);
+          await batchRevokeOrder(ids);
+          this.$message.success('批量撤回成功');
+          this.visible = false;
+          this.selection = [];
+          this.$emit('refresh');
+        } catch (error) {
+          this.$message.error('批量撤回失败');
+        } finally {
+          this.revokeLoading = false;
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .dialog-footer {
+    text-align: right;
+  }
+</style>

+ 54 - 22
src/views/recordComponents/plan.vue

@@ -51,22 +51,28 @@
           <el-link
             type="primary"
             :underline="false"
-            v-if="row.status != 2 && row.status != 3"
+            v-if="row.dispatchType == 1 || (row.status != 2 && row.status != 3)"
             @click="openEdit('dispatch', row)"
           >
             派单
           </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            v-if="row.dispatchType == 1"
+            @click="openEdit('dispatch', row, 'dispatchAll')"
+          >
+            批量派单
+          </el-link>
 
-          <el-popconfirm
+          <el-link
+            type="primary"
+            :underline="false"
             v-if="row.status == 2"
-            class="ele-action"
-            title="确定要撤回此条数据吗?"
-            @confirm="revoke(row.id)"
+            @click="handleRevoke(row)"
           >
-            <template v-slot:reference>
-              <el-link type="primary" :underline="false"> 撤回 </el-link>
-            </template>
-          </el-popconfirm>
+            撤回
+          </el-link>
 
           <el-popconfirm
             class="ele-action"
@@ -85,8 +91,16 @@
     <programRulesDialog
       ref="programRulesDialogRef"
       @reload="reload"
+      :pageName="pageName"
       :planType="planTypeList[pageName]"
     ></programRulesDialog>
+
+    <batchRevokeDialog
+      ref="batchRevokeDialogRef"
+      :pageName="pageName"
+      :planType="planTypeList[pageName]"
+      @refresh="reload"
+    ></batchRevokeDialog>
   </div>
 </template>
 
@@ -99,13 +113,15 @@
     recordrulesplanRevoke
   } from '@/api/recordRules/index';
   import programRulesDialog from './programRulesDialog.vue';
+  import batchRevokeDialog from './batchRevokeDialog.vue';
   import { getteampage } from '@/api/main/index.js';
   import { getFactoryarea } from '@/api/factoryModel/index';
 
   export default {
     mixins: [dictMixins, tableColumnsMixin],
     components: {
-      programRulesDialog
+      programRulesDialog,
+      batchRevokeDialog
     },
     props: {
       pageName: {
@@ -214,16 +230,16 @@
             },
             minWidth: 110
           },
-          // {
-          //   prop: 'autoOrder',
-          //   label: '自动派单',
-          //   align: 'center',
-          //   showOverflowTooltip: true,
-          //   minWidth: 110,
-          //   formatter: (row) => {
-          //     return row.autoOrder ? '是' : '否';
-          //   }
-          // },
+          {
+            prop: 'dispatchType',
+            label: '派单类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (row) => {
+              return row.dispatchType ? '多次' : '单次';
+            }
+          },
           {
             prop: 'status',
             label: '状态',
@@ -378,7 +394,7 @@
         }
         this.reload(where);
       },
-      openEdit(type, row = null) {
+      openEdit(type, row = null, dispatchType) {
         this.$refs.programRulesDialogRef.open(
           type,
           row,
@@ -399,7 +415,8 @@
               : this.pageName == 'TransportAsh'
               ? '拉灰记录'
               : '锅炉运行记录'
-          )
+          ),
+          dispatchType
         );
       },
       async deleteRow(id) {
@@ -411,6 +428,21 @@
         await recordrulesplanRevoke({ id });
         this.$message.success('撤回成功');
         this.reload();
+      },
+      handleRevoke(row) {
+        if (row.dispatchType == 1) {
+          // 多次派单,打开批量撤回弹窗
+          this.$refs.batchRevokeDialogRef.open(row.code);
+        } else {
+          // 单次派单,直接撤回
+          this.$confirm('确定要撤回此条数据吗?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            this.revoke(row.id);
+          }).catch(() => {});
+        }
       }
     }
   };

+ 49 - 6
src/views/recordComponents/programRulesDialog.vue

@@ -40,7 +40,24 @@
             ></el-input>
           </el-form-item>
         </el-col>
-
+        <el-col
+          :span="8"
+          v-if="
+            ['QualityInspection', 'HaulSlag', 'TransportAsh'].includes(pageName)
+          "
+        >
+          <el-form-item label="派单类型" prop="dispatchType">
+            <el-select
+              v-model="addForm.dispatchType"
+              size="small"
+              style="width: 100%"
+              :disabled="type === 'dispatch'"
+            >
+              <el-option :value="0" label="单次派单"></el-option>
+              <el-option :value="1" label="多次派单"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
         <el-col :span="8">
           <el-form-item label="自动派单" prop="autoOrder">
             <el-select
@@ -265,6 +282,16 @@
             ></el-input>
           </el-form-item>
         </el-col>
+        <el-col :span="6" v-if="dispatchType">
+          <el-form-item label="派单次数" prop="dispatchQuantity">
+            <el-input
+              type="number"
+              v-model="addForm.dispatchQuantity"
+              placeholder="派单次数"
+              size="small"
+            ></el-input>
+          </el-form-item>
+        </el-col>
       </el-row>
 
       <header-title title="规则明细" style="margin-top: 20px"> </header-title>
@@ -667,7 +694,8 @@
     save,
     update,
     recordrulesGetById,
-    recordrulesplanManualDispatchOrder
+    recordrulesplanManualDispatchOrder,
+    dispatchRepeatedly
   } from '@/api/recordRules/index.js';
   import toolModal from '@/BIZComponents/toolModal.vue';
   import MaterialAdd from '@/components/common/MaterialAdd.vue';
@@ -691,6 +719,7 @@
     areaId: 0,
     areaName: '',
     autoOrder: 1,
+    dispatchType: 0,
     code: '',
     configCode: '',
     configType: 1,
@@ -729,15 +758,21 @@
     teamId: '', // 班组id
     teamName: '', // 班组id
     productLineId: null,
-    productLineName: ''
+    productLineName: '',
+    dispatchQuantity: 1
   };
   export default {
     props: {
       planType: {
         type: Number,
         default: 2
+      },
+      pageName: {
+        type: String,
+        default: 'productionRecords'
       }
     },
+
     mixins: [dictMixins, tableColumnsMixin],
     components: {
       deptSelect,
@@ -793,6 +828,7 @@
           ]
         },
         executorList: [],
+        dispatchType: '',
         uerList: [],
         // 执行方式列表
         executeMethodList: [],
@@ -813,7 +849,7 @@
     },
     computed: {
       dispatchStatus() {
-        return true
+        return true;
         return (
           this.type == 'add' || this.type == 'edit' || this.type == 'detail'
         );
@@ -1007,8 +1043,9 @@
     },
     methods: {
       // 外部调用,打开弹窗
-      async open(type, data, classify) {
+      async open(type, data, classify, dispatchType) {
         console.log('type data', type, data);
+        this.dispatchType = dispatchType;
         this.classify = classify;
         this.type = type;
         await this.getAllTeamList();
@@ -1056,6 +1093,9 @@
         //   // 自动派单
         //   this.addForm.autoOrder = 1;
         // }
+        if (this.dispatchType) {
+          this.addForm.dispatchQuantity = 1;
+        }
 
         this.loading = false;
 
@@ -1115,7 +1155,10 @@
               body.planType = this.planType;
 
               if (this.type == 'dispatch') {
-                await recordrulesplanManualDispatchOrder(body);
+                let api = this.dispatchType
+                  ? dispatchRepeatedly
+                  : recordrulesplanManualDispatchOrder;
+                await api(body);
                 this.$message.success('派单成功');
               } else {
                 let api = this.addForm.id ? update : save;