提交 44e1cf16 编写于 作者: C Captain.B

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

......@@ -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);
......
......@@ -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());
}
}
......@@ -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 = [];
this.selectDataCounts = 0;
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();
});
......
......@@ -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 = [
......
......@@ -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;
},
......
......@@ -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;
......
......@@ -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;
......
......@@ -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();
},
......
......@@ -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,9 +101,11 @@ export function _sort(column, condition) {
}
}
export function initCondition(condition) {
condition.selectAll = false;
condition.unSelectIds = [];
export function initCondition(condition,isSelectAll) {
if(!isSelectAll){
condition.selectAll = false;
condition.unSelectIds = [];
}
}
export function getLabel(vueObj, type) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册