From cf8e874f0b9cff419530632d212e357ebce7e9cf Mon Sep 17 00:00:00 2001
From: BoBoooooo <17746714@qq.com>
Date: Thu, 21 Mar 2019 17:19:31 +0800
Subject: [PATCH] =?UTF-8?q?[feature]{WidgetFormItem}:=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=86=92=E6=B3=A1bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/GenerateFormDialog.vue | 56 ++++++++++---------
src/components/CrudTable/index.vue | 12 ++--
.../FormDesigner/WidgetFormItem.vue | 2 +-
3 files changed, 38 insertions(+), 32 deletions(-)
diff --git a/src/components/CrudTable/components/GenerateFormDialog.vue b/src/components/CrudTable/components/GenerateFormDialog.vue
index fbc640b..cf4210c 100644
--- a/src/components/CrudTable/components/GenerateFormDialog.vue
+++ b/src/components/CrudTable/components/GenerateFormDialog.vue
@@ -17,7 +17,7 @@
@@ -75,7 +75,7 @@ export default {
},
tableName: String,
dialogStatus: String,
- formValue: {
+ formValues: {
type: Object,
default: () => ({}),
},
@@ -110,32 +110,37 @@ export default {
});
},
},
- created() {
- // 如果select,radio,checkbox等组件为多选情况 后台返回逗号分隔字符串 => 数组
- for (const row of this.jsonData.list) {
- if (row.columns) {
- for (const column of row.columns) {
- const { list } = column;
- if (Array.isArray(list)) {
- list.forEach((citem) => {
- if (citem.options.multiple) {
- if (!Array.isArray(this.formValues[citem.model])
- && this.formValues[citem.model]) {
- this.formValues[citem.model] = this.formValues[citem.model].split(',');
- }
+
+ watch: {
+ formValues: {
+ deep: true,
+ immediate: true,
+ handler() {
+ // 如果select,radio,checkbox等组件为多选情况 后台返回逗号分隔字符串 => 数组
+ for (const row of this.jsonData.list) {
+ if (row.columns) {
+ for (const column of row.columns) {
+ const { list } = column;
+ if (Array.isArray(list)) {
+ list.forEach((citem) => {
+ if (citem.options.multiple) {
+ if (!Array.isArray(this.formValues[citem.model])
+ && this.formValues[citem.model]) {
+ this.formValues[citem.model] = this.formValues[citem.model].split(',');
+ }
+ }
+ });
}
- });
+ }
+ } else if (row.options.multiple) {
+ if (!Array.isArray(this.formValues[row.model])
+ && this.formValues[row.model]) {
+ this.formValues[row.model] = this.formValues[row.model].split(',');
+ }
}
}
- } else if (row.options.multiple) {
- if (!Array.isArray(this.formValues[row.model])
- && this.formValues[row.model]) {
- this.formValues[row.model] = this.formValues[row.model].split(',');
- }
- }
- }
- },
- watch: {
+ },
+ },
dialogFormVisible(val) {
this.visible = val;
},
@@ -148,6 +153,7 @@ export default {
},
},
}
+