fix(测试计划): 修复测试计划首次关联接口用例选中问题&用例删除模块

This commit is contained in:
xinxin.wu 2024-07-15 17:02:15 +08:00 committed by 刘瑞斌
parent 8b04d9cb9a
commit d98ebb6f13
6 changed files with 28 additions and 33 deletions

View File

@ -284,25 +284,16 @@
const tableRef = ref<InstanceType<typeof MsBaseTable>>(); const tableRef = ref<InstanceType<typeof MsBaseTable>>();
watch( watch(
() => props.showType, [() => props.currentProject, () => props.protocols],
(val) => {
if (val === 'API_CASE') {
resetSelector();
resetFilterParams();
loadCaseList();
}
}
);
watch(
() => () => props.currentProject,
() => { () => {
setPagination({ setPagination({
current: 1, current: 1,
}); });
resetSelector();
resetFilterParams(); resetFilterParams();
loadCaseList(); loadCaseList();
},
{
deep: true,
} }
); );
const innerSelectedIds = defineModel<string[]>('selectedIds', { required: true }); const innerSelectedIds = defineModel<string[]>('selectedIds', { required: true });
@ -352,6 +343,10 @@
propsRes.value propsRes.value
); );
onMounted(() => {
loadCaseList();
});
watch( watch(
[() => props.moduleTree, () => props.modulesCount], [() => props.moduleTree, () => props.modulesCount],
(val) => { (val) => {

View File

@ -214,11 +214,11 @@
return { return {
keyword: props.keyword, keyword: props.keyword,
projectId: props.currentProject, projectId: props.currentProject,
protocols: props.protocols,
moduleIds: props.activeModule === 'all' || !props.activeModule ? [] : [props.activeModule, ...props.offspringIds], moduleIds: props.activeModule === 'all' || !props.activeModule ? [] : [props.activeModule, ...props.offspringIds],
excludeIds: [...excludeKeys], excludeIds: [...excludeKeys],
filter: propsRes.value.filter, filter: propsRes.value.filter,
...props.extraTableParams, ...props.extraTableParams,
protocols: props.protocols || [],
}; };
} }
@ -248,13 +248,16 @@
} }
watch( watch(
() => [() => props.currentProject, () => props.protocols], [() => props.currentProject, () => props.protocols],
() => { () => {
setPagination({ setPagination({
current: 1, current: 1,
}); });
resetFilterParams(); resetFilterParams();
loadApiList(); loadApiList();
},
{
deep: true,
} }
); );
@ -270,17 +273,6 @@
} }
); );
watch(
() => props.showType,
(val) => {
if (val === 'API') {
resetSelector();
resetFilterParams();
loadApiList();
}
}
);
watch( watch(
() => props.activeModule, () => props.activeModule,
(val) => { (val) => {
@ -317,6 +309,10 @@
propsRes.value propsRes.value
); );
onMounted(() => {
loadApiList();
});
watch( watch(
[() => props.moduleTree, () => props.modulesCount], [() => props.moduleTree, () => props.modulesCount],
(val) => { (val) => {

View File

@ -197,6 +197,8 @@
}; };
}); });
allCount.value = props.modulesCount.all || 0; allCount.value = props.modulesCount.all || 0;
emit('init', caseTree.value, selectedProtocols.value);
} }
/** /**
* 初始化模块树 * 初始化模块树
@ -218,8 +220,6 @@
if (setDefault) { if (setDefault) {
setActiveFolder('all'); setActiveFolder('all');
} }
emit('init', caseTree.value, selectedProtocols.value);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);

View File

@ -636,9 +636,6 @@
function initModuleTree(tree: ModuleTreeNode[], _protocols?: string[]) { function initModuleTree(tree: ModuleTreeNode[], _protocols?: string[]) {
moduleTree.value = tree; moduleTree.value = tree;
selectedProtocols.value = _protocols || []; selectedProtocols.value = _protocols || [];
if (props.associatedType === CaseLinkEnum.API) {
loadCaseList();
}
} }
const apiSetTree = ref<ModuleTreeNode[]>(); const apiSetTree = ref<ModuleTreeNode[]>();

View File

@ -1019,6 +1019,13 @@ export const pathMap: PathMapItem[] = [
permission: [], permission: [],
level: MENU_LEVEL[2], level: MENU_LEVEL[2],
children: [ children: [
{
key: 'TEST_PLAN_MODULE', // 测试计划-模块
locale: 'testPlan.testPlanGroup.module',
route: RouteEnum.TEST_PLAN,
permission: [],
level: MENU_LEVEL[2],
},
{ {
key: 'TEST_PLAN_PLAN', // 测试计划-计划 key: 'TEST_PLAN_PLAN', // 测试计划-计划
locale: 'menu.testPlanShort', locale: 'menu.testPlanShort',

View File

@ -99,7 +99,7 @@
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useFeatureCaseStore from '@/store/modules/case/featureCase'; import useFeatureCaseStore from '@/store/modules/case/featureCase';
import { mapTree, traverseTree } from '@/utils'; import { characterLimit, mapTree, traverseTree } from '@/utils';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase'; import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase';
@ -217,7 +217,7 @@
const deleteHandler = (node: MsTreeNodeData) => { const deleteHandler = (node: MsTreeNodeData) => {
openModal({ openModal({
type: 'error', type: 'error',
title: t('caseManagement.featureCase.moduleDeleteTipTitle', { name: node.name }), title: t('caseManagement.featureCase.moduleDeleteTipTitle', { name: characterLimit(node.name) }),
content: t('caseManagement.featureCase.deleteCaseTipContent'), content: t('caseManagement.featureCase.deleteCaseTipContent'),
okText: t('caseManagement.featureCase.deleteConfirm'), okText: t('caseManagement.featureCase.deleteConfirm'),
okButtonProps: { okButtonProps: {