Commit c78fb78e5edc5bf75b198887c210e758eba8b344
Merge branch 'fix/template-mode-data-effect' into 'main_dev'
fix: 修复组态在创建模版时数据动效未将设备Id置为空 See merge request yunteng/thingskit-scada!180
Showing
2 changed files
with
7 additions
and
1 deletions
@@ -162,7 +162,7 @@ export interface RangeItemType { | @@ -162,7 +162,7 @@ export interface RangeItemType { | ||
162 | } | 162 | } |
163 | 163 | ||
164 | export interface BasicActDataType { | 164 | export interface BasicActDataType { |
165 | - deviceId?: string | 165 | + deviceId?: Nullable<string> |
166 | attr?: string | 166 | attr?: string |
167 | enable?: boolean | 167 | enable?: boolean |
168 | deviceProfileId?: string | number | 168 | deviceProfileId?: string | number |
@@ -7,9 +7,12 @@ import type { ModalProps } from '@/components/Modal' | @@ -7,9 +7,12 @@ import type { ModalProps } from '@/components/Modal' | ||
7 | import { BasicModal, useModalInner } from '@/components/Modal' | 7 | import { BasicModal, useModalInner } from '@/components/Modal' |
8 | import { DataSourceTypeEnum } from '@/enums/datasource' | 8 | import { DataSourceTypeEnum } from '@/enums/datasource' |
9 | import type { NodeDataActJsonType, NodeDataEventJsonType } from '@/api/node/model' | 9 | import type { NodeDataActJsonType, NodeDataEventJsonType } from '@/api/node/model' |
10 | +import { useContentDataStoreWithOut } from '@/store/modules/contentData' | ||
10 | 11 | ||
11 | defineEmits(['register']) | 12 | defineEmits(['register']) |
12 | 13 | ||
14 | +const contentDataStore = useContentDataStoreWithOut() | ||
15 | + | ||
13 | const { getNodeData, getNodeAllData, saveNodeAllData } = usePublicFormContext() | 16 | const { getNodeData, getNodeAllData, saveNodeAllData } = usePublicFormContext() |
14 | 17 | ||
15 | const contentComponent = shallowRef() | 18 | const contentComponent = shallowRef() |
@@ -39,6 +42,9 @@ const handleDoSaveActData = async () => { | @@ -39,6 +42,9 @@ const handleDoSaveActData = async () => { | ||
39 | const { event } = unref(componentProps)! | 42 | const { event } = unref(componentProps)! |
40 | const { actJson } = toRaw(unref(getNodeData)) || {} | 43 | const { actJson } = toRaw(unref(getNodeData)) || {} |
41 | const value = unref(componentInstance)?.getFieldsValue() | 44 | const value = unref(componentInstance)?.getFieldsValue() |
45 | + | ||
46 | + if (contentDataStore.getIsTemplate) value.deviceId = null | ||
47 | + | ||
42 | await saveNodeAllData({ ...toRaw(unref(getNodeData)), actJson: { ...(actJson || {} as NodeDataActJsonType), [event]: value } }) | 48 | await saveNodeAllData({ ...toRaw(unref(getNodeData)), actJson: { ...(actJson || {} as NodeDataActJsonType), [event]: value } }) |
43 | } | 49 | } |
44 | 50 |