fix(测试计划): 修复关联用例接口分页count重复请求

This commit is contained in:
xinxin.wu 2024-06-18 15:57:19 +08:00 committed by Craftsman
parent 50cec0aef2
commit 59bd127bb8
5 changed files with 65 additions and 84 deletions

View File

@ -80,6 +80,7 @@
activeSourceType: keyof typeof CaseLinkEnum;
selectorAll?: boolean;
keyword: string;
showType: string;
getPageApiType: keyof typeof CasePageApiTypeEnum; // Api
extraTableParams?: TableQueryParams; //
protocols: string[];
@ -245,6 +246,17 @@
const tableRef = ref<InstanceType<typeof MsBaseTable>>();
watch(
() => props.showType,
(val) => {
if (val === 'API_CASE') {
resetSelector();
resetFilterParams();
loadCaseList();
}
}
);
watch(
() => () => props.currentProject,
() => {

View File

@ -265,48 +265,31 @@
};
}
watch(
() => props.activeSourceType,
(val) => {
if (val) {
tableRef.value?.initColumn(columns);
resetSelector();
resetFilterParams();
setPagination({
current: 1,
});
}
}
);
watch(
() => props.currentProject,
(val) => {
if (val) {
setPagination({
current: 1,
});
resetSelector();
resetFilterParams();
loadCaseList();
}
},
{
immediate: true,
() => {
setPagination({
current: 1,
});
resetSelector();
resetFilterParams();
emit('refresh');
}
);
watch(
() => props.activeModule,
(val) => {
if (val) {
resetSelector();
resetFilterParams();
loadCaseList();
}
() => {
resetSelector();
resetFilterParams();
loadCaseList();
}
);
onMounted(() => {
loadCaseList();
});
defineExpose({
getFunctionalSaveParams,
loadCaseList,

View File

@ -60,7 +60,6 @@
import { ref } from 'vue';
import { useVModel } from '@vueuse/core';
import MsFolderAll from '@/components/business/ms-folder-all/index.vue';
import MsTree from '@/components/business/ms-tree/index.vue';
import type { MsTreeNodeData } from '@/components/business/ms-tree/types';
import TreeFolderAll from '@/views/api-test/components/treeFolderAll.vue';
@ -180,20 +179,21 @@
}
);
watchEffect(() => {
if (props.currentProject) {
initModules();
}
});
watch(
() => props.activeTab,
() => props.showType,
(val) => {
if (val) {
initModules();
selectedProtocolsChange();
}
}
);
watch(
() => props.currentProject,
() => {
initModules();
}
);
</script>
<style scoped lang="less">

View File

@ -194,6 +194,7 @@
:extra-table-params="props.extraTableParams"
:keyword="keyword"
@get-module-count="initModulesCount"
@refresh="loadCaseList"
/>
<!-- 接口用例 API -->
<ApiTable
@ -244,6 +245,7 @@
:extra-table-params="props.extraTableParams"
:keyword="keyword"
@get-module-count="initModulesCount"
@refresh="loadCaseList"
/>
<div class="footer">
@ -421,8 +423,7 @@
modulesCount.value = await initGetModuleCountFunc(props.getModuleCountApiType, associationType.value, {
...params,
...props.extraModuleCountParams,
protocols:
associationType.value === CaseLinkEnum.API && showType.value === 'API' ? selectedProtocols.value : undefined,
protocols: associationType.value === CaseLinkEnum.API ? selectedProtocols.value : undefined,
});
} catch (error) {
// eslint-disable-next-line no-console
@ -450,7 +451,11 @@
function initModuleTree(tree: ModuleTreeNode[], _protocols?: string[]) {
moduleTree.value = unref(tree);
selectedProtocols.value = _protocols || [];
loadCaseList();
if (props.associatedType === CaseLinkEnum.API) {
loadCaseList();
} else {
activeFolder.value = 'all';
}
}
const functionalType = ref('project');
@ -502,9 +507,7 @@
watch(
() => innerProject.value,
(val) => {
if (val) {
activeFolder.value = 'all';
}
innerProject.value = val;
}
);
</script>

View File

@ -225,45 +225,15 @@
const tableRef = ref<InstanceType<typeof MsBaseTable>>();
watch(
() => props.activeSourceType,
(val) => {
if (val) {
tableRef.value?.initColumn(columns);
resetSelector();
resetFilterParams();
setPagination({
current: 1,
});
}
}
);
watch(
() => props.currentProject,
(val) => {
if (val) {
setPagination({
current: 1,
});
resetSelector();
resetFilterParams();
loadScenarioList();
}
},
{
immediate: true,
}
);
watch(
() => props.activeModule,
(val) => {
if (val) {
resetSelector();
resetFilterParams();
loadScenarioList();
}
() => {
setPagination({
current: 1,
});
resetSelector();
resetFilterParams();
emit('refresh');
}
);
@ -278,6 +248,19 @@
};
}
onMounted(() => {
loadScenarioList();
});
watch(
() => props.activeModule,
() => {
resetSelector();
resetFilterParams();
loadScenarioList();
}
);
defineExpose({
getScenarioSaveParams,
loadScenarioList,