...
|
...
|
@@ -16,6 +16,9 @@ import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue'; |
16
|
16
|
import { createImgPreview } from '/@/components/Preview';
|
17
|
17
|
import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter';
|
18
|
18
|
|
|
19
|
+import { getOrganizationList } from '/@/api/system/system';
|
|
20
|
+import { copyTransFun } from '/@/utils/fnUtils';
|
|
21
|
+
|
19
|
22
|
useComponentRegister('JSONEditor', JSONEditor);
|
20
|
23
|
useComponentRegister('ObjectModelValidateForm', ObjectModelValidateForm);
|
21
|
24
|
|
...
|
...
|
@@ -263,22 +266,15 @@ export const step1Schemas: FormSchema[] = [ |
263
|
266
|
ifShow: ({ values }) => isGateWay(values.deviceType),
|
264
|
267
|
},
|
265
|
268
|
{
|
266
|
|
- field: 'organizationId',
|
267
|
|
- label: '所属组织',
|
268
|
|
- component: 'Input',
|
269
|
|
- required: true,
|
270
|
|
- slot: 'addOrg',
|
271
|
|
- },
|
272
|
|
- {
|
273
|
269
|
field: 'gatewayId',
|
274
|
270
|
label: '网关设备',
|
275
|
271
|
required: true,
|
276
|
272
|
component: 'ApiSelect',
|
277
|
|
- ifShow: ({ values }) => values.deviceType === 'SENSOR' && values.organizationId,
|
|
273
|
+ ifShow: ({ values }) => values.deviceType === 'SENSOR',
|
278
|
274
|
componentProps: ({ formModel, formActionType }) => {
|
279
|
|
- const { organizationId, transportType } = formModel;
|
|
275
|
+ const { transportType } = formModel;
|
280
|
276
|
const { validateFields } = formActionType;
|
281
|
|
- if (![organizationId, transportType].every(Boolean)) return {};
|
|
277
|
+ if (!transportType) return {};
|
282
|
278
|
return {
|
283
|
279
|
api: async (params: Recordable) => {
|
284
|
280
|
try {
|
...
|
...
|
@@ -291,19 +287,36 @@ export const step1Schemas: FormSchema[] = [ |
291
|
287
|
},
|
292
|
288
|
showSearch: true,
|
293
|
289
|
params: {
|
294
|
|
- organizationId,
|
295
|
290
|
transportType,
|
296
|
291
|
},
|
297
|
292
|
valueField: 'tbDeviceId',
|
298
|
293
|
labelField: 'alias',
|
299
|
|
- onChange: async () => {
|
|
294
|
+ onChange: async (value, options) => {
|
300
|
295
|
await nextTick();
|
|
296
|
+ if (value) {
|
|
297
|
+ const data = await getOrganizationList({ organizationId: options?.organizationId });
|
|
298
|
+ copyTransFun(data as any as any[]);
|
|
299
|
+ formModel.organizationList = data;
|
|
300
|
+ }
|
301
|
301
|
validateFields(['gatewayId']);
|
302
|
302
|
},
|
303
|
303
|
};
|
304
|
304
|
},
|
305
|
305
|
},
|
306
|
306
|
{
|
|
307
|
+ field: 'organizationList',
|
|
308
|
+ label: '依据网关设备请求的组织数组',
|
|
309
|
+ component: 'Input',
|
|
310
|
+ ifShow: false,
|
|
311
|
+ },
|
|
312
|
+ {
|
|
313
|
+ field: 'organizationId',
|
|
314
|
+ label: '所属组织',
|
|
315
|
+ component: 'Input',
|
|
316
|
+ required: true,
|
|
317
|
+ slot: 'addOrg',
|
|
318
|
+ },
|
|
319
|
+ {
|
307
|
320
|
field: 'label',
|
308
|
321
|
label: '设备标签',
|
309
|
322
|
component: 'Input',
|
...
|
...
|
|