Commit df64f3a0bdb838fc5d7e8255f46112ec19e0ce10

Authored by dev001
1 parent 0686d4ea

perf: 优化组态引用模板,查询设备接口变更

@@ -20,7 +20,7 @@ enum Api { @@ -20,7 +20,7 @@ enum Api {
20 GEN_MODBUS_COMMAND = '/js/modbus', 20 GEN_MODBUS_COMMAND = '/js/modbus',
21 GET_DEVICE_DETAIL = '/device/', // 获取设备详情 21 GET_DEVICE_DETAIL = '/device/', // 获取设备详情
22 22
23 - GET_LIST_BY_CONFIGURATION_ID = '/getListByConfigurationId', 23 + GET_LIST_BY_CONFIGURATION_ID = '/configuration/center/getListByConfigurationId',
24 } 24 }
25 25
26 export interface GenModbusCommandType { 26 export interface GenModbusCommandType {
@@ -135,8 +135,7 @@ export const getDeviceInfo = (deviceId: string) => { @@ -135,8 +135,7 @@ export const getDeviceInfo = (deviceId: string) => {
135 } 135 }
136 136
137 export const getListByConfigurationId = (configurationId: string) => { 137 export const getListByConfigurationId = (configurationId: string) => {
138 - return defHttp.get({  
139 - url: Api.GET_LIST_BY_CONFIGURATION_ID,  
140 - params: { configurationId }, 138 + return defHttp.post({
  139 + url: `${Api.GET_LIST_BY_CONFIGURATION_ID}?configurationId=${configurationId}`,
141 }) 140 })
142 } 141 }
@@ -19,9 +19,13 @@ import { useContentDataStore } from '@/store/modules/contentData' @@ -19,9 +19,13 @@ import { useContentDataStore } from '@/store/modules/contentData'
19 import { useJsonParse } from '@/hooks/business/useJSONParse' 19 import { useJsonParse } from '@/hooks/business/useJSONParse'
20 import type { DeviceCommandListItemType, MouseDownEventDataType } from '@/api/node/model' 20 import type { DeviceCommandListItemType, MouseDownEventDataType } from '@/api/node/model'
21 import type { ProductAndDevice } from '@/api/content/model' 21 import type { ProductAndDevice } from '@/api/content/model'
  22 +import { useParseParams } from '@/core/LoadData'
22 23
23 const props = defineProps<{ event: EventTypeEnum }>() 24 const props = defineProps<{ event: EventTypeEnum }>()
24 25
  26 +const params = useParseParams()
  27 +const { configurationId } = params
  28 +
25 const contentDataStore = useContentDataStore() 29 const contentDataStore = useContentDataStore()
26 const validateTable = ref<boolean>(false) 30 const validateTable = ref<boolean>(false)
27 31
@@ -73,7 +77,7 @@ async function getDeviceList() { @@ -73,7 +77,7 @@ async function getDeviceList() {
73 const organizationId = window.useParseParams().organizationId 77 const organizationId = window.useParseParams().organizationId
74 if (!organizationId) return 78 if (!organizationId) return
75 const productIds = unref(contentDataStore.getProductIds) 79 const productIds = unref(contentDataStore.getProductIds)
76 - const result = unref(contentDataStore.getIsTemplateLink) ? await getListByConfigurationId(unref(contentDataStore.configurationId)!) : await getListByDeviceProfileIds({ deviceProfileIds: productIds || [], organizationId }) 80 + const result = unref(contentDataStore.getIsTemplateLink) ? await getListByConfigurationId(configurationId!) : await getListByDeviceProfileIds({ deviceProfileIds: productIds || [], organizationId })
77 deviceList.value = result.map(item => ({ 81 deviceList.value = result.map(item => ({
78 ...item, 82 ...item,
79 label: item.alias || item.name, 83 label: item.alias || item.name,
@@ -7,12 +7,14 @@ import { ContentDataFieldsEnum, ContentDataFieldsNameEnum, DataTypeEnum } from ' @@ -7,12 +7,14 @@ import { ContentDataFieldsEnum, ContentDataFieldsNameEnum, DataTypeEnum } from '
7 import { useContentDataStoreWithOut } from '@/store/modules/contentData' 7 import { useContentDataStoreWithOut } from '@/store/modules/contentData'
8 import type { ProductAndDevice } from '@/api/content/model' 8 import type { ProductAndDevice } from '@/api/content/model'
9 import { ControlComponentEnum } from '@/core/Library/packages/Control' 9 import { ControlComponentEnum } from '@/core/Library/packages/Control'
  10 +import { useParseParams } from '@/core/LoadData'
10 11
11 const contentDataStore = useContentDataStoreWithOut() 12 const contentDataStore = useContentDataStoreWithOut()
12 export const formSchemas = (componentKey?: string): FormSchema[] => { 13 export const formSchemas = (componentKey?: string): FormSchema[] => {
13 const isTemplate = contentDataStore.isTemplate // 判断是否是模板组态 14 const isTemplate = contentDataStore.isTemplate // 判断是否是模板组态
14 const isTemplateLink = contentDataStore.getIsTemplateLink 15 const isTemplateLink = contentDataStore.getIsTemplateLink
15 - const configurationId = contentDataStore.configurationId 16 + const params = useParseParams()
  17 + const { configurationId } = params
16 return [ 18 return [
17 { 19 {
18 field: ContentDataFieldsEnum.DEVICE_PROFILE_ID, 20 field: ContentDataFieldsEnum.DEVICE_PROFILE_ID,