ソースを参照

修改请托提交的时候有流程图

695593266@qq.com 4 ヶ月 前
コミット
7c77007c31

+ 12 - 1
src/components/processSubmitDialog/processSubmitDialog.vue

@@ -182,6 +182,7 @@
   import { listOrganizations } from '@/api/system/organization';
   import dictMixins from '@/mixins/dictMixins';
   import { getByCode } from '@/api/system/dictionary-data';
+  import { submit as entrustSubmit } from '@/api/entrust/index.js';
 
   export default {
     name: 'processSubmitDialog',
@@ -418,7 +419,17 @@
         });
       },
       async submit() {
-        await processInstanceCreateAPI(this.form);
+        console.log(this.form);
+
+        if (this.form.businessKey == 'please_entrust_approve') {
+          await entrustSubmit({
+            businessId: this.form.businessId,
+            beEntrustedDeptId: this.form.variables.beEntrustedDeptId
+          });
+        } else {
+          await processInstanceCreateAPI(this.form);
+        }
+
         this.$message('提交审核成功');
         this.$emit('reload');
         this.cancel();

+ 54 - 13
src/views/entrust/components/create.vue

@@ -648,6 +648,8 @@
             beEntrustedDeptName,
             beEntrustedFactoriesName,
             beEntrustedFactoriesId,
+            executeUserId,
+            executeUserName,
             name,
             type,
             priority,
@@ -666,6 +668,8 @@
             beEntrustedDeptName,
             beEntrustedFactoriesName,
             beEntrustedFactoriesId,
+            executeUserId,
+            executeUserName,
             name,
             type,
             priority,
@@ -849,20 +853,57 @@
             }
           }
 
+          // const user = this.userList.find(
+          //   (it) => it.id == this.form.executeUserId
+          // );
+
+          // this.orderList.forEach((item) => {
+          //   item.beEntrustedFactoriesId = this.form.beEntrustedFactoriesId;
+          //   item.beEntrustedFactoriesName = this.form.beEntrustedFactoriesName;
+          //   item.beEntrustedDeptName = this.form.beEntrustedDeptName;
+          //   item.beEntrustedDeptId = this.form.beEntrustedDeptId;
+          //   item.executeUserId = user && user.id ? user.id : '';
+          //   item.executeUserName = user && user.name ? user.name : '';
+          //   item.isLast = this.form.isLast;
+          //   item.name = this.form.name;
+          //   item.type = this.form.type;
+          //   item.status = type == 1 ? 0 : 1;
+          //   item.approvalStatus = item.approvalStatus
+          //     ? item.approvalStatus
+          //     : type == 1
+          //     ? 0
+          //     : 1;
+          // });
+          const user = this.userList.find(
+            (it) => it.id == this.form.executeUserId
+          );
+
+          const {
+            beEntrustedFactoriesId,
+            beEntrustedFactoriesName,
+            beEntrustedDeptName,
+            beEntrustedDeptId,
+            isLast,
+            name,
+            type: formType
+          } = this.form;
+
+          const executeUserId = user?.id || '';
+          const executeUserName = user?.name || '';
+          const status = type == 1 ? 0 : 1;
+
           this.orderList.forEach((item) => {
-            item.beEntrustedFactoriesId = this.form.beEntrustedFactoriesId;
-            item.beEntrustedFactoriesName = this.form.beEntrustedFactoriesName;
-            item.beEntrustedDeptName = this.form.beEntrustedDeptName;
-            item.beEntrustedDeptId = this.form.beEntrustedDeptId;
-            item.isLast = this.form.isLast;
-            item.name = this.form.name;
-            item.type = this.form.type;
-            item.status = type == 1 ? 0 : 1;
-            item.approvalStatus = item.approvalStatus
-              ? item.approvalStatus
-              : type == 1
-              ? 0
-              : 1;
+            item.beEntrustedFactoriesId = beEntrustedFactoriesId;
+            item.beEntrustedFactoriesName = beEntrustedFactoriesName;
+            item.beEntrustedDeptName = beEntrustedDeptName;
+            item.beEntrustedDeptId = beEntrustedDeptId;
+            item.executeUserId = executeUserId;
+            item.executeUserName = executeUserName;
+            item.isLast = isLast;
+            item.name = name;
+            item.type = formType;
+            item.status = status;
+            item.approvalStatus = item.approvalStatus ?? (type == 1 ? 0 : 1);
           });
           let URL;
 

+ 47 - 18
src/views/entrust/index.vue

@@ -218,6 +218,14 @@
     <flow ref="flowRef"></flow>
     <pleasePrint ref="pleasePrintRef"></pleasePrint>
     <goodsDetail ref="goodsDetailRef" @done="refresh"></goodsDetail>
+
+    <process-submit-dialog
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="reload"
+      :isNotNeedProcess="false"
+    ></process-submit-dialog>
   </div>
 </template>
 
@@ -230,6 +238,8 @@
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   import goodsDetail from './components/goodsDetail.vue';
   import { getByCode } from '@/api/system/dictionary-data';
+  import { mapGetters } from 'vuex';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
   import {
     getWarehouseList
 
@@ -248,7 +258,8 @@
       Create,
       flow,
       pleasePrint,
-      goodsDetail
+      goodsDetail,
+      processSubmitDialog
     },
     mixins: [dictMixins],
     data() {
@@ -261,7 +272,8 @@
         warehouseList: [],
         tableHeight: 'calc(100vh - 320px)',
         factoryList: [],
-        typeList: []
+        typeList: [],
+        processSubmitDialogFlag: false
       };
     },
     computed: {
@@ -551,7 +563,8 @@
             placeholder: ''
           }
         ];
-      }
+      },
+      ...mapGetters(['user'])
     },
     created() {
       this.getTypeList('entrust_type');
@@ -633,22 +646,38 @@
       },
 
       submit(item) {
-        this.$confirm('是否提交该请托单的审核流程?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
-          .then(() => {
-            submit({
-              businessId: item.id,
+        let businessType = '请托受托审批';
+        this.processSubmitDialogFlag = true;
+        // this.$confirm('是否提交该请托单的审核流程?', '提示', {
+        //   confirmButtonText: '确定',
+        //   cancelButtonText: '取消',
+        //   type: 'warning'
+        // })
+        //   .then(() => {
+        //     submit({
+        //       businessId: item.id,
+        //       beEntrustedDeptId: item.beEntrustedDeptId
+        //     }).then((res) => {
+        //       this.$message.success('提交' + res.message);
+        //       this.reload();
+        //       this.visible = false;
+        //     });
+        //   })
+        //   .catch(() => {});
+        this.$nextTick(() => {
+          let params = {
+            businessId: item.id,
+            businessKey: 'please_entrust_approve',
+            formCreateUserId: this.user.info.userId,
+            variables: {
+              businessCode: item.code,
+              businessName: '请托受托审批',
+              businessType: businessType,
               beEntrustedDeptId: item.beEntrustedDeptId
-            }).then((res) => {
-              this.$message.success('提交' + res.message);
-              this.reload();
-              this.visible = false;
-            });
-          })
-          .catch(() => {});
+            }
+          };
+          this.$refs.processSubmitDialogRef.init(params);
+        });
       },
       /* 刷新表格 */
       reload(where) {