|
@@ -4,10 +4,10 @@ import { getGatewayDevice, queryDeviceProfileBy } from '/@/api/device/deviceMana |
|
@@ -4,10 +4,10 @@ import { getGatewayDevice, queryDeviceProfileBy } from '/@/api/device/deviceMana |
4
|
import { TransportTypeEnum } from '../../profiles/components/TransportDescript/const';
|
4
|
import { TransportTypeEnum } from '../../profiles/components/TransportDescript/const';
|
5
|
import { JSONEditorValidator } from '/@/components/CodeEditor/src/JSONEditor';
|
5
|
import { JSONEditorValidator } from '/@/components/CodeEditor/src/JSONEditor';
|
6
|
import { JSONEditor } from '/@/components/CodeEditor';
|
6
|
import { JSONEditor } from '/@/components/CodeEditor';
|
7
|
-import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
|
7
|
+import { DeviceRecord, DeviceTypeEnum } from '/@/api/device/model/deviceModel';
|
8
|
import { getModelServices } from '/@/api/device/modelOfMatter';
|
8
|
import { getModelServices } from '/@/api/device/modelOfMatter';
|
9
|
import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel';
|
9
|
import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel';
|
10
|
-import { h, nextTick, toRaw, unref } from 'vue';
|
10
|
+import { h, toRaw, unref } from 'vue';
|
11
|
import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue';
|
11
|
import ObjectModelValidateForm from '/@/components/Form/src/externalCompns/components/ObjectModelValidateForm/ObjectModelValidateForm.vue';
|
12
|
import { CommandDeliveryWayEnum, ServiceCallTypeEnum } from '/@/enums/toolEnum';
|
12
|
import { CommandDeliveryWayEnum, ServiceCallTypeEnum } from '/@/enums/toolEnum';
|
13
|
import { TaskTypeEnum } from '/@/views/task/center/config';
|
13
|
import { TaskTypeEnum } from '/@/views/task/center/config';
|
|
@@ -15,9 +15,6 @@ import { AddressTypeEnum } from '/@/views/task/center/components/PollCommandInpu |
|
@@ -15,9 +15,6 @@ import { AddressTypeEnum } from '/@/views/task/center/components/PollCommandInpu |
15
|
import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue';
|
15
|
import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue';
|
16
|
import { createImgPreview } from '/@/components/Preview';
|
16
|
import { createImgPreview } from '/@/components/Preview';
|
17
|
import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter';
|
17
|
import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter';
|
18
|
-
|
|
|
19
|
-import { getOrganizationList } from '/@/api/system/system';
|
|
|
20
|
-import { copyTransFun } from '/@/utils/fnUtils';
|
|
|
21
|
import LockControlGroup from '/@/components/Form/src/components/LockControlGroup.vue';
|
18
|
import LockControlGroup from '/@/components/Form/src/components/LockControlGroup.vue';
|
22
|
import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
|
19
|
import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
|
23
|
|
20
|
|
|
@@ -305,7 +302,7 @@ export const step1Schemas: FormSchema[] = [ |
|
@@ -305,7 +302,7 @@ export const step1Schemas: FormSchema[] = [ |
305
|
ifShow: ({ values }) => values.deviceType === 'SENSOR',
|
302
|
ifShow: ({ values }) => values.deviceType === 'SENSOR',
|
306
|
componentProps: ({ formModel, formActionType }) => {
|
303
|
componentProps: ({ formModel, formActionType }) => {
|
307
|
const { transportType } = formModel;
|
304
|
const { transportType } = formModel;
|
308
|
- const { validateFields } = formActionType;
|
305
|
+ const { setFieldsValue } = formActionType;
|
309
|
if (!transportType) return {};
|
306
|
if (!transportType) return {};
|
310
|
return {
|
307
|
return {
|
311
|
api: async (params: Recordable) => {
|
308
|
api: async (params: Recordable) => {
|
|
@@ -320,22 +317,23 @@ export const step1Schemas: FormSchema[] = [ |
|
@@ -320,22 +317,23 @@ export const step1Schemas: FormSchema[] = [ |
320
|
params: {
|
317
|
params: {
|
321
|
transportType,
|
318
|
transportType,
|
322
|
},
|
319
|
},
|
|
|
320
|
+ placeholder: '请选择网关设备',
|
323
|
valueField: 'tbDeviceId',
|
321
|
valueField: 'tbDeviceId',
|
324
|
labelField: 'alias',
|
322
|
labelField: 'alias',
|
325
|
- onChange: async (value, options) => {
|
|
|
326
|
- await nextTick();
|
|
|
327
|
- if (value) {
|
|
|
328
|
- const data = await getOrganizationList({ organizationId: options?.organizationId });
|
|
|
329
|
- copyTransFun(data as any as any[]);
|
|
|
330
|
- formModel.organizationList = data;
|
323
|
+ onChange: async (_value: string, option: DeviceRecord) => {
|
|
|
324
|
+ setFieldsValue({ sensorOrganizationId: option?.organizationId, organizationId: null });
|
|
|
325
|
+ },
|
|
|
326
|
+ onOptionsChange(options: (DeviceRecord & Record<'value', string>)[]) {
|
|
|
327
|
+ if (formModel?.deviceType === DeviceTypeEnum.SENSOR && formModel?.gatewayId) {
|
|
|
328
|
+ const result = options.find((item) => item.value === formModel?.gatewayId);
|
|
|
329
|
+ result && setFieldsValue({ sensorOrganizationId: result?.organizationId });
|
331
|
}
|
330
|
}
|
332
|
- validateFields(['gatewayId']);
|
|
|
333
|
},
|
331
|
},
|
334
|
};
|
332
|
};
|
335
|
},
|
333
|
},
|
336
|
},
|
334
|
},
|
337
|
{
|
335
|
{
|
338
|
- field: 'organizationList',
|
336
|
+ field: 'sensorOrganizationId',
|
339
|
label: '依据网关设备请求的组织数组',
|
337
|
label: '依据网关设备请求的组织数组',
|
340
|
component: 'Input',
|
338
|
component: 'Input',
|
341
|
ifShow: false,
|
339
|
ifShow: false,
|
|
@@ -354,6 +352,13 @@ export const step1Schemas: FormSchema[] = [ |
|
@@ -354,6 +352,13 @@ export const step1Schemas: FormSchema[] = [ |
354
|
return {
|
352
|
return {
|
355
|
component: 'OrgTreeSelect',
|
353
|
component: 'OrgTreeSelect',
|
356
|
defaultLockStatus: !!formModel?.isUpdate,
|
354
|
defaultLockStatus: !!formModel?.isUpdate,
|
|
|
355
|
+ componentProps: {
|
|
|
356
|
+ apiTreeSelectProps: {
|
|
|
357
|
+ params: {
|
|
|
358
|
+ organizationId: formModel?.sensorOrganizationId,
|
|
|
359
|
+ },
|
|
|
360
|
+ },
|
|
|
361
|
+ },
|
357
|
};
|
362
|
};
|
358
|
},
|
363
|
},
|
359
|
},
|
364
|
},
|