From f4bdceb42aef38f1cd9431ae5addd37bec4cf60b Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 28 十一月 2024 06:07:21 +0800
Subject: [PATCH] 新的流程页面对接自带的流程页面,查询表单使用同一个接口,其接口内部做判定、流程推进详情页面

---
 src/views/flowable/task/myProcess/send/index.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/src/views/flowable/task/myProcess/send/index.vue b/src/views/flowable/task/myProcess/send/index.vue
index 46eb4be..3f23f26 100644
--- a/src/views/flowable/task/myProcess/send/index.vue
+++ b/src/views/flowable/task/myProcess/send/index.vue
@@ -2,7 +2,7 @@
   <div class="app-container">
     <el-card class="box-card" >
       <div slot="header" class="clearfix">
-        <span class="el-icon-document">鍙戣捣浠诲姟</span>
+        <span class="el-icon-document">{{`娴佺▼澶勭悊锛歚 + processName}}</span>
         <el-button style="float: right;" size="mini" type="danger" @click="goBack">鍏抽棴</el-button>
       </div>
       <el-tabs  tab-position="top" v-model="activeName"  @tab-click="handleClick">
@@ -38,7 +38,8 @@
 <script>
 import {definitionStart, flowXmlAndNode} from "@/api/flowable/definition";
 import BpmnViewer from '@/components/Process/viewer';
-import {flowFormData} from "@/api/flowable/process";
+import {completeSubmitFormTask} from "@/api/flowable/process";
+import { flowTaskForm } from "@/api/flowable/todo";
 import {getNextFlowNodeByStart} from "@/api/flowable/todo";
 import FlowUser from '@/components/flow/User'
 import FlowRole from '@/components/flow/Role'
@@ -53,6 +54,8 @@
   props: {},
   data() {
     return {
+      taskId: '',
+      processName: '',
       // 妯″瀷xml鏁版嵁
       flowData: {},
       activeName: '1', // 鍒囨崲tab鏍囩
@@ -78,11 +81,13 @@
     };
   },
   created() {
+    this.processName = this.$route.query && this.$route.query.processName;
     this.deployId = this.$route.query && this.$route.query.deployId;
+    this.taskId = this.$route.query && this.$route.query.taskId;
     // 鍒濆鍖栬〃鍗�
     this.procDefId  = this.$route.query && this.$route.query.procDefId;
     // this.getNextFlowNodeByStart(this.deployId);
-    this.getFlowFormData(this.deployId);
+    this.getFlowFormData(this.taskId);
   },
   methods: {
     handleClick(tab, event) {
@@ -93,15 +98,28 @@
       }
     },
     /** 娴佺▼琛ㄥ崟鏁版嵁 */
-    getFlowFormData(deployId) {
-      const params = {deployId: deployId}
-      flowFormData(params).then(res => {
-        // 娴佺▼杩囩▼涓笉瀛樺湪鍒濆鍖栬〃鍗� 鐩存帴璇诲彇鐨勬祦绋嬪彉閲忎腑瀛樺偍鐨勮〃鍗曞��
-        this.$nextTick(() => {
-          // 鍥炴樉鏁版嵁
-          this.$refs.vFormRef.setFormJson(res.data);
-          this.formJson = res.data;
-        })
+    getFlowFormData(taskId) {
+      const params = {taskId: taskId}
+      flowTaskForm(params).then(res => {
+        if (res.data.formJson) {
+          // 鍥炴樉琛ㄥ崟
+          this.$refs.vFormRef.setFormJson(res.data.formJson);
+          this.formJson = res.data.formJson;
+          this.$nextTick(() => {
+            // 鍔犺浇琛ㄥ崟濉啓鐨勬暟鎹�
+            this.$refs.vFormRef.setFormData(res.data);
+            // this.$nextTick(() => {
+            //   // 琛ㄥ崟绂佺敤
+            //   this.$refs.vFormRef.disableForm();
+            // })
+          })
+        } else {
+          this.$nextTick(() => {
+            // 鍥炴樉鏁版嵁
+            this.$refs.vFormRef.setFormJson(res.data);
+            this.formJson = res.data;
+          })
+        }
       }).catch(res => {
         this.goBack();
       })
@@ -144,11 +162,16 @@
                 }
                 // 澶嶅埗瀵硅薄鐨勫睘鎬у�肩粰鏂扮殑瀵硅薄
                 Object.assign(param, formData);
-                // 鍚姩娴佺▼骞跺皢琛ㄥ崟鏁版嵁鍔犲叆娴佺▼鍙橀噺
-                definitionStart(this.procDefId, param).then(res => {
+                // 瀹屾垚浠诲姟
+                completeSubmitFormTask(this.taskId, param).then(res => {
                   this.$modal.msgSuccess(res.msg);
                   this.goBack();
                 })
+                // // 鍚姩娴佺▼骞跺皢琛ㄥ崟鏁版嵁鍔犲叆娴佺▼鍙橀噺
+                // definitionStart(this.procDefId, param).then(res => {
+                //   this.$modal.msgSuccess(res.msg);
+                //   this.goBack();
+                // })
               }
             }
           }
@@ -182,11 +205,16 @@
         } else {
           this.$set(param, "approval", this.checkValues);
         }
-        // 鍚姩娴佺▼骞跺皢琛ㄥ崟鏁版嵁鍔犲叆娴佺▼鍙橀噺
-        definitionStart(this.procDefId, param).then(res => {
+        // 瀹屾垚浠诲姟
+        completeSubmitFormTask(this.taskId, param).then(res => {
           this.$modal.msgSuccess(res.msg);
           this.goBack();
         })
+        // // 鍚姩娴佺▼骞跺皢琛ㄥ崟鏁版嵁鍔犲叆娴佺▼鍙橀噺
+        // definitionStart(this.procDefId, param).then(res => {
+        //   this.$modal.msgSuccess(res.msg);
+        //   this.goBack();
+        // })
       }
     },
     // 鐢ㄦ埛淇℃伅閫変腑鏁版嵁

--
Gitblit v1.8.0