Răsfoiți Sursa

性能快速评价流程v0.2

zhonghuizhen 6 luni în urmă
părinte
comite
9209bffd3c

+ 89 - 50
src/views/business/performance/experimental.vue

@@ -17,6 +17,7 @@
       :label-width="formLabelWidth"
       :model.sync="form"
       :rules="rules"
+      :readonly="readonly"
       class="config-form"
       :class="readonly ? 'readonly-form' : ''"
       @submit.native.prevent
@@ -87,7 +88,7 @@
       :modal="false"
       :visible.sync="dialogFormVisible"
     >
-      <el-form id="pdfDom">
+      <el-form id="pdfDom" :disabled="true">
         <div
           style="
             text-align: center;
@@ -160,12 +161,19 @@
     
     <flow-diagram-dialog
       :visible="flowDiagramVisible"
-      :def-id="params &&  (params.instanceId  || params.taskId)? '': '1430598730687447040'"
+      :def-id="'1430598730687447040'"
       :task-id="params && params.taskId ? params.taskId : ''"
-      :inst-id="params && params.instanceId ? params.instanceId : ''"
+      :inst-id="params && params.attrs ? params.attrs.id : ''"
       @close="(visible) => (flowDiagramVisible = visible)"
     />
+    <approval-history-dialog
+      :visible="approvalHistoryVisible"
+      :inst-id="instid"
+      @close="(visible) => (approvalHistoryVisible = visible)"
+    />
+
   </el-dialog>
+  
 </template>
 
 <script>
@@ -184,6 +192,7 @@ import { agree, reject } from '@/api/platform/bpmn/bpmTask'
 import html2Canvas from 'html2canvas'
 import JsPDF from 'jspdf'
 import FlowDiagramDialog from '@/business/platform/bpmn/components/flow-diagram/dialog'
