From ce20e86b57be436a42b65befe8e1da2283922030 Mon Sep 17 00:00:00 2001
From: luohairen <3399054449@qq.com>
Date: 星期三, 11 十二月 2024 10:17:05 +0800
Subject: [PATCH] 优化

---
 src/views/flowable/task/myProcess/send/index.vue |   94 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 68 insertions(+), 26 deletions(-)

diff --git a/src/views/flowable/task/myProcess/send/index.vue b/src/views/flowable/task/myProcess/send/index.vue
index 3f23f26..b235359 100644
--- a/src/views/flowable/task/myProcess/send/index.vue
+++ b/src/views/flowable/task/myProcess/send/index.vue
@@ -9,11 +9,22 @@
         <!--琛ㄥ崟淇℃伅-->
         <el-tab-pane label="琛ㄥ崟淇℃伅" name="1">
           <!--鍒濆鍖栨祦绋嬪姞杞借〃鍗曚俊鎭�-->
-          <el-col :span="16" :offset="4">
-            <v-form-render :form-data="formRenderData" ref="vFormRef"/>
-            <div style="margin-left:15%;margin-bottom: 20px;font-size: 14px;">
-              <el-button type="primary" @click="submitForm">鎻� 浜�</el-button>
-              <el-button type="primary" @click="resetForm">閲� 缃�</el-button>
+          <el-col :span="16" :offset="4" v-if="formDataList && formDataList.length > 0">
+            <div v-for="(formDataObj, index) in formDataList" :key="index" class="form-warp" style="position: relative">
+              <div v-if="!formDataObj.current" style="position: absolute; top: 2px; right: 2px">
+                <el-button type="danger" disabled>椹冲洖(鍔熻兘寮�鍙戜腑)</el-button>
+              </div>
+              <div v-if="formDataObj.current" style="margin-bottom: 15px;color: #409eff">褰撳墠闃舵锛�<span style="color: red">{{formDataObj.beforeNodeName}}</span></div>
+              <div v-else style="margin-bottom: 15px;color: #409eff">鍓嶇疆闃舵锛�<span style="color: #d5904b">{{formDataObj.beforeNodeName}}</span></div>
+              <v-form-render  :form-data="formDataObj.formJson" :ref="'form' + index"/>
+            </div>
+
+<!--            <v-form-render :form-data="formRenderData" ref="vFormRef"/>-->
+            <div style="display: flex;justify-content: center; align-items: center; margin: 20px 0">
+              <el-button type="primary" @click="submitForm">纭骞舵彁浜�</el-button>
+              <el-button type="primary" disabled @click="submitForm">鍗忓悓鍔炵悊(鍔熻兘寮�鍙戜腑)</el-button>
+              <el-button type="primary" disabled @click="submitForm">杞氦浠栦汉鍔炵悊(鍔熻兘寮�鍙戜腑)</el-button>
+<!--              <el-button type="primary" @click="resetForm">閲� 缃�</el-button>-->
             </div>
           </el-col>
         </el-tab-pane>
@@ -54,6 +65,8 @@
   props: {},
   data() {
     return {
+      goBackParams: {},
+      formDataList: [],  // 琛ㄥ崟鍒楄〃
       taskId: '',
       processName: '',
       // 妯″瀷xml鏁版嵁
@@ -68,6 +81,7 @@
       deployId: "",  // 娴佺▼瀹氫箟缂栧彿
       procDefId: "",  // 娴佺▼瀹炰緥缂栧彿
       formRenderData: {},
+      formRenderDataList: [],
       variables: [], // 娴佺▼鍙橀噺鏁版嵁
       taskTitle: null,
       taskOpen: false,
@@ -80,12 +94,13 @@
       formJson: {} // 琛ㄥ崟json
     };
   },
-  created() {
+  mounted() {
     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.goBackParams  = this.$route.query && this.$route.query.goBackParams;
     // this.getNextFlowNodeByStart(this.deployId);
     this.getFlowFormData(this.taskId);
   },
@@ -101,38 +116,56 @@
     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.formDataList = res.data
+        if (this.formDataList && this.formDataList.length > 0) {
           this.$nextTick(() => {
-            // 鍔犺浇琛ㄥ崟濉啓鐨勬暟鎹�
-            this.$refs.vFormRef.setFormData(res.data);
-            // this.$nextTick(() => {
-            //   // 琛ㄥ崟绂佺敤
-            //   this.$refs.vFormRef.disableForm();
-            // })
+            this.formDataList.forEach((formDataObj, index) => {
+              console.log("琛ㄥ崟鏁版嵁鍒楄〃", formDataObj.formJson)
+              let that = this
+              console.log(eval("that.$refs.form" +index)[0])
+              eval("that.$refs.form" +index)[0].setFormJson(formDataObj.formJsonObj.formJson);
+
+              eval("that.$refs.form" +index)[0].setFormData(formDataObj.formJsonObj);
+            })
+            this.formJson = this.formDataList[0].formJsonObj.formJson
           })
-        } else {
-          this.$nextTick(() => {
-            // 鍥炴樉鏁版嵁
-            this.$refs.vFormRef.setFormJson(res.data);
-            this.formJson = res.data;
-          })
+
         }
+        // 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 => {
+        console.log("鎶ラ敊浜嗭細", res)
         this.goBack();
       })
     },
     /** 杩斿洖椤甸潰 */
     goBack() {
-      // 鍏抽棴褰撳墠鏍囩椤靛苟杩斿洖涓婁釜椤甸潰
-      const obj = { path: "/task/process", query: { t: Date.now()} };
-      this.$tab.closeOpenPage(obj);
+      this.$router.push({
+        path: '/projectFlow/detail',
+        query: this.goBackParams
+      })
     },
     /** 鐢宠娴佺▼琛ㄥ崟鏁版嵁鎻愪氦 */
     submitForm() {
-      this.$refs.vFormRef.getFormData().then(formData => {
+      let that = this
+      eval("that.$refs.form" +0)[0].getFormData().then(formData => {
         // 鏍规嵁褰撳墠浠诲姟鎴栬�呮祦绋嬭璁¢厤缃殑涓嬩竴姝ヨ妭鐐� todo 鏆傛椂鏈秹鍙婂埌鑰冭檻缃戝叧銆佽〃杈惧紡鍜屽鑺傜偣鎯呭喌
         getNextFlowNodeByStart({deploymentId: this.deployId, variables: formData}).then(res => {
           const data = res.data;
@@ -274,4 +307,13 @@
 .my-label {
   background: #E1F3D8;
 }
+
+.form-warp {
+  padding: 20px;
+  margin-bottom: 20px;
+  box-shadow:
+    inset 0 -3em 3em rgba(0, 0, 0, 0.1),
+    0 0 0 2px rgb(239, 239, 239),
+    0.3em 0.3em 1em rgba(0, 0, 0, 0.3);
+}
 </style>

--
Gitblit v1.8.0