Merge remote-tracking branch 'origin/v1.8' into v1.8

This commit is contained in:
Captain.B 2021-03-26 18:38:35 +08:00
commit 44e1cf16fa
10 changed files with 713 additions and 461 deletions

View File

@ -74,11 +74,21 @@ public class ApiAutomationController {
apiAutomationService.deleteBatch(ids);
}
@PostMapping("/deleteBatchByCondition")
public void deleteBatchByCondition(@RequestBody ApiScenarioBatchRequest request) {
apiAutomationService.deleteBatchByCondition(request);
}
@PostMapping("/removeToGc")
public void removeToGc(@RequestBody List<String> ids) {
apiAutomationService.removeToGc(ids);
}
@PostMapping("/removeToGcByBatch")
public void removeToGcByBatch(@RequestBody ApiScenarioBatchRequest request) {
apiAutomationService.removeToGcByBatch(request);
}
@PostMapping("/reduction")
public void reduction(@RequestBody List<String> ids) {
apiAutomationService.reduction(ids);

View File

@ -1001,4 +1001,18 @@ public class ApiAutomationService {
}
});
}
public void removeToGcByBatch(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
this.removeToGc(request.getIds());
}
public void deleteBatchByCondition(ApiScenarioBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
this.deleteBatch(request.getIds());
}
}

View File

