Просмотр исходного кода

报工-产前准备、过程监测、产后检查

lucw 9 месяцев назад
Родитель
Сommit
bd24e3b168

+ 12 - 0
src/api/producetaskrulerecord/index.js

@@ -23,3 +23,15 @@ export async function saveRuleRecord(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 产前准备是否完成,工序配置事项的产前准备部分,事项里每一项都有已执行记录 /mes/producetaskrulerecord/isPreProductionResult
+export async function isPreProductionResult(body) {
+  const res = await request.post(
+    '/mes/producetaskrulerecord/isPreProductionResult',
+    body
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 24 - 0
src/views/batchRecord/after.vue

@@ -0,0 +1,24 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading"> 产后检查 </el-card>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+
+  export default {
+    name: 'batchRecord',
+    mixins: [dictMixins, tableColumnsMixin],
+    data() {
+      return {
+        loading: true
+      };
+    },
+    created() {},
+    methods: {}
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 24 - 0
src/views/batchRecord/before.vue

@@ -0,0 +1,24 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading"> 产前准备 </el-card>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+
+  export default {
+    name: 'batchRecord',
+    mixins: [dictMixins, tableColumnsMixin],
+    data() {
+      return {
+        loading: true
+      };
+    },
+    created() {},
+    methods: {}
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 12 - 3
src/views/batchRecord/index.vue

@@ -1,14 +1,23 @@
 <template>
-  <div>批记录</div>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading"> 批记录管理 </el-card>
+  </div>
 </template>
 
 <script>
   import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
 
   export default {
     name: 'batchRecord',
-
-    mixins: [dictMixins]
+    mixins: [dictMixins, tableColumnsMixin],
+    data() {
+      return {
+        loading: true
+      };
+    },
+    created() {},
+    methods: {}
   };
 </script>
 

+ 24 - 0
src/views/batchRecord/process.vue

@@ -0,0 +1,24 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading"> 过程监测 </el-card>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+
+  export default {
+    name: 'batchRecord',
+    mixins: [dictMixins, tableColumnsMixin],
+    data() {
+      return {
+        loading: true
+      };
+    },
+    created() {},
+    methods: {}
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 44 - 14
src/views/produce/components/footBtn.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="foot_box">
     <div
-      v-for="(item, index) in btnList"
+      v-for="(item, index) in btnListData"
       :key="index"
       class="btn"
-      :style="{ background: item.bjColor }"
-      @click="footClick(item.type)"
+      :style="{ background: item.disable ? '#858585' : item.bjColor }"
+      @click="footClick(item)"
     >
       <img src="../../../assets/Frame.png" class="Frame" />
       {{ item.name }}
@@ -15,6 +15,18 @@
 
 <script>
   export default {
+    props: {
+      type: {
+        type: String | Number,
+        default: ''
+      },
+      singleReportInspection: {},
+      // 是否完成产前准备
+      isPreProductionResult: {
+        type: Boolean,
+        default: true
+      }
+    },
     data() {
       return {
         btnList1: [
@@ -221,17 +233,21 @@
             bjColor: '#cc0000'
           }
         ],
-        btnList: []
+        btnList: [],
+        // 未完成产前准备 需要禁用的按钮
+        disable: [
+          '领料',
+          '投料',
+          '过程监测',
+          '报工',
+          '委外请托',
+          '暂停启动',
+          '产后检查',
+          '工单交接',
+          '异常'
+        ]
       };
     },
-    props: {
-      type: {
-        type: String | Number,
-        default: ''
-      },
-      singleReportInspection: {}
-    },
-
     computed: {
       taskObj() {
         return this.$store.state.user.taskObj;
@@ -239,6 +255,17 @@
 
       clientEnvironmentId() {
         return this.$store.state.user.info.clientEnvironmentId;
+      },
+      btnListData() {
+        if (this.isPreProductionResult) {
+          return this.btnList;
+        }
+        return this.btnList.map((i) => {
+          return {
+            ...i,
+            disable: this.disable.includes(i.name)
+          };
+        });
       }
     },
     watch: {
@@ -308,8 +335,11 @@
       // }
     },
     methods: {
-      footClick(type) {
-        this.$emit('footBtn', type);
+      footClick(item) {
+        if (item.disable && !this.isPreProductionResult) {
+          return this.$message.warning(`请先完成产前准备!`);
+        }
+        this.$emit('footBtn', item.type);
       }
     }
   };

+ 23 - 1
src/views/produce/components/new_produceOrder.vue

@@ -93,9 +93,20 @@
     removeItem,
     updateCertificateNumber
   } from '@/api/inspectionWork';
+  import { isPreProductionResult } from '@/api/producetaskrulerecord/index.js';
+
   export default {
     components: { routings },
     mixins: [tableColumnsMixin],
+    emits: ['changeIsPreProductionResult'],
+    props: {
+      produceTaskInfo: {
+        type: Object,
+        default: () => {
+          return null;
+        }
+      }
+    },
     data() {
       return {
         loading: false,
@@ -428,7 +439,9 @@
         });
       },
 
-      handleSelectionChange(val) {
+      async handleSelectionChange(val) {
+        console.log('val 选择的工单列表', val);
+        console.log('this.produceTaskInfo', this.produceTaskInfo);
         let initReportValue = val[0] && val[0].singleReport;
         let allSame = true;
 
@@ -442,6 +455,15 @@
           return this.$message.warning('请选择报工类型相同的工单');
         }
 
+        if (this.produceTaskInfo.isPrenatalPreProduction && val.length > 0) {
+          // 判断是否要求先完成 产前准备
+          const result = await isPreProductionResult({
+            produceTaskId: this.produceTaskInfo.id,
+            workOrderIds: val.map((i) => i.id)
+          });
+          this.$emit('changeIsPreProductionResult', result);
+        }
+
         let ids = [];
         ids = val.map((item) => {
           return item.id;

+ 47 - 34
src/views/produce/components/prenatalExamination/programRulesDialog.vue

@@ -7,7 +7,7 @@
     custom-class="ele-dialog-form"
     :title="title"
     :close-on-click-modal="false"
-    :before-close="close"
+    :before-close="beforeClose"
     :maxable="true"
   >
     <header-title title="基本信息"></header-title>
@@ -16,6 +16,7 @@
       :model="addForm"
       :rules="addFormRules"
       label-width="120px"
+      v-loading="loading"
     >
       <el-row>
         <el-col :span="8">
@@ -312,11 +313,12 @@
       </el-tabs>
     </el-form>
     <template v-slot:footer>
-      <el-button @click="visible = false">取消</el-button>
+      <el-button :loading="butLoading" @click="beforeClose">取消</el-button>
       <el-button
         type="primary"
         @click="submit"
         :disabled="productionInfo.executeStatus != 0"
+        :loading="butLoading"
       >
         派单</el-button
       >
@@ -369,7 +371,8 @@
 
       return {
         visible: false,
-        addForm: formData,
+        formData,
+        addForm: JSON.parse(JSON.stringify(formData)),
         uerList: [], // 审核人列表
         executorList: [], // 业务人员列表
 
@@ -410,8 +413,6 @@
           { label: '生效', value: 1 }
         ],
 
-        // 提交状态
-        loading: false,
         // 规则信息
         ruleInfo: null,
         // 设备信息
@@ -421,7 +422,11 @@
         // 工艺路线
         workOrderInfo: null,
         // 工序信息
-        produceTaskInfo: null
+        produceTaskInfo: null,
+        // 加载状态
+        loading: false,
+        // 提交状态
+        butLoading: false
       };
     },
     computed: {
@@ -445,7 +450,12 @@
       }
     },
     methods: {
-      close() {
+      // 关闭重置数据
+      beforeClose() {
+        this.$refs.addFormRef.resetFields();
+        this.addForm = JSON.parse(JSON.stringify(this.formData));
+        this.ruleInfo = null;
+        this.deviceList = [];
         this.visible = false;
       },
       // 初始化
@@ -467,26 +477,32 @@
       },
       // 已执行获取基本信息
       async getInfo() {
-        const { data } = await getById(this.productionInfo.eamPlanIds[0]);
-        console.log('data 基本信息', data);
-        // 数据回显
-        this.$util.assignObject(this.addForm, data);
-        // 类型转换
-        this.addForm.urgent = this.addForm.urgent + '';
-        this.addForm.executorId = data.executorId.split(',');
-        // 获取部门用户列表
-        this.getUserList({ groupId: data.groupId });
-        this.ruleInfo = data.ruleInfo;
-        this.ruleInfo.ruleItems = data.planDeviceList[0]?.workItems || [];
-        this.deviceList = data.planDeviceList.map((item) => {
-          return {
-            name: item.substance.name,
-            position: item.substance.position,
-            id: item.substance.id,
-            fixCode: item.substance.fixCode,
-            codeNumber: item.substance.codeNumber
-          };
-        });
+        try {
+          this.loading = true;
+          const { data } = await getById(this.productionInfo.eamPlanIds[0]);
+          console.log('data 基本信息', data);
+          // 数据回显
+          this.$util.assignObject(this.addForm, data);
+          // 类型转换
+          this.addForm.urgent = this.addForm.urgent + '';
+          this.addForm.executorId = data.executorId.split(',');
+          // 获取部门用户列表
+          this.getUserList({ groupId: data.groupId });
+          this.ruleInfo = data.ruleInfo;
+          this.ruleInfo.ruleItems = data.planDeviceList[0]?.workItems || [];
+          this.deviceList = data.planDeviceList.map((item) => {
+            return {
+              name: item.substance.name,
+              position: item.substance.position,
+              id: item.substance.id,
+              fixCode: item.substance.fixCode,
+              codeNumber: item.substance.codeNumber
+            };
+          });
+          this.loading = false;
+        } catch (error) {
+          this.loading = false;
+        }
       },
       // 获取规则信息 和 规则事项列表
       async getRuleInfoAndList(row) {
@@ -609,6 +625,7 @@
           console.log('this.addForm', this.addForm);
 
           try {
+            this.butLoading = true;
             let deviceInfo = this.deviceList[0] || {};
 
             // 请求参数
@@ -649,18 +666,14 @@
 
             await saveRuleRecord(body);
             this.$message.success('派单成功!');
-            this.resetFormDate();
-            this.visible = false;
+            this.butLoading = false;
+            this.beforeClose();
             this.$emit('reload');
           } catch (error) {
             this.$message.error('派单失败!');
+            this.butLoading = false;
           }
         });
-      },
-      // 重置表单
-      resetFormDate() {
-        this.$refs.addFormRef.resetFields();
-        this.addForm = formData;
       }
     }
   };

+ 16 - 7
src/views/produce/components/prenatalExamination/releaseRulesDialog.vue

@@ -15,6 +15,7 @@
       :rules="formRules"
       ref="ruleFormRef"
       label-width="150px"
+      v-loading="loading"
     >
       <el-row>
         <el-col :span="8">
@@ -109,7 +110,7 @@
     <header-title title="检查项目"></header-title>
 
     <!-- 表格 -->
-    <el-table :data="addForm.details" style="width: 100%">
+    <el-table v-loading="loading" :data="addForm.details" style="width: 100%">
       <el-table-column type="index" label="序号" width="50"> </el-table-column>
       <el-table-column label="检查内容">
         <template slot-scope="scope">
@@ -259,7 +260,7 @@
         checkFinishTime: '',
         checkValidity: null,
         checkValidityUnit: '',
-        conclution: 0,
+        conclution: null,
         isTempRecord: 0,
         details: [],
         deviceId: 0,
@@ -323,7 +324,9 @@
         // 工艺路线
         workOrderInfo: null,
         //工序信息
-        produceTaskInfo: null
+        produceTaskInfo: null,
+        // 加载中 loading
+        loading: false
       };
     },
     computed: {
@@ -379,10 +382,16 @@
       },
       // 获取详情
       async getCacheInfo() {
-        const data = await getById(this.productionInfo.recordId);
-        console.log('dat 缓存', data);
-        this.$util.assignObject(this.addForm, data);
-        this.addForm.recordRulesClassify += '';
+        this.loading = true;
+        try {
+          const data = await getById(this.productionInfo.recordId);
+          console.log('dat 缓存', data);
+          this.$util.assignObject(this.addForm, data);
+          this.addForm.recordRulesClassify += '';
+          this.loading = false;
+        } catch (error) {
+          this.loading = false;
+        }
       },
       // 规则信息
       async getRuleInfo() {

+ 17 - 1
src/views/produce/index.vue

@@ -149,6 +149,8 @@
                 @rowClick="rowClick"
                 ref="produceOrder"
                 @getTaskName="getTaskName"
+                :produceTaskInfo="produceTaskInfo"
+                @changeIsPreProductionResult="changeIsPreProductionResult"
               >
               </produceOrder>
             </div>
@@ -278,6 +280,7 @@
           :type="type"
           :singleReportInspection="singleReportInspection"
           style="background: rgba(223, 250, 222, 0.6); padding: 10px"
+          :isPreProductionResult="isPreProductionResult"
         ></footBtn>
 
         <!-- <div class="box"> -->
@@ -451,7 +454,8 @@
           { label: '产前准备', action: 'Delete' },
           { label: '过程检测', action: 'Edit' },
           { label: '产后检查', action: 'Favorite' }
-        ]
+        ],
+        isPreProductionResult: true
       };
     },
 
@@ -576,6 +580,11 @@
         this.reportNeedFeed = data.reportNeedFeed;
         this.produceTaskInfo = data;
 
+        // 重置按钮 禁用
+        if (this.produceTaskInfo && this.produceTaskInfo.id != data.id) {
+          this.isPreProductionResult = true;
+        }
+
         console.log(data, 'handleNodeClick');
 
         let obj = {
@@ -934,6 +943,8 @@
 
           let reportWorkType = 1;
 
+          console.log('this.workListIds', this.workListIds, t);
+
           switch (t) {
             case 'prenatalExamination':
               reportWorkType = 1;
@@ -1047,6 +1058,11 @@
             this.$forceUpdate();
           });
         }
+      },
+      // 是否完成 产前准备 限制按钮
+      changeIsPreProductionResult(isPreProductionResult) {
+        console.log('isPreProductionResult', isPreProductionResult);
+        this.isPreProductionResult = isPreProductionResult;
       }
     },