fix: 修复接口定义、接口自动化刷新模块树频繁的问题

在接口定义、接口自动化页面增加表格刷新动作参数,用来修复接口定义、接口自动化刷新模块树频繁的问题。如果是树模块引起的表格数据变化,不再回调更新树函数。
This commit is contained in:
song-tianyang 2021-06-01 15:46:36 +08:00 committed by 刘瑞斌
parent e4295985ea
commit bd82d0bba8
5 changed files with 49 additions and 6 deletions

View File

@ -33,6 +33,8 @@
@edit="editScenario"
@changeSelectDataRangeAll="changeSelectDataRangeAll"
:custom-num="customNum"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiScenarioList"/>
</el-tab-pane>
@ -123,7 +125,9 @@ export default {
selectNodeIds: [],
nodeTree: [],
currentModulePath: "",
customNum: false
customNum: false,
//API
initApiTableOpretion: 'init',
};
},
mounted() {
@ -341,6 +345,7 @@ export default {
},
nodeChange(node, nodeIds, pNodes) {
this.initApiTableOpretion = "nodeChange";
this.selectNodeIds = nodeIds;
},
setModuleOptions(data) {
@ -354,6 +359,7 @@ export default {
},
enableTrash(data) {
this.activeName = "default";
this.initApiTableOpretion = "enableTrash";
this.trashEnable = data;
},
getProject() {
@ -363,6 +369,9 @@ export default {
this.customNum = data.scenarioCustomNum;
}
});
},
updateInitApiTableOpretion(param){
this.initApiTableOpretion = param;
}
}
};

View File

@ -275,7 +275,8 @@ export default {
customNum: {
type: Boolean,
default: false
}
},
initApiTableOpretion: String,
},
data() {
return {
@ -426,7 +427,9 @@ export default {
this.search();
},
search(projectId) {
this.$emit('refreshTree');
if(this.needRefreshModule()){
this.$emit('refreshTree');
}
this.selectRows = new Set();
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
@ -866,6 +869,14 @@ export default {
},
getConditions() {
return this.condition;
},
needRefreshModule(){
if(this.initApiTableOpretion === '0'){
return true;
}else {
this.$emit('updateInitApiTableOpretion','0');
return false;
}
}
}
};

View File

@ -55,6 +55,8 @@
@handleCase="handleCase"
@showExecResult="showExecResult"
@refreshTable="refresh"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiList"/>
<!--测试用例列表-->
<api-case-simple-list
@ -242,6 +244,8 @@ export default {
syncTabs: [],
nodeTree: [],
currentModulePath: "",
//API
initApiTableOpretion: 'init',
};
},
created() {
@ -458,7 +462,7 @@ export default {
},
refresh(data) {
this.$refs.apiList[0].initTable(data);
this.$refs.nodeTree.list();
//this.$refs.nodeTree.list();
},
refreshTree() {
this.$refs.nodeTree.list();
@ -489,9 +493,11 @@ export default {
this.debug(row);
},
nodeChange(node, nodeIds, pNodes) {
this.initApiTableOpretion = "selectNodeIds";
this.selectNodeIds = nodeIds;
},
handleProtocolChange(protocol) {
this.initApiTableOpretion = "currentProtocol";
this.currentProtocol = protocol;
},
setModuleOptions(data) {
@ -504,7 +510,11 @@ export default {
this.$route.params.dataSelectRange = 'all';
},
enableTrash(data) {
this.initApiTableOpretion = "trashEnable";
this.trashEnable = data;
},
updateInitApiTableOpretion(param){
this.initApiTableOpretion = param;
}
}
};

View File

@ -375,6 +375,7 @@ export default {
selectNodeIds: Array,
isSelectThisWeek: String,
activeDom: String,
initApiTableOpretion: String,
visible: {
type: Boolean,
default: false,
@ -410,7 +411,7 @@ export default {
},
selectRows() {
return this.$refs.apiDefinitionTable.getSelectRows();
}
},
},
created: function () {
if (this.trashEnable) {
@ -514,7 +515,9 @@ export default {
});
}
getLabel(this, API_LIST);
this.$emit("refreshTree");
if(this.needRefreshModule()){
this.$emit("refreshTree");
}
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {
@ -817,6 +820,14 @@ export default {
open() {
this.$refs.searchBar.open();
},
needRefreshModule(){
if(this.initApiTableOpretion === '0'){
return true;
}else {
this.$emit('updateInitApiTableOpretion','0');
return false;
}
}
},
};
</script>

View File

@ -12,6 +12,7 @@
class="test-content adjust-table ms-table"
:class="{'ms-select-all-fixed':showSelectAll}"
:height="screenHeight"
v-loading="result.loading"
ref="table" @row-click="handleRowClick">
<el-table-column v-if="enableSelection" width="50" type="selection"/>
@ -79,6 +80,7 @@ export default {
return {
selectDataCounts: 0,
selectRows: new Set(),
result: {},
selectIds: []
};
},