From 353efff194122e281925a390be5d576c2f4fff6d Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期三, 27 三月 2024 18:04:04 +0800
Subject: [PATCH] UI上下文展示引擎

---
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue |   83 +++++++++++++++++++++++++++--------------
 1 files changed, 55 insertions(+), 28 deletions(-)

diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index 65e77a0..9ec835c 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -38,14 +38,24 @@
       type: String,
       default: ''
     },
-    sourceData: {
+    sourceData:{
       //鑿滃崟婧愭暟鎹垨鑰呭脊绐楁椂鎸夐挳鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁
-      type: Object,
+      type:Object,
       default: {}
+    },
+    dataStore:{
+      //寮圭獥鏃舵寜閽墍灞炲尯鍩熼�変腑鏁版嵁
+      type:Array,
+      default: []
     },
     paramVOS: {
       type: Object,
       default: {}
+    },
+    isShow: {
+      //鎵�鍦ㄥ尯鍩熸槸鍚﹀凡鏄剧ず锛岄拡瀵箃ab鍜宑ollapse
+      type: Boolean,
+      default: true
     },
   },
   data() {
@@ -54,7 +64,6 @@
     }
   },
   mounted() {
-    // console.log('componentVO--',this.componentVO.tableDefineVO.cols[0])
   },
   computed: {
     option() {
@@ -62,41 +71,59 @@
         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)
+    }
+  },
+  watch:{
+    sourceData:{
+      handler(newval) {
+        console.log(this.areasName);
+        console.log(newval);
+      }
     }
   },
   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 : 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"
-          }]
-        }
-      })
+          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