Commit 1710a222e5e9145a75987f73ae7bf358ee62d71d
1 parent
b3f380e7
fix: device list create device select tcp sensor device only select gateway device
Showing
4 changed files
with
33 additions
and
8 deletions
@@ -14,9 +14,9 @@ VITE_PUBLIC_PATH = / | @@ -14,9 +14,9 @@ VITE_PUBLIC_PATH = / | ||
14 | # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | 14 | # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] |
15 | # 线上测试环境 | 15 | # 线上测试环境 |
16 | # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] | 16 | # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] |
17 | -VITE_PROXY = [["/api","http://222.180.200.114:48080/api"],["/thingskit-drawio","http://localhost:3000/"]] | 17 | +# VITE_PROXY = [["/api","http://222.180.200.114:48080/api"],["/thingskit-drawio","http://localhost:3000/"]] |
18 | # VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] | 18 | # VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] |
19 | -# VITE_PROXY = [["/api","http://192.168.10.103:8080/api"],["/thingskit-drawio","http://192.168.10.136:8080/api"]] | 19 | +VITE_PROXY = [["/api","http://192.168.10.114:8080/api"],["/thingskit-drawio","http://192.168.10.136:8080/api"]] |
20 | 20 | ||
21 | # 实时数据的ws地址 | 21 | # 实时数据的ws地址 |
22 | # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token= | 22 | # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token= |
@@ -5,6 +5,7 @@ import { | @@ -5,6 +5,7 @@ import { | ||
5 | DeviceProfileModel, | 5 | DeviceProfileModel, |
6 | DeviceProfileQueryParam, | 6 | DeviceProfileQueryParam, |
7 | DeviceQueryParam, | 7 | DeviceQueryParam, |
8 | + DeviceRecord, | ||
8 | DeviceTypeEnum, | 9 | DeviceTypeEnum, |
9 | } from '/@/api/device/model/deviceModel'; | 10 | } from '/@/api/device/model/deviceModel'; |
10 | import { ChildDeviceParams } from './model/deviceModel'; | 11 | import { ChildDeviceParams } from './model/deviceModel'; |
@@ -28,6 +29,8 @@ enum DeviceManagerApi { | @@ -28,6 +29,8 @@ enum DeviceManagerApi { | ||
28 | COMMAND_ISSUANCE = '/rpc', | 29 | COMMAND_ISSUANCE = '/rpc', |
29 | 30 | ||
30 | DEVICE_ATTR = '/device/attributes', | 31 | DEVICE_ATTR = '/device/attributes', |
32 | + | ||
33 | + GATEWAY_DEVICE = '/device/gateway/list', | ||
31 | } | 34 | } |
32 | 35 | ||
33 | export const devicePage = (params: DeviceQueryParam) => { | 36 | export const devicePage = (params: DeviceQueryParam) => { |
@@ -201,6 +204,17 @@ export const getGATEWAYdevice = async (params: { | @@ -201,6 +204,17 @@ export const getGATEWAYdevice = async (params: { | ||
201 | ); | 204 | ); |
202 | }; | 205 | }; |
203 | 206 | ||
207 | +export const getGatewayDevice = (params: Record<'organizationId' | 'transportType', string>) => { | ||
208 | + const { organizationId, transportType } = params; | ||
209 | + return defHttp.get<DeviceRecord[]>({ | ||
210 | + url: DeviceManagerApi.GATEWAY_DEVICE, | ||
211 | + params: { | ||
212 | + organizationId, | ||
213 | + transportType, | ||
214 | + }, | ||
215 | + }); | ||
216 | +}; | ||
217 | + | ||
204 | // 获取网关设备 | 218 | // 获取网关设备 |
205 | export const getGATEWAY = (tbDeviceId: string) => { | 219 | export const getGATEWAY = (tbDeviceId: string) => { |
206 | return defHttp.get({ | 220 | return defHttp.get({ |
@@ -82,9 +82,9 @@ | @@ -82,9 +82,9 @@ | ||
82 | if (next) { | 82 | if (next) { |
83 | const value = next[valueField]; | 83 | const value = next[valueField]; |
84 | prev.push({ | 84 | prev.push({ |
85 | + ...omit(next, [labelField, valueField]), | ||
85 | label: next[labelField], | 86 | label: next[labelField], |
86 | value: numberToString ? `${value}` : value, | 87 | value: numberToString ? `${value}` : value, |
87 | - ...omit(next, [labelField, valueField]), | ||
88 | }); | 88 | }); |
89 | } | 89 | } |
90 | return prev; | 90 | return prev; |
1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
2 | import { findDictItemByCode } from '/@/api/system/dict'; | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | -import { deviceProfile, getGATEWAYdevice } from '/@/api/device/deviceManager'; | 3 | +import { deviceProfile, getGatewayDevice } from '/@/api/device/deviceManager'; |
4 | 4 | ||
5 | export enum TypeEnum { | 5 | export enum TypeEnum { |
6 | IS_GATEWAY = 'GATEWAY', | 6 | IS_GATEWAY = 'GATEWAY', |
@@ -73,7 +73,12 @@ export const step1Schemas: FormSchema[] = [ | @@ -73,7 +73,12 @@ export const step1Schemas: FormSchema[] = [ | ||
73 | option: { deviceType: string; transportType: string; id: string } | 73 | option: { deviceType: string; transportType: string; id: string } |
74 | ) { | 74 | ) { |
75 | const { deviceType, transportType, id } = option; | 75 | const { deviceType, transportType, id } = option; |
76 | - setFieldsValue({ deviceType: deviceType, transportType, deviceProfileId: id }); | 76 | + setFieldsValue({ |
77 | + deviceType: deviceType, | ||
78 | + transportType, | ||
79 | + deviceProfileId: id, | ||
80 | + gatewayId: null, | ||
81 | + }); | ||
77 | }, | 82 | }, |
78 | }; | 83 | }; |
79 | }, | 84 | }, |
@@ -139,14 +144,20 @@ export const step1Schemas: FormSchema[] = [ | @@ -139,14 +144,20 @@ export const step1Schemas: FormSchema[] = [ | ||
139 | component: 'ApiSelect', | 144 | component: 'ApiSelect', |
140 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, | 145 | ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId, |
141 | componentProps: ({ formModel }) => { | 146 | componentProps: ({ formModel }) => { |
142 | - const { organizationId, deviceType } = formModel; | 147 | + const { organizationId, transportType } = formModel; |
143 | return { | 148 | return { |
144 | - api: getGATEWAYdevice, | 149 | + // api: async (params: Record<'transportType' | 'organizationId', string>) => { |
150 | + // const options = await getGatewayDevice(params); | ||
151 | + // return options.filter((item) => item.deviceType === DeviceTypeEnum.GATEWAY); | ||
152 | + // }, | ||
153 | + api: getGatewayDevice, | ||
145 | showSearch: true, | 154 | showSearch: true, |
146 | params: { | 155 | params: { |
147 | organizationId, | 156 | organizationId, |
148 | - deviceType, | 157 | + transportType, |
149 | }, | 158 | }, |
159 | + valueField: 'id', | ||
160 | + labelField: 'name', | ||
150 | }; | 161 | }; |
151 | }, | 162 | }, |
152 | }, | 163 | }, |