Sfoglia il codice sorgente

处理表单组回显失败问题

lph 1 anno fa
parent
commit
6d8d7758f8

+ 7 - 0
zkqy-ui/src/components/FormGroup/formList.vue

@@ -7,6 +7,7 @@
     >
       <k-form-build
         :dynamicData="item.template.dfFormSql || {}"
+        :defaultValue="{}"
         class="formBuild"
         :ref="item.tableName"
         :value="item.template.dfVueTemplate"
@@ -108,7 +109,10 @@ export default {
         this.formArray = this.disableHandler(temp);
         this.$nextTick(() => {
           console.log("表单组渲染");
+          // setTimeout(() => {
+          //   console.log("倒计时结束");
           this.setDefaultValue();
+          // }, 5000);
         });
       },
       deep: true,
@@ -134,6 +138,7 @@ export default {
       });
       for (const key in this.defaultValue) {
         this.$refs[key][0]?.setData(this.defaultValue[key]);
+        console.log(this.defaultValue[key]);
         console.log(this.$refs[key][0]);
       }
     },
@@ -166,6 +171,8 @@ export default {
             : JSON.parse(item.template.dfVueTemplate);
 
         if (item.template.resultMap) {
+          console.log(item.template.resultMap);
+          console.log(item.template.resultMap[0]?.resultMap);
           item.template.defaultValue = item.template.resultMap[0]?.resultMap
             ? item.template.resultMap[0].resultMap
             : {};

+ 16 - 5
zkqy-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -245,12 +245,17 @@
       >
       </iframe> -->
       <!-- <template v-else> -->
-      <template v-if="formType == 'dragFormGroup'">
-        <FormList ref="formGroupRef" :formList="formList"></FormList>
+      <template>
+        <FormList
+          v-show="formType == 'dragFormGroup'"
+          ref="formGroupRef"
+          :formList="formList"
+        ></FormList>
+        <!-- <el-button @click="showValue">test</el-button> -->
       </template>
-      <template v-else-if="formType == 'dragForm'">
+      <template>
         <k-form-build
-          v-if="jsonData"
+          v-if="jsonData && formType == 'dragForm'"
           class="formBuild"
           ref="addFromRef"
           :dynamicData="dynamicData"
@@ -474,6 +479,11 @@ export default {
     // },
   },
   methods: {
+    // test
+    showValue() {
+      console.log(this.$refs.formGroupRef);
+      this.$refs.formGroupRef.setDefaultValue();
+    },
     // 计算操作列的显示与隐藏
     calcuteExcuteCol() {
       if (!this.excuteBtnArr || !this.excuteBtnArr.length) {
@@ -808,6 +818,7 @@ export default {
                 this.formList = res.data;
                 this.tableName = res.data.dfTableName;
               }
+              console.log(this.formList);
               this.open = true;
               // this.$nextTick(() => {
               //   // this.sleep(1000);
@@ -948,7 +959,7 @@ export default {
           console.log(item);
           let showValue = item.showValue[0];
           if (showValue) {
-            item.showTemplate.resultMap = mainForm.showValue;
+            item.showTemplate.resultMap = item.showValue;
           }
           this.formList.push({
             template: item.showTemplate,