Showing
5 changed files
with
19 additions
and
3 deletions
@@ -24,6 +24,7 @@ export interface ConfigurationContentType { | @@ -24,6 +24,7 @@ export interface ConfigurationContentType { | ||
24 | productIds?: string[] | 24 | productIds?: string[] |
25 | isTemplate?: string | number | 25 | isTemplate?: string | number |
26 | productAndDevice?: ProductAndDevice[] | 26 | productAndDevice?: ProductAndDevice[] |
27 | + templateId?: string | ||
27 | } | 28 | } |
28 | 29 | ||
29 | export interface ConfigurationContentListItemType { | 30 | export interface ConfigurationContentListItemType { |
@@ -73,7 +73,7 @@ async function getDeviceList() { | @@ -73,7 +73,7 @@ async function getDeviceList() { | ||
73 | const organizationId = window.useParseParams().organizationId | 73 | const organizationId = window.useParseParams().organizationId |
74 | if (!organizationId) return | 74 | if (!organizationId) return |
75 | const productIds = unref(contentDataStore.getProductIds) | 75 | const productIds = unref(contentDataStore.getProductIds) |
76 | - const result = await getListByDeviceProfileIds({ deviceProfileIds: productIds || [], organizationId }) | 76 | + const result = unref(contentDataStore.getIsTemplateLink) ? [] : await getListByDeviceProfileIds({ deviceProfileIds: productIds || [], organizationId }) |
77 | deviceList.value = result.map(item => ({ | 77 | deviceList.value = result.map(item => ({ |
78 | ...item, | 78 | ...item, |
79 | label: item.alias || item.name, | 79 | label: item.alias || item.name, |
@@ -11,6 +11,7 @@ import { ControlComponentEnum } from '@/core/Library/packages/Control' | @@ -11,6 +11,7 @@ import { ControlComponentEnum } from '@/core/Library/packages/Control' | ||
11 | const contentDataStore = useContentDataStoreWithOut() | 11 | const contentDataStore = useContentDataStoreWithOut() |
12 | export const formSchemas = (componentKey?: string): FormSchema[] => { | 12 | export const formSchemas = (componentKey?: string): FormSchema[] => { |
13 | const isTemplate = contentDataStore.isTemplate // 判断是否是模板组态 | 13 | const isTemplate = contentDataStore.isTemplate // 判断是否是模板组态 |
14 | + const isTemplateLink = contentDataStore.getIsTemplateLink | ||
14 | return [ | 15 | return [ |
15 | { | 16 | { |
16 | field: ContentDataFieldsEnum.DEVICE_PROFILE_ID, | 17 | field: ContentDataFieldsEnum.DEVICE_PROFILE_ID, |
@@ -47,7 +48,10 @@ export const formSchemas = (componentKey?: string): FormSchema[] => { | @@ -47,7 +48,10 @@ export const formSchemas = (componentKey?: string): FormSchema[] => { | ||
47 | if (!organizationId) return | 48 | if (!organizationId) return |
48 | return { | 49 | return { |
49 | showSearch: true, | 50 | showSearch: true, |
50 | - api: getListByDeviceProfileIds, | 51 | + api: async (params: Recordable) => { |
52 | + if (isTemplateLink) return [] | ||
53 | + return await getListByDeviceProfileIds(params) | ||
54 | + }, | ||
51 | params: { | 55 | params: { |
52 | deviceProfileIds: unref(contentDataStore.getProductIds), | 56 | deviceProfileIds: unref(contentDataStore.getProductIds), |
53 | organizationId, | 57 | organizationId, |
@@ -46,9 +46,10 @@ export function useContentData() { | @@ -46,9 +46,10 @@ export function useContentData() { | ||
46 | const result = mode === PageModeEnum.SHARE ? await shareModeBootstrap() : await getContent() | 46 | const result = mode === PageModeEnum.SHARE ? await shareModeBootstrap() : await getContent() |
47 | 47 | ||
48 | if (result) { | 48 | if (result) { |
49 | - const { productAndDevice, nodelist, isTemplate } = result | 49 | + const { productAndDevice, nodelist, isTemplate, templateId } = result |
50 | if (nodelist) contentDataStore.saveContentData(nodelist) | 50 | if (nodelist) contentDataStore.saveContentData(nodelist) |
51 | if (isTemplate) contentDataStore.setIsTemplate(isTemplate) | 51 | if (isTemplate) contentDataStore.setIsTemplate(isTemplate) |
52 | + if (templateId) contentDataStore.setIsTemplateLink(templateId) | ||
52 | if (productAndDevice) contentDataStore.setProductAndDevice(productAndDevice) | 53 | if (productAndDevice) contentDataStore.setProductAndDevice(productAndDevice) |
53 | } | 54 | } |
54 | return result | 55 | return result |
@@ -23,6 +23,8 @@ interface ContentDataStoreType { | @@ -23,6 +23,8 @@ interface ContentDataStoreType { | ||
23 | diveceDetailMap: Record<string, DeviceList> | 23 | diveceDetailMap: Record<string, DeviceList> |
24 | hasDesignAuth?: boolean | 24 | hasDesignAuth?: boolean |
25 | hasPerviewAuth?: boolean | 25 | hasPerviewAuth?: boolean |
26 | + isTemplateLink?: boolean | ||
27 | + | ||
26 | } | 28 | } |
27 | 29 | ||
28 | export const useContentDataStore = defineStore('app-content-data', { | 30 | export const useContentDataStore = defineStore('app-content-data', { |
@@ -36,6 +38,7 @@ export const useContentDataStore = defineStore('app-content-data', { | @@ -36,6 +38,7 @@ export const useContentDataStore = defineStore('app-content-data', { | ||
36 | diveceDetailMap: {}, | 38 | diveceDetailMap: {}, |
37 | hasDesignAuth: true, | 39 | hasDesignAuth: true, |
38 | hasPerviewAuth: true, | 40 | hasPerviewAuth: true, |
41 | + isTemplateLink: true, | ||
39 | }), | 42 | }), |
40 | actions: { | 43 | actions: { |
41 | 44 | ||
@@ -61,6 +64,10 @@ export const useContentDataStore = defineStore('app-content-data', { | @@ -61,6 +64,10 @@ export const useContentDataStore = defineStore('app-content-data', { | ||
61 | this.isTemplate = string | 64 | this.isTemplate = string |
62 | }, | 65 | }, |
63 | 66 | ||
67 | + setIsTemplateLink(string?: string) { | ||
68 | + this.isTemplateLink = !!string | ||
69 | + }, | ||
70 | + | ||
64 | setProductAndDevice(list: ProductAndDevice[]) { | 71 | setProductAndDevice(list: ProductAndDevice[]) { |
65 | this.productAndDevice = list | 72 | this.productAndDevice = list |
66 | this.doBuildDeviceMap() | 73 | this.doBuildDeviceMap() |
@@ -103,6 +110,9 @@ export const useContentDataStore = defineStore('app-content-data', { | @@ -103,6 +110,9 @@ export const useContentDataStore = defineStore('app-content-data', { | ||
103 | getIsTemplate(): number | null | string | undefined { | 110 | getIsTemplate(): number | null | string | undefined { |
104 | return this.isTemplate | 111 | return this.isTemplate |
105 | }, | 112 | }, |
113 | + getIsTemplateLink(): boolean { | ||
114 | + return !!this.isTemplateLink | ||
115 | + }, | ||
106 | }, | 116 | }, |
107 | }) | 117 | }) |
108 | 118 |