From 3b5faa420d89c2ee7f3973c043ea997e4885e0ec Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 18 三月 2024 15:59:26 +0800
Subject: [PATCH] 编辑回填

---
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue |  197 +++++-------------------------------------------
 1 files changed, 23 insertions(+), 174 deletions(-)

diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index acae2e5..d0ccd6c 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,6 +1,6 @@
 <template>
   <basic-container>
-    <el-dialog v-if="dialogFormVisible" :title="title" :visible.sync="dialogFormVisible" append-to-body>
+    <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>
@@ -37,170 +37,14 @@
     },
     title: {
       type: String
-    }
+    },
+    formList:{
+      type:Array
+    },
   },
   data() {
     return {
       form: {},
-      formList: [
-        {
-          comboxKey: null,
-          customClass: null,
-          data: null,
-          dateFormate: null,
-          defaultValue: "3-15-test",
-          displayExtension: "",
-          extendAttrMap: null,
-          extendAttrString: null,
-          field: "name",
-          hidden: false,
-          keyAttr: false,
-          prefix: null,
-          readOnly: false,
-          referConfig: null,
-          required: true,
-          selectLibFlag: null,
-          showField: null,
-          suffix: '$',
-          text: "鍚嶇О",
-          tooltips: null,
-          type: "text",
-          unique: false,
-          verify: ""
-        },
-        {
-          comboxKey: null,
-          customClass: null,
-          data: null,
-          dateFormate: null,
-          defaultValue: "",
-          displayExtension: "",
-          extendAttrMap: null,
-          extendAttrString: null,
-          field: "code",
-          hidden: false,
-          keyAttr: false,
-          prefix: null,
-          readOnly: false,
-          referConfig: null,
-          required: false,
-          selectLibFlag: null,
-          showField: null,
-          suffix: null,
-          text: "缂栫爜",
-          tooltips: null,
-          type: "text",
-          unique: false,
-          verify: ""
-        },
-        {
-          comboxKey: "EnumReviewType",
-          customClass: null,
-          data: null,
-          dateFormate: null,
-          defaultValue: "department",
-          displayExtension: "",
-          extendAttrMap: null,
-          extendAttrString: null,
-          field: "reviewtype",
-          hidden: false,
-          keyAttr: false,
-          prefix: null,
-          readOnly: false,
-          referConfig: null,
-          required: false,
-          selectLibFlag: null,
-          showField: null,
-          suffix: null,
-          text: "绫诲瀷",
-          tooltips: null,
-          type: "combox",
-          unique: false,
-          verify: "",
-          dicData: [{
-            label: '娴嬭瘯1',
-            value: 'department'
-          }, {
-            label: '娴嬭瘯2',
-            value: 'departments'
-          }]
-        },
-        {
-          comboxKey: null,
-          customClass: null,
-          data: null,
-          dateFormate: null,
-          defaultValue: "",
-          displayExtension: "",
-          extendAttrMap: null,
-          extendAttrString: null,
-          field: "creator",
-          hidden: true,
-          keyAttr: false,
-          prefix: null,
-          readOnly: true,
-          referConfig: null,
-          required: false,
-          selectLibFlag: null,
-          showField: null,
-          suffix: null,
-          text: "鍒涘缓浜�",
-          tooltips: null,
-          type: "text",
-          unique: false,
-          verify: ""
-        },
-        {
-          comboxKey: null,
-          customClass: null,
-          data: null,
-          dateFormate: "yyyy-MM-dd HH:mm:ss",
-          defaultValue: "",
-          displayExtension: "",
-          extendAttrMap: null,
-          extendAttrString: null,
-          field: "createtime",
-          hidden: true,
-          keyAttr: false,
-          prefix: null,
-          readOnly: false,
-          referConfig: null,
-          required: false,
-          selectLibFlag: null,
-          showField: null,
-          suffix: null,
-          text: "鍒涘缓鏃堕棿",
-          tooltips: null,
-          type: "datetime",
-          unique: false,
-          verify: ""
-        },
-        {
-          comboxKey: null,
-          customClass: null,
-          data: null,
-          dateFormate: null,
-          defaultValue: "",
-          displayExtension: "",
-          extendAttrMap: null,
-          extendAttrString: null,
-          field: "content",
-          hidden: false,
-          keyAttr: false,
-          prefix: null,
-          readOnly: false,
-          referConfig: null,
-          required: false,
-          selectLibFlag: null,
-          showField: null,
-          suffix: null,
-          text: "澶囨敞",
-          tooltips: null,
-          type: "textarea",
-          unique: false,
-          verify: ""
-        },
-      ],
     }
   },
   computed: {
@@ -214,11 +58,23 @@
     },
     option() {
       return {
-        column: this.formColumn
+        column: this.formColumn(this.formList)
       }
     },
-    formColumn() {
-      return this.formList.map(item => {
+  },
+  methods:{
+    //琛ㄥ崟鎻愪氦
+    submitHandler(form,done){
+      console.log(form)
+      done()
+    },
+    changeHandler(){
+      this.form = {};
+      // this.clearValidate() 娓呯┖鏍¢獙
+      // this.resetFields()
+    },
+    formColumn(formList) {
+      return formList.map(item => {
         const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type;
 
         return {
@@ -231,6 +87,8 @@
           disabled: item.disabled,
           labelSuffix: item.suffix,
           suffixIcon: item.prefix,
+          placeholder:item.placeholder,
+          clearable:item.clearable,
           rules: [{
             required: item.required,
             message: `璇疯緭鍏�${item.text}!`,
@@ -238,18 +96,9 @@
           }]
         }
       })
-    }
-  },
-  methods:{
-    //琛ㄥ崟鎻愪氦
-    submitHandler(form,done){
-      console.log(form)
-      done()
     },
-    changeHandler(){
+    closeHandler(){
       this.form = {};
-      // this.clearValidate() 娓呯┖鏍¢獙
-      // this.resetFields()
     },
   }
 }

--
Gitblit v1.9.3