Kaynağa Gözat

优化驳回操作逻辑,提取独立方法处理驳回流程

yusheng 9 ay önce
ebeveyn
işleme
be229c6506

+ 22 - 21
src/views/bpm/handleTask/components/outBound/submit.vue

@@ -3,7 +3,6 @@
     <el-form label-width="100px" ref="formRef" :model="form">
       <el-form-item
         label="审批建议"
-
         style="margin-bottom: 20px"
         :rules="{
           required: true,
@@ -34,7 +33,7 @@
         type="danger"
         size="mini"
         :loading="isLoading"
-        @click="handleAudit(0)"
+        @click="outApproveNotPass(0)"
         >驳回
       </el-button>
     </div>
@@ -65,6 +64,27 @@
       }
     },
     methods: {
+      async outApproveNotPass(status) {
+        const params = {
+          id: this.taskId,
+          reason: this.form.reason,
+          outInId: this.businessId
+        };
+        try {
+          this.isLoading = true;
+          const data = await outApproveNotPass(params);
+          if (data.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: '驳回'
+            });
+          }
+          this.isLoading = false;
+        } catch (error) {
+          this.isLoading = false;
+        }
+      },
+
       handleAudit(status) {
         if (!this.form.reason && status == 1) {
           this.$message.warning(`请填写审批意见!`);
@@ -94,25 +114,6 @@
           } catch (error) {
             this.isLoading = false;
           }
-        } else {
-          const params = {
-            id: this.taskId,
-            reason: this.form.reason,
-            outInId: this.businessId
-          };
-          try {
-            this.isLoading = true;
-            const data = await outApproveNotPass(params);
-            if (data.data.code != '-1') {
-              this.$emit('handleAudit', {
-                status,
-                title: '驳回'
-              });
-            }
-            this.isLoading = false;
-          } catch (error) {
-            this.isLoading = false;
-          }
         }
       }
     }