Jelajahi Sumber

性能验证快速评价流程v0.3

zhonghuizhen 6 bulan lalu
induk
melakukan
35de6bd112

+ 72 - 43
src/views/business/performance/experimental.vue

@@ -188,7 +188,7 @@ import {
   importTemplate,
 } from '@/api/business/pv'
 import { startFlow,saveDraft } from '@/api/platform/bpmn/bpmInst'
-import { agree, reject } from '@/api/platform/bpmn/bpmTask'
+import { agree, reject,doEndProcess } from '@/api/platform/bpmn/bpmTask'
 import html2Canvas from 'html2canvas'
 import JsPDF from 'jspdf'
 import FlowDiagramDialog from '@/business/platform/bpmn/components/flow-diagram/dialog'
@@ -314,6 +314,13 @@ export default {
           type: 'primary',
           hidden: this.showToolBarsBtn('sendBack')
         },
+        {
+          key: 'doEndProcess',
+          icon: 'ibps-icon-picture',
+          label: '终止',
+          type: 'primary',
+          hidden: this.showToolBarsBtn('doEndProcess')
+        },
         {
           key: 'cancel',
           icon: 'el-icon-close',
@@ -448,17 +455,21 @@ export default {
           this.handleAgree(this.params.taskId,this.form);
           /*
           if (this.getSubmitLabel() === '同意') {
-            this.handleAgree({ taskId: this.params.taskId, data: this.form });
+            this.handleAgree(this.params.taskId, this.form )
           } else {
-           // this.handleStartFlow(this.form);
-          }*/
-          break;
+            this.handleStartFlow(this.form);
+          }
+          break;*/
         case 'approvalHistory':
           this.handleapprovalHistory(this.params.taskId, this.form);
           break;
         case 'sendBack':
           this.handleReject(this.params.taskId, this.form);
           break;
+        case 'doEndProcess':
+          //this.handleSave(this.form);
+          this.handleDoEndProcess(this.params.taskId, this.form)
+          break;
         case 'generate':
           this.handleGenerate();
           break;
@@ -485,43 +496,46 @@ export default {
       }).catch(() => {
         this.$message.error('保存失败');
       });
-    },
+    },*/
     validateFormData() {
-      return new Promise((resolve, reject) => {
-        this.$refs.form.validate((valid) => {
-          if (!valid) {
-            this.$message.warning('请完善表单必填项后再进行操作!');
-            reject('Validation failed');
-          } else {
-            const { shiYanXiangMu } = this.form;
-            const regex = /[\/\\]/g;
-            if (regex.test(shiYanXiangMu)) {
-              this.form.shiYanXiangMu = shiYanXiangMu.replace(regex, '_');
-              this.$message.warning('【实验项目】中的【\\】与【/】已被转化为【_】');
+        return new Promise((resolve, reject) => {
+          this.$refs.form.validate((valid) => {
+            if (!valid) {
+              this.$message.warning('请完善表单必填项后再进行操作!');
+              reject('Validation failed');
+            } else {
+              const { shiYanXiangMu } = this.form;
+              const regex = /[\/\\]/g;
+              if (regex.test(shiYanXiangMu)) {
+                this.form.shiYanXiangMu = shiYanXiangMu.replace(regex, '_');
+                this.$message.warning('【实验项目】中的【\\】与【/】已被转化为【_】');
+              }
+              resolve();
             }
-            resolve();
-          }
+          });
         });
-      });
-    },*/
-    /*
+      },
+      /*
     handleStartFlow(data) {
-      this.validateFormData()
-        .then(() => {
-          return startFlow({
-            defId: '1430598730687447040',
-            version: '0',
-            data: JSON.stringify(data)
+        this.validateFormData()
+          .then(async () => {
+            const instid = await this.fetchInstanceId(data.id);
+            return startFlow({
+              defId: '1430598730687447040',
+              version: '0',
+              data: JSON.stringify(data),
+              proInstId: instid || ''
+            });
+          })
+          .then((res) => {
+            this.$message.success('提交成功');
+            this.visible = false;
+            const id = res.variables.bizKey || '';
+            return this.saveExperimentalData(id,'已编制')
+          })
+          .catch((error) => {
+              this.$message.error('启动失败');
           });
-        })
-        .then(() => {
-          this.$message.success('提交成功');
-          this.visible = false;
-          return this.saveExperimentalData()
-        })
-        .catch((error) => {
-            this.$message.error('启动失败');
-        });
     },*/
     handleAgree(taskId,data) {
       if(data.shiFouGuoShen === '已编制'){
@@ -562,6 +576,21 @@ export default {
     handleSave(key, callback) {
       this.submitForm(key, callback)
     },*/
+    handleDoEndProcess(taskId,data){
+      data.shiFouGuoShen = '已终止'
+      doEndProcess({
+        taskId: taskId,
+        endReason: '流程终止'
+      })
+        .then((response) => {
+          this.$message.success('终止成功');
+          this.saveExperimentalData(data.id,data.shiFouGuoShen)
+          this.closeDialog()
+        })
+        .catch((err) => {
+          this.$message.error('终止失败');
+        })
+    },
     handleSubmit(key, showMsg, callback) {
       this.$refs.form.validate((valid) => {
         if (!valid) {
@@ -857,19 +886,19 @@ export default {
     // 控制工具栏按钮显示
     showToolBarsBtn(key) {
       const status = (this.form && this.form.shiFouGuoShen) || '已暂存'
-      // 已暂存状态显示流程图,导出pdf,关闭,保存,提交按钮
+      // 已暂存状态显示流程图,导出pdf,关闭,保存,提交,终止按钮
       if (status === '已暂存' || status === '已退回') {
-        return !['flowChart', 'approvalHistory','pdf', 'cancel', 'save', 'submit'].includes(key)
+        return !['flowChart', 'approvalHistory','pdf', 'cancel', 'save','doEndProcess', 'submit'].includes(key)
       }
       
-      // 已编制状态显示流程图,导出pdf,关闭,保存,退回,提交按钮
+      // 已编制状态显示流程图,导出pdf,关闭,保存,退回,提交,终止按钮
       if (status === '已编制') {
-        return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
+        return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'sendBack','doEndProcess', 'submit'].includes(key)
       }
       
-      // 已审核状态显示流程图,导出pdf,关闭,保存,退回,提交按钮
+      // 已审核状态显示流程图,导出pdf,关闭,保存,退回,提交,终止按钮
       if (status === '已审核') {
-        return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
+        return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'sendBack','doEndProcess', 'submit'].includes(key)
       }
       
       // 已完成,已终止状态和查阅时显示一致

+ 1 - 1
src/views/business/performance/record.vue

@@ -101,7 +101,7 @@ export default {
             slotName: 'time',
             width: 140
           },
-          { prop: 'dataStatus', label: '状态', width: 80 },
+          { prop: 'shiFouGuoShen', label: '状态', width: 80 },
           {
             prop: 'bianZhiRen',
             label: '实验人',