diff --git a/frontend/src/models/apiTest/scenario.ts b/frontend/src/models/apiTest/scenario.ts index 3c63712a9c..13a99a577d 100644 --- a/frontend/src/models/apiTest/scenario.ts +++ b/frontend/src/models/apiTest/scenario.ts @@ -386,6 +386,11 @@ export interface ScenarioStepFileParams { deleteFileIds?: string[]; unLinkFileIds?: string[]; } +// 场景文件参数 +export interface ScenarioFileParams { + uploadFileIds: string[]; + linkFileIds: string[]; +} // 场景步骤详情 export type ScenarioStepDetails = Partial; // 场景 @@ -405,6 +410,7 @@ export interface Scenario { steps: ScenarioStepItem[]; stepDetails: Record; // case、api、脚本操作抽屉的详情结构 stepFileParam: Record; + fileParam: ScenarioFileParams; follow?: boolean; uploadFileIds: string[]; linkFileIds: string[]; @@ -455,6 +461,7 @@ export interface ApiScenarioDebugRequest { steps: ScenarioStepItem[]; projectId: string; stepFileParam: Record; + fileParam: ScenarioFileParams; frontendDebug?: boolean; } diff --git a/frontend/src/views/api-test/components/paramTable.vue b/frontend/src/views/api-test/components/paramTable.vue index 815c36ea10..cae4df6abd 100644 --- a/frontend/src/views/api-test/components/paramTable.vue +++ b/frontend/src/views/api-test/components/paramTable.vue @@ -916,7 +916,7 @@ (arr) => { if (arr.length > 0) { let hasNoIdItem = false; - paramsData.value = arr.map((item, i) => { + paramsData.value = arr.map((item) => { if (!item) { // 批量添加过来的数据最后一行会是 undefined hasNoIdItem = true; @@ -935,7 +935,12 @@ } return item; }); - if (hasNoIdItem && !filterKeyValParams(arr, props.defaultParamItem).lastDataIsDefault && !props.isTreeTable) { + if ( + (!props.disabledExceptParam || !props.disabledParamValue) && + hasNoIdItem && + !filterKeyValParams(arr, props.defaultParamItem).lastDataIsDefault && + !props.isTreeTable + ) { addTableLine(arr.length - 1, false, true); } } else { diff --git a/frontend/src/views/api-test/scenario/components/common/csvParamsTable.vue b/frontend/src/views/api-test/scenario/components/common/csvParamsTable.vue index 122030b3ed..68705876ab 100644 --- a/frontend/src/views/api-test/scenario/components/common/csvParamsTable.vue +++ b/frontend/src/views/api-test/scenario/components/common/csvParamsTable.vue @@ -124,6 +124,7 @@ import { CsvVariable } from '@/models/apiTest/scenario'; import { defaultCsvParamItem } from '@/views/api-test/components/config'; + import { filterKeyValParams } from '@/views/api-test/components/utils'; const props = defineProps<{ scenarioId?: string | number; @@ -310,6 +311,18 @@ } return true; } + + onBeforeMount(() => { + if ( + csvVariables.value.length > 0 && + !filterKeyValParams(csvVariables.value, defaultCsvParamItem).lastDataIsDefault + ) { + csvVariables.value.push({ + ...cloneDeep(defaultCsvParamItem), + id: getGenerateId(), + }); + } + });