Kaynağa Gözat

计划规则报工修改

lucw 7 ay önce
ebeveyn
işleme
bb4d17cef7

+ 18 - 0
src/api/ruleManagement/plan.js

@@ -114,3 +114,21 @@ export async function getWarehouseList() {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// /mes/producetaskrulerecord/getEamInfoByMesWorkOrderIdAndPlanConfigId/{workOrderId}/{planConfigId}
+export async function getEamInfoByMesWorkOrderIdAndPlanConfigId(
+  workOrderId,
+  planConfigId
+) {
+  const res = await request.get(
+    `/mes/producetaskrulerecord/getEamInfoByMesWorkOrderIdAndPlanConfigId/` +
+      workOrderId +
+      '/' +
+      planConfigId,
+    {}
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 6 - 4
src/components/selectPlanRules/selectPlanRules.vue

@@ -62,9 +62,11 @@
         })
       },
       // 1巡点检 2保养
-      ruleType: {
-        type: Number,
-        default: 1
+      ruleTypes: {
+        type: Array,
+        default: () => {
+          return [1, 2];
+        }
       }
     },
     computed: {
@@ -241,7 +243,7 @@
           size: limit,
           ...where,
           ...this.where,
-          ruleType: this.ruleType
+          ruleTypes: this.ruleTypes
         });
       },
       /* 刷新表格 */

+ 20 - 5
src/views/batchRecord/components/editModal.vue

@@ -104,10 +104,10 @@
             </el-form-item>
           </el-col>
           <el-col v-if="form.itemType == '1'" :span="8">
-            <el-form-item label="关联计划规则" required prop="ruleName">
+            <el-form-item label="关联计划规则" required prop="planConfigName">
               <div class="mask-box" @click="selectRulesId">
                 <el-input
-                  v-model="form.ruleName"
+                  v-model="form.planConfigName"
                   placeholder="请选择设备有关计划规则,如保养规则,巡点检规则等"
                   size="small"
                   readonly
@@ -333,7 +333,11 @@
         <header-title title="关联产品" style="margin-top: 20px"></header-title>
         <el-row>
           <el-col :span="8">
-            <el-form-item label="生产工单号" prop="workOrderCode">
+            <el-form-item
+              label="生产工单号"
+              prop="workOrderCode"
+              :required="form.itemType == 1"
+            >
               <el-input
                 v-model="form.workOrderCode"
                 placeholder="请选择生产工单"
@@ -750,6 +754,7 @@
   import statistics from './statistics.vue';
   import selectWorkOrder from '@/views/checklistManagement/components/selectWorkOrder.vue';
   import selectPlanRules from '@/components/selectPlanRules/selectPlanRules.vue';
+  import { getEamInfoByMesWorkOrderIdAndPlanConfigId } from '@/api/ruleManagement/plan';
 
   export default {
     name: 'editModal',
@@ -866,7 +871,9 @@
         recordRulesExecuteMethodName: '',
         recordRulesExecuteMethodId: null,
         conclusion: null,
-        outputType: 1
+        outputType: 1,
+        planConfigId: null,
+        planConfigName: ''
       };
 
       return {
@@ -898,6 +905,10 @@
             { required: true, message: '请选择规则', trigger: 'blur' },
             { required: true, message: '请选择规则', trigger: 'change' }
           ],
+          planConfigName: [
+            { required: true, message: '请选择规则', trigger: 'blur' },
+            { required: true, message: '请选择规则', trigger: 'change' }
+          ],
           productCode: [
             {
               required: true,
@@ -1201,7 +1212,9 @@
           };
         });
         // 工时毫秒转小时
-        this.form.duration = (this.form.duration / (1000 * 60 * 60)).toFixed(2);
+        if (this.form.duration) {
+          this.form.duration = this.form.duration / (1000 * 60 * 60);
+        }
         this.form.executeUsersIds = this.form.executeUsers.map((i) => i.userId);
         this.form.teamId =
           this.form.executeUsers.length > 0
