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 |  143 ++++++++++++++++++++++++++++-------------------
 1 files changed, 85 insertions(+), 58 deletions(-)

diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index d0ccd6c..9ec835c 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,9 +1,25 @@
 <template>
-  <basic-container>
-    <el-dialog v-if="dialogFormVisible" :title="title" :visible.sync="dialogFormVisible" @close="closeHandler" append-to-body>
-      <avue-form v-model="form" :option="option" @submit="submitHandler" @reset-change="changeHandler"></avue-form>
-    </el-dialog>
-  </basic-container>
+  <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
+            v-if="item.keyAttr"
+            class="item"
+            content="璇ュ睘鎬т负鍏抽敭灞炴��"
+            effect="dark"
+            placement="top-start"
+          >
+            <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>
+  </div>
 </template>
 
 <script>
@@ -22,24 +38,24 @@
       type: String,
       default: ''
     },
-    sourceData: {
+    sourceData:{
       //鑿滃崟婧愭暟鎹垨鑰呭脊绐楁椂鎸夐挳鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁
-      type: Object,
+      type:Object,
       default: {}
+    },
+    dataStore:{
+      //寮圭獥鏃舵寜閽墍灞炲尯鍩熼�変腑鏁版嵁
+      type:Array,
+      default: []
     },
     paramVOS: {
       type: Object,
       default: {}
     },
-    visible: {
+    isShow: {
+      //鎵�鍦ㄥ尯鍩熸槸鍚﹀凡鏄剧ず锛岄拡瀵箃ab鍜宑ollapse
       type: Boolean,
-      default: false,
-    },
-    title: {
-      type: String
-    },
-    formList:{
-      type:Array
+      default: true
     },
   },
   data() {
@@ -47,58 +63,69 @@
       form: {},
     }
   },
+  mounted() {
+  },
   computed: {
-    dialogFormVisible: {
-      get() {
-        return this.visible;
-      },
-      set(val) {
-        this.$emit("update:visible", val);
-      },
-    },
     option() {
       return {
-        column: this.formColumn(this.formList)
+        submitBtn: false,
+        emptyBtn: false,
+        height: 300,
+        column: this.getColumnData(0)
       }
     },
+    slotData() {
+      return this.getColumnData(0)
+    }
   },
-  methods:{
-    //琛ㄥ崟鎻愪氦
-    submitHandler(form,done){
-      console.log(form)
-      done()
-    },
-    changeHandler(){
-      this.form = {};
-      // this.clearValidate() 娓呯┖鏍¢獙
-      // this.resetFields()
-    },
+  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 : null,
-          readonly: item.readOnly,
-          disabled: item.disabled,
-          labelSuffix: item.suffix,
-          suffixIcon: item.prefix,
-          placeholder:item.placeholder,
-          clearable:item.clearable,
-          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"
+            }]
+          };
+        });
     },
-    closeHandler(){
-      this.form = {};
+
+    //鏁版嵁鍒ょ┖
+    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