Commit 289e59e25d9d1f44fb689524172648f510ec830e

Authored by ww
1 parent ab6da34f

fix: 修复温度计无法回显绑定数据源

... ... @@ -101,7 +101,7 @@ export interface NodeDataDataSourceJsonType {
101 101 }
102 102 circularFlowMeterOption?: FlowMeterColorItemType[] // 圆形水球图数据暂定any
103 103 rectFlowMeterOption?: FlowMeterColorItemType[] // 方形水球图颜色配置数据暂定any
104   - thermometerOption?: any// 温度计数据暂定any
  104 +
105 105 }
106 106
107 107 export interface DeviceCommandListItemType {
... ...
... ... @@ -5,7 +5,6 @@ import { DataSourceForm } from '@/core/Library/components/PublicForm/components/
5 5 import { useNodeData } from '@/core/Library/hook/useNodeData'
6 6 import { useMessage } from '@/hooks/web/useMessage'
7 7 import type { ConfigComponentProps } from '@/core/Library/types'
8   -import type { NodeDataDataSourceJsonType } from '@/api/node/model'
9 8 import { useSavePageContent } from '@/core/Library/hook/useSavePageContent'
10 9
11 10 const props = defineProps<ConfigComponentProps>()
... ... @@ -16,7 +15,7 @@ const loading = ref(false)
16 15
17 16 const dataSourceFormRef = ref<Nullable<InstanceType<typeof DataSourceForm>>>(null)
18 17
19   -const nodeDataActinType = useNodeData({ cell: props.cell!, immediate: true })
  18 +const nodeDataActinType = useNodeData({ cell: props.cell!, immediate: false })
20 19
21 20 const { getNodeAllData, saveNodeAllData, getNodeData } = nodeDataActinType
22 21
... ... @@ -38,11 +37,9 @@ const handleSubmit = async () => {
38 37
39 38 onMounted(async () => {
40 39 await getNodeAllData()
41   - if (unref(getNodeData)?.dataSourceJson) {
42   - const { thermometerOption } = unref(getNodeData)?.dataSourceJson as NodeDataDataSourceJsonType
43   - if (!thermometerOption) return
44   - dataSourceFormRef.value?.setFieldsValue(thermometerOption)
45   - }
  40 + const { dataSourceJson } = unref(getNodeData) || {}
  41 + if (dataSourceJson)
  42 + dataSourceFormRef.value?.setFieldsValue(dataSourceJson)
46 43 })
47 44 </script>
48 45
... ...