diff --git a/frontend/src/api/modules/project-management/envManagement.ts b/frontend/src/api/modules/project-management/envManagement.ts index 8c91b6b17f..80b527736e 100644 --- a/frontend/src/api/modules/project-management/envManagement.ts +++ b/frontend/src/api/modules/project-management/envManagement.ts @@ -25,7 +25,7 @@ export function updateOrAddEnv(data: { request: EnvDetailItem; fileList: FileIte export function listEnv(data: { projectId: string; keyword: string }) { return MSR.post({ url: envURL.listEnvUrl, data }); } -export function importEnv(data: { request: any; fileList: FileItem[] }) { +export function importEnv(data: { request: any; fileList: File[] }) { return MSR.uploadFile({ url: envURL.importEnvUrl }, data, '', false); } export function getEntryEnv(data: EnvListItem) { @@ -94,7 +94,7 @@ export function updateOrAddGlobalParam(data: GlobalParams) { return MSR.post({ url: data.id ? envURL.updateGlobalParamUrl : envURL.addGlobalParamUrl, data }); } /** 项目管理-环境-全局参数-导入 */ -export function importGlobalParam(data: { request: any; fileList: FileItem[] }) { +export function importGlobalParam(data: { request: any; fileList: File[] }) { return MSR.uploadFile({ url: envURL.importGlobalParamUrl }, data, '', false); } /** 项目管理-环境-全局参数-详情 */ diff --git a/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue b/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue index 51468289ef..0a4c89dca9 100644 --- a/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue +++ b/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue @@ -88,7 +88,13 @@
{{ t('ms.assertion.responseContentType') }}
- + XML HTML @@ -328,6 +334,7 @@ import moreSetting from '@/views/api-test/components/fastExtraction/moreSetting.vue'; import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue'; + import { conditionTypeNameMap } from '@/config/apiTest'; import { useI18n } from '@/hooks/useI18n'; import { countNodes, @@ -403,10 +410,6 @@ }; const condition = useVModel(props, 'data', emit); - // const condition = ref(props.data || defaultParamItem); - // watchEffect(() => { - // emit('change', { ...condition.value }); - // }); const extractParamsTableRef = ref>(); const fastExtractionVisible = ref(false); @@ -782,4 +785,10 @@ const handleScriptChange = (data: ExecuteConditionProcessor) => { condition.value.script = data; }; + // XML改变 + function changeHandler(value: string | number | boolean, type: string) { + if (value === condition.value.responseFormat) { + handleChange([], type); + } + } diff --git a/frontend/src/components/business/ms-assertion/comp/ScriptTab.vue b/frontend/src/components/business/ms-assertion/comp/ScriptTab.vue index 43c7d1b488..ae9beed6ba 100644 --- a/frontend/src/components/business/ms-assertion/comp/ScriptTab.vue +++ b/frontend/src/components/business/ms-assertion/comp/ScriptTab.vue @@ -1,40 +1,53 @@ diff --git a/frontend/src/components/business/ms-assertion/index.vue b/frontend/src/components/business/ms-assertion/index.vue index 94e0284883..55b97f89ef 100644 --- a/frontend/src/components/business/ms-assertion/index.vue +++ b/frontend/src/components/business/ms-assertion/index.vue @@ -12,11 +12,12 @@ -
+
@@ -63,49 +64,49 @@
- - - - - - - - - - - - - - + > --> + + + + + + + + + + + + +
@@ -117,6 +118,7 @@ import { VueDraggable } from 'vue-draggable-plus'; import MsButton from '@/components/pure/ms-button/index.vue'; + import { LanguageEnum } from '@/components/pure/ms-code-editor/types'; import MsIcon from '@/components/pure/ms-icon-font/index.vue'; import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; @@ -129,7 +131,8 @@ import { useI18n } from '@/hooks/useI18n'; - import { ResponseAssertionType } from '@/enums/apiEnum'; + import { ExecuteConditionProcessor } from '@/models/apiTest/common'; + import { RequestConditionScriptLanguage, ResponseAssertionType } from '@/enums/apiEnum'; import { ExecuteAssertion, MsAssertionItem } from './type'; @@ -192,6 +195,12 @@ bodyAssertionDataByType: {}, }; } + if (currentResItem && currentResItem?.assertionType === ResponseAssertionType.SCRIPT) { + return { + ...currentResItem, + processorType: ResponseAssertionType.SCRIPT, + }; + } return currentResItem; }, set: (val: ExecuteAssertion) => { @@ -303,6 +312,23 @@ }); break; case ResponseAssertionType.SCRIPT: + assertions.value.push({ + ...tmpObj, + id, + processorType: ResponseAssertionType.SCRIPT, + scriptName: t('apiTestDebug.preconditionScriptName'), + enableCommonScript: true, + script: '', + scriptId: '', + scriptLanguage: LanguageEnum.BEANSHELL, + commonScriptInfo: { + id: '', + name: '', + script: '', + params: [{}], + scriptLanguage: LanguageEnum.BEANSHELL, + }, + }); break; default: @@ -360,6 +386,7 @@ getCurrentItemState.value = assertions.value.find((item: any) => item.id === activeKey.value) || assertions.value[0] || {}; activeKey.value = getCurrentItemState.value.id; + console.log(getCurrentItemState.value, 'getCurrentItemState.value'); }); diff --git a/frontend/src/components/business/ms-common-script/insertCommonScript.vue b/frontend/src/components/business/ms-common-script/insertCommonScript.vue index caa635fcbc..61af1e062e 100644 --- a/frontend/src/components/business/ms-common-script/insertCommonScript.vue +++ b/frontend/src/components/business/ms-common-script/insertCommonScript.vue @@ -33,7 +33,7 @@