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

View File

@ -275,7 +275,8 @@ export default {
customNum: { customNum: {
type: Boolean, type: Boolean,
default: false default: false
} },
initApiTableOpretion: String,
}, },
data() { data() {
return { return {
@ -426,7 +427,9 @@ export default {
this.search(); this.search();
}, },
search(projectId) { search(projectId) {
if(this.needRefreshModule()){
this.$emit('refreshTree'); this.$emit('refreshTree');
}
this.selectRows = new Set(); this.selectRows = new Set();
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) { if (this.trashEnable) {
@ -866,6 +869,14 @@ export default {
}, },
getConditions() { getConditions() {
return this.condition; 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" @handleCase="handleCase"
@showExecResult="showExecResult" @showExecResult="showExecResult"
@refreshTable="refresh" @refreshTable="refresh"
:init-api-table-opretion="initApiTableOpretion"
@updateInitApiTableOpretion="updateInitApiTableOpretion"
ref="apiList"/> ref="apiList"/>
<!--测试用例列表--> <!--测试用例列表-->
<api-case-simple-list <api-case-simple-list
@ -242,6 +244,8 @@ export default {
syncTabs: [], syncTabs: [],
nodeTree: [], nodeTree: [],
currentModulePath: "", currentModulePath: "",
//API
initApiTableOpretion: 'init',
}; };
}, },
created() { created() {
@ -458,7 +462,7 @@ export default {
}, },
refresh(data) { refresh(data) {
this.$refs.apiList[0].initTable(data); this.$refs.apiList[0].initTable(data);
this.$refs.nodeTree.list(); //this.$refs.nodeTree.list();
}, },
refreshTree() { refreshTree() {
this.$refs.nodeTree.list(); this.$refs.nodeTree.list();
@ -489,9 +493,11 @@ export default {
this.debug(row); this.debug(row);
}, },
nodeChange(node, nodeIds, pNodes) { nodeChange(node, nodeIds, pNodes) {
this.initApiTableOpretion = "selectNodeIds";
this.selectNodeIds = nodeIds; this.selectNodeIds = nodeIds;
}, },
handleProtocolChange(protocol) { handleProtocolChange(protocol) {
this.initApiTableOpretion = "currentProtocol";
this.currentProtocol = protocol; this.currentProtocol = protocol;
}, },
setModuleOptions(data) { setModuleOptions(data) {
@ -504,7 +510,11 @@ export default {
this.$route.params.dataSelectRange = 'all'; this.$route.params.dataSelectRange = 'all';
}, },
enableTrash(data) { enableTrash(data) {
this.initApiTableOpretion = "trashEnable";
this.trashEnable = data; this.trashEnable = data;
},
updateInitApiTableOpretion(param){
this.initApiTableOpretion = param;
} }
} }
}; };

View File

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

View File

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