Commit 16a6e0fc64d32361471f0ff62f4c79330ec2b179

Authored by xp.Huang
2 parents ee078697 390ea437

Merge branch 'fix/switch-component-status' into 'main_dev'

fix: 修复开关组件无推送值时状态

See merge request yunteng/thingskit-scada!219
1 1 <script lang="ts" setup>
2 2 import { computed, ref, unref } from 'vue'
  3 +import { isNullOrUnDef } from '@wry-smile/utils-is'
3 4 import type { RenderComponentExposeType, RenderComponentProps } from '@/core/Library/types'
4 5 import { useLatestMessageValue } from '@/core/Library/hook/useLatestMessageValue'
5 6 import { NodeUtils } from '@/hooks/business/useNodeUtils'
... ... @@ -25,6 +26,10 @@ const onReceiveDataSourceMessage = (_commandSource: CommandSource, message: Subs
25 26 const cell = nodeUtils.getCellById(node)
26 27 if (!cell) return
27 28 const { latestValue } = useLatestMessageValue(message.data, attr!)
  29 +
  30 + if (isNullOrUnDef(latestValue))
  31 + return
  32 +
28 33 const flag = rangeList.find(item => item.statusValue?.toString() === latestValue?.toString())
29 34
30 35 if (flag) {
... ...