@ -348,6 +348,9 @@
},
watch: {
selectNodeIds() {
this.condition.selectAll = false;
this.condition.unSelectIds = [];
this.selectDataCounts = 0;
this.selectProjectId ? this.search(this.selectProjectId) : this.search();
},
trashEnable() {
@ -357,6 +360,10 @@
} else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
this.condition.selectAll = false;
this.condition.unSelectIds = [];
this.selectDataCounts = 0;
this.search();
},
batchReportId() {
@ -414,9 +421,13 @@
break;
}
this.selection = [];
this.selectAll = false;
this.unSelection = [];
if(!this.condition.selectAll){
this.condition.selectAll = false;
this.condition.unSelectIds = [];
this.selectDataCounts = 0;
}
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
if (this.condition.projectId) {
this.result.loading = true;
@ -430,23 +441,53 @@
}
});
this.result.loading = false;
this.unSelection = data.listObject.map(s => s.id);
if (this.$refs.scenarioTable) {
setTimeout(this.$refs.scenarioTable.doLayout, 200)
}
if(!this.condition.selectAll){
this.condition.unSelectIds = response.data.listObject.map(s => s.id);
}
this.$nextTick(function(){
this.checkTableRowIsSelect();
})
});
}
getLabel(this, API_SCENARIO_LIST);
},
checkTableRowIsSelect(){
//
if(this.condition.selectAll){
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.scenarioTable.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
handleCommand(cmd) {
let table = this.$refs.scenarioTable;
switch (cmd) {
case "table":
this.selectAll = false;
this.condition.selectAll = false;
table.toggleAllSelection();
break;
case "all":
this.selectAll = true;
this.condition.selectAll = true;
break
}
},
@ -520,11 +561,6 @@
addTestPlan(params) {
let obj = {planIds: params[0], scenarioIds: this.selection};
// obj.projectId = getCurrentProjectID();
// obj.selectAllDate = this.isSelectAllDate;
// obj.unSelectIds = this.unSelection;
// obj = Object.assign(obj, this.condition);
// todo
if (this.isSelectAllDate) {
this.$warning("暂不支持批量添加所有场景到测试计划!");
@ -619,8 +655,10 @@
},
handleDeleteBatch(row) {
if (this.trashEnable) {
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/api/automation/deleteBatch/', ids, () => {
//let ids = Array.from(this.selectRows).map(row => row.id);
let param = {};
this.buildBatchParam(param);
this.$post('/api/automation/deleteBatchByCondition/', param, () => {
this.$success(this.$t('commons.delete_success'));
this.search();
});
@ -630,8 +668,10 @@
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/api/automation/removeToGc/', ids, () => {
//let ids = Array.from(this.selectRows).map(row => row.id);
let param = {};
this.buildBatchParam(param);
this.$post('/api/automation/removeToGcByBatch/', param, () => {
this.$success(this.$t('commons.delete_success'));
this.search();
});
@ -686,8 +726,11 @@
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let ids = [row.id];
this.$post('/api/automation/removeToGc/', ids, () => {
// let ids = [row.id];
let param = {};
this.buildBatchParam(param);
this.$post('/api/automation/removeToGcByBatch/', param, () => {
// this.$post('/api/automation/removeToGc/', ids, () => {
this.$success(this.$t('commons.delete_success'));
this.search();
});

View File

@ -1,9 +1,11 @@
<template>
<div>
<div>
<el-link type="primary" style="float:right;margin-top: 5px" @click="open">{{$t('commons.adv_search.title')}}</el-link>
<el-link type="primary" style="float:right;margin-top: 5px" @click="open">{{ $t('commons.adv_search.title') }}
</el-link>
<el-input :placeholder="$t('commons.search_by_id_name_tag')" @blur="search" @keyup.enter.native="search" class="search-input" size="small"
<el-input :placeholder="$t('commons.search_by_id_name_tag')" @blur="search" @keyup.enter.native="search"
class="search-input" size="small"
v-model="condition.name"/>
<el-table v-loading="result.loading"
@ -71,7 +73,8 @@
<el-table-column v-if="item.id=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
:key="index">
<template v-slot:default="scope">
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain" :content="itemName" style="margin-left: 0px; margin-right: 2px"/>
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
</template>
</el-table-column>
@ -267,13 +270,22 @@ export default {
},
watch: {
selectNodeIds() {
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
this.initTable();
},
currentProtocol() {
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
this.initTable();
},
trashEnable() {
if (this.trashEnable) {
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
this.initTable();
}
},
@ -302,9 +314,11 @@ export default {
this.condition.status = "Trash";
this.condition.moduleIds = [];
}
if(!this.selectAll){
this.selectAll = false;
this.unSelection = [];
this.selectDataCounts = 0;
}
this.condition.projectId = this.projectId;
if (this.currentProtocol != null) {
@ -328,7 +342,10 @@ export default {
this.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
this.total = response.data.itemCount;
this.tableData = response.data.listObject;
if(!this.selectAll){
this.unSelection = response.data.listObject.map(s => s.id);
}
this.tableData.forEach(item => {
if (item.tags && item.tags.length > 0) {
@ -338,11 +355,38 @@ export default {
if (this.$refs.caseTable) {
setTimeout(this.$refs.caseTable.doLayout, 200)
}
this.$nextTick(function(){
this.checkTableRowIsSelect();
})
});
}
getLabel(this, API_CASE_LIST);
},
checkTableRowIsSelect(){
//
if(this.selectAll){
let unSelectIds = this.unSelection;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.caseTable.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
open() {
this.$refs.searchBar.open();
},
@ -410,7 +454,7 @@ export default {
if (action === 'confirm') {
let obj = {};
obj.projectId = this.projectId;
obj.selectAllDate = this.isSelectAllDate;
obj.selectAllDate = this.selectAll;
obj.unSelectIds = this.unSelection;
obj.ids = Array.from(this.selectRows).map(row => row.id);
obj = Object.assign(obj, this.condition);
@ -457,7 +501,7 @@ export default {
param[form.type] = form.value;
param.ids = ids;
param.projectId = this.projectId;
param.selectAllDate = this.isSelectAllDate;
param.selectAllDate = this.selectAll;
param.unSelectIds = this.unSelection;
param = Object.assign(param, this.condition);
this.$post('/api/testcase/batch/editByParam', param, () => {
@ -489,14 +533,14 @@ export default {
this.unSelection = allIDs.filter(function (val) {
return selectedIDs.indexOf(val) === -1
});
if (this.isSelectAllDate) {
if (this.selectAll) {
this.selectDataCounts = this.total - this.unSelection.length;
} else {
this.selectDataCounts = selection.size;
}
},
isSelectDataAll(dataType) {
this.isSelectAllDate = dataType;
this.selectAll = dataType;
this.selectRowsCount(this.selectRows)
//
if (this.selectRows.size != this.tableData.length) {

View File

@ -386,9 +386,11 @@
},
watch: {
selectNodeIds() {
initCondition(this.condition,false);
this.initTable();
},
currentProtocol() {
initCondition(this.condition,false);
this.initTable();
},
trashEnable() {
@ -398,6 +400,7 @@
} else {
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
}
initCondition(this.condition,false);
this.initTable();
}
},
@ -419,7 +422,7 @@
},
initTable() {
this.selectRows = new Set();
initCondition(this.condition);
initCondition(this.condition,this.condition.selectAll);
this.selectDataCounts = 0;
this.condition.moduleIds = this.selectNodeIds;
this.condition.projectId = this.projectId;
@ -464,11 +467,37 @@
if (this.$refs.apiDefinitionTable) {
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
}
// nexttick:
this.$nextTick(function(){
this.checkTableRowIsSelect();
})
});
}
getLabel(this, API_LIST);
},
checkTableRowIsSelect(){
//
if(this.condition.selectAll){
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.apiDefinitionTable.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {
this.methodFilters = [

View File

@ -216,8 +216,36 @@
})
}
this.total = data.itemCount;
this.$nextTick(function(){
this.checkTableRowIsSelect();
});
})
},
checkTableRowIsSelect(){
//
if(this.condition.selectAll){
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.userTable.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},

View File

@ -598,7 +598,7 @@ export default {
return;
}
this.selectRows = new Set();
this.condition.selectAll = false;
// this.condition.selectAll = false;
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
@ -615,8 +615,38 @@ export default {
});
}
}
this.$nextTick(function(){
this.checkTableRowIsSelect();
});
})
},
checkTableRowIsSelect(){
//
if(this.condition.selectAll){
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.userTable.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
handleClose() {
this.form = {roles: [{id: ''}]};
this.btnAddRole = false;

View File

@ -208,8 +208,33 @@
})
}
this.total = data.itemCount;
this.$nextTick(function(){
this.checkTableRowIsSelect();
});
})
},
checkTableRowIsSelect(){
//
if(this.condition.selectAll){
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.userTable.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;

View File

@ -314,6 +314,7 @@ export default {
watch: {
selectNodeIds() {
this.currentPage = 1;
initCondition(this.condition,false);
this.initTableData();
},
condition() {
@ -332,7 +333,8 @@ export default {
initTableData() {
this.condition.planId = "";
this.condition.nodeIds = [];
initCondition(this.condition);
//initCondition(this.condition);
initCondition(this.condition,this.condition.selectAll);
this.selectDataCounts = 0;
if (this.planId) {
// param.planId = this.planId;
@ -394,9 +396,35 @@ export default {
setTimeout(this.$refs.table.doLayout, 200)
}
this.$nextTick(function(){
this.checkTableRowIsSelect();
})
});
}
},
checkTableRowIsSelect(){
//
if(this.condition.selectAll){
let unSelectIds = this.condition.unSelectIds;
this.tableData.forEach(row=>{
if(unSelectIds.indexOf(row.id)<0){
this.$refs.table.toggleRowSelection(row,true);
//selectRows
if (!this.selectRows.has(row)) {
this.$set(row, "showMore", true);
this.selectRows.add(row);
}
}else{
//selectRow
if (this.selectRows.has(row)) {
this.$set(row, "showMore", false);
this.selectRows.delete(row);
}
}
})
}
},
search() {
this.initTableData();
},

View File

@ -43,7 +43,6 @@ export function setUnSelectIds(tableData, condition, selectRows) {
condition.unSelectIds = allIDs.filter(function (val) {
return ids.indexOf(val) === -1
});
}
export function getSelectDataCounts(condition, total, selectRows) {
@ -102,10 +101,12 @@ export function _sort(column, condition) {
}
}
export function initCondition(condition) {
export function initCondition(condition,isSelectAll) {
if(!isSelectAll){
condition.selectAll = false;
condition.unSelectIds = [];
}
}
export function getLabel(vueObj, type) {
let param = {}