Commit b3f380e743355a066b118128417833ff5ea40317

Authored by ww
1 parent bb028e90

fix: device list create device search sensor device carry dataType field

... ... @@ -170,8 +170,8 @@ export const getShareBoardComponentInfo = (params: { boardId: string; tenantId:
170 170 */
171 171 export const getAllDeviceByOrg = (organizationId: string, deviceProfileId?: string) => {
172 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 5 DeviceProfileModel,
6 6 DeviceProfileQueryParam,
7 7 DeviceQueryParam,
  8 + DeviceTypeEnum,
8 9 } from '/@/api/device/model/deviceModel';
9 10 import { ChildDeviceParams } from './model/deviceModel';
10 11 import { PaginationResult } from '/#/axios';
... ... @@ -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 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 199 return Promise.resolve<{ label: string; value: string }[]>(
192 200 res.map((item) => ({ label: item.name, value: item.tbDeviceId }))
... ...
... ... @@ -125,7 +125,6 @@ export const step1Schemas: FormSchema[] = [
125 125 },
126 126 ifShow: ({ values }) => isGateWay(values.deviceType),
127 127 },
128   -
129 128 {
130 129 field: 'organizationId',
131 130 label: '所属组织',
... ... @@ -140,12 +139,13 @@ export const step1Schemas: FormSchema[] = [
140 139 component: 'ApiSelect',
141 140 ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId,
142 141 componentProps: ({ formModel }) => {
143   - const { organizationId } = formModel;
  142 + const { organizationId, deviceType } = formModel;
144 143 return {
145 144 api: getGATEWAYdevice,
146 145 showSearch: true,
147 146 params: {
148 147 organizationId,
  148 + deviceType,
149 149 },
150 150 };
151 151 },
... ...
... ... @@ -95,10 +95,8 @@
95 95 const validateMapComponent = async (dataSource: Record<DataSourceField, string>[]) => {
96 96 if (dataSource.length) {
97 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 100 if (!flag) {
103 101 createMessage.warning('地图组件绑定的数据源应该一致');
104 102 return Promise.reject(false);
... ...
... ... @@ -252,7 +252,6 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => {
252 252 componentProps({ formModel }) {
253 253 const deviceProfileId = formModel[DataSourceField.DEVICE_PROFILE_ID];
254 254 const transportType = formModel[DataSourceField.TRANSPORT_TYPE];
255   -
256 255 return {
257 256 api: async () => {
258 257 try {
... ... @@ -281,7 +280,7 @@ export const dataSourceSchema = (frontId?: FrontComponent): FormSchema[] => {
281 280 {
282 281 field: DataSourceField.DEVICE_RENAME,
283 282 component: 'Input',
284   - label: '设备',
  283 + label: '设备',
285 284 colProps: { span: 8 },
286 285 componentProps: {
287 286 placeholder: '设备重命名',
... ...