From 31bc95191c241dc0887465a7121146c4a5b84dbc Mon Sep 17 00:00:00 2001 From: qiaochuLei <124648559+qiaochuLei@users.noreply.github.com> Date: Thu, 11 Jan 2024 09:51:06 +0800 Subject: [PATCH] fix: bug#21262 * fix: bug#21262 --- .../Product/Detail/DeviceAccess/index.vue | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/views/device/Product/Detail/DeviceAccess/index.vue b/src/views/device/Product/Detail/DeviceAccess/index.vue index ed24de15..8d77f1df 100644 --- a/src/views/device/Product/Detail/DeviceAccess/index.vue +++ b/src/views/device/Product/Detail/DeviceAccess/index.vue @@ -110,7 +110,7 @@ { required: !!item?.type?.expands?.required, message: `${ - item.type.type === 'enum' + item.type.type === 'enum' || 'boolean' ? '请选择' : '请输入' }${item.name}`, @@ -129,10 +129,11 @@ > - {{ el.text }} - + --> + @@ -346,6 +348,29 @@ const form = reactive<Record<string, any>>({ const formData = reactive<Record<string, any>>({ data: productStore.current?.configuration || {}, }); +//获取物模型下拉选项 +const getOptions = (i:any) =>{ + if (i.type.type === 'enum') { + return (i.type?.elements || []).map((item) => { + return { + label: item?.text, + value: item?.value, + }; + }); + } else if (i.type.type === 'boolean') { + return [ + { + label: i.type?.falseText, + value: i.type?.falseValue, + }, + { + label: i.type?.trueText, + value: i.type?.trueValue, + } + ]; + } + return undefined; +} const fun = () =>{ console.log(formData.data,productStore.current?.configuration) }