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

---
 src/const/application/application.js    |   42 ++++-
 src/views/evaluation/evaluation.vue     |    1 
 src/views/work/process/audit/form.vue   |    4 
 src/api/application/application.js      |   15 ++
 package.json                            |    1 
 src/const/pass/pass.js                  |    7 +
 src/views/pass/pass.vue                 |   40 +++++
 src/views/work/process/audit/handle.vue |  260 +++++++++++++++++++++++++++++++++---
 src/views/work/process/audit/detail.vue |    6 
 src/const/evaluation/evaluation.js      |   23 ++
 10 files changed, 351 insertions(+), 48 deletions(-)

diff --git a/package.json b/package.json
index 7a9dddb..bba997c 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
     "node-gyp": "^5.0.6",
     "nprogress": "^0.2.0",
     "portfinder": "^1.0.23",
+    "qrcodejs2": "0.0.2",
     "script-loader": "^0.7.2",
     "vue": "^2.6.10",
     "vue-axios": "^2.1.2",
diff --git a/src/api/application/application.js b/src/api/application/application.js
index 5c9f160..115ee8a 100644
--- a/src/api/application/application.js
+++ b/src/api/application/application.js
@@ -88,7 +88,7 @@
 }
 
 /**
- * 完成任务
+ * 审批人员完成任务
  * @param data
  * @returns {AxiosPromise}
  */
@@ -99,3 +99,16 @@
     data
   })
 }
+
+/**
+ * 申请人员完成任务
+ * @param data
+ * @returns {AxiosPromise}
+ */
+export const userCompleteTask = (data) => {
+  return request({
+    url: '/api/application/application/user-complete-task',
+    method: 'post',
+    data
+  })
+}
diff --git a/src/const/application/application.js b/src/const/application/application.js
index b8111b9..4af12ec 100644
--- a/src/const/application/application.js
+++ b/src/const/application/application.js
@@ -33,6 +33,7 @@
           prop: "name",
           type: "input",
           labelWidth:labelWidth,
+          disabled:false,
           rules: [{required: true, message: "请输入经办人姓名", trigger: ['blur','change']}]
         },
         {
@@ -40,6 +41,7 @@
           prop: "idCard",
           type: "input",
           labelWidth:labelWidth,
+          disabled:false,
           rules: [{required: true, trigger: ['blur','change'],validator:idCardValidate}]
         },
         {
@@ -49,6 +51,7 @@
           span:12,
           row:true,
           labelWidth:labelWidth,
+          disabled:false,
           rules: [{required: true, trigger: ['blur','change'],validator:mobileValidate}]
         },
         {
@@ -57,7 +60,8 @@
           type: "date",
           format:'yyyy-MM-dd',
           valueFormat:'yyyy-MM-dd',
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "通行结束时间",
@@ -65,31 +69,36 @@
           type: "date",
           format:'yyyy-MM-dd',
           valueFormat:'yyyy-MM-dd',
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "起运机构",
           prop: "transportDept",
           type: "input",
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "途径省份",
           prop: "passProvince",
           type: "input",
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "出发地",
           prop: "departure",
           type: "input",
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "目的地",
           prop: "destination",
           type: "input",
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "通行路线",
@@ -97,7 +106,8 @@
           type: "textarea",
           row:true,
           minRows:2,
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
         {
           label: "通行桥涵",
@@ -105,7 +115,8 @@
           type: "textarea",
           row:true,
           minRows:2,
-          labelWidth:labelWidth
+          labelWidth:labelWidth,
+          disabled:false,
         },
       ]
     },
@@ -121,6 +132,7 @@
           type: 'upload',
           loadText: '附件上传中,请稍等',
           span: 24,
+          disabled:false,
           propsHttp:propsHttp,
           action: uploadUrl
         },
@@ -130,6 +142,7 @@
           type: 'upload',
           loadText: '附件上传中,请稍等',
           span: 24,
+          disabled:false,
           propsHttp:propsHttp,
           action: uploadUrl
         },
