From 1991488bda02a53ba4af491f88b1c3acaa026491 Mon Sep 17 00:00:00 2001 From: PeopleSea Date: Mon, 18 Nov 2024 13:11:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(ma-crud,=20ma-form):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=A4=9A=E9=80=89=20select=20=E5=8F=8D=E5=90=91=E8=B5=8B?= =?UTF-8?q?=E5=80=BC=E6=97=B6=E9=9D=9E=E5=AF=B9=E8=B1=A1=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ma-crud 和 ma-form 组件中,增加了对多选 select 值类型的判断 - 当值不是对象时,将其转换为数组,避免遍历操作时的错误 Close #214 --- src/components/ma-crud/components/searchFormItem/form-select.vue | 1 + src/components/ma-form/formItem/form-select.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/ma-crud/components/searchFormItem/form-select.vue b/src/components/ma-crud/components/searchFormItem/form-select.vue index e2d41d6..5430323 100644 --- a/src/components/ma-crud/components/searchFormItem/form-select.vue +++ b/src/components/ma-crud/components/searchFormItem/form-select.vue @@ -167,6 +167,7 @@ const handlerFallback = (key) => { watch( () => get(searchForm.value, props.component.dataIndex), vl => value.value = vl ) watch( () => value.value, v => { if (props.component.multiple) { + if (!isObject(v)) v = [] v.forEach(k => { if ( !optionMap.value[k] ) { optionMap.value[k] = dicts.value[dictIndex].find(i => i.value === k) diff --git a/src/components/ma-form/formItem/form-select.vue b/src/components/ma-form/formItem/form-select.vue index 55d8089..c7cfe57 100644 --- a/src/components/ma-form/formItem/form-select.vue +++ b/src/components/ma-form/formItem/form-select.vue @@ -161,6 +161,7 @@ const keyword = ref('') watch( () => get(formModel.value, index), vl => value.value = vl ) watch( () => value.value, v => { if (props.component.multiple) { + if (!isObject(v)) v = [] v.forEach(k => { if ( !optionMap.value[k] ) { optionMap.value[k] = dictList.value[dictIndex].find(i => i.value === k)