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

放行单功能优化、物料清单功能优化

lucw 7 месяцев назад
Родитель
Сommit
802bce304d

+ 5 - 1
src/views/checklistManagement/checklist.vue

@@ -19,7 +19,10 @@
           >
         </template>
         <template v-slot:action="{ row }">
-          <el-link type="text" @click="checkAddConfirm('edit', row)"
+          <el-link
+            type="text"
+            v-if="row.approvalStatus == 0"
+            @click="checkAddConfirm('edit', row)"
             >编辑</el-link
           >
           <el-link
@@ -29,6 +32,7 @@
             >提交</el-link
           >
           <el-popconfirm
+            v-if="row.approvalStatus != 1"
             title="您确定要删除这条数据吗?"
             @confirm="deleteRow(row)"
           >

+ 90 - 21
src/views/checklistManagement/components/checkDetails.vue

@@ -228,12 +228,6 @@
         </tr>
       </table>
 
-      <bpmTask
-        v-if="form.processInstanceId"
-        :id="form.processInstanceId"
-        :businessId="form.id"
-      ></bpmTask>
-
       <!-- 选择生产工单 -->
       <selectWorkOrder
         ref="selectWorkOrderRef"
@@ -251,15 +245,15 @@
     </el-form>
 
     <template v-slot:footer>
-      <!-- <el-button
-        v-if="type != 'detail'"
+      <el-button
+        v-if="type != 'detail' && !form.approvalStatus"
         type="primary"
-        @click="submit"
+        @click="submit('submit')"
         :loading="butLoading"
-        >提 交</el-button
-      > -->
+        >保存并提交</el-button
+      >
       <el-button
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && !form.approvalStatus"
         type="primary"
         @click="submit('save')"
         :loading="butLoading"
@@ -269,6 +263,13 @@
     </template>
 
     <detailsPop ref="detailsRef"> </detailsPop>
+
+    <process-submit-dialog
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      :isNotNeedProcess="false"
+    ></process-submit-dialog>
   </ele-modal>
 </template>
 
@@ -287,10 +288,18 @@
   import bpmDetail from '@/views/bpm/processInstance/detail.vue';
   import detailsPop from '@/views/produceOrder/components/details/index.vue';
   import { getById as getworkOrderById } from '@/api/produceOrder/index';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
 
   export default {
     mixins: [dictMixins],
-    components: { selectWorkOrder, SelectUser, bpmTask, bpmDetail, detailsPop },
+    components: {
+      selectWorkOrder,
+      SelectUser,
+      bpmTask,
+      bpmDetail,
+      detailsPop,
+      processSubmitDialog
+    },
     props: {
       // 保存是否关闭弹窗
       saveClose: {
@@ -349,7 +358,8 @@
         activeComp: 'main',
         showSelectUser: false,
         // 0 生产验收人 1 质检验收人
-        selectUserType: 0
+        selectUserType: 0,
+        processSubmitDialogFlag: false
       };
     },
     watch: {
@@ -381,6 +391,17 @@
           }
         },
         deep: true
+      },
+      processSubmitDialogFlag(val) {
+        if (!val) {
+          // 关闭后 刷新详情
+          if (this.form.id) {
+            this.$emit('reload');
+            this.$nextTick(() => {
+              this.handleClose();
+            });
+          }
+        }
       }
     },
     computed: {
@@ -562,25 +583,32 @@
                 // 存在id 则更新
                 if (this.form.id) {
                   await checklistrecordUpdate(this.form);
-                  this.$message.success('操作成功');
+                  this.$message.success('操作成功,已保存到放行单列表');
                 } else {
                   this.form.createUserName = this.$store.state.user.info.name;
                   const data = await checklistrecordSave(this.form);
-                  this.$message.success('操作成功');
+                  this.$message.success('操作成功,已保存到放行单列表');
                   this.form.id = data;
-                  this.getCheckDetails(data);
+                  this.getCheckDetails(this.form.id);
                 }
               } else {
+                // submit 保存并提交审核
+                // 存在id 则更新
+                if (this.form.id) {
+                  await checklistrecordUpdate(this.form);
+                } else {
+                  this.form.createUserName = this.$store.state.user.info.name;
+                  const data = await checklistrecordSave(this.form);
+                  this.form.id = data;
+                  await this.getCheckDetails(this.form.id);
+                }
+                this.openApproval();
               }
               this.butLoading = false;
               this.$emit('reload');
             } catch (error) {
               this.butLoading = false;
             }
