From 101fd2fc9231a8f399815549745c2067be434d21 Mon Sep 17 00:00:00 2001 From: BoBoooooo <17746714@qq.com> Date: Sun, 31 Mar 2019 00:02:55 +0800 Subject: [PATCH] =?UTF-8?q?[feature]{CrudTable}:=20=E6=94=B9=E5=86=99?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CrudTable/CrudTable.vue | 27 +++++++++----------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/components/CrudTable/CrudTable.vue b/src/components/CrudTable/CrudTable.vue index f0a958d..28a737b 100644 --- a/src/components/CrudTable/CrudTable.vue +++ b/src/components/CrudTable/CrudTable.vue @@ -172,24 +172,15 @@ export default { }, formValueToArray() { // 如果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]) { + const genList = this.jsondata.list + for (let i = 0; i < genList.length; i += 1) { + if (genList[i].type === 'grid') { + genList[i].columns.forEach((item) => { + this.formValueToArray(item.list); + }); + } else { + const row = genList[i] + if (!Array.isArray(this.formValues[row.model])) { this.formValues[row.model] = this.formValues[row.model].split(','); } }