Commit b3f380e743355a066b118128417833ff5ea40317
1 parent
bb028e90
fix: device list create device search sensor device carry dataType field
Showing
5 changed files
with
18 additions
and
13 deletions
| @@ -170,8 +170,8 @@ export const getShareBoardComponentInfo = (params: { boardId: string; tenantId: | @@ -170,8 +170,8 @@ export const getShareBoardComponentInfo = (params: { boardId: string; tenantId: | ||
| 170 | */ | 170 | */ |
| 171 | export const getAllDeviceByOrg = (organizationId: string, deviceProfileId?: string) => { | 171 | export const getAllDeviceByOrg = (organizationId: string, deviceProfileId?: string) => { |
| 172 | return defHttp.get<MasterDeviceList[]>({ | 172 | return defHttp.get<MasterDeviceList[]>({ |
| 173 | - url: `${DeviceUrl.GET_DEVICE_MASTER}/${organizationId}`, | ||
| 174 | - params: { deviceProfileId }, | 173 | + url: DeviceUrl.GET_DEVICE_MASTER, |
| 174 | + params: { deviceProfileId, organizationId }, | ||
| 175 | }); | 175 | }); |
| 176 | }; | 176 | }; |
| 177 | 177 |
| @@ -5,6 +5,7 @@ import { | @@ -5,6 +5,7 @@ import { | ||
| 5 | DeviceProfileModel, | 5 | DeviceProfileModel, |
| 6 | DeviceProfileQueryParam, | 6 | DeviceProfileQueryParam, |
| 7 | DeviceQueryParam, | 7 | DeviceQueryParam, |
| 8 | + DeviceTypeEnum, | ||
| 8 | } from '/@/api/device/model/deviceModel'; | 9 | } from '/@/api/device/model/deviceModel'; |
| 9 | import { ChildDeviceParams } from './model/deviceModel'; | 10 | import { ChildDeviceParams } from './model/deviceModel'; |
| 10 | import { PaginationResult } from '/#/axios'; | 11 | import { PaginationResult } from '/#/axios'; |
| @@ -183,10 +184,17 @@ export const cancelDispatchCustomer = (data) => { | @@ -183,10 +184,17 @@ export const cancelDispatchCustomer = (data) => { | ||
| 183 | }; | 184 | }; |
| 184 | 185 | ||
| 185 | // 获取组织下的的所有网关设备 | 186 | // 获取组织下的的所有网关设备 |
| 186 | -export const getGATEWAYdevice = async (params: { organization: string }) => { | 187 | +export const getGATEWAYdevice = async (params: { |
| 188 | + organizationId: string; | ||
| 189 | + deviceType: DeviceTypeEnum.GATEWAY; | ||
| 190 | +}) => { | ||
| 191 | + const { organizationId, deviceType } = params; | ||
| 187 | const res = await defHttp.get({ | 192 | const res = await defHttp.get({ |
| 188 | - url: `/device/list/GATEWAY`, | ||
| 189 | - params, | 193 | + url: `/device/list`, |
| 194 | + params: { | ||
| 195 | + organizationId, | ||
| 196 | + deviceType, | ||
| 197 | + }, | ||
| 190 | }); | 198 | }); |
| 191 | return Promise.resolve<{ label: string; value: string }[]>( | 199 | return Promise.resolve<{ label: string; value: string }[]>( |
| 192 | res.map((item) => ({ label: item.name, value: item.tbDeviceId })) | 200 | res.map((item) => ({ label: item.name, value: item.tbDeviceId })) |
| @@ -125,7 +125,6 @@ export const step1Schemas: FormSchema[] = [ | @@ -125,7 +125,6 @@ export const step1Schemas: FormSchema[] = [ | ||
| 125 | }, | 125 | }, |
| 126 | ifShow: ({ values }) => isGateWay(values.deviceType), | 126 | ifShow: ({ values }) => isGateWay(values.deviceType), |
| 127 | }, | 127 | }, |
| 128 | - | ||
| 129 | { | 128 | { |
| 130 | field: 'organizationId', | 129 | field: 'organizationId', |
| 131 | label: '所属组织', | 130 | label: '所属组织', |
| @@ -140,12 +139,13 @@ export const step1Schemas: FormSchema[] = [ | @@ -140,12 +139,13 @@ export const step1Schemas: FormSchema[] = [ | ||
| 140 | component: 'ApiSelect', | 139 | component: 'ApiSelect', |
| 141 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, | 140 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, |
| 142 | componentProps: ({ formModel }) => { | 141 | componentProps: ({ formModel }) => { |
| 143 | - const { organizationId } = formModel; | 142 | + const { organizationId, deviceType } = formModel; |
| 144 | return { | 143 | return { |
| 145 | api: getGATEWAYdevice, | 144 | api: getGATEWAYdevice, |
| 146 | showSearch: true, | 145 | showSearch: true, |
| 147 | params: { | 146 | params: { |
| 148 | organizationId, | 147 | organizationId, |
| 148 | + deviceType, | ||
| 149 | }, | 149 | }, |
| 150 | }; | 150 | }; |
| 151 | }, | 151 | }, |
| @@ -95,10 +95,8 @@ | @@ -95,10 +95,8 @@ | ||
| 95 | const validateMapComponent = async (dataSource: Record<DataSourceField, string>[]) => { | 95 | const validateMapComponent = async (dataSource: Record<DataSourceField, string>[]) => { |
| 96 | if (dataSource.length) { | 96 | if (dataSource.length) { |
| 97 | const firstRecord = dataSource.at(0)!; | 97 | const firstRecord = dataSource.at(0)!; |
| 98 | - const { deviceId, slaveDeviceId } = firstRecord; | ||
| 99 | - const flag = dataSource.every( | ||
| 100 | - (item) => item.deviceId === deviceId && item.slaveDeviceId === slaveDeviceId | ||
| 101 | - ); | 98 | + const { deviceId } = firstRecord; |
| 99 | + const flag = dataSource.every((item) => item.deviceId === deviceId); | ||
| 102 | if (!flag) { | 100 | if (!flag) { |
| 103 | createMessage.warning('地图组件绑定的数据源应该一致'); | 101 | createMessage.warning('地图组件绑定的数据源应该一致'); |
| 104 | return Promise.reject(false); | 102 | return Promise.reject(false); |
| @@ -252,7 +252,6 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | @@ -252,7 +252,6 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | ||
| 252 | componentProps({ formModel }) { | 252 | componentProps({ formModel }) { |
| 253 | const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID]; | 253 | const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID]; |
| 254 | const transportType = formModel[DataSourceField.TRANSPORT_TYPE]; | 254 | const transportType = formModel[DataSourceField.TRANSPORT_TYPE]; |
| 255 | - | ||
| 256 | return { | 255 | return { |
| 257 | api: async () => { | 256 | api: async () => { |
| 258 | try { | 257 | try { |
| @@ -281,7 +280,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | @@ -281,7 +280,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => { | ||
| 281 | { | 280 | { |
| 282 | field: DataSourceField.DEVICE_RENAME, | 281 | field: DataSourceField.DEVICE_RENAME, |
| 283 | component: 'Input', | 282 | component: 'Input', |
| 284 | - label: '设备', | 283 | + label: '设备名', |
| 285 | colProps: { span: 8 }, | 284 | colProps: { span: 8 }, |
| 286 | componentProps: { | 285 | componentProps: { |
| 287 | placeholder: '设备重命名', | 286 | placeholder: '设备重命名', |