Переглянути джерело

表单组布局数据回显

lph 1 рік тому
батько
коміт
0e5835a809

+ 17 - 1
zkqy-ui/src/views/system/formGroupMange/component/DragPosition.vue

@@ -177,10 +177,25 @@ export default {
     },
   },
   methods: {
+    // 添加表单json数据
+    addFormJSONData(data) {
+      df = (arr) => {
+        arr.forEach((element) => {
+          if (element.type == "form") {
+            // element.dfVueTemplate=
+          }
+        });
+      };
+    },
     // 预览展示
     showPreView() {
+      console.log(this.layoutData, formList);
+      let tempLayoutData = JSON.parse(JSON.stringify(this.layoutData));
+
       this.$refs.PreViewRef.setLayoutData(this.layoutData, formList);
-      this.$refs.PreViewRef.showPreView();
+      this.$nextTick(() => {
+        this.$refs.PreViewRef.showPreView();
+      });
     },
     // JSON展示回调
     showJSONData() {
@@ -224,6 +239,7 @@ export default {
       } else {
         this.layoutData.list.push(...res);
       }
+      console.log(this.layoutData);
       // this.schemaGroup[0].list = res;
     },
     // 预览json

+ 1 - 0
zkqy-ui/src/views/system/formGroupMange/component/PreView.vue

@@ -10,6 +10,7 @@
       :key="index"
       class="drag-move"
       :record="item"
+      :formData="formData"
     />
     <template #footer>
       <span>

+ 6 - 1
zkqy-ui/src/views/system/formGroupMange/preView/preViewItem.vue

@@ -101,7 +101,7 @@ import KFormDesign from "./KFormDesign.vue";
 import draggable from "vuedraggable";
 export default {
   name: "preViewItem",
-  props: ["record"],
+  props: ["record", "formData"],
   components: { FormCard, draggable, KFormDesign },
   data() {
     return {};
@@ -113,6 +113,11 @@ export default {
     },
   },
   methods: {
+    // 获取表单json数据
+    getFormJson(formKey) {
+      return this.formData.filter((item) => item.formKey == formKey)
+        ?.dfVueTemplate;
+    },
     // 删除
     deleHandle(record) {
       console.log("dele", record);