Commit c78fb78e5edc5bf75b198887c210e758eba8b344

Authored by xp.Huang
2 parents a201616e 2ad418e5

Merge branch 'fix/template-mode-data-effect' into 'main_dev'

fix: 修复组态在创建模版时数据动效未将设备Id置为空

See merge request yunteng/thingskit-scada!180
... ... @@ -162,7 +162,7 @@ export interface RangeItemType {
162 162 }
163 163
164 164 export interface BasicActDataType {
165   - deviceId?: string
  165 + deviceId?: Nullable<string>
166 166 attr?: string
167 167 enable?: boolean
168 168 deviceProfileId?: string | number
... ...
... ... @@ -7,9 +7,12 @@ import type { ModalProps } from '@/components/Modal'
7 7 import { BasicModal, useModalInner } from '@/components/Modal'
8 8 import { DataSourceTypeEnum } from '@/enums/datasource'
9 9 import type { NodeDataActJsonType, NodeDataEventJsonType } from '@/api/node/model'
  10 +import { useContentDataStoreWithOut } from '@/store/modules/contentData'
10 11
11 12 defineEmits(['register'])
12 13
  14 +const contentDataStore = useContentDataStoreWithOut()
  15 +
13 16 const { getNodeData, getNodeAllData, saveNodeAllData } = usePublicFormContext()
14 17
15 18 const contentComponent = shallowRef()
... ... @@ -39,6 +42,9 @@ const handleDoSaveActData = async () => {
39 42 const { event } = unref(componentProps)!
40 43 const { actJson } = toRaw(unref(getNodeData)) || {}
41 44 const value = unref(componentInstance)?.getFieldsValue()
  45 +
  46 + if (contentDataStore.getIsTemplate) value.deviceId = null
  47 +
42 48 await saveNodeAllData({ ...toRaw(unref(getNodeData)), actJson: { ...(actJson || {} as NodeDataActJsonType), [event]: value } })
43 49 }
44 50
... ...