fix(测试计划): 修复测试计划关联用例APICountUrl不正确

This commit is contained in:
xinxin.wu 2024-07-16 16:02:14 +08:00 committed by 刘瑞斌
parent fdbadd5494
commit 993508e2f7
3 changed files with 31 additions and 11 deletions

View File

@ -279,6 +279,12 @@
const tableParams = await getTableParams();
setLoadListParams(tableParams);
loadList();
emit('getModuleCount', {
...tableParams,
current: propsRes.value.msPagination?.current,
pageSize: propsRes.value.msPagination?.pageSize,
});
}
const tableRef = ref<InstanceType<typeof MsBaseTable>>();

View File

@ -419,7 +419,7 @@
const projectList = ref<ProjectListItem[]>([]);
const innerProject = useVModel(props, 'projectId', emit);
const showType = ref('API');
const showType = ref<'API' | 'CASE'>('API');
const innerVisible = useVModel(props, 'visible', emit);
const associateType = ref<string>('project');
@ -600,14 +600,19 @@
const selectedProtocols = ref<string[]>([]);
async function initModulesCount(params: TableQueryParams) {
try {
modulesCount.value = await initGetModuleCountFunc(props.getModuleCountApiType, associationType.value, {
...params,
moduleIds: [],
filter: {},
keyword: '',
...props.extraModuleCountParams,
protocols: associationType.value === CaseLinkEnum.API ? selectedProtocols.value : undefined,
});
modulesCount.value = await initGetModuleCountFunc(
props.getModuleCountApiType,
associationType.value,
showType.value,
{
...params,
moduleIds: [],
filter: {},
keyword: '',
...props.extraModuleCountParams,
protocols: associationType.value === CaseLinkEnum.API ? selectedProtocols.value : undefined,
}
);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);

View File

@ -1,3 +1,4 @@
import { getModuleCount } from '@/api/modules/api-test/management';
import { getModuleCount as getScenarioModuleCount } from '@/api/modules/api-test/scenario';
import { getCaseModulesCounts, getPublicLinkCaseModulesCounts } from '@/api/modules/case-management/featureCase';
import { testPlanAssociateModuleCount } from '@/api/modules/test-plan/testPlan';
@ -13,7 +14,11 @@ export const getModuleTreeCountApiMap: Record<string, any> = {
},
[CaseCountApiTypeEnum.TEST_PLAN_CASE_COUNT]: {
[CaseLinkEnum.FUNCTIONAL]: getCaseModulesCounts,
[CaseLinkEnum.API]: testPlanAssociateModuleCount,
[CaseLinkEnum.API]: {
API: getModuleCount,
CASE: testPlanAssociateModuleCount,
},
[CaseLinkEnum.SCENARIO]: getScenarioModuleCount,
},
};
@ -22,9 +27,13 @@ export const getModuleTreeCountApiMap: Record<string, any> = {
export function initGetModuleCountFunc(
type: CaseCountApiTypeEnum[keyof CaseCountApiTypeEnum],
activeTab: keyof typeof CaseLinkEnum,
showType: 'API' | 'CASE',
params: Record<string, any>
) {
return getModuleTreeCountApiMap[type as keyof typeof CaseCountApiTypeEnum][activeTab](params);
if (activeTab !== CaseLinkEnum.API) {
return getModuleTreeCountApiMap[type as keyof typeof CaseCountApiTypeEnum][activeTab](params);
}
return getModuleTreeCountApiMap[type as keyof typeof CaseCountApiTypeEnum][activeTab][showType](params);
}
export default {};