Эх сурвалжийг харах

解决审批时表单组数据回显异常问题

lph 1 жил өмнө
parent
commit
035bdf726e

+ 38 - 4
zkqy-ui/src/views/bussiness/OAMange.vue

@@ -102,7 +102,7 @@
               <el-button
                 v-show="scope.row.bepTaskProcessState != 3"
                 class="mr5 mb5"
-                @click="approveHandler(scope.row)"
+                @click="approveHandlerTemp(scope.row)"
                 type="primary"
                 size="small"
                 >审批</el-button
@@ -177,10 +177,14 @@
         <el-dialog title="审批" :visible.sync="show">
           <!-- <FormGroup ref="formGroupRef" :formList="formList"></FormGroup> -->
           <Approve
+            v-show="!times"
             ref="approveRef"
             :formList="formList"
             :nodeLogList="nodeLogList"
           ></Approve>
+          <div v-show="times" class="times">
+            <i class="el-icon-loading" style="font-size: 30px"></i>
+          </div>
           <template #footer>
             <span>
               <el-button @click="show = false">取消</el-button>
@@ -221,6 +225,7 @@ export default {
   dicts: ["bpm_type", "task_process_state"],
   data() {
     return {
+      times: 2, //多次请求  表单组数据回显异常处理
       // 弹窗表单数据
       row: {},
       formList: [],
@@ -340,6 +345,10 @@ export default {
     this.getList();
   },
   methods: {
+    approveHandlerTemp(row) {
+      this.times = 2;
+      this.approveHandler(row);
+    },
     // 审批回调
     async approveHandler(row) {
       console.log(row);
@@ -363,6 +372,21 @@ export default {
         taskPlanKey: bepTaskPlanKey,
       };
       let res = await getProcessNodeFormTemplate(payLoad);
+      this.handlerFormData(res, row);
+      // if (res.code == 200 && res.data[0]?.template?.mainForm) {
+      //   this.times--;
+      //   if (this.times) {
+      //     setTimeout(() => {
+      //       this.handlerFormData(res, row);
+      //     }, 1000);
+      //   }
+      // }
+      // setTimeout(() => {
+      //   this.handlerFormData(res, row);
+      // }, 1000);
+    },
+    // 处理表单数据
+    handlerFormData(res, row) {
       if (res.code == 200) {
         if (res.data[0]?.template?.mainForm) {
           //表单组
@@ -370,13 +394,23 @@ export default {
           this.tableName =
             res.data[0].template.mainForm.showTemplate.dfTableName;
           console.log(this.formList);
+          this.nodeLogList = row.nodeLog.slice(1);
+          this.show = true;
+          this.times--;
+          if (this.times) {
+            this.$nextTick(() => {
+              setTimeout(() => {
+                console.log(1111);
+                this.approveHandler(row);
+              }, 1000);
+            });
+          }
         } else {
           this.formList = res.data;
           this.tableName = res.data[0].template.dfTableName;
+          this.nodeLogList = row.nodeLog.slice(1);
+          this.show = true;
         }
-
-        this.nodeLogList = row.nodeLog.slice(1);
-        this.show = true;
       } else {
         this.$message.error("网络异常,请稍后再试");
       }

+ 3 - 1
zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -267,7 +267,9 @@
             ref="formGroupRef"
             :formList="formList"
           ></FormList>
-
+          <!-- <div v-show="times" class="times">
+            <i class="el-icon-loading" style="font-size: 30px"></i>
+          </div> -->
           <!-- <el-button @click="showValue">test</el-button> -->
         </template>
         <template>