refactor(测试跟踪): 回收站左侧模块树优化

--task=1008552 --bug=1015939,1015927,1015930 --user=宋昌昌
https://www.tapd.cn/55049933/s/1226931
https://www.tapd.cn/55049933/s/1226965
https://www.tapd.cn/55049933/s/1226980
This commit is contained in:
song-cc-rock 2022-08-18 16:54:43 +08:00 committed by f2c-ci-robot[bot]
parent ee1aff37a9
commit ee740ad063
7 changed files with 71 additions and 8 deletions

View File

@ -164,4 +164,6 @@ public interface ExtTestCaseMapper {
int bathUpdateByCondition(@Param("request") QueryTestCaseRequest condition, @Param("record") TestCaseWithBLOBs testCaseWithBLOBs);
List<TestCaseNodeDTO> getWorkspaceCountNodes(@Param("request") QueryTestCaseRequest request);
void updateNoModuleTrashNodeToDefault(@Param("projectId") String projectId, @Param("defaultNodeId") String defaultNodeId, @Param("defaultNodePath") String defaultNodePath);
}

View File

@ -1351,4 +1351,16 @@
and p.workspace_id = #{request.workspaceId}
group by tcn.id;
</select>
<update id="updateNoModuleTrashNodeToDefault">
update test_case
set node_id = #{defaultNodeId},
node_path = #{defaultNodePath}
where project_id = #{projectId}
and status = 'Trash'
and latest = true
and node_id not in (
select id from test_case_node where project_id = #{projectId}
)
</update>
</mapper>

View File

@ -280,6 +280,9 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
}
public List<TestCaseNodeDTO> getTrashCaseNode(String projectId, QueryTestCaseRequest request) {
// 初始化回收站中模块被删除的用例, 挂在默认未规划模块, 获取回收站模块节点数据
TestCaseNode defaultNode = this.getDefaultNode(projectId);
extTestCaseMapper.updateNoModuleTrashNodeToDefault(projectId, defaultNode.getId(), defaultNode.getName());
request.setProjectId(projectId);
request.setNodeIds(null);
List<TestCaseNodeDTO> countModules = extTestCaseMapper.getCountNodes(request);

View File

@ -125,6 +125,9 @@ export default {
condition['customs'] = [];
}
let value = component.value;
if (component.label === '用例状态' && value.length === 1 && value.indexOf('Trash') > -1) {
return;
}
if (component.type === "multipleMember" || component.type === "checkbox" || component.type === "multipleSelect") {
try {
value = JSON.stringify(component.value);

View File

@ -39,7 +39,7 @@
<ms-main-container>
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="closeConfirm">
<el-tab-pane name="trash" v-if="trashEnable" :label="$t('commons.trash')">
<el-tab-pane name="trash" v-if="trashEnable" :label="$t('commons.trash')" :closable="true">
<ms-tab-button
:isShowChangeButton="false">
<template v-slot:version>
@ -318,11 +318,16 @@ export default {
this.$refs.minder.refresh();
}
if (oldVal === 'trash' && newVal === 'default') {
this.condition.filters.status = [];
//
if (!this.hasRefreshDefault) {
this.refreshAll();
this.hasRefreshDefault = true;
} else {
this.refresh();
}
} else if (newVal === 'default') {
this.refresh();
}
},
activeDom(newVal, oldVal) {
@ -551,6 +556,14 @@ export default {
}
},
closeConfirm(targetName) {
this.activeName = 'default';
if (targetName === 'trash') {
this.trashEnable = false;
} else {
this.closeTabWithSave(targetName);
}
},
closeTabWithSave(targetName) {
let t = this.tabs.filter(tab => tab.name === targetName);
let message = "";
if (t && this.$store.state.testCaseMap.has(t[0].testCaseInfo.id) && this.$store.state.testCaseMap.get(t[0].testCaseInfo.id) > 0) {

View File

@ -651,6 +651,26 @@ export default {
// todo
this.condition.components = this.condition.components.filter(item => item.custom !== true);
let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields);
//
comp.filter(element => {
if (element.label === '责任人') {
element.label = this.$t('custom_field.case_maintainer')
}
if (element.label === '用例等级') {
element.label = this.$t('custom_field.case_priority')
}
if (element.label === '用例状态') {
element.label = this.$t('custom_field.case_status')
// TAB
if (this.trashEnable) {
element.options = [{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'}];
} else {
element.options.forEach(option => {
option.text = this.$t(option.text)
})
}
}
})
this.condition.components.push(...comp);
this.setTestCaseDefaultValue(template);
this.typeArr = [];
@ -694,18 +714,24 @@ export default {
return row.priority;
} else if (field.name === '责任人') {
return row.maintainerName;
} else if (field.name === '用例状态') {
value = value === 'Trash' ? this.$t('test_track.plan.plan_status_trash') : value
}
return value ? value : defaultVal;
},
getCustomFieldFilter(field) {
if (field.name === '用例状态') {
let option = [];
field.options.forEach((item) => {
option.push({
text: this.$t(item.text),
value: item.value
})
});
if (this.trashEnable) {
option.push({text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'});
} else {
field.options.forEach((item) => {
option.push({
text: this.$t(item.text),
value: item.value
})
});
}
return option;
}
return getCustomFieldFilter(field, this.userFilter);

View File

@ -29,7 +29,11 @@ export default {
},
list() {
this.result = getTestCaseTrashNodes(this.caseCondition, data => {
this.trashTreeNodes = data;
if (data && data.length > 0) {
this.trashTreeNodes = data[0].children;
} else {
this.trashTreeNodes = [];
}
if (this.$refs.trashNodeTree) {
this.trashTreeNodes.forEach(firstLevel => {
this.$refs.trashNodeTree.nodeExpand(firstLevel);