From 2974dce33b4d519c3d06870dfe9b19c40d3f97c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B9=90?= <419641032@qq.com> Date: Thu, 17 Sep 2020 16:57:33 +0800 Subject: [PATCH] =?UTF-8?q?form=E8=A1=A8=E5=8D=95=20=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormGenerator/components/parser/Parser.vue | 13 ++++++++++++- .../views/appSetting/wxAccount/wxTemplate/index.vue | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/admin/src/components/FormGenerator/components/parser/Parser.vue b/admin/src/components/FormGenerator/components/parser/Parser.vue index ed626285..84d81bca 100644 --- a/admin/src/components/FormGenerator/components/parser/Parser.vue +++ b/admin/src/components/FormGenerator/components/parser/Parser.vue @@ -134,7 +134,18 @@ export default { data() { if (this.isEdit) { // 初始化待编辑数据 this.formConf.fields.forEach(conf => { - conf.__config__.defaultValue = this.formEditData[conf.__vModel__] + // 设置现有的数据 + const hasValueForEdit = this.formEditData[conf.__vModel__] + if(hasValueForEdit){ + conf.__config__.defaultValue = hasValueForEdit + } + // 如果是el-select标签 判断数据后改变实现默认选中效果 + if(conf.__config__.tag === 'el-select' || conf.__config__.tag === 'el-radio-group'){ + const perValue = conf.__slot__.options.filter(option => option.value == this.formEditData[conf.__vModel__]) + if(perValue.length > 0){ // 有表单数据 + conf.__config__.defaultValue = perValue[0].value + } + } }) } const data = { diff --git a/admin/src/views/appSetting/wxAccount/wxTemplate/index.vue b/admin/src/views/appSetting/wxAccount/wxTemplate/index.vue index 932f94c4..c074c38b 100644 --- a/admin/src/views/appSetting/wxAccount/wxTemplate/index.vue +++ b/admin/src/views/appSetting/wxAccount/wxTemplate/index.vue @@ -102,7 +102,7 @@