fix(接口测试): 修复模块树切换错误的缺陷

--bug=1025701 --user=王孝刚 【接口测试】场景列表和回收站切换-模块树切换错误
https://www.tapd.cn/55049933/s/1369029
This commit is contained in:
wxg0103 2023-05-05 20:19:11 +08:00 committed by fit2-zhao
parent b1045a29a1
commit 782872f5c8
2 changed files with 10 additions and 12 deletions

View File

@ -312,10 +312,13 @@ export default {
addTab(tab) { addTab(tab) {
this.trashEnable = tab.name === 'trash'; this.trashEnable = tab.name === 'trash';
if (tab.name === 'default') { if (tab.name === 'default') {
this.$refs.apiScenarioList.condition = {};
this.trashEnable = false;
this.$refs.nodeTree.list(this.projectId); this.$refs.nodeTree.list(this.projectId);
} else if (tab.name === 'trash') { } else if (tab.name === 'trash') {
this.trashEnable = true;
this.$refs.apiTrashScenarioList.search(); this.$refs.apiTrashScenarioList.search();
this.$refs.nodeTree.list(this.projectId, tab.name); this.$refs.nodeTree.list(this.projectId);
} }
if (!this.projectId) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
@ -619,7 +622,6 @@ export default {
if (targetName === 'trash') { if (targetName === 'trash') {
this.selectNodeIds = []; this.selectNodeIds = [];
this.trashEnable = false; this.trashEnable = false;
this.$refs.nodeTree.list(this.projectId);
} else { } else {
let message = ''; let message = '';
this.tabs.forEach((tab) => { this.tabs.forEach((tab) => {

View File

@ -156,17 +156,9 @@ export default {
'condition.filterText'() { 'condition.filterText'() {
this.filter(); this.filter();
}, },
'condition.trashEnable'() {
this.param = {};
this.$emit('enableTrash', this.condition.trashEnable);
},
relevanceProjectId() { relevanceProjectId() {
this.list(); this.list();
}, },
isTrashData() {
this.condition.trashEnable = this.isTrashData;
this.param = {};
},
}, },
created() { created() {
this.$EventBus.$on('scenarioConditionBus', (param) => { this.$EventBus.$on('scenarioConditionBus', (param) => {
@ -195,12 +187,13 @@ export default {
filter() { filter() {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);
}, },
list(projectId, targetName) { list(projectId) {
if (this.isRelevanceModel) { if (this.isRelevanceModel) {
this.result = getModuleByRelevanceProjectId(this.relevanceProjectId).then((response) => { this.result = getModuleByRelevanceProjectId(this.relevanceProjectId).then((response) => {
this.setData(response); this.setData(response);
}); });
} else if (this.isTrashData && targetName === 'trash') { } else if (this.isTrashData) {
this.result = postModuleByTrash(projectId ? projectId : this.projectId, this.param).then((response) => { this.result = postModuleByTrash(projectId ? projectId : this.projectId, this.param).then((response) => {
this.setData(response); this.setData(response);
}); });
@ -352,9 +345,12 @@ export default {
enableTrash() { enableTrash() {
this.condition.trashEnable = true; this.condition.trashEnable = true;
this.param.trashEnable = true; this.param.trashEnable = true;
this.param.name = '';
this.param.combine = {};
this.result = postModuleByTrash(this.projectId, this.param).then((response) => { this.result = postModuleByTrash(this.projectId, this.param).then((response) => {
this.setData(response); this.setData(response);
}); });
this.$emit('enableTrash', this.condition.trashEnable);
}, },
removeModuleId(nodeIds) { removeModuleId(nodeIds) {
if (localStorage.getItem('scenarioModule') && localStorage.getItem('scenarioModule') === nodeIds[0]) { if (localStorage.getItem('scenarioModule') && localStorage.getItem('scenarioModule') === nodeIds[0]) {