Showing
18 changed files
with
262 additions
and
55 deletions
1 | -import { DeviceInfoItemType, DeviceTypeItem, PageParams, ScriptTestParams } from './model'; | |
1 | +import { | |
2 | + DeviceInfoItemType, | |
3 | + DeviceTypeItem, | |
4 | + PageParams, | |
5 | + QueryItemType, | |
6 | + ScriptTestParams, | |
7 | +} from './model'; | |
2 | 8 | import { TBPaginationResult } from '/#/axios'; |
3 | 9 | import { ScriptLanguageEnum } from '/@/enums/scriptEnum'; |
4 | 10 | import { defHttp } from '/@/utils/http/axios'; |
... | ... | @@ -6,7 +12,7 @@ import { defHttp } from '/@/utils/http/axios'; |
6 | 12 | enum Api { |
7 | 13 | GET_DEVICE_INFOS = '/tenant/deviceInfos', |
8 | 14 | GET_DEVICE_TYPE = '/device/types', |
9 | - TENANT_QUEUE = '/tenant/queues', | |
15 | + QUEUE = '/queues', | |
10 | 16 | TEST_SCRIPT = '/ruleChain/testScript', |
11 | 17 | } |
12 | 18 | |
... | ... | @@ -39,10 +45,10 @@ export const getDeviceTypes = () => { |
39 | 45 | ); |
40 | 46 | }; |
41 | 47 | |
42 | -export const getTenantQueue = (params: Recordable) => { | |
43 | - return defHttp.get<string[]>( | |
48 | +export const getQueue = (params: Recordable) => { | |
49 | + return defHttp.get<TBPaginationResult<QueryItemType>>( | |
44 | 50 | { |
45 | - url: Api.TENANT_QUEUE, | |
51 | + url: Api.QUEUE, | |
46 | 52 | params, |
47 | 53 | }, |
48 | 54 | { joinPrefix: false } | ... | ... |
... | ... | @@ -62,3 +62,31 @@ export interface ScriptTestParams { |
62 | 62 | scriptType?: string; |
63 | 63 | needMetadataAndMsgType?: boolean; |
64 | 64 | } |
65 | + | |
66 | +export interface QueryItemType { | |
67 | + id: Id; | |
68 | + createdTime: number; | |
69 | + additionalInfo: any; | |
70 | + tenantId: Id; | |
71 | + name: string; | |
72 | + topic: string; | |
73 | + pollInterval: number; | |
74 | + partitions: number; | |
75 | + consumerPerPartition: boolean; | |
76 | + packProcessingTimeout: number; | |
77 | + submitStrategy: SubmitStrategy; | |
78 | + processingStrategy: ProcessingStrategy; | |
79 | +} | |
80 | + | |
81 | +export interface SubmitStrategy { | |
82 | + type: string; | |
83 | + batchSize: number; | |
84 | +} | |
85 | + | |
86 | +export interface ProcessingStrategy { | |
87 | + type: string; | |
88 | + retries: number; | |
89 | + failurePercentage: number; | |
90 | + pauseBetweenRetries: number; | |
91 | + maxPauseBetweenRetries: number; | |
92 | +} | ... | ... |
... | ... | @@ -15,6 +15,8 @@ export enum AssignToCustomerFieldsNameEnum { |
15 | 15 | export enum ClearAlarmFieldsEnum { |
16 | 16 | ALARM_TYPE = 'alarmType', |
17 | 17 | ALARM_DETAILS_BUILD_JS = 'alarmDetailsBuildJs', |
18 | + ALARM_DETAILS_BUILD_TBEL = 'alarmDetailsBuildTbel', | |
19 | + SCRIPT_LANG = 'scriptLang', | |
18 | 20 | } |
19 | 21 | |
20 | 22 | export enum ClearAlarmFieldsNameEnum { | ... | ... |
1 | 1 | import { ClearAlarmFieldsEnum, ClearAlarmFieldsNameEnum } from '../../../enum/formField/action'; |
2 | -import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; | |
2 | +import { | |
3 | + JavascriptEditorWithTestModal, | |
4 | + ScriptEditorValueType, | |
5 | +} from '../../../src/components/JavaScriptFilterModal'; | |
6 | +import { DefaultNodeConfig } from '../../../types/node'; | |
3 | 7 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
4 | 8 | import { useI18n } from '/@/hooks/web/useI18n'; |
5 | 9 | |
... | ... | @@ -7,6 +11,17 @@ const { t } = useI18n(); |
7 | 11 | |
8 | 12 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
9 | 13 | |
14 | +export interface FormFieldsValue { | |
15 | + [ClearAlarmFieldsEnum.ALARM_DETAILS_BUILD_JS]: ScriptEditorValueType; | |
16 | +} | |
17 | + | |
18 | +export interface NodeConfigValue extends DefaultNodeConfig { | |
19 | + alarmDetailsBuildJs: string; | |
20 | + alarmDetailsBuildTbel: string; | |
21 | + alarmType: string; | |
22 | + scriptLang: string; | |
23 | +} | |
24 | + | |
10 | 25 | export const formSchemas: FormSchema[] = [ |
11 | 26 | { |
12 | 27 | field: ClearAlarmFieldsEnum.ALARM_DETAILS_BUILD_JS, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { NodeConfigValue, FormFieldsValue, formSchemas } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | 6 | |
7 | 7 | defineProps<{ |
... | ... | @@ -15,13 +15,29 @@ |
15 | 15 | |
16 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
17 | 17 | await validate(); |
18 | - const value = getFieldsValue() || {}; | |
19 | - return value; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { alarmDetailsBuildJs, ...restParams } = value; | |
20 | + const { scriptLang, jsScript, tbelScript } = alarmDetailsBuildJs || {}; | |
21 | + | |
22 | + return { | |
23 | + ...restParams, | |
24 | + scriptLang, | |
25 | + alarmDetailsBuildJs: jsScript, | |
26 | + alarmDetailsBuildTbel: tbelScript, | |
27 | + }; | |
20 | 28 | }; |
21 | 29 | |
22 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
30 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
23 | 31 | resetFields(); |
24 | - setFieldsValue(value); | |
32 | + const { alarmDetailsBuildJs, alarmDetailsBuildTbel, scriptLang } = value || {}; | |
33 | + setFieldsValue({ | |
34 | + ...value, | |
35 | + alarmDetailsBuildJs: { | |
36 | + jsScript: alarmDetailsBuildJs, | |
37 | + tbelScript: alarmDetailsBuildTbel, | |
38 | + scriptLang, | |
39 | + }, | |
40 | + } as FormFieldsValue); | |
25 | 41 | }; |
26 | 42 | |
27 | 43 | defineExpose({ | ... | ... |
1 | 1 | import { CreateAlarmFieldsEnum, CreateAlarmFieldsNameEnum } from '../../../enum/formField/action'; |
2 | -import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; | |
2 | +import { | |
3 | + JavascriptEditorWithTestModal, | |
4 | + ScriptEditorValueType, | |
5 | +} from '../../../src/components/JavaScriptFilterModal'; | |
6 | +import { DefaultNodeConfig } from '../../../types/node'; | |
3 | 7 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | 8 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
5 | 9 | import { useI18n } from '/@/hooks/web/useI18n'; |
... | ... | @@ -8,6 +12,16 @@ const { t } = useI18n(); |
8 | 12 | |
9 | 13 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
10 | 14 | |
15 | +export interface FormFieldsValue { | |
16 | + [CreateAlarmFieldsEnum.ALARM_DETAILS_BUILD_JS]: ScriptEditorValueType; | |
17 | +} | |
18 | + | |
19 | +export interface NodeConfigValue extends DefaultNodeConfig { | |
20 | + alarmDetailsBuildJs: string; | |
21 | + alarmDetailsBuildTbel: string; | |
22 | + scriptLang: string; | |
23 | +} | |
24 | + | |
11 | 25 | export const formSchemas: FormSchema[] = [ |
12 | 26 | { |
13 | 27 | field: CreateAlarmFieldsEnum.USE_MESSAGE_ALARM_DATA, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { FormFieldsValue, formSchemas, NodeConfigValue } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | 6 | |
7 | 7 | defineProps<{ |
... | ... | @@ -15,13 +15,28 @@ |
15 | 15 | |
16 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
17 | 17 | await validate(); |
18 | - const value = getFieldsValue() || {}; | |
19 | - return value; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { alarmDetailsBuildJs, ...resetParams } = value; | |
20 | + const { scriptLang, tbelScript, jsScript } = alarmDetailsBuildJs; | |
21 | + return { | |
22 | + ...resetParams, | |
23 | + alarmDetailsBuildJs: jsScript, | |
24 | + alarmDetailsBuildTbel: tbelScript, | |
25 | + scriptLang, | |
26 | + } as NodeConfigValue; | |
20 | 27 | }; |
21 | 28 | |
22 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
29 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
23 | 30 | resetFields(); |
24 | - setFieldsValue(value); | |
31 | + const { alarmDetailsBuildJs, alarmDetailsBuildTbel, scriptLang } = value; | |
32 | + setFieldsValue({ | |
33 | + ...value, | |
34 | + alarmDetailsBuildJs: { | |
35 | + jsScript: alarmDetailsBuildJs, | |
36 | + tbelScript: alarmDetailsBuildTbel, | |
37 | + scriptLang, | |
38 | + }, | |
39 | + } as FormFieldsValue); | |
25 | 40 | }; |
26 | 41 | |
27 | 42 | defineExpose({ | ... | ... |
1 | 1 | import { EntityTypeEnum, EntityTypeNameEnum } from '../../../enum/form'; |
2 | 2 | import { GeneratorFieldsEnum, GeneratorFieldsNameEnum } from '../../../enum/formField/action'; |
3 | -import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; | |
3 | +import { | |
4 | + JavascriptEditorWithTestModal, | |
5 | + ScriptEditorValueType, | |
6 | +} from '../../../src/components/JavaScriptFilterModal'; | |
7 | +import { DefaultNodeConfig } from '../../../types/node'; | |
4 | 8 | import { getEntityIdSelect } from '../../Filter/CheckRelation/create.config'; |
5 | 9 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
6 | 10 | import { useI18n } from '/@/hooks/web/useI18n'; |
... | ... | @@ -9,6 +13,12 @@ const { t } = useI18n(); |
9 | 13 | |
10 | 14 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
11 | 15 | |
16 | +export interface FormFieldsValue { | |
17 | + [GeneratorFieldsEnum.JS_SCRIPT]: ScriptEditorValueType; | |
18 | +} | |
19 | + | |
20 | +export interface NodeConfigValue extends DefaultNodeConfig, ScriptEditorValueType {} | |
21 | + | |
12 | 22 | export const formSchemas: FormSchema[] = [ |
13 | 23 | { |
14 | 24 | field: GeneratorFieldsEnum.MSG_COUNT, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { FormFieldsValue, formSchemas, NodeConfigValue } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | 6 | |
7 | 7 | defineProps<{ |
... | ... | @@ -15,13 +15,25 @@ |
15 | 15 | |
16 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
17 | 17 | await validate(); |
18 | - const value = getFieldsValue() || {}; | |
19 | - return value; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { jsScript, ...resetParams } = value; | |
20 | + return { | |
21 | + ...resetParams, | |
22 | + ...jsScript, | |
23 | + } as NodeConfigValue; | |
20 | 24 | }; |
21 | 25 | |
22 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
26 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
23 | 27 | resetFields(); |
24 | - setFieldsValue(value); | |
28 | + const { jsScript, tbelScript, scriptLang } = value; | |
29 | + setFieldsValue({ | |
30 | + ...value, | |
31 | + jsScript: { | |
32 | + jsScript, | |
33 | + tbelScript, | |
34 | + scriptLang, | |
35 | + }, | |
36 | + } as FormFieldsValue); | |
25 | 37 | }; |
26 | 38 | |
27 | 39 | defineExpose({ | ... | ... |
1 | 1 | import { LogFieldsEnum, LogFieldsNameEnum } from '../../../enum/formField/action'; |
2 | -import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; | |
2 | +import { | |
3 | + JavascriptEditorWithTestModal, | |
4 | + ScriptEditorValueType, | |
5 | +} from '../../../src/components/JavaScriptFilterModal'; | |
6 | +import { DefaultNodeConfig } from '../../../types/node'; | |
3 | 7 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
4 | 8 | import { useI18n } from '/@/hooks/web/useI18n'; |
5 | 9 | const { t } = useI18n(); |
6 | 10 | |
7 | 11 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
8 | 12 | |
13 | +export interface FormFieldsValue { | |
14 | + [LogFieldsEnum.JS_SCRIPT]: ScriptEditorValueType; | |
15 | +} | |
16 | + | |
17 | +export interface NodeConfigValue extends DefaultNodeConfig, ScriptEditorValueType {} | |
18 | + | |
9 | 19 | export const formSchemas: FormSchema[] = [ |
10 | 20 | { |
11 | 21 | field: LogFieldsEnum.JS_SCRIPT, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { FormFieldsValue, formSchemas, NodeConfigValue } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | 6 | |
7 | 7 | defineProps<{ |
... | ... | @@ -15,13 +15,25 @@ |
15 | 15 | |
16 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
17 | 17 | await validate(); |
18 | - const value = getFieldsValue() || {}; | |
19 | - return value; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { jsScript, ...resetParams } = value; | |
20 | + return { | |
21 | + ...resetParams, | |
22 | + ...jsScript, | |
23 | + } as NodeConfigValue; | |
20 | 24 | }; |
21 | 25 | |
22 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
26 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
23 | 27 | resetFields(); |
24 | - setFieldsValue(value); | |
28 | + const { jsScript, tbelScript, scriptLang } = value; | |
29 | + setFieldsValue({ | |
30 | + ...value, | |
31 | + jsScript: { | |
32 | + jsScript, | |
33 | + tbelScript, | |
34 | + scriptLang, | |
35 | + }, | |
36 | + } as FormFieldsValue); | |
25 | 37 | }; |
26 | 38 | |
27 | 39 | defineExpose({ | ... | ... |
1 | 1 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
2 | 2 | import HelpMessage from './HelpMessage.vue'; |
3 | -import { JavascriptEditorWithTestModal } from '/@/views/rule/designer/src/components/JavaScriptFilterModal'; | |
3 | +import { | |
4 | + JavascriptEditorWithTestModal, | |
5 | + ScriptEditorValueType, | |
6 | +} from '/@/views/rule/designer/src/components/JavaScriptFilterModal'; | |
4 | 7 | import { ScriptFieldsEnum, ScriptFieldsNameEnum } from '../../../enum/formField/filter'; |
5 | 8 | import { useI18n } from '/@/hooks/web/useI18n'; |
6 | 9 | import { h } from 'vue'; |
10 | +import { DefaultNodeConfig } from '../../../types/node'; | |
7 | 11 | |
8 | 12 | const { t } = useI18n(); |
9 | 13 | |
10 | 14 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
11 | 15 | |
16 | +export interface FormFieldsValue { | |
17 | + [ScriptFieldsEnum.JS_SCRIPT]: ScriptEditorValueType; | |
18 | +} | |
19 | + | |
20 | +export interface NodeConfigValue extends DefaultNodeConfig, ScriptEditorValueType {} | |
21 | + | |
12 | 22 | export const formSchemas: FormSchema[] = [ |
13 | 23 | { |
14 | 24 | field: ScriptFieldsEnum.JS_SCRIPT, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { FormFieldsValue, formSchemas, NodeConfigValue } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | 6 | |
7 | 7 | defineProps<{ |
... | ... | @@ -15,13 +15,25 @@ |
15 | 15 | |
16 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
17 | 17 | await validate(); |
18 | - const value = getFieldsValue() || {}; | |
19 | - return value; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { jsScript, ...resetParams } = value; | |
20 | + return { | |
21 | + ...resetParams, | |
22 | + ...jsScript, | |
23 | + } as NodeConfigValue; | |
20 | 24 | }; |
21 | 25 | |
22 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
26 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
23 | 27 | resetFields(); |
24 | - setFieldsValue(value); | |
28 | + const { jsScript, tbelScript, scriptLang } = value; | |
29 | + setFieldsValue({ | |
30 | + ...value, | |
31 | + jsScript: { | |
32 | + jsScript, | |
33 | + tbelScript, | |
34 | + scriptLang, | |
35 | + }, | |
36 | + } as FormFieldsValue); | |
25 | 37 | }; |
26 | 38 | |
27 | 39 | defineExpose({ | ... | ... |
1 | 1 | import { SwitchFieldsEnum, SwitchFieldsNameEnum } from '../../../enum/formField/filter'; |
2 | 2 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
3 | -import { JavascriptEditorWithTestModal } from '/@/views/rule/designer/src/components/JavaScriptFilterModal'; | |
3 | +import { | |
4 | + JavascriptEditorWithTestModal, | |
5 | + ScriptEditorValueType, | |
6 | +} from '/@/views/rule/designer/src/components/JavaScriptFilterModal'; | |
4 | 7 | import { useI18n } from '/@/hooks/web/useI18n'; |
8 | +import { DefaultNodeConfig } from '../../../types/node'; | |
5 | 9 | |
6 | 10 | const { t } = useI18n(); |
7 | 11 | |
8 | 12 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
9 | 13 | |
14 | +export interface FormFieldsValue { | |
15 | + [SwitchFieldsEnum.JS_SCRIPT]: ScriptEditorValueType; | |
16 | +} | |
17 | + | |
18 | +export interface NodeConfigValue extends DefaultNodeConfig, ScriptEditorValueType {} | |
19 | + | |
10 | 20 | export const formSchemas: FormSchema[] = [ |
11 | 21 | { |
12 | 22 | field: SwitchFieldsEnum.JS_SCRIPT, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { FormFieldsValue, formSchemas, NodeConfigValue } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | 6 | |
7 | 7 | defineProps<{ |
... | ... | @@ -15,13 +15,25 @@ |
15 | 15 | |
16 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
17 | 17 | await validate(); |
18 | - const value = getFieldsValue() || {}; | |
19 | - return value; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { jsScript, ...resetParams } = value; | |
20 | + return { | |
21 | + ...resetParams, | |
22 | + ...jsScript, | |
23 | + } as NodeConfigValue; | |
20 | 24 | }; |
21 | 25 | |
22 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
26 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
23 | 27 | resetFields(); |
24 | - setFieldsValue(value); | |
28 | + const { jsScript, tbelScript, scriptLang } = value; | |
29 | + setFieldsValue({ | |
30 | + ...value, | |
31 | + jsScript: { | |
32 | + jsScript, | |
33 | + tbelScript, | |
34 | + scriptLang, | |
35 | + }, | |
36 | + } as FormFieldsValue); | |
25 | 37 | }; |
26 | 38 | |
27 | 39 | defineExpose({ | ... | ... |
1 | 1 | import { CheckPointFieldsEnum, CheckPointFieldsNameEnum } from '../../../enum/formField/flow'; |
2 | 2 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
3 | 3 | import ApiComplete from './ApiComplete.vue'; |
4 | -import { getTenantQueue } from '/@/api/ruleChainDesigner'; | |
4 | +import { getQueue } from '/@/api/ruleChainDesigner'; | |
5 | 5 | |
6 | 6 | import { useI18n } from '/@/hooks/web/useI18n'; |
7 | 7 | |
... | ... | @@ -23,10 +23,16 @@ export const formSchemas: FormSchema[] = [ |
23 | 23 | placeholder: `请选择${t(CheckPointFieldsNameEnum.QUEUE_NAME)}`, |
24 | 24 | getPopupContainer: () => document.body, |
25 | 25 | api: async (params: Recordable) => { |
26 | - const options = await getTenantQueue(params); | |
27 | - return options.map((value) => ({ label: value, value })); | |
26 | + const options = await getQueue(params); | |
27 | + return options.data.map((value) => ({ label: value.name, value: value.name })); | |
28 | + }, | |
29 | + params: { | |
30 | + serviceType: 'TB_RULE_ENGINE', | |
31 | + page: 0, | |
32 | + pageSize: 10, | |
33 | + sortProperty: 'name', | |
34 | + sortOrder: 'ASC', | |
28 | 35 | }, |
29 | - params: { serviceType: 'TB_RULE_ENGINE' }, | |
30 | 36 | }; |
31 | 37 | }, |
32 | 38 | }, | ... | ... |
1 | 1 | import { ScriptFieldsEnum, ScriptFieldsNameEnum } from '../../../enum/formField/transformation'; |
2 | -import { JavascriptEditorWithTestModal } from '../../../src/components/JavaScriptFilterModal'; | |
2 | +import { | |
3 | + JavascriptEditorWithTestModal, | |
4 | + ScriptEditorValueType, | |
5 | +} from '../../../src/components/JavaScriptFilterModal'; | |
6 | +import { DefaultNodeConfig } from '../../../types/node'; | |
3 | 7 | import { FormSchema, useComponentRegister } from '/@/components/Form'; |
4 | 8 | import { useI18n } from '/@/hooks/web/useI18n'; |
5 | 9 | |
... | ... | @@ -7,6 +11,12 @@ const { t } = useI18n(); |
7 | 11 | |
8 | 12 | useComponentRegister('JavascriptEditorWithTestModal', JavascriptEditorWithTestModal); |
9 | 13 | |
14 | +export interface FormFieldsValue { | |
15 | + [ScriptFieldsEnum.JS_SCRIPT]: ScriptEditorValueType; | |
16 | +} | |
17 | + | |
18 | +export interface NodeConfigValue extends DefaultNodeConfig, ScriptEditorValueType {} | |
19 | + | |
10 | 20 | export const formSchemas: FormSchema[] = [ |
11 | 21 | { |
12 | 22 | field: ScriptFieldsEnum.JS_SCRIPT, | ... | ... |
1 | 1 | <script lang="ts" setup> |
2 | 2 | import type { CreateModalDefineExposeType } from '../../../types'; |
3 | 3 | import { BasicForm, useForm } from '/@/components/Form'; |
4 | - import { formSchemas } from './create.config'; | |
4 | + import { FormFieldsValue, formSchemas, NodeConfigValue } from './create.config'; | |
5 | 5 | import { NodeData } from '../../../types/node'; |
6 | - import { ScriptEditorValueType } from '/@/views/rule/designer/src/components/JavaScriptFilterModal'; | |
7 | - import { ScriptFieldsEnum } from '../../../enum/formField/transformation'; | |
8 | 6 | |
9 | 7 | defineProps<{ |
10 | 8 | config: NodeData; |
... | ... | @@ -17,16 +15,25 @@ |
17 | 15 | |
18 | 16 | const getValue: CreateModalDefineExposeType['getFieldsValue'] = async () => { |
19 | 17 | await validate(); |
20 | - const value = getFieldsValue() || {}; | |
21 | - const { scriptLang, jsScript, tbelScript } = (value || {})?.jsScript as ScriptEditorValueType; | |
22 | - return { scriptLang, jsScript, tbelScript }; | |
18 | + const value = (getFieldsValue() || {}) as FormFieldsValue; | |
19 | + const { jsScript, ...resetParams } = value; | |
20 | + return { | |
21 | + ...resetParams, | |
22 | + ...jsScript, | |
23 | + } as NodeConfigValue; | |
23 | 24 | }; |
24 | 25 | |
25 | - const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value) => { | |
26 | + const setValue: CreateModalDefineExposeType['setFieldsValue'] = (value: NodeConfigValue) => { | |
26 | 27 | resetFields(); |
28 | + const { jsScript, tbelScript, scriptLang } = value; | |
27 | 29 | setFieldsValue({ |
28 | - [ScriptFieldsEnum.JS_SCRIPT]: value, | |
29 | - }); | |
30 | + ...value, | |
31 | + jsScript: { | |
32 | + jsScript, | |
33 | + tbelScript, | |
34 | + scriptLang, | |
35 | + }, | |
36 | + } as FormFieldsValue); | |
30 | 37 | }; |
31 | 38 | |
32 | 39 | defineExpose({ | ... | ... |