@@ -145,12 +158,14 @@
           label: "货物信息",
           prop: "goodsName",
           labelWidth:labelWidth,
+          disabled:false,
           type: "input",
         },
         {
           label: "货物分类",
           prop: "goodsCategory",
           labelWidth:labelWidth,
+          disabled:false,
           type: "select",
           dicUrl: "/api/blade-system/dict-biz/dictionary?code=goods_category",
           props:{
@@ -162,6 +177,7 @@
           label: "货物类别",
           prop: "goodsType",
           labelWidth:labelWidth,
+          disabled:false,
           type: "select",
           dicUrl: "/api/blade-system/dict-biz/dictionary?code=goods_type",
           props:{
@@ -173,12 +189,14 @@
           label: "轴荷分布",
           prop: "axialLoad",
           labelWidth:labelWidth,
+          disabled:false,
           type: "input",
           append:'轴',
         },
         {
           label: "货物重量",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "weight",
           type: "input",
           append:'吨',
@@ -186,6 +204,7 @@
         {
           label: "车货总重量",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "allWeight",
           type: "input",
           append:'吨',
@@ -193,6 +212,7 @@
         {
           label: "货物最大长度",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "length",
           type: "input",
           append:'米',
@@ -200,6 +220,7 @@
         {
           label: "货物最大宽度",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "width",
           type: "input",
           append:'米',
@@ -207,6 +228,7 @@
         {
           label: "货物最大高度",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "height",
           type: "input",
           append:'米',
@@ -216,6 +238,7 @@
         {
           label: "车货最大长度",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "allLength",
           type: "input",
           append:'米',
@@ -223,6 +246,7 @@
         {
           label: "车货最大宽度",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "allWidth",
           type: "input",
           append:'米',
@@ -230,6 +254,7 @@
         {
           label: "车货最大高度",
           labelWidth:labelWidth,
+          disabled:false,
           prop: "allHeight",
           type: "input",
           append:'米',
@@ -241,6 +266,7 @@
           labelWidth:'10%',
           span: 24,
           minRows:2,
+          disabled:false,
         },
       ]
     },
diff --git a/src/const/evaluation/evaluation.js b/src/const/evaluation/evaluation.js
index 1b19c40..2fa867c 100644
--- a/src/const/evaluation/evaluation.js
+++ b/src/const/evaluation/evaluation.js
@@ -20,24 +20,35 @@
       hide: true,
     },
     {
-      label: "申请表主键",
-      prop: "applicationId",
+      label: "申请单号",
+      prop: "no",
       type: "input",
+      addDisplay: false,
+      editDisplay: false,
     },
     {
       label: "评分",
       prop: "score",
-      type: "input",
+      type: "rate",
+      colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
     },
     {
       label: "评价",
-      prop: "evaluation",
-      type: "input",
+      prop: "comment",
+      span:24,
+      type: "select",
+      multiple:true,
+      dicUrl: "/api/blade-system/dict-biz/dictionary?code=evaluation_comment",
+      props:{
+        label:"dictValue",
+        value:"dictKey"
+      },
     },
     {
       label: "建议与反馈",
       prop: "feedback",
-      type: "input",
+      span:24,
+      type: "textarea",
     },
     {
       label: "租户id",
diff --git a/src/const/pass/pass.js b/src/const/pass/pass.js
index 56731f2..f976930 100644
--- a/src/const/pass/pass.js
+++ b/src/const/pass/pass.js
@@ -27,6 +27,13 @@
       type: "input",
     },
     {
+      label: "编号",
+      prop: "no",
+      type: "input",
+      addDisplay: false,
+      editDisplay: false,
+    },
+    {
       label: "租户id",
       prop: "tenantId",
       type: "input",
diff --git a/src/views/evaluation/evaluation.vue b/src/views/evaluation/evaluation.vue
index 55916f6..1879619 100644
--- a/src/views/evaluation/evaluation.vue
+++ b/src/views/evaluation/evaluation.vue
@@ -27,6 +27,7 @@
                    @click="handleDelete">删 除
         </el-button>
       </template>
+
     </avue-crud>
   </basic-container>
 </template>
diff --git a/src/views/pass/pass.vue b/src/views/pass/pass.vue
index b4cd969..70e5526 100644
--- a/src/views/pass/pass.vue
+++ b/src/views/pass/pass.vue
@@ -28,12 +28,26 @@
         </el-button>
       </template>
       <template slot-scope="{type,size,row,index}" slot="menu">
-        <el-button icon="el-icon-view" :size="size" :type="type">预 览</el-button>
+        <el-button icon="el-icon-view" :size="size" :type="type" @click="viewQr(row)">预 览</el-button>
         <el-button icon="el-icon-edit" :size="size" :type="type">导 出</el-button>
         <el-button icon="el-icon-delete" :size="size" :type="type" >打 印</el-button>
         <el-button icon="el-icon-delete" :size="size" :type="type">废 止</el-button>
       </template>
     </avue-crud>
+
+    <el-dialog
+      title="通行证预览"
+      :visible.sync="dialogVisible"
+      :append-to-body="true"
+      width="30%">
+      <div id="qrCode" ref="qrCodeDiv"></div>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
+      </span>
+    </el-dialog>
+
+
+
   </basic-container>
 </template>
 
@@ -41,6 +55,7 @@
   import {getList, getDetail, add, update, remove} from "@/api/pass/pass";
   import option from "@/const/pass/pass";
   import {mapGetters} from "vuex";
+  import QRCode from 'qrcodejs2';
 
   export default {
     data() {
@@ -55,7 +70,9 @@
         },
         selectionList: [],
         option: option,
-        data: []
+        data: [],
+        dialogVisible:false,
+        qrCode:"",
       };
     },
     computed: {
@@ -185,6 +202,25 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+      viewQr(row){
+        console.log(row)
+        this.dialogVisible = true
+        this.$nextTick(()=>{
+          if(this.qrcode) {  // 有新的二维码地址了,先把之前的清除掉
+            this.$refs.qrCodeDiv.innerHTML = ''
+          }
+          this.qrcode = new QRCode(this.$refs.qrCodeDiv, {
+            text: 'https://www.baidu.com/',
+            width: 200,
+            height: 200,
+            colorDark: "#333333", //二维码颜色
+            colorLight: "#ffffff", //二维码背景色
+            correctLevel: QRCode.CorrectLevel.L//容错率,L/M/H
+          })
+        })
+
+
       }
     }
   };
diff --git a/src/views/work/process/audit/detail.vue b/src/views/work/process/audit/detail.vue
index e86b8fc..99197aa 100644
--- a/src/views/work/process/audit/detail.vue
+++ b/src/views/work/process/audit/detail.vue
@@ -24,7 +24,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>
@@ -129,8 +129,8 @@
       this.form.goodsEntity.id = goodsId
     },
     controlOption(arg){
-      const suggestion = this.findObject(this.option.column,"suggestion")
-      const comment = this.findObject(this.option.column,"comment")
+      // const suggestion = this.findObject(this.option.column,"suggestion")
+      // const comment = this.findObject(this.option.column,"comment")
       if (arg == 'open'){
         this.option.detail = true
         if (!this.form.suggestion){
diff --git a/src/views/work/process/audit/form.vue b/src/views/work/process/audit/form.vue
index 726eb72..032e807 100644
--- a/src/views/work/process/audit/form.vue
+++ b/src/views/work/process/audit/form.vue
@@ -51,8 +51,8 @@
       });
     },
     controlOption(arg) {
-      const suggestion = this.findObject(this.option.column,"suggestion")
-      const comment = this.findObject(this.option.column,"comment")
+      // const suggestion = this.findObject(this.option.column,"suggestion")
+      // const comment = this.findObject(this.option.column,"comment")
       if (arg == 'open'){
         //解除禁用状态
         this.option.group.forEach(group=>{
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