-
@@ -215,6 +215,10 @@
this.apiTabs = tabs.filter(tab => tab.name !== targetName);
this.refresh();
},
+ //创建左侧树的根目录模块
+ createRootModel(){
+ this.$refs.nodeTree.createRootModel();
+ },
handleTabsEdit(targetName, action, api) {
if (!getCurrentProjectID()) {
this.$warning(this.$t('commons.check_project_tip'));
diff --git a/frontend/src/business/components/api/definition/components/ApiConfig.vue b/frontend/src/business/components/api/definition/components/ApiConfig.vue
index 2f3ef68ada..393c6e780a 100644
--- a/frontend/src/business/components/api/definition/components/ApiConfig.vue
+++ b/frontend/src/business/components/api/definition/components/ApiConfig.vue
@@ -2,16 +2,16 @@
-
-
-
-
@@ -75,6 +75,9 @@
this.$emit('runTest', data);
})
},
+ createRootModelInTree(){
+ this.$emit("createRootModel");
+ },
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
diff --git a/frontend/src/business/components/api/definition/components/complete/BasisApi.vue b/frontend/src/business/components/api/definition/components/complete/BasisApi.vue
index 13544bc4da..e964545917 100644
--- a/frontend/src/business/components/api/definition/components/complete/BasisApi.vue
+++ b/frontend/src/business/components/api/definition/components/complete/BasisApi.vue
@@ -11,7 +11,17 @@
-
+
+
+
+
+
+
+ {{$t('api_test.definition.select_comp.no_data')}},
+ {{$t('api_test.definition.select_comp.add_data')}}
+
+
+
@@ -115,7 +125,10 @@
this.$emit('callback');
}
})
- }
+ },
+ createModules(){
+ this.$emit("createRootModelInTree");
+ },
}
}
diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue
index 84380d6fa3..fb8a41a3ce 100644
--- a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue
+++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue
@@ -16,7 +16,7 @@
-
+
@@ -71,7 +71,10 @@
this.basisData.request = this.request;
this.$emit('runTest', this.basisData);
}
- }
+ },
+ createRootModelInTree(){
+ this.$emit("createRootModelInTree");
+ },
},
computed: {}
diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue
index 9648a9bbb3..1561e5484b 100644
--- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue
+++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue
@@ -36,7 +36,17 @@
-
+
+
+
+
+
+
+ {{$t('api_test.definition.select_comp.no_data')}},
+ {{$t('api_test.definition.select_comp.add_data')}}
+
+
+
@@ -96,6 +106,7 @@
import {REQ_METHOD, API_STATUS} from "../../model/JsonData";
import MsJsr233Processor from "../processor/Jsr233Processor";
import {KeyValue} from "../../model/ApiTestModel";
+ // import {append} from "./../../../../track/common/NodeTree";
export default {
name: "MsAddCompleteHttpApi",
@@ -161,6 +172,9 @@
}
})
},
+ createModules(){
+ this.$emit("createRootModelInTree");
+ },
getPath(id) {
if (id === null) {
return null;
diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue
index 54bc58ea4e..4ca16a2d0b 100644
--- a/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue
+++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteSQLApi.vue
@@ -15,7 +15,7 @@
-
+
@@ -70,6 +70,9 @@
this.$emit('runTest', this.basisData);
}
},
+ createRootModelInTree(){
+ this.$emit("createRootModelInTree");
+ },
},
}
diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue
index 5e24359337..6d26a4da03 100644
--- a/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue
+++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteTCPApi.vue
@@ -15,7 +15,7 @@
-
+
@@ -70,7 +70,10 @@
this.basisData.request = this.request;
this.$emit('runTest', this.basisData);
}
- }
+ },
+ createRootModelInTree(){
+ this.$emit("createRootModelInTree");
+ },
},
}
diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue
index c2fb3b5fbc..dad5520ea2 100644
--- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue
+++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue
@@ -7,6 +7,7 @@
+
+
+
+
+
+
+ {{$t('api_test.batch_menus.select_all_data',[total])}}
+
+
+ {{$t('api_test.batch_menus.select_show_data',[tableData.length])}}
+
+
+
-
+
@@ -143,7 +157,10 @@
pageSize: 10,
total: 0,
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
- environmentId: undefined
+ environmentId: undefined,
+ selectAll: false,
+ unSelection:[],
+ selectDataCounts:0,
}
},
props: {
@@ -216,7 +233,9 @@
this.condition.status = "Trash";
this.condition.moduleIds = [];
}
-
+ this.selectAll = false;
+ this.unSelection = [];
+ this.selectDataCounts = 0;
this.condition.projectId = getCurrentProjectID();
if (this.currentProtocol != null) {
@@ -226,6 +245,7 @@
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
+ this.unSelection = response.data.listObject.map(s=>s.id);
});
}
},
@@ -237,6 +257,7 @@
// },
handleSelect(selection, row) {
_handleSelect(this, selection, row, this.selectRows);
+ this.selectRowsCount(this.selectRows)
},
showExecResult(row) {
this.visible = false;
@@ -256,6 +277,7 @@
},
handleSelectAll(selection) {
_handleSelectAll(this, selection, this.tableData, this.selectRows);
+ this.selectRowsCount(this.selectRows)
},
search() {
this.initTable();
@@ -294,7 +316,13 @@
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
- this.$post('/api/testcase/deleteBatch/', Array.from(this.selectRows).map(row => row.id), () => {
+ let obj = {};
+ obj.projectId = getCurrentProjectID();
+ obj.selectAllDate = this.isSelectAllDate;
+ obj.unSelectIds = this.unSelection;
+ obj.ids = Array.from(this.selectRows).map(row => row.id);
+ obj = Object.assign(obj, this.condition);
+ this.$post('/api/testcase/deleteBatchByParam/', obj , () => {
this.selectRows.clear();
this.initTable();
this.$success(this.$t('commons.delete_success'));
@@ -327,7 +355,12 @@
let param = {};
param[form.type] = form.value;
param.ids = ids;
- this.$post('/api/testcase/batch/edit', param, () => {
+
+ param.projectId = getCurrentProjectID();
+ param.selectAllDate = this.isSelectAllDate;
+ param.unSelectIds = this.unSelection;
+ param = Object.assign(param, this.condition);
+ this.$post('/api/testcase/batch/editByParam', param, () => {
this.$success(this.$t('commons.save_success'));
this.initTable();
});
@@ -355,6 +388,31 @@
},
setEnvironment(data) {
this.environmentId = data.id;
+ },
+ selectRowsCount(selection){
+ let selectedIDs = this.getIds(selection);
+ let allIDs = this.tableData.map(s=>s.id);
+ this.unSelection = allIDs.filter(function (val) {
+ return selectedIDs.indexOf(val) === -1
+ });
+ if(this.isSelectAllDate){
+ this.selectDataCounts =this.total - this.unSelection.length;
+ }else {
+ this.selectDataCounts =selection.size;
+ }
+ },
+ isSelectDataAll(dataType) {
+ this.isSelectAllDate = dataType;
+ this.selectRowsCount(this.selectRows)
+ //如果已经全选,不需要再操作了
+ if (this.selectRows.size != this.tableData.length) {
+ this.$refs.caseTable.toggleAllSelection(true);
+ }
+ },
+ getIds(rowSets){
+ let rowArray = Array.from(rowSets)
+ let ids = rowArray.map(s=>s.id);
+ return ids;
}
},
}
diff --git a/frontend/src/business/components/api/definition/components/module/ApiModule.vue b/frontend/src/business/components/api/definition/components/module/ApiModule.vue
index cb9844960a..73e221ba19 100644
--- a/frontend/src/business/components/api/definition/components/module/ApiModule.vue
+++ b/frontend/src/business/components/api/definition/components/module/ApiModule.vue
@@ -176,6 +176,13 @@
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
}
},
+ //创建根目录的模块---供父类使用
+ createRootModel(){
+ let dataArr = this.$refs.nodeTree.extendTreeNodes;
+ if(dataArr.length>0){
+ this.$refs.nodeTree.append({},dataArr[0]);
+ }
+ },
exportAPI() {
this.$emit('exportAPI');
},
diff --git a/frontend/src/business/components/api/definition/components/response/RequestMetric.vue b/frontend/src/business/components/api/definition/components/response/RequestMetric.vue
index cb504b5703..660da3ecae 100644
--- a/frontend/src/business/components/api/definition/components/response/RequestMetric.vue
+++ b/frontend/src/business/components/api/definition/components/response/RequestMetric.vue
@@ -27,7 +27,7 @@
computed: {
error() {
- return this.response.responseCode >= 400;
+ return this.response && this.response.responseCode && this.response.responseCode >= 400;
}
}
}
diff --git a/frontend/src/business/components/api/definition/components/response/ResponseResult.vue b/frontend/src/business/components/api/definition/components/response/ResponseResult.vue
index 547feb25ac..78c9c31698 100644
--- a/frontend/src/business/components/api/definition/components/response/ResponseResult.vue
+++ b/frontend/src/business/components/api/definition/components/response/ResponseResult.vue
@@ -41,7 +41,7 @@