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