@@ -1333,6 +1346,8 @@
       // 选择事项规则
       chooseRules(rules) {
         console.log('rules', rules);
+        this.form.planConfigId = rules.id;
+        this.form.planConfigName = rules.name;
       },
       // 获取生产工单号
       async getWorkOrderList(code = '') {

+ 8 - 8
src/views/batchRecord/components/tables/deviceBatchRecordTable.vue

@@ -140,17 +140,17 @@
       seekList() {
         return [
           {
-            label: '工单单号',
-            value: 'code',
+            label: '生产工单号',
+            value: 'mesWorkOrderCode',
+            type: 'input',
+            placeholder: '请输入'
+          },
+          {
+            label: '计划单号:',
+            value: 'planCode',
             type: 'input',
             placeholder: '请输入'
           },
-          // {
-          //   label: '计划单号:',
-          //   value: 'planCode',
-          //   type: 'input',
-          //   placeholder: '请输入'
-          // },
           {
             label: '状态:',
             value: 'orderStatus',

+ 19 - 18
src/views/produce/components/prenatalExamination/PlanRulesDialog.vue

@@ -9,32 +9,33 @@
     width="80%"
     append-to-body
   >
-    <div v-if="rulesInfo && currentPlanDevices">
-      <!-- {{ JSON.stringify(currentPlanDevices) }} -->
-      <!-- 根据当前currentPlanDevices的 planStatus状态展示不同内容 -->
+    <div v-if="rulesInfo && currentPlanOrders">
+      <!-- {{ JSON.stringify(currentPlanOrders) }} -->
+      <!-- 根据当前currentPlanOrders的 planStatus状态展示不同内容 -->
       <!-- 0 派单, 4为撤回的计划 -->
       <programRulesDialog
         v-if="
-          currentPlanDevices.planStatus == 0 ||
-          currentPlanDevices.planStatus == 4
+          currentPlanOrders.planStatus == 0 ||
+          currentPlanOrders.planStatus == 4
         "
-        :planId="currentPlanDevices.planId"
+        :planId="currentPlanOrders.planId"
+        :info="currentPlanOrders"
         @done="setPlanStatus(1)"
       />
       <!-- 1 报工 -->
       <signingUpWork
-        v-if="currentPlanDevices.planStatus == 1"
-        :planId="currentPlanDevices.planId"
-        :workOrderId="currentPlanDevices.eamWorkOrderId"
+        v-if="currentPlanOrders.planStatus == 1"
+        :planId="currentPlanOrders.planId"
+        :workOrderId="currentPlanOrders.eamWorkOrderId"
         @refresh="setPlanStatus(2)"
       ></signingUpWork>
       <!-- 2 执行中 3 完成展示详情-->
       <workOrderDetails
         v-if="
-          currentPlanDevices.planStatus == 3 ||
-          currentPlanDevices.planStatus == 2
+          currentPlanOrders.planStatus == 3 ||
+          currentPlanOrders.planStatus == 2
         "
-        :workOrderId="currentPlanDevices.eamWorkOrderId"
+        :workOrderId="currentPlanOrders.eamWorkOrderId"
       ></workOrderDetails>
     </div>
 
@@ -43,7 +44,7 @@
         <div class="txt-tip">
           <span class="active">
-            {{ rulesInfo ? rulesInfo.planDevices.length : 0 }}
+            {{ rulesInfo ? rulesInfo.planOrders.length : 0 }}
           </span>
           条记录,当前位于第
           <span class="active">{{ activeIndex + 1 }}</span
@@ -63,7 +64,7 @@
         <el-button
           type="primary"
           size="mini"
-          :disabled="activeIndex === rulesInfo.planDevices.length - 1"
+          :disabled="activeIndex === rulesInfo.planOrders.length - 1"
           @click="activeIndex++"
         >
           下一页
@@ -101,9 +102,9 @@
     },
     computed: {
       // 当前设备信息
-      currentPlanDevices() {
-        if (this.rulesInfo && this.rulesInfo.planDevices) {
-          return this.rulesInfo.planDevices[this.activeIndex];
+      currentPlanOrders() {
+        if (this.rulesInfo && this.rulesInfo.planOrders) {
+          return this.rulesInfo.planOrders[this.activeIndex];
         }
         return {};
       }
@@ -127,7 +128,7 @@
       },
       // 报工成功后刷新当前项状态
       setPlanStatus(status) {
-        this.rulesInfo.planDevices[this.activeIndex].planStatus = status;
+        this.rulesInfo.planOrders[this.activeIndex].planStatus = status;
       }
     }
   };

+ 39 - 4
src/views/produce/components/prenatalExamination/components/workOrder/programRulesDialog.vue

@@ -423,7 +423,6 @@
   import { getById } from '@/api/maintenance/patrol_maintenance';
   import { getFile } from '@/api/system/file';
   import { deepClone } from 'ele-admin/lib/utils/core';
-  import work from '@/api/technology/work';
 
   export default {
     components: {
@@ -440,6 +439,11 @@
       planId: {
         type: String,
         required: true
+      },
+      // 当前信息
+      info: {
+        type: Object,
+        required: true
       }
     },
     data() {
@@ -698,7 +702,7 @@
       },
       autoOrderChange(val) {
         if (val == 0) {
-          this.addForm.executorId = '';
+          this.addForm.executorId = [];
           this.addForm.groupId = '';
         }
       },
@@ -822,8 +826,10 @@
         console.log(id);
         try {
           const res = await getById(id);
-          console.log('res----------', res);
+
+          console.log('res----------', res.data);
           this.addForm = res.data;
+
           this.addForm.id = res.data.planId;
           if (this.dialogTitle === '派单') {
             this.addForm.autoOrder = 1;
@@ -859,7 +865,11 @@
           // this._getMatterRulesDetails(res.ruleId);
           this.$set(this.addForm, 'code', res.data.code);
           this.$set(this.addForm, 'urgent', JSON.stringify(res.data.urgent));
-          this.$set(this.addForm, 'executorId', res.data.executorId.split(','));
+          this.$set(
+            this.addForm,
+            'executorId',
+            res.data.executorId.split(',').filter((i) => i)
+          );
           this.$set(this.addForm, 'imageUrl', {});
           console.log(this.rootData);
           if (res.data.groupId) {
@@ -881,6 +891,25 @@
           //   this.$refs.equiListTree.setCheckedKeys(keys);
           // });
           // this.clickedTreeNode = true;
+
+          console.log('this.info', this.info);
+          if (this.info.planDevices) {
+            let userIds = this.info.planDevices
+              .map((i) => {
+                return i.deviceUserId;
+              })
+              .filter((i) => i);
+            // 去重
+            userIds = [...new Set(userIds)];
+
+            console.log('userIds', userIds);
+            // 赋值负责人
+            if (userIds.length > 0) {
+              this.addForm.executorId = userIds;
+            }
+          }
+
+          console.log('this.addForm', this.addForm);
         } catch (error) {
           console.log(error);
         }
@@ -1234,4 +1263,10 @@
     justify-content: flex-end;
     gap: 15px;
   }
+
+  :deep(.el-form) {
+    .el-form-item:last-child {
+      margin-bottom: 22px !important;
+    }
+  }
 </style>