From 6fd27418225f2d36fc206acdfe6c24fb33ae7590 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 19 Dec 2022 17:26:50 +0800
Subject: [PATCH] 添加申请用户任务完成流程

---
 src/views/work/process/audit/handle.vue |  260 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 234 insertions(+), 26 deletions(-)

diff --git a/src/views/work/process/audit/handle.vue b/src/views/work/process/audit/handle.vue
index 5175af7..136fc1c 100644
--- a/src/views/work/process/audit/handle.vue
+++ b/src/views/work/process/audit/handle.vue
@@ -9,7 +9,7 @@
           <el-button @click="handleCancel">关闭</el-button>
         </el-form-item>
       </el-row>
-      <el-card shadow="hover">
+      <el-card v-if="!isUserTask" shadow="hover">
         <div slot="header">
           <span>审批信息</span>
         </div>
@@ -28,8 +28,27 @@
             <avue-form ref="form" v-model="rejectModel" :option="rejectOption" @submit="handleDisagree"/>
           </el-tab-pane>
         </el-tabs>
+      </el-card>
 
+      <el-card v-else shadow="hover">
+        <div slot="header">
+          <span>审批信息</span>
+        </div>
+        <avue-form :option="option" v-model="form"/>
 
+        <el-tabs type="border-card" @tab-click="tabsClick">
+          <el-tab-pane label="采纳建议" name="userAgree">
+            <avue-form ref="form" v-model="userAgreeModel" :option="userAgreeOption" @submit="userHandleAgree"/>
+          </el-tab-pane>
+
+          <el-tab-pane label="不采纳建议" name="userPolish">
+            <avue-form ref="form" v-model="userPolishModel" :option="userPolishOption" @submit="userHandlePolish"/>
+          </el-tab-pane>
+
+          <el-tab-pane label="撤销申请" name="userDisagree">
+            <avue-form ref="form" v-model="userRejectModel" :option="userRejectOption" @submit="userHandleDisagree"/>
+          </el-tab-pane>
+        </el-tabs>
       </el-card>
 
       <el-card shadow="hover">
@@ -42,7 +61,7 @@
               <el-card shadow="hover">
                 <p>{{ flow.assigneeName }} 在 [{{ flow.createTime }}] 开始处理 [{{ flow.historyActivityName }}] 环节</p>
                 <p v-if="flow.historyActivityDurationTime!==''">任务历时 [{{ flow.historyActivityDurationTime }}]</p>
-                <p v-if="flow.comment!==''">批复意见: [{{ flow.comment }}]</p>
+                <p v-if="flow.comment!==''">反馈意见: [{{ flow.comment }}]</p>
                 <p v-if="flow.endTime!==''">结束时间: [{{ flow.endTime }}]</p>
               </el-card>
             </el-timeline-item>
@@ -63,9 +82,10 @@
 </template>
 
 <script>
-import {historyFlowList, leaveDetail} from "@/api/work/process";
+import {historyFlowList} from "@/api/work/process";
 import option from "@/const/application/application";
-import {applicationDetail,completeTask} from "@/api/application/application";
+import {applicationDetail, completeTask, userCompleteTask} from "@/api/application/application";
+import {deepClone} from "@/util/util";
 
 export default {
   name: "handle",
@@ -76,17 +96,9 @@
       processInstanceId: '',
       src: '',
       flowList: [],
-      form: {
-        flow: {
-          assigneeName: '',
-        },
-        startTime: '',
-        endTime: '',
-        reason: '',
-        comment: '',
-      },
+      form: {},
       option: option,
-      //批复相关数据
+      //审批人员相关字段
       agreeModel: {},
       agreeOption: {
         emptyBtn: false,
@@ -94,14 +106,14 @@
         gutter: 30,
         column: [
           {
-            label: "批复意见",
+            label: "反馈意见",
             prop: "comment",
             span:24,
             type:'textarea',
             hide: true,
             rules: [{
               required: true,
-              message: "请输入批复意见",
+              message: "请输入反馈意见",
               trigger: "blur"
             }]
           },
@@ -126,14 +138,14 @@
             }]
           },
           {
-            label: "批复意见",
+            label: "反馈意见",
             prop: "comment",
             type:'textarea',
             span:24,
             hide: true,
             rules: [{
               required: true,
-              message: "请输入批复意见",
+              message: "请输入反馈意见",
               trigger: "blur"
             }]
           },
@@ -166,9 +178,89 @@
             prop: "remark",
             type: "textarea",
             span: 24
-          }
+          },
+          {
+            label: "反馈意见",
+            prop: "comment",
+            type:'textarea',
+            span:24,
+            hide: true,
+            rules: [{
+              required: true,
+              message: "请输入反馈意见",
+              trigger: "blur"
+            }]
+          },
         ]
