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) }