fix:自动刷新模块树

This commit is contained in:
wenyann 2021-05-26 19:18:15 +08:00 committed by jianxing
parent 16e0e805f8
commit 521f20aaa4
8 changed files with 38 additions and 26 deletions

View File

@ -114,7 +114,7 @@ public class ApiDefinitionService {
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
calculateResult(resList, request.getProjectId());
ApiDefinitionRequest finalRequest = request;
List<ApiDefinitionResult> resListFilters = new ArrayList<>();
/* List<ApiDefinitionResult> resListFilters = new ArrayList<>();
if (finalRequest.getFilters().size() > 1) {
if (null != finalRequest.getFilters().get("case_status")) {
resListFilters = resList.stream()
@ -123,7 +123,7 @@ public class ApiDefinitionService {
return resListFilters;
}
}
}*/
return resList;

View File

@ -20,6 +20,7 @@
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
<el-tab-pane name="default" :label="$t('api_test.automation.scenario_list')">
<ms-api-scenario-list
@refreshTree="refreshTree"
:module-tree="nodeTree"
:module-options="moduleOptions"
:select-node-ids="selectNodeIds"
@ -308,25 +309,28 @@ import MsEditApiScenario from "./scenario/EditApiScenario";
selectModule(data) {
this.currentModule = data;
},
saveScenario(data) {
this.setTabLabel(data);
this.$refs.apiScenarioList.search(data);
},
refresh(data) {
this.setTabTitle(data);
this.$refs.apiScenarioList.search(data);
this.$refs.nodeTree.list();
},
refreshAll() {
this.$refs.nodeTree.list();
this.$refs.apiScenarioList.search();
},
setTabTitle(data) {
for (let index in this.tabs) {
let tab = this.tabs[index];
if (tab.name === this.activeName) {
tab.label = data.name;
break;
saveScenario(data) {
this.setTabLabel(data);
this.$refs.apiScenarioList.search(data);
},
refresh(data) {
this.setTabTitle(data);
this.$refs.apiScenarioList.search(data);
this.$refs.nodeTree.list();
},
refreshTree() {
this.$refs.nodeTree.list();
},
refreshAll() {
this.$refs.nodeTree.list();
this.$refs.apiScenarioList.search();
},
setTabTitle(data) {
for (let index in this.tabs) {
let tab = this.tabs[index];
if (tab.name === this.activeName) {
tab.label = data.name;
break;
}
}
},

View File

@ -426,6 +426,7 @@ export default {
this.search();
},
search(projectId) {
this.$emit('refreshTree');
this.selectRows = new Set();
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
@ -492,6 +493,7 @@ export default {
});
}
getLabel(this, API_SCENARIO_LIST);
},
checkTableRowIsSelect() {
//

View File

@ -38,6 +38,7 @@
<ms-api-list
v-if="activeDom==='left'"
@runTest="runTest"
@refreshTree="refreshTree"
:module-tree="nodeTree"
:module-options="moduleOptions"
:current-protocol="currentProtocol"
@ -52,6 +53,7 @@
@editApi="editApi"
@handleCase="handleCase"
@showExecResult="showExecResult"
@refreshTable="refresh"
ref="apiList"/>
<!--测试用例列表-->
<api-case-simple-list
@ -456,6 +458,9 @@ export default {
this.$refs.apiList[0].initTable(data);
this.$refs.nodeTree.list();
},
refreshTree() {
this.$refs.nodeTree.list();
},
setTabTitle(data) {
for (let index in this.apiTabs) {
let tab = this.apiTabs[index];

View File

@ -128,7 +128,6 @@
<ms-table-column
v-if="item.id == 'caseTotal'"
prop="caseTotal"
sortable
width="140px"
:label="$t('api_test.definition.api_case_number')"
show-overflow-tooltip
@ -137,7 +136,6 @@
<ms-table-column
v-if="item.id == 'caseStatus'"
prop="caseStatus"
:filters="caseStatusFilters"
width="130px"
:label="$t('api_test.definition.api_case_status')"
show-overflow-tooltip
@ -147,7 +145,6 @@
<ms-table-column
v-if="item.id == 'casePassingRate'"
width="150px"
sortable
prop="casePassingRate"
:label="$t('api_test.definition.api_case_passing_rate')"
show-overflow-tooltip
@ -496,7 +493,7 @@ export default {
if (this.condition.projectId) {
this.result = this.$post("/api/definition/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.genProtocalFilter(this.condition.protocol);
this.total = response.data.listObject.length;
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
@ -514,6 +511,7 @@ export default {
});
}
getLabel(this, API_LIST);
this.$emit("refreshTree");
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {

View File

@ -31,6 +31,7 @@
:checkRedirectID="checkRedirectID"
:isRedirectEdit="isRedirectEdit"
:tree-nodes="treeNodes"
@refreshTable="refresh"
@testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase"
@testCaseDetail="showTestCaseDetail"

View File

@ -501,6 +501,7 @@ export default {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$emit('refreshTable');
this._handleDelete(testCase);
}
}
@ -528,6 +529,7 @@ export default {
this.$post('/test/case/delete/' + testCaseId, {}, () => {
this.initTableData();
this.$success(this.$t('commons.delete_success'));
});
},
refresh() {

View File

@ -148,7 +148,7 @@ export default {
"name": this.allLabel,
"level": 0,
"children": this.treeNodes,
"caseNum": num
"caseNum": num > 0 ? num : ""
});
if (this.expandedNode.length === 0) {
this.expandedNode.push("root");