-
-            if (type != 'save') {
-              this.handleClose();
-            }
           } else {
             // 转换为数组
             const firstErrorField = Object.values(invalidFields);
@@ -781,6 +809,47 @@
         console.log('row', row);
         const info = await getworkOrderById(row.workOrderId);
         this.$refs.detailsRef.open(info);
+      },
+      // 提交审批
+      openApproval() {
+        const row = this.form;
+        console.log('row', row);
+
+        let businessType = this.getDictValue(
+          '放行类型',
+          row.checklistType + ''
+        );
+        console.log('businessType', businessType);
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(async () => {
+          let params = {
+            businessId: row.id,
+            businessKey: 'work_order_checklist_approval',
+            formCreateUserId: row.createUserId,
+            variables: {
+              businessCode: row.code,
+              businessName: '放行单',
+              businessType: businessType
+            }
+          };
+
+          if (this.clientEnvironmentId == 5) {
+            // 嘉实环境
+            const data = await getCategoryByCode(row.orders[0]?.productCode);
+
+            // 判断品类
+            if (data && data.categoryLevelCodePath?.includes('W3-209')) {
+              // 药品
+              params.businessKey = 'work_order_checklist_approval1';
+            } else {
+              // 器械
+              params.businessKey = 'work_order_checklist_approval';
+            }
+          }
+
+          console.log('params', params);
+          this.$refs.processSubmitDialogRef.init(params);
+        });
       }
     }
   };

+ 52 - 8
src/views/produce/components/prenatalExamination/material.vue

@@ -6,7 +6,7 @@
       ref="table"
       row-key="id"
       :columns="materialColumns"
-      :datasource="materialList"
+      :datasource="localPickDetails"
       cache-key="prenatal-examination-material-list-table-2511031522"
       autoAmendPage
       :needPage="false"
@@ -18,6 +18,14 @@
         >
       </template>
 
+      <template v-if="outputType == 1" v-slot:selectColumnHeader>
+        <el-checkbox
+          v-model="selectedAll"
+          @change="selectedAllChange"
+          :indeterminate="isIndeterminate"
+        ></el-checkbox>
+      </template>
+
       <template v-slot:selectColumn="{ row }">
         <el-checkbox
           v-model="row.selected"
@@ -324,13 +332,23 @@
           this.getCategoryAndLevelByCategoryId();
         },
         immediate: true
+      },
+      localPickDetails: {
+        handler(newVal) {
+          // 如果全选则更新 selectdAll
+          if (
+            newVal.length > 0 &&
+            newVal.every((item) => item.selected === true)
+          ) {
+            this.selectedAll = true;
+          } else {
+            this.selectedAll = false;
+          }
+        },
+        deep: true
       }
     },
     computed: {
-      // 物料清单(包含上到工序产出明细)
-      materialList() {
-        return this.localPickDetails;
-      },
       // 物料清单表头
       materialColumns() {
         const list = [
@@ -622,7 +640,8 @@
             label: '选择',
             slot: 'selectColumn',
             align: 'center',
-            fixed: 'right'
+            fixed: 'right',
+            headerSlot: 'selectColumnHeader'
           });
         }
         return list;
@@ -783,6 +802,12 @@
             headerSlot: 'sumNoQualifiedQuantityHeader'
           }
         ];
+      },
+      isIndeterminate() {
+        return (
+          this.localPickDetails.some((item) => item.selected) &&
+          !this.selectedAll
+        );
       }
     },
 
@@ -793,7 +818,8 @@
         // bom配置的 标准产出信息
         materialQuotaInfo: null,
         // 在制品信息
-        categoryInfo: null
+        categoryInfo: null,
+        selectedAll: false
       };
     },
     methods: {
@@ -848,7 +874,8 @@
               workOrderId: this.workOrderId,
               sumQualifiedQuantity,
               sumNoQualifiedQuantity,
-              sumReportQuantity
+              sumReportQuantity,
+              selected: false
             });
           }
         });
@@ -933,6 +960,7 @@
       noQualifiedQuantityMax(row) {
         return row.reportQuantity;
       },
+      // 单选
       selectedChange(row) {
         console.log('row', row);
         if (this.outputType != 1) return;
@@ -987,9 +1015,25 @@
             (item) => !(item.categoryId === row.categoryId)
           );
         }
+
         console.log('this.localOutputDetails', this.localOutputDetails);
+
         this.$emit('update:outputDetails', this.localOutputDetails);
       },
+      // 全选
+      selectedAllChange() {
+        this.localPickDetails = this.localPickDetails.map((item) => {
+          if (item.selected == this.selectedAll) {
+            return item;
+          }
+
+          item.selected = this.selectedAll;
+
+          this.selectedChange(item);
+
+          return item;
+        });
+      },
       // getCategoryAndLevelByCategoryId 获取产品 在制品信息
       async getCategoryAndLevelByCategoryId() {
         const data = await getCategoryAndLevelByCategoryId(this.categoryId);