fix(用例管理&测试计划): 修复用例管理删除节点默认选中问题

This commit is contained in:
xinxin.wu 2024-06-24 20:18:25 +08:00 committed by 刘瑞斌
parent bff79b1868
commit 75f0d83ac8
4 changed files with 34 additions and 12 deletions

View File

@ -123,7 +123,14 @@
groupKeyword: string; // groupKeyword: string; //
}>(); }>();
const emits = defineEmits(['update:selectedKeys', 'caseNodeSelect', 'init', 'dragUpdate', 'update:groupKeyword']); const emits = defineEmits([
'update:selectedKeys',
'caseNodeSelect',
'init',
'dragUpdate',
'update:groupKeyword',
'deleteNode',
]);
const currentProjectId = computed(() => appStore.currentProjectId); const currentProjectId = computed(() => appStore.currentProjectId);
@ -220,12 +227,14 @@
onBeforeOk: async () => { onBeforeOk: async () => {
try { try {
await deleteCaseModuleTree(node.id); await deleteCaseModuleTree(node.id);
initModules();
if (selectedNodeKeys.value[0] === node.id) {
selectedNodeKeys.value = ['all'];
emits('update:selectedKeys', selectedNodeKeys.value);
emits('caseNodeSelect', selectedNodeKeys.value, []);
}
emits('deleteNode');
Message.success(t('caseManagement.featureCase.deleteSuccess')); Message.success(t('caseManagement.featureCase.deleteSuccess'));
emits(
'init',
caseTree.value.map((e) => e.name),
true
);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@ -101,6 +101,7 @@
@case-node-select="caseNodeSelect" @case-node-select="caseNodeSelect"
@init="setRootModules" @init="setRootModules"
@drag-update="dragUpdate" @drag-update="dragUpdate"
@delete-node="deleteNode"
/> />
</div> </div>
</div> </div>
@ -275,12 +276,8 @@
* 设置根模块名称列表 * 设置根模块名称列表
* @param names 根模块名称列表 * @param names 根模块名称列表
*/ */
function setRootModules(names: string[], isDelete = false) { function setRootModules(names: string[]) {
rootModulesName.value = names; rootModulesName.value = names;
if (isDelete) {
caseTreeRef.value?.initModules(true);
caseTableRef.value?.initData();
}
} }
// //
@ -445,6 +442,10 @@
} }
} }
function deleteNode() {
caseTableRef.value.initData();
}
function dragUpdate() { function dragUpdate() {
caseTableRef.value.emitTableParams(); caseTableRef.value.emitTableParams();
} }

View File

@ -123,6 +123,7 @@
'dragUpdate', 'dragUpdate',
'getNodeName', 'getNodeName',
'update:groupKeyword', 'update:groupKeyword',
'deleteNode',
]); ]);
const currentProjectId = computed(() => appStore.currentProjectId); const currentProjectId = computed(() => appStore.currentProjectId);
@ -206,8 +207,14 @@
onBeforeOk: async () => { onBeforeOk: async () => {
try { try {
await deletePlanModuleTree(node.id); await deletePlanModuleTree(node.id);
initModules();
if (selectedNodeKeys.value[0] === node.id) {
selectedNodeKeys.value = ['all'];
emits('update:selectedKeys', selectedNodeKeys.value);
emits('planTreeNodeSelect', selectedNodeKeys.value, []);
}
emits('deleteNode');
Message.success(t('common.deleteSuccess')); Message.success(t('common.deleteSuccess'));
initModules(true);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@ -74,6 +74,7 @@
@plan-tree-node-select="planNodeSelect" @plan-tree-node-select="planNodeSelect"
@init="setRootModules" @init="setRootModules"
@drag-update="dragUpdate" @drag-update="dragUpdate"
@delete-node="deleteNode"
></TestPlanTree> ></TestPlanTree>
</div> </div>
</div> </div>
@ -272,6 +273,10 @@
planTableRef.value?.emitTableParams(); planTableRef.value?.emitTableParams();
} }
function deleteNode() {
planTableRef.value?.fetchData();
}
function createTestPlan(type: string) { function createTestPlan(type: string) {
if (type === 'group') { if (type === 'group') {
showPlanGroupModel.value = true; showPlanGroupModel.value = true;