fix(测试计划): 修复测试计划关联用例切换项目初始化全部

This commit is contained in:
xinxin.wu 2024-06-20 20:00:48 +08:00 committed by Craftsman
parent 9ff9a3d25a
commit a2479398eb
4 changed files with 19 additions and 46 deletions

View File

@ -305,18 +305,6 @@
}); });
} }
watch(
() => props.currentProject,
() => {
setPagination({
current: 1,
});
resetSelector();
resetFilterParams();
emit('refresh');
}
);
const selectIds = computed(() => { const selectIds = computed(() => {
return [...propsRes.value.selectedKeys]; return [...propsRes.value.selectedKeys];
}); });
@ -328,14 +316,11 @@
} }
); );
watch( watch([() => props.currentProject, () => props.activeModule], () => {
() => props.activeModule, resetSelector();
() => { resetFilterParams();
resetSelector(); loadCaseList();
resetFilterParams(); });
loadCaseList();
}
);
onMounted(() => { onMounted(() => {
loadCaseList(); loadCaseList();

View File

@ -132,7 +132,7 @@
/** /**
* 初始化模块树 * 初始化模块树
*/ */
async function initModules() { async function initModules(setDefault = false) {
try { try {
moduleLoading.value = true; moduleLoading.value = true;
const getModuleParams = { const getModuleParams = {
@ -149,6 +149,9 @@
count: props.modulesCount?.[node.id] || 0, count: props.modulesCount?.[node.id] || 0,
}; };
}); });
if (setDefault) {
setActiveFolder('all');
}
emit('init', caseTree.value, selectedProtocols.value); emit('init', caseTree.value, selectedProtocols.value);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
@ -190,8 +193,10 @@
watch( watch(
() => props.currentProject, () => props.currentProject,
() => { (val) => {
initModules(); if (val) {
initModules(true);
}
} }
); );
</script> </script>

View File

@ -471,8 +471,6 @@
selectedProtocols.value = _protocols || []; selectedProtocols.value = _protocols || [];
if (props.associatedType === CaseLinkEnum.API) { if (props.associatedType === CaseLinkEnum.API) {
loadCaseList(); loadCaseList();
} else {
activeFolder.value = 'all';
} }
} }
@ -514,6 +512,7 @@
(val) => { (val) => {
if (val) { if (val) {
associationType.value = props.associatedType; associationType.value = props.associatedType;
activeFolder.value = 'all';
initProjectList(); initProjectList();
} }
selectPopVisible.value = false; selectPopVisible.value = false;

View File

@ -268,18 +268,6 @@
} }
); );
watch(
() => props.currentProject,
() => {
setPagination({
current: 1,
});
resetSelector();
resetFilterParams();
emit('refresh');
}
);
function getScenarioSaveParams() { function getScenarioSaveParams() {
const { excludeKeys, selectedKeys, selectorStatus } = propsRes.value; const { excludeKeys, selectedKeys, selectorStatus } = propsRes.value;
const tableParams = getTableParams(); const tableParams = getTableParams();
@ -298,20 +286,16 @@
pId: record.projectId, pId: record.projectId,
}); });
} }
watch([() => props.currentProject, () => props.activeModule], () => {
resetSelector();
resetFilterParams();
loadScenarioList();
});
onMounted(() => { onMounted(() => {
loadScenarioList(); loadScenarioList();
}); });
watch(
() => props.activeModule,
() => {
resetSelector();
resetFilterParams();
loadScenarioList();
}
);
defineExpose({ defineExpose({
getScenarioSaveParams, getScenarioSaveParams,
loadScenarioList, loadScenarioList,