+import ApprovalHistoryDialog from '@/business/platform/bpmn/components/approval-history/dialog'
 export default {
   components: {
     ExperimentalDesc: () => import('./components/experimental-desc'),
@@ -193,17 +202,19 @@ export default {
     ExperimentalData: () => import('./components/experimental-data'),
     Conclusion: () => import('./components/conclusion'),
     Precision: () => import('./report/precision'),
-    FlowDiagramDialog
+    FlowDiagramDialog,
+    ApprovalHistoryDialog
   },
   props: {
     visible: {
       type: Boolean,
       default: false
     },
+    /*
     readonly: {
       type: Boolean,
       default: true
-    },
+    },*/
     params: {
       type: Object,
       default: () => {}
@@ -215,8 +226,11 @@ export default {
       dialogVisible: true, // Set to true to always display the component
       dialogFormVisible: false,
       flowDiagramVisible: false,
+      approvalHistoryVisible: false,
       pdf: 'pdf',
       formLabelWidth: '110px',
+      readonly: true,
+      instid:'',
       configData: { methodName: '' },
       formId: this.params.attrs.id,
       form: {
@@ -246,14 +260,32 @@ export default {
       rules: formRules,
       loading: false,
       loadCompleted: false,
-      toolbars: [
-      {
+      validateList: [
+        'specimensName',
+        'targetValue',
+        'allowableSDr',
+        'allowableSDl',
+        'claimValue'
+      ]
+    }
+  },
+  computed: {
+    toolbars() {
+      return [
+        {
           key: 'flowChart',
           icon: 'ibps-icon-picture',
           label: '流程图',
           type: 'primary',
           hidden: this.showToolBarsBtn('flowChart')
         },
+        {
+          key: 'approvalHistory',
+          icon: 'ibps-icon-picture',
+          label: '审批历史',
+          type: 'primary',
+          hidden: this.showToolBarsBtn('approvalHistory')
+        },
         {
           key: 'pdf',
           icon: 'ibps-icon-cube',
@@ -261,7 +293,6 @@ export default {
           type: 'primary',
           hidden: this.showToolBarsBtn('pdf')
         },
-        // { key: 'test', icon: 'ibps-icon-gg', label: '测试', type: 'warning', hidden: this.readonly },
         {
           key: 'save',
           icon: 'ibps-icon-save',
@@ -272,7 +303,7 @@ export default {
         {
           key: 'submit',
           icon: 'el-icon-s-promotion',
-          label: '同意',
+          label: this.getSubmitLabel(),
           type: 'primary',
           hidden: this.showToolBarsBtn('submit')
         },
@@ -283,8 +314,6 @@ export default {
           type: 'primary',
           hidden: this.showToolBarsBtn('sendBack')
         },
-        // { key: 'submit', icon: 'ibps-icon-send', label: '提交', type: 'primary', hidden: this.readonly },
-        // { key: 'generate', icon: 'ibps-icon-cube', label: '生成报告', type: 'success', hidden: this.readonly },
         {
           key: 'cancel',
           icon: 'el-icon-close',
@@ -292,13 +321,6 @@ export default {
           type: 'danger',
           hidden: this.showToolBarsBtn('cancel')
         }
-      ],
-      validateList: [
-        'specimensName',
-        'targetValue',
-        'allowableSDr',
-        'allowableSDl',
-        'claimValue'
       ]
     }
   },
@@ -312,14 +334,6 @@ export default {
     }*/
   },
   created() {
-    // 如果从myRecord传来了shiFouGuoShen,则使用它
-    if (this.params && this.params.shiFouGuoShen) {
-      // 确保form对象存在
-      if (!this.form) {
-        this.form = {}
-      }
-      this.form.shiFouGuoShen = this.params.shiFouGuoShen
-    }
    // this.getConfigData(this.params)
     if (!this.params.attrs.id) {
       this.loadCompleted = true
@@ -370,7 +384,7 @@ export default {
     loadData() {
       this.loading = true
       getExperimental({ id: this.params.attrs.id })
-        .then((res) => {
+        .then(async (res) => {
           this.loading = false
           const data = res.data
           if (!data) {
@@ -387,6 +401,7 @@ export default {
             : {}
           this.form = Object.assign(this.form, data)
           this.getConfigData(this.form)
+          this.instid = await this.fetchInstanceId(data.id);
           this.loadCompleted = true
           console.log(data.jiSuanJieGuo)
         })
@@ -394,6 +409,13 @@ export default {
           this.loading = false
         })
     },
+    async fetchInstanceId(dataId) { //获取当前单据对应流程
+        const instres = await this.$common.request('query', {
+          key: 'xnyzkspjcxdylc',
+          params: [dataId]
+        });
+        return instres.variables.data[0]?.id_ || '';
+    },
     getConfigData({ zhiBiaoId,fangFaId  }) {
       getConfigDetail({ id: zhiBiaoId }).then((res) => {
         const {
@@ -423,7 +445,7 @@ export default {
           this.saveExperimentalData(this.form.id,this.form.shiFouGuoShen)
           break;
         case 'submit':
-          this.handleAgree({ taskId: this.params.taskId, data: this.form });
+          this.handleAgree(this.params.taskId,this.form);
           /*
           if (this.getSubmitLabel() === '同意') {
             this.handleAgree({ taskId: this.params.taskId, data: this.form });
@@ -431,8 +453,11 @@ export default {
            // this.handleStartFlow(this.form);
           }*/
           break;
+        case 'approvalHistory':
+          this.handleapprovalHistory(this.params.taskId, this.form);
+          break;
         case 'sendBack':
-          this.handleReject({ taskId: this.params.taskId, data: this.form });
+          this.handleReject(this.params.taskId, this.form);
           break;
         case 'generate':
           this.handleGenerate();
@@ -498,18 +523,39 @@ export default {
             this.$message.error('启动失败');
         });
     },*/
-    handleAgree(data) {
-      agree(data).then(() => {
+    handleAgree(taskId,data) {
+      if(data.shiFouGuoShen === '已编制'){
+          data.shiFouGuoShen === '已审核'
+      }else if(data.shiFouGuoShen === '已审核'){
+        data.shiFouGuoShen === '已完成'
+      }
+      agree({ 
+        opinion: '同意',
+        taskId: taskId,
+        data: JSON.stringify(data)
+      }).then(() => {
         this.$message.success('操作成功');
+        this.saveExperimentalData(data.id,data.shiFouGuoShen)
+        this.closeDialog()
       }).catch(() => {
         this.$message.error('操作失败');
       });
     },
-    handleReject(data) {
-      reject(data).then(() => {
-        this.$message.success('退回成功');
+    handleReject(taskId,data) {
+      data.shiFouGuoShen = '已退回'
+      reject({
+              backHandMode: 'normal',
+              destination: '',
+              opinion: '退回修改',
+              rejectMode: 'reject',
+              taskId: taskId,
+              data: JSON.stringify(data)
+            }).then(() => {
+              this.$message.success('退回成功');
+              this.saveExperimentalData(data.id,data.shiFouGuoShen)
+              this.closeDialog()
       }).catch(() => {
-        this.$message.error('退回失败');
+              this.$message.error('退回失败');
       });
     },
     /*
@@ -545,6 +591,9 @@ export default {
     handleGenerate() {
       this.$message.info('waiting...')
     },
+    handleapprovalHistory() {
+      this.approvalHistoryVisible = true
+    },
     judgeArrayData(data) {
       if (!data || !data.length) {
         return true
@@ -670,8 +719,6 @@ export default {
     closeDialog() {
       this.dialogVisible = false
       this.$emit('close', false)
-      //this.$emit('update:visible', false)
-      //this.$emit('refresh')
     },
     handleUpdateParams(value) {
       this.form.shiYanCanShu = value
@@ -809,37 +856,29 @@ export default {
     },
     // 控制工具栏按钮显示
     showToolBarsBtn(key) {
-      // 在查阅状态时,只显示流程图、导出PDF和关闭按钮
-      if (this.readonly) {
-        // 允许显示的按钮:flowChart(流程图)、pdf(导出PDF)、cancel(关闭)
-        return !['flowChart', 'pdf', 'cancel'].includes(key)
-      }
-      
-      // 非查阅状态,根据shiFouGuoShen状态字段控制按钮显示
       const status = (this.form && this.form.shiFouGuoShen) || '已暂存'
-      
       // 已暂存状态显示流程图,导出pdf,关闭,保存,提交按钮
       if (status === '已暂存' || status === '已退回') {
-        return !['flowChart', 'pdf', 'cancel', 'save', 'submit'].includes(key)
+        return !['flowChart', 'approvalHistory','pdf', 'cancel', 'save', 'submit'].includes(key)
       }
       
       // 已编制状态显示流程图,导出pdf,关闭,保存,退回,提交按钮
       if (status === '已编制') {
-        return !['flowChart', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
+        return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
       }
       
       // 已审核状态显示流程图,导出pdf,关闭,保存,退回,提交按钮
       if (status === '已审核') {
-        return !['flowChart', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
+        return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'sendBack', 'submit'].includes(key)
       }
       
       // 已完成,已终止状态和查阅时显示一致
       if (status === '已完成' || status === '已终止') {
-        return !['flowChart', 'pdf', 'cancel'].includes(key)
+        return !['flowChart','approvalHistory', 'pdf', 'cancel'].includes(key)
       }
       
       // 默认显示流程图,导出pdf,关闭,保存,提交按钮
-      return !['flowChart', 'pdf', 'cancel', 'save', 'submit'].includes(key)
+      return !['flowChart','approvalHistory', 'pdf', 'cancel', 'save', 'submit'].includes(key)
     },
     // 获取提交按钮的标签
     getSubmitLabel() {

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

@@ -274,7 +274,7 @@
           {
             key: 'submit',
             icon: 'el-icon-s-promotion',
-            label: this.getSubmitLabel,
+            label: '提交',
             type: 'primary',
             hidden: this.showToolBarsBtn('submit')
           },