Showing
1 changed file
with
13 additions
and
7 deletions
| @@ -29,7 +29,6 @@ | @@ -29,7 +29,6 @@ | ||
| 29 | <script lang="ts" setup> | 29 | <script lang="ts" setup> |
| 30 | import { reactive, UnwrapRef, watchEffect, ref } from 'vue'; | 30 | import { reactive, UnwrapRef, watchEffect, ref } from 'vue'; |
| 31 | import { propTypes } from '/@/utils/propTypes'; | 31 | import { propTypes } from '/@/utils/propTypes'; |
| 32 | - import { SelectTypes } from 'ant-design-vue/es/select'; | ||
| 33 | import { Select } from 'ant-design-vue'; | 32 | import { Select } from 'ant-design-vue'; |
| 34 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; | 33 | import { getAttribute } from '/@/api/ruleengine/ruleengineApi'; |
| 35 | 34 | ||
| @@ -42,16 +41,23 @@ | @@ -42,16 +41,23 @@ | ||
| 42 | value: propTypes.object.def({}), | 41 | value: propTypes.object.def({}), |
| 43 | orgId: propTypes.string.def(''), | 42 | orgId: propTypes.string.def(''), |
| 44 | }); | 43 | }); |
| 45 | - const selectOptions = ref<SelectTypes['options']>([]); | ||
| 46 | - //获取属性 | 44 | + const selectOptions: any = ref([]); |
| 45 | + //获取对应设备属性 | ||
| 47 | const getAttr = async (orgId, deviceId) => { | 46 | const getAttr = async (orgId, deviceId) => { |
| 48 | const res = await getAttribute(orgId, deviceId); | 47 | const res = await getAttribute(orgId, deviceId); |
| 49 | selectOptions.value = res.map((o) => { | 48 | selectOptions.value = res.map((o) => { |
| 50 | - return { | ||
| 51 | - label: o, | ||
| 52 | - value: o, | ||
| 53 | - }; | 49 | + let obj: any = {}; |
| 50 | + if (o !== null) { | ||
| 51 | + obj = { | ||
| 52 | + label: o, | ||
| 53 | + value: o, | ||
| 54 | + }; | ||
| 55 | + return obj; | ||
| 56 | + } | ||
| 54 | }); | 57 | }); |
| 58 | + //如果服务端返回的数组里含有null 过滤null值 | ||
| 59 | + const excludeNull = selectOptions.value.filter(Boolean); | ||
| 60 | + selectOptions.value = excludeNull; | ||
| 55 | }; | 61 | }; |
| 56 | //动态数据 | 62 | //动态数据 |
| 57 | const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); | 63 | const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); |