Showing
5 changed files
with
27 additions
and
2 deletions
... | ... | @@ -34,13 +34,14 @@ |
34 | 34 | |
35 | 35 | const getValue = async () => { |
36 | 36 | const record = (await validateFields()) || {}; |
37 | - const { type, remark } = record; | |
37 | + const { type, remark, organizationId } = record; | |
38 | 38 | const datasourceType = Reflect.get(record, BasicInfoFormField.DATA_SOURCE_TYPE); |
39 | 39 | const convertDevices = Reflect.get(record, BasicInfoFormField.DATA_SOURCE_DEVICE); |
40 | 40 | const convertProducts = Reflect.get(record, BasicInfoFormField.DATA_SOURCE_PRODUCT); |
41 | 41 | return { |
42 | 42 | type, |
43 | 43 | remark, |
44 | + organizationId, | |
44 | 45 | datasourceType, |
45 | 46 | datasourceContent: { |
46 | 47 | convertProducts, | ... | ... |
1 | -import { FormSchema } from '/@/components/Form'; | |
1 | +import { FormSchema, useComponentRegister } from '/@/components/Form'; | |
2 | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | 3 | import { getDeviceProfile } from '/@/api/alarm/position'; |
4 | 4 | import { BasicInfoFormField, DataSourceType } from '../enum'; |
5 | 5 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; |
6 | 6 | import { useMessage } from '/@/hooks/web/useMessage'; |
7 | +import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect'; | |
8 | + | |
9 | +useComponentRegister('OrgTreeSelect', OrgTreeSelect); | |
7 | 10 | |
8 | 11 | export const stepConfig = ['选择流转方式', '完善配置参数']; |
9 | 12 | |
... | ... | @@ -122,6 +125,13 @@ export const modeForm = (disabled: boolean): FormSchema[] => { |
122 | 125 | }, |
123 | 126 | }, |
124 | 127 | { |
128 | + required: true, | |
129 | + field: 'organizationId', | |
130 | + label: '所属组织', | |
131 | + colProps: { span: 24 }, | |
132 | + component: 'OrgTreeSelect', | |
133 | + }, | |
134 | + { | |
125 | 135 | field: 'type', |
126 | 136 | label: '转换方式', |
127 | 137 | component: 'ApiSelect', | ... | ... |
... | ... | @@ -15,7 +15,9 @@ import { ProductPicker, validateProductPicker } from '../ProductPicker'; |
15 | 15 | import { useGlobSetting } from '/@/hooks/setting'; |
16 | 16 | import { TransportTypeEnum } from '/@/enums/deviceEnum'; |
17 | 17 | import { validateTCPCustomCommand } from '/@/components/Form/src/components/ThingsModelForm'; |
18 | +import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect'; | |
18 | 19 | |
20 | +useComponentRegister('OrgTreeSelect', OrgTreeSelect); | |
19 | 21 | useComponentRegister('DevicePicker', DevicePicker); |
20 | 22 | useComponentRegister('ProductPicker', ProductPicker); |
21 | 23 | useComponentRegister('PollCommandInput', PollCommandInput); |
... | ... | @@ -25,6 +27,8 @@ const { disabledTaskCenterExecuteIntervalUnitSecond } = useGlobSetting(); |
25 | 27 | export enum FormFieldsEnum { |
26 | 28 | // 任务名称 |
27 | 29 | NAME = 'name', |
30 | + // 所属组织 | |
31 | + ORGANIZATION_ID = 'organizationId', | |
28 | 32 | // 目标类型 |
29 | 33 | TARGET_TYPE = 'targetType', |
30 | 34 | // 设备类型选择 |
... | ... | @@ -99,6 +103,13 @@ export const formSchemas: FormSchema[] = [ |
99 | 103 | }, |
100 | 104 | }, |
101 | 105 | { |
106 | + required: true, | |
107 | + field: FormFieldsEnum.ORGANIZATION_ID, | |
108 | + label: '所属组织', | |
109 | + colProps: { span: 24 }, | |
110 | + component: 'OrgTreeSelect', | |
111 | + }, | |
112 | + { | |
102 | 113 | field: FormFieldsEnum.TARGET_TYPE, |
103 | 114 | component: 'RadioGroup', |
104 | 115 | label: '目标类型', | ... | ... |
... | ... | @@ -92,6 +92,7 @@ export const composeData = (result: Required<FormValueType>): CreateTaskRecordTy |
92 | 92 | |
93 | 93 | return { |
94 | 94 | name, |
95 | + organizationId: result.organizationId, | |
95 | 96 | targetType, |
96 | 97 | executeContent: { |
97 | 98 | pushContent: { |
... | ... | @@ -127,6 +128,7 @@ export const parseData = (result: TaskRecordType): Required<FormValueType> => { |
127 | 128 | const { type: executeTimeType, period, periodType, time, pollUnit } = executeTime; |
128 | 129 | return { |
129 | 130 | name, |
131 | + organizationId: result.organizationId, | |
130 | 132 | targetType, |
131 | 133 | rpcCommand: pushWay === PushWayEnum.MQTT ? JSON.stringify(rpcCommand, null, 2) : rpcCommand, |
132 | 134 | transportType: pushWay, | ... | ... |