Commit 1710a222e5e9145a75987f73ae7bf358ee62d71d

Authored by ww
1 parent b3f380e7

fix: device list create device select tcp sensor device only select gateway device

... ... @@ -14,9 +14,9 @@ VITE_PUBLIC_PATH = /
14 14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
15 15 # 线上测试环境
16 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 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 21 # 实时数据的ws地址
22 22 # VITE_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token=
... ...
... ... @@ -5,6 +5,7 @@ import {
5 5 DeviceProfileModel,
6 6 DeviceProfileQueryParam,
7 7 DeviceQueryParam,
  8 + DeviceRecord,
8 9 DeviceTypeEnum,
9 10 } from '/@/api/device/model/deviceModel';
10 11 import { ChildDeviceParams } from './model/deviceModel';
... ... @@ -28,6 +29,8 @@ enum DeviceManagerApi {
28 29 COMMAND_ISSUANCE = '/rpc',
29 30
30 31 DEVICE_ATTR = '/device/attributes',
  32 +
  33 + GATEWAY_DEVICE = '/device/gateway/list',
31 34 }
32 35
33 36 export const devicePage = (params: DeviceQueryParam) => {
... ... @@ -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 219 export const getGATEWAY = (tbDeviceId: string) => {
206 220 return defHttp.get({
... ...
... ... @@ -82,9 +82,9 @@
82 82 if (next) {
83 83 const value = next[valueField];
84 84 prev.push({
  85 + ...omit(next, [labelField, valueField]),
85 86 label: next[labelField],
86 87 value: numberToString ? `${value}` : value,
87   - ...omit(next, [labelField, valueField]),
88 88 });
89 89 }
90 90 return prev;
... ...
1 1 import { FormSchema } from '/@/components/Form';
2 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 5 export enum TypeEnum {
6 6 IS_GATEWAY = 'GATEWAY',
... ... @@ -73,7 +73,12 @@ export const step1Schemas: FormSchema[] = [
73 73 option: { deviceType: string; transportType: string; id: string }
74 74 ) {
75 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 144 component: 'ApiSelect',
140 145 ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId,
141 146 componentProps: ({ formModel }) => {
142   - const { organizationId, deviceType } = formModel;
  147 + const { organizationId, transportType } = formModel;
143 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 154 showSearch: true,
146 155 params: {
147 156 organizationId,
148   - deviceType,
  157 + transportType,
149 158 },
  159 + valueField: 'id',
  160 + labelField: 'name',
150 161 };
151 162 },
152 163 },
... ...