yusheng 11 ماه پیش
والد
کامیت
1c00cdd014
1فایلهای تغییر یافته به همراه22 افزوده شده و 5 حذف شده
  1. 22 5
      src/views/bpm/handleTask/components/contact/submit.vue

+ 22 - 5
src/views/bpm/handleTask/components/contact/submit.vue

@@ -29,8 +29,7 @@
         icon="el-icon-circle-close"
         type="danger"
         size="mini"
-        @click="handleAudit(0)"
-        v-if="!['starter', 'starterFillApprove'].includes(taskDefinitionKey)"
+        @click="rejectTask(0)"
       >驳回
       </el-button>
 
@@ -70,7 +69,7 @@
 
 <script>
 import { cancel} from '@/api/bpm/components/supplierManage/contact';
-import {approveTaskWithVariables, rejectTask} from '@/api/bpm/task';
+import {approveTaskWithVariables, rejectTask,cancelTask} from '@/api/bpm/task';
 import {listAllUserBind} from '@/api/system/organization';
 
 // 流程实例的详情页,可用于审批
@@ -125,6 +124,23 @@ export default {
       }
       await this._approveTaskWithVariables(status);
     },
+    rejectTask(status){
+      let variables = {
+        pass: !!status
+      };
+      rejectTask({
+        id: this.taskId,
+        reason: this.form.reason,
+        variables
+      }).then((res) => {
+        if (res.data.code != '-1') {
+          this.$emit('handleAudit', {
+            status,
+            title: status === 0 ? '驳回' : ''
+          });
+        }
+      });
+    },
     async _approveTaskWithVariables(status) {
       let variables = {
         pass: !!status
@@ -160,8 +176,9 @@ export default {
           cancelButtonText: '取消',
           confirmButtonText: '确定'
         }).then(() => {
-          cancel({
-            id: this.taskId,
+          cancelTask({
+            id: this.id,
+            taskId: this.taskId,
             reason: this.form.reason,
             businessId: this.businessId,
           }).then(() => {