Showing
5 changed files
with
23 additions
and
8 deletions
| @@ -5,10 +5,13 @@ import { isString } from '/@/utils/is'; | @@ -5,10 +5,13 @@ import { isString } from '/@/utils/is'; | ||
| 5 | import { OrderByEnum } from '/@/views/device/localtion/cpns/TimePeriodForm/config'; | 5 | import { OrderByEnum } from '/@/views/device/localtion/cpns/TimePeriodForm/config'; | 
| 6 | 6 | ||
| 7 | // 获取设备配置,很多地方使用,不能修改这里 | 7 | // 获取设备配置,很多地方使用,不能修改这里 | 
| 8 | -export const getDeviceProfile = (deviceType?: string) => { | 8 | +export const getDeviceProfile = (deviceType?: string, isSceneLinkage?: Boolean) => { | 
| 9 | return defHttp.get<DeviceProfileModel[]>({ | 9 | return defHttp.get<DeviceProfileModel[]>({ | 
| 10 | url: '/device_profile/me/list', | 10 | url: '/device_profile/me/list', | 
| 11 | - params: { deviceType: isString(deviceType) ? deviceType : undefined }, | 11 | + params: { | 
| 12 | + deviceType: isString(deviceType) ? deviceType : undefined, | ||
| 13 | + isSceneLinkage: isSceneLinkage ? isSceneLinkage : undefined, | ||
| 14 | + }, | ||
| 12 | }); | 15 | }); | 
| 13 | }; | 16 | }; | 
| 14 | 17 | 
| @@ -125,11 +125,16 @@ export const getAttribute = (orgId) => { | @@ -125,11 +125,16 @@ export const getAttribute = (orgId) => { | ||
| 125 | export const byOrganizationIdGetMasterDevice = (params: { | 125 | export const byOrganizationIdGetMasterDevice = (params: { | 
| 126 | organizationId: string; | 126 | organizationId: string; | 
| 127 | deviceProfileId?: string; | 127 | deviceProfileId?: string; | 
| 128 | + isSceneLinkage?: Boolean; | ||
| 128 | }) => { | 129 | }) => { | 
| 129 | - const { organizationId, deviceProfileId } = params; | 130 | + const { organizationId, deviceProfileId, isSceneLinkage } = params; | 
| 130 | return defHttp.get<DeviceModel[]>({ | 131 | return defHttp.get<DeviceModel[]>({ | 
| 131 | url: `${ScreenManagerApi.MASTER_GET_DEVICE}`, | 132 | url: `${ScreenManagerApi.MASTER_GET_DEVICE}`, | 
| 132 | - params: { deviceProfileId, organizationId }, | 133 | + params: { | 
| 134 | + deviceProfileId, | ||
| 135 | + organizationId, | ||
| 136 | + isSceneLinkage: isSceneLinkage ? isSceneLinkage : undefined, | ||
| 137 | + }, | ||
| 133 | }); | 138 | }); | 
| 134 | }; | 139 | }; | 
| 135 | //TODO-fengtao | 140 | //TODO-fengtao | 
| @@ -217,7 +217,7 @@ export const getFormSchemas = (hasAlarmNotify: Ref<boolean>): FormSchema[] => { | @@ -217,7 +217,7 @@ export const getFormSchemas = (hasAlarmNotify: Ref<boolean>): FormSchema[] => { | ||
| 217 | const { setFieldsValue } = formActionType; | 217 | const { setFieldsValue } = formActionType; | 
| 218 | return { | 218 | return { | 
| 219 | api: async () => { | 219 | api: async () => { | 
| 220 | - return await getDeviceProfile(deviceType); | 220 | + return await getDeviceProfile(deviceType, true); | 
| 221 | }, | 221 | }, | 
| 222 | labelField: 'name', | 222 | labelField: 'name', | 
| 223 | valueField: 'id', | 223 | valueField: 'id', | 
| @@ -283,7 +283,10 @@ export const getFormSchemas = (hasAlarmNotify: Ref<boolean>): FormSchema[] => { | @@ -283,7 +283,10 @@ export const getFormSchemas = (hasAlarmNotify: Ref<boolean>): FormSchema[] => { | ||
| 283 | return { | 283 | return { | 
| 284 | api: async (params: Record<'organizationId' | 'deviceProfileId', string>) => { | 284 | api: async (params: Record<'organizationId' | 'deviceProfileId', string>) => { | 
| 285 | if (params.deviceProfileId && params.organizationId) { | 285 | if (params.deviceProfileId && params.organizationId) { | 
| 286 | - const result = await byOrganizationIdGetMasterDevice(params); | 286 | + const result = await byOrganizationIdGetMasterDevice({ | 
| 287 | + ...params, | ||
| 288 | + isSceneLinkage: true, | ||
| 289 | + }); | ||
| 287 | if (result) { | 290 | if (result) { | 
| 288 | return result.map((item) => ({ | 291 | return result.map((item) => ({ | 
| 289 | ...item, | 292 | ...item, | 
| @@ -147,7 +147,7 @@ export const getFormSchemas = ( | @@ -147,7 +147,7 @@ export const getFormSchemas = ( | ||
| 147 | const { setFieldsValue } = formActionType; | 147 | const { setFieldsValue } = formActionType; | 
| 148 | return { | 148 | return { | 
| 149 | api: async () => { | 149 | api: async () => { | 
| 150 | - return await getDeviceProfile(deviceType); | 150 | + return await getDeviceProfile(deviceType, true); | 
| 151 | }, | 151 | }, | 
| 152 | labelField: 'name', | 152 | labelField: 'name', | 
| 153 | valueField: 'id', | 153 | valueField: 'id', | 
| @@ -251,7 +251,10 @@ export const getFormSchemas = ( | @@ -251,7 +251,10 @@ export const getFormSchemas = ( | ||
| 251 | return { | 251 | return { | 
| 252 | api: async (params: Record<'organizationId' | 'deviceProfileId', string>) => { | 252 | api: async (params: Record<'organizationId' | 'deviceProfileId', string>) => { | 
| 253 | if (params.deviceProfileId && params.organizationId) { | 253 | if (params.deviceProfileId && params.organizationId) { | 
| 254 | - const result = await byOrganizationIdGetMasterDevice(params); | 254 | + const result = await byOrganizationIdGetMasterDevice({ | 
| 255 | + ...params, | ||
| 256 | + isSceneLinkage: true, | ||
| 257 | + }); | ||
| 255 | if (result) { | 258 | if (result) { | 
| 256 | return result.map((item) => ({ | 259 | return result.map((item) => ({ | 
| 257 | ...item, | 260 | ...item, |