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