-      }
+      },
+
+      //申请人员相关字段
+      isUserTask:false,
+      userAgreeModel:{
+        comment:'同意',
+      },
+      userAgreeOption:{
+        emptyBtn: false,
+        submitText: "提交",
+        gutter: 30,
+        column: [
+          {
+            label: "反馈意见",
+            prop: "comment",
+            span:24,
+            type:'textarea',
+            hide: true,
+            rules: [{
+              required: true,
+              message: "请输入反馈意见",
+              trigger: "blur"
+            }]
+          },
+        ]
+      },
+      userPolishModel:{},
+      userPolishOption:{
+        emptyBtn: false,
+        submitText: "提交",
+        gutter: 30,
+        column: [
+          {
+            label: "反馈意见",
+            prop: "comment",
+            span:24,
+            type:'textarea',
+            hide: true,
+            rules: [{
+              required: true,
+              message: "请输入反馈意见",
+              trigger: "blur"
+            }]
+          },
+        ]
+      },
+      userRejectModel:{
+        comment:'撤销申请'
+      },
+      userRejectOption:{
+        emptyBtn: false,
+        submitText: "提交",
+        gutter: 30,
+        column: [
+          {
+            label: "反馈意见",
+            prop: "comment",
+            type:'textarea',
+            span:24,
+            hide: true,
+            rules: [{
+              required: true,
+              message: "请输入反馈意见",
+              trigger: "blur"
+            }]
+          },
+        ]
+      },
+      cloneForm:{},
     }
   },
   created() {
@@ -194,25 +286,30 @@
       this.businessId = this.$route.params.businessId;
 
       this.controlOption('open')
-
       historyFlowList(this.processInstanceId).then(res => {
         const data = res.data;
         if (data.success) {
           this.flowList = data.data;
+          if (this.flowList[this.flowList.length-1].historyActivityId == 'userTask'){
+            this.controlOption('userTask')
+            this.isUserTask = true
+          }
         }
       })
       applicationDetail(this.businessId).then(res => {
         const data = res.data;
         if (data.success) {
           this.form = data.data;
+          this.cloneForm = deepClone(this.form)
           this.initForm()
         }
       })
     },
+    //==============审批人员审核方法=======================
     //同意
     handleAgree() {
       if (!this.agreeModel.comment) {
-        this.$message.warning('请先填写批复意见');
+        this.$message.warning('请先填写反馈意见');
         return;
       }
       const params = {
@@ -220,6 +317,7 @@
         processInstanceId: this.processInstanceId,
         flag: 'ok',
         comment: this.agreeModel.comment,
+        isSuggestion:false,
       };
       completeTask(params).then(res => {
         const data = res.data;
@@ -234,14 +332,15 @@
     },
     //驳回
     handleDisagree() {
-      if (!this.form.comment) {
-        this.$message.warning('请先填写批复意见');
+      if (!this.rejectModel.comment) {
+        this.$message.warning('请先填写反馈意见');
         return;
       }
       const params = {
         taskId: this.taskId,
         processInstanceId: this.processInstanceId,
-        comment: this.form.comment,
+        comment: this.rejectModel.comment,
+        isSuggestion:false
       };
       completeTask(params).then(res => {
         const data = res.data;
@@ -256,7 +355,95 @@
     },
     //完善
     handlePolish() {
+      if (!this.polishModel.comment) {
+        this.$message.warning('请先填写反馈意见');
+        return;
+      }
+      const params = {
+        taskId: this.taskId,
+        processInstanceId: this.processInstanceId,
+        comment: this.polishModel.comment,
+        suggestion:this.polishModel.suggestion,
+        isSuggestion:true,
+      };
+      completeTask(params).then(res => {
+        const data = res.data;
+        if (data.success) {
+          this.$message.success(data.msg);
+          this.$router.$avueRouter.closeTag();
+          this.$router.push({path: `/work/start`});
+        } else {
+          this.$message.error(data.msg || '提交失败');
+        }
+      })
     },
+
+    //===============申请人员审核方法================
+    //采纳意见
+    userHandleAgree(){
+      const params = {
+        ...this.form,
+        taskId: this.taskId,
+        processInstanceId: this.processInstanceId,
+        flag: 'ok',
+        comment: this.userAgreeModel.comment,
+        isSuggestion:true,
+      };
+      userCompleteTask(params).then(res => {
+        const data = res.data;
+        if (data.success) {
+          this.$message.success(data.msg);
+          this.$router.$avueRouter.closeTag();
+          this.$router.push({path: `/work/start`});
+        } else {
+          this.$message.error(data.msg || '提交失败');
+        }
+      })
+    },
+    //撤销申请
+    userHandleDisagree(){
+      if (!this.rejectModel.comment) {
+        this.$message.warning('请先填写反馈意见');
+        return;
+      }
+      const params = {
+        taskId: this.taskId,
+        processInstanceId: this.processInstanceId,
+        comment: this.userRejectModel.comment,
+      };
+      userCompleteTask(params).then(res => {
+        const data = res.data;
+        if (data.success) {
+          this.$message.success(data.msg);
+          this.$router.$avueRouter.closeTag();
+          this.$router.push({path: `/work/start`});
+        } else {
+          this.$message.error(data.msg || '提交失败');
+        }
+      })
+    },
+    //不采纳意见
+    userHandlePolish(){
+      const params = {
+        taskId: this.taskId,
+        processInstanceId: this.processInstanceId,
+        flag: 'ok',
+        isSuggestion:false,
+        comment: this.polishModel.comment,
+      };
+      userCompleteTask(params).then(res => {
+        const data = res.data;
+        if (data.success) {
+          this.$message.success(data.msg);
+          this.$router.$avueRouter.closeTag();
+          this.$router.push({path: `/work/start`});
+        } else {
+          this.$message.error(data.msg || '提交失败');
+        }
+      })
+    },
+
+
     handleCancel() {
       this.$router.$avueRouter.closeTag();
       this.$router.push({path: `/work/start`});
@@ -319,8 +506,29 @@
         this.option.submitBtn = true
         this.option.emptyBtn = true
 
-      }
+      }else if (arg == 'userTask'){
+        //解除禁用状态
+        this.option.group.forEach(group => {
+          group.column.forEach(item => {
+            item.disabled = false
+          })
+        })
 
+      }else if (arg == 'noPolish'){
+        //设置group内全为禁用状态
+        this.option.group.forEach(group => {
+          group.column.forEach(item => {
+            item.disabled = true
+          })
+        })
+      }
+    },
+    tabsClick(tab){
+      if (tab.name == 'userAgree'){
+        this.controlOption('userTask')
+      }else {
+        this.controlOption('noPolish')
+      }
     }
   }
 }

--
Gitblit v1.9.3