Преглед изворни кода

feat(plan-edit-dialog): 添加流程提交并优化提交逻辑

liujt пре 6 месеци
родитељ
комит
4941dc1d02
1 измењених фајлова са 53 додато и 5 уклоњено
  1. 53 5
      src/views/materialPlan/components/plan-edit-dialog.vue

+ 53 - 5
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -381,6 +381,14 @@
     ></ProductionVersion>
 
     <timeDialog ref="timeDialogRef" @chooseTime="chooseTime"></timeDialog>
+    <!-- 提交 -->
+    <process-submit-dialog
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+      :isNotNeedProcess="false"
+    ></process-submit-dialog>
 
     <ele-modal
       :visible.sync="batchVisible"
@@ -454,6 +462,7 @@
   import ProductionVersion from '@/components/CreatePlan/ProductionVersion2.vue';
 
   import { getCode } from '@/api/codeManagement';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
 
   // import fileUpload from '@/components/addDoc/index.vue';
   import timeDialog from './timeDialog.vue';
@@ -464,7 +473,8 @@
       ProductModal,
       ProductionVersion,
       // fileUpload,
-      timeDialog
+      timeDialog,
+      processSubmitDialog
     },
     mixins: [dictMixins],
     data() {
@@ -474,6 +484,8 @@
           requireDeliveryTime: '',
           timeList: []
         },
+        businessId: '',
+        processSubmitDialogFlag: false,
         batchVisible: false,
         multipleSelection: [],
         visible: false,
@@ -877,6 +889,7 @@
 
       getDetail(id) {
         getById(id).then((res) => {
+          this.businessId = res.id;
           this.$set(this.formData, 'demandType', res.demandType);
           this.$set(this.formData, 'name', res.name);
           this.$set(this.formData, 'remark', res.remark);
@@ -1307,20 +1320,55 @@
               return;
             }
             if (type == 'submit') {
-              await saveAndSubmit(this.formData);
-              this.$message.success('保存并提交成功!');
+              save(this.formData).then((res) => {
+                this.todo(res);
+              });
+              // await saveAndSubmit(this.formData);
+              // this.$message.success('保存并提交成功!');
             } else if (type == 'publish') {
               await submitAndPublish(this.formData);
               this.$message.success('保存并发布成功!');
+              this.$emit('success');
+              this.cancel();
             } else {
               await save(this.formData);
               this.$message.success('保存成功!');
+              this.$emit('success');
+              this.cancel();
             }
-            this.$emit('success');
-            this.cancel();
+            
           }
         });
       },
+      reload() {
+        this.$emit('success');
+        this.cancel();
+      },
+      async todo(res) {
+        const data = await getById(this.businessId || res);
+        console.log('data~~~', data);
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: data.id,
+            businessKey: 'release_purchase_plan',
+            formCreateUserId: data.createUserId,
+            variables: {
+              businessCode: data.code,
+              businessName: data.name,
+              businessType:
+                data.demandType == 1
+                  ? '生产性物资采购'
+                  : data.demandType == 6
+                  ? '外协自供料采购'
+                  : data.demandType == 7
+                  ? '外协客供料采购'
+                  : ''
+            }
+          };
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+      },
       cancel() {
         this.visible = false;