From fce9d4e89a50c0b53faee6f6bfd2c385531fbc4b Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 21 三月 2024 13:45:16 +0800
Subject: [PATCH] 解决冲突代码(原始数据判空)

---
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue |   76 ++++++++++++++++++++++----------------
 1 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index 3d555d7..0af4863 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,6 +1,7 @@
 <template>
-  <avue-form v-model="form" :option="option">
-    <template v-for="item in slotData" :slot="item.prop + 'Label'">
+  <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid">
+    <avue-form v-model="form" :option="option">
+      <template v-for="item in slotData" :slot="item.prop + 'Label'">
         <span>
           <span>{{ item.label }} </span>
           <el-tooltip
@@ -13,11 +14,12 @@
             <i class="el-icon-star-on" style="font-size: 17px !important; color: red;vertical-align: baseline;"></i>
           </el-tooltip>
         </span>
-    </template>
-    <template slot="menuForm">
-      <dynamic-button type="form" :butttonList="componentVO.buttons" @buttonClick="buttonClick"></dynamic-button>
-    </template>
-  </avue-form>
+      </template>
+      <template slot="menuForm">
+        <dynamic-button type="form" :butttonList="componentVO.buttons" @buttonClick="buttonClick"></dynamic-button>
+      </template>
+    </avue-form>
+  </div>
 </template>
 
 <script>
@@ -60,41 +62,51 @@
         submitBtn: false,
         emptyBtn: false,
         height: 300,
-        column: this.formColumn(this.componentVO.tableDefineVO.cols[0])
+        column: this.getColumnData(0)
       }
     },
     slotData() {
-      return this.formColumn(this.componentVO.tableDefineVO.cols[0])
+      return this.getColumnData(0)
     }
   },
   methods: {
     //杞寲鏁版嵁
     formColumn(formList) {
-      return formList.map(item => {
-        const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type;
+        return formList.map(item => {
+          const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type;
 
-        return {
-          label: item.text,
-          prop: item.field,
-          type: typeValue,
-          value: item.defaultValue,
-          dicData: item.type === 'combox' ? item.dicData : null,
-          readonly: item.readOnly,
-          disabled: item.disabled,
-          labelSuffix: item.suffix,
-          suffixIcon: item.prefix,
-          placeholder: item.placeholder,
-          clearable: item.clearable,
-          tip: item.tooltips,
-          keyAttr: item.keyAttr,
-          rules: [{
-            required: item.required,
-            message: `璇疯緭鍏�${item.text}!`,
-            trigger: "blur"
-          }]
-        }
-      })
+          return {
+            label: item.text,
+            prop: item.field,
+            type: typeValue,
+            value: item.defaultValue,
+            dicData: item.type === 'combox' ? item.dicData : item.dicUrl,
+            readonly: item.readOnly,
+            disabled: item.disabled,
+            labelSuffix: item.suffix,
+            suffixIcon: item.prefix,
+            placeholder: item.placeholder,
+            clearable: item.clearable,
+            tip: item.tooltips,
+            keyAttr: item.keyAttr,
+            rules: [{
+              required: item.required,
+              message: `璇疯緭鍏�${item.text}!`,
+              trigger: "blur"
+            }]
+          };
+        });
     },
+
+    //鏁版嵁鍒ょ┖
+    getColumnData(index) {
+      if (this.componentVO && this.componentVO.tableDefineVO && this.componentVO.tableDefineVO.cols && this.componentVO.tableDefineVO.cols.length > 0) {
+        return this.formColumn(this.componentVO.tableDefineVO.cols[index])
+      } else {
+        return null;
+      }
+    },
+
     buttonClick(item) {
       console.log(item.id)
     },

--
Gitblit v1.9.3