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; //
}>();
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);
@ -220,12 +227,14 @@
onBeforeOk: async () => {
try {
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'));
emits(
'init',
caseTree.value.map((e) => e.name),
true
);
} catch (error) {
console.log(error);
}

View File

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

View File

@ -123,6 +123,7 @@
'dragUpdate',
'getNodeName',
'update:groupKeyword',
'deleteNode',
]);
const currentProjectId = computed(() => appStore.currentProjectId);
@ -206,8 +207,14 @@
onBeforeOk: async () => {
try {
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'));
initModules(true);
} catch (error) {
console.log(error);
}

View File

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