Merge remote-tracking branch 'origin/v1.8' into v1.8
This commit is contained in:
commit
44e1cf16fa
|
@ -74,11 +74,21 @@ public class ApiAutomationController {
|
||||||
apiAutomationService.deleteBatch(ids);
|
apiAutomationService.deleteBatch(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/deleteBatchByCondition")
|
||||||
|
public void deleteBatchByCondition(@RequestBody ApiScenarioBatchRequest request) {
|
||||||
|
apiAutomationService.deleteBatchByCondition(request);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/removeToGc")
|
@PostMapping("/removeToGc")
|
||||||
public void removeToGc(@RequestBody List<String> ids) {
|
public void removeToGc(@RequestBody List<String> ids) {
|
||||||
apiAutomationService.removeToGc(ids);
|
apiAutomationService.removeToGc(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/removeToGcByBatch")
|
||||||
|
public void removeToGcByBatch(@RequestBody ApiScenarioBatchRequest request) {
|
||||||
|
apiAutomationService.removeToGcByBatch(request);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/reduction")
|
@PostMapping("/reduction")
|
||||||
public void reduction(@RequestBody List<String> ids) {
|
public void reduction(@RequestBody List<String> ids) {
|
||||||
apiAutomationService.reduction(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: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
|
this.condition.selectAll = false;
|
||||||
|
this.condition.unSelectIds = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
this.selectProjectId ? this.search(this.selectProjectId) : this.search();
|
this.selectProjectId ? this.search(this.selectProjectId) : this.search();
|
||||||
},
|
},
|
||||||
trashEnable() {
|
trashEnable() {
|
||||||
|
@ -357,6 +360,10 @@
|
||||||
} else {
|
} else {
|
||||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||||
}
|
}
|
||||||
|
this.condition.selectAll = false;
|
||||||
|
this.condition.unSelectIds = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
|
|
||||||
this.search();
|
this.search();
|
||||||
},
|
},
|
||||||
batchReportId() {
|
batchReportId() {
|
||||||
|
@ -414,9 +421,13 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.selection = [];
|
this.selection = [];
|
||||||
this.selectAll = false;
|
|
||||||
this.unSelection = [];
|
if(!this.condition.selectAll){
|
||||||
|
this.condition.selectAll = false;
|
||||||
|
this.condition.unSelectIds = [];
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
|
}
|
||||||
|
|
||||||
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
|
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
|
||||||
if (this.condition.projectId) {
|
if (this.condition.projectId) {
|
||||||
this.result.loading = true;
|
this.result.loading = true;
|
||||||
|
@ -430,23 +441,53 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.result.loading = false;
|
this.result.loading = false;
|
||||||
this.unSelection = data.listObject.map(s => s.id);
|
|
||||||
if (this.$refs.scenarioTable) {
|
if (this.$refs.scenarioTable) {
|
||||||
setTimeout(this.$refs.scenarioTable.doLayout, 200)
|
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);
|
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) {
|
handleCommand(cmd) {
|
||||||
let table = this.$refs.scenarioTable;
|
let table = this.$refs.scenarioTable;
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case "table":
|
case "table":
|
||||||
this.selectAll = false;
|
this.condition.selectAll = false;
|
||||||
table.toggleAllSelection();
|
table.toggleAllSelection();
|
||||||
break;
|
break;
|
||||||
case "all":
|
case "all":
|
||||||
this.selectAll = true;
|
this.condition.selectAll = true;
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -520,11 +561,6 @@
|
||||||
addTestPlan(params) {
|
addTestPlan(params) {
|
||||||
let obj = {planIds: params[0], scenarioIds: this.selection};
|
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 选取全部数据
|
// todo 选取全部数据
|
||||||
if (this.isSelectAllDate) {
|
if (this.isSelectAllDate) {
|
||||||
this.$warning("暂不支持批量添加所有场景到测试计划!");
|
this.$warning("暂不支持批量添加所有场景到测试计划!");
|
||||||
|
@ -619,8 +655,10 @@
|
||||||
},
|
},
|
||||||
handleDeleteBatch(row) {
|
handleDeleteBatch(row) {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
//let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
this.$post('/api/automation/deleteBatch/', ids, () => {
|
let param = {};
|
||||||
|
this.buildBatchParam(param);
|
||||||
|
this.$post('/api/automation/deleteBatchByCondition/', param, () => {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.search();
|
this.search();
|
||||||
});
|
});
|
||||||
|
@ -630,8 +668,10 @@
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
let ids = Array.from(this.selectRows).map(row => row.id);
|
//let ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
this.$post('/api/automation/removeToGc/', ids, () => {
|
let param = {};
|
||||||
|
this.buildBatchParam(param);
|
||||||
|
this.$post('/api/automation/removeToGcByBatch/', param, () => {
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.search();
|
this.search();
|
||||||
});
|
});
|
||||||
|
@ -686,8 +726,11 @@
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
let ids = [row.id];
|
// let ids = [row.id];
|
||||||
this.$post('/api/automation/removeToGc/', ids, () => {
|
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.$success(this.$t('commons.delete_success'));
|
||||||
this.search();
|
this.search();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<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"/>
|
v-model="condition.name"/>
|
||||||
|
|
||||||
<el-table v-loading="result.loading"
|
<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')"
|
<el-table-column v-if="item.id=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
|
||||||
:key="index">
|
:key="index">
|
||||||
<template v-slot:default="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
@ -267,13 +270,22 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
|
this.selectAll = false;
|
||||||
|
this.unSelection = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
currentProtocol() {
|
currentProtocol() {
|
||||||
|
this.selectAll = false;
|
||||||
|
this.unSelection = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
trashEnable() {
|
trashEnable() {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
|
this.selectAll = false;
|
||||||
|
this.unSelection = [];
|
||||||
|
this.selectDataCounts = 0;
|
||||||
this.initTable();
|
this.initTable();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -302,9 +314,11 @@ export default {
|
||||||
this.condition.status = "Trash";
|
this.condition.status = "Trash";
|
||||||
this.condition.moduleIds = [];
|
this.condition.moduleIds = [];
|
||||||
}
|
}
|
||||||
|
if(!this.selectAll){
|
||||||
this.selectAll = false;
|
this.selectAll = false;
|
||||||
this.unSelection = [];
|
this.unSelection = [];
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
|
}
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
|
|
||||||
if (this.currentProtocol != null) {
|
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.result = this.$post('/api/testcase/list/' + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
|
|
||||||
|
if(!this.selectAll){
|
||||||
this.unSelection = response.data.listObject.map(s => s.id);
|
this.unSelection = response.data.listObject.map(s => s.id);
|
||||||
|
}
|
||||||
|
|
||||||
this.tableData.forEach(item => {
|
this.tableData.forEach(item => {
|
||||||
if (item.tags && item.tags.length > 0) {
|
if (item.tags && item.tags.length > 0) {
|
||||||
|
@ -338,11 +355,38 @@ export default {
|
||||||
if (this.$refs.caseTable) {
|
if (this.$refs.caseTable) {
|
||||||
setTimeout(this.$refs.caseTable.doLayout, 200)
|
setTimeout(this.$refs.caseTable.doLayout, 200)
|
||||||
}
|
}
|
||||||
|
this.$nextTick(function(){
|
||||||
|
this.checkTableRowIsSelect();
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getLabel(this, API_CASE_LIST);
|
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() {
|
open() {
|
||||||
this.$refs.searchBar.open();
|
this.$refs.searchBar.open();
|
||||||
},
|
},
|
||||||
|
@ -410,7 +454,7 @@ export default {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.projectId = this.projectId;
|
obj.projectId = this.projectId;
|
||||||
obj.selectAllDate = this.isSelectAllDate;
|
obj.selectAllDate = this.selectAll;
|
||||||
obj.unSelectIds = this.unSelection;
|
obj.unSelectIds = this.unSelection;
|
||||||
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
obj.ids = Array.from(this.selectRows).map(row => row.id);
|
||||||
obj = Object.assign(obj, this.condition);
|
obj = Object.assign(obj, this.condition);
|
||||||
|
@ -457,7 +501,7 @@ export default {
|
||||||
param[form.type] = form.value;
|
param[form.type] = form.value;
|
||||||
param.ids = ids;
|
param.ids = ids;
|
||||||
param.projectId = this.projectId;
|
param.projectId = this.projectId;
|
||||||
param.selectAllDate = this.isSelectAllDate;
|
param.selectAllDate = this.selectAll;
|
||||||
param.unSelectIds = this.unSelection;
|
param.unSelectIds = this.unSelection;
|
||||||
param = Object.assign(param, this.condition);
|
param = Object.assign(param, this.condition);
|
||||||
this.$post('/api/testcase/batch/editByParam', param, () => {
|
this.$post('/api/testcase/batch/editByParam', param, () => {
|
||||||
|
@ -489,14 +533,14 @@ export default {
|
||||||
this.unSelection = allIDs.filter(function (val) {
|
this.unSelection = allIDs.filter(function (val) {
|
||||||
return selectedIDs.indexOf(val) === -1
|
return selectedIDs.indexOf(val) === -1
|
||||||
});
|
});
|
||||||
if (this.isSelectAllDate) {
|
if (this.selectAll) {
|
||||||
this.selectDataCounts = this.total - this.unSelection.length;
|
this.selectDataCounts = this.total - this.unSelection.length;
|
||||||
} else {
|
} else {
|
||||||
this.selectDataCounts = selection.size;
|
this.selectDataCounts = selection.size;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isSelectDataAll(dataType) {
|
isSelectDataAll(dataType) {
|
||||||
this.isSelectAllDate = dataType;
|
this.selectAll = dataType;
|
||||||
this.selectRowsCount(this.selectRows)
|
this.selectRowsCount(this.selectRows)
|
||||||
//如果已经全选,不需要再操作了
|
//如果已经全选,不需要再操作了
|
||||||
if (this.selectRows.size != this.tableData.length) {
|
if (this.selectRows.size != this.tableData.length) {
|
||||||
|
|
|
@ -386,9 +386,11 @@
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
|
initCondition(this.condition,false);
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
currentProtocol() {
|
currentProtocol() {
|
||||||
|
initCondition(this.condition,false);
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
trashEnable() {
|
trashEnable() {
|
||||||
|
@ -398,6 +400,7 @@
|
||||||
} else {
|
} else {
|
||||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||||
}
|
}
|
||||||
|
initCondition(this.condition,false);
|
||||||
this.initTable();
|
this.initTable();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -419,7 +422,7 @@
|
||||||
},
|
},
|
||||||
initTable() {
|
initTable() {
|
||||||
this.selectRows = new Set();
|
this.selectRows = new Set();
|
||||||
initCondition(this.condition);
|
initCondition(this.condition,this.condition.selectAll);
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
|
@ -464,11 +467,37 @@
|
||||||
if (this.$refs.apiDefinitionTable) {
|
if (this.$refs.apiDefinitionTable) {
|
||||||
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
|
setTimeout(this.$refs.apiDefinitionTable.doLayout, 200)
|
||||||
}
|
}
|
||||||
|
// nexttick:表格加载完成之后触发。判断是否需要勾选行
|
||||||
|
this.$nextTick(function(){
|
||||||
|
this.checkTableRowIsSelect();
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getLabel(this, API_LIST);
|
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) {
|
genProtocalFilter(protocalType) {
|
||||||
if (protocalType === "HTTP") {
|
if (protocalType === "HTTP") {
|
||||||
this.methodFilters = [
|
this.methodFilters = [
|
||||||
|
|
|
@ -216,8 +216,36 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.total = data.itemCount;
|
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) {
|
buildPagePath(path) {
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
},
|
},
|
||||||
|
|
|
@ -598,7 +598,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.selectRows = new Set();
|
this.selectRows = new Set();
|
||||||
this.condition.selectAll = false;
|
// this.condition.selectAll = false;
|
||||||
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
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() {
|
handleClose() {
|
||||||
this.form = {roles: [{id: ''}]};
|
this.form = {roles: [{id: ''}]};
|
||||||
this.btnAddRole = false;
|
this.btnAddRole = false;
|
||||||
|
|
|
@ -208,8 +208,33 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.total = data.itemCount;
|
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) {
|
buildPagePath(path) {
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
|
|
|
@ -314,6 +314,7 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
|
initCondition(this.condition,false);
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
condition() {
|
condition() {
|
||||||
|
@ -332,7 +333,8 @@ export default {
|
||||||
initTableData() {
|
initTableData() {
|
||||||
this.condition.planId = "";
|
this.condition.planId = "";
|
||||||
this.condition.nodeIds = [];
|
this.condition.nodeIds = [];
|
||||||
initCondition(this.condition);
|
//initCondition(this.condition);
|
||||||
|
initCondition(this.condition,this.condition.selectAll);
|
||||||
this.selectDataCounts = 0;
|
this.selectDataCounts = 0;
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
// param.planId = this.planId;
|
// param.planId = this.planId;
|
||||||
|
@ -394,9 +396,35 @@ export default {
|
||||||
setTimeout(this.$refs.table.doLayout, 200)
|
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() {
|
search() {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
|
|
|
@ -43,7 +43,6 @@ export function setUnSelectIds(tableData, condition, selectRows) {
|
||||||
condition.unSelectIds = allIDs.filter(function (val) {
|
condition.unSelectIds = allIDs.filter(function (val) {
|
||||||
return ids.indexOf(val) === -1
|
return ids.indexOf(val) === -1
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSelectDataCounts(condition, total, selectRows) {
|
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.selectAll = false;
|
||||||
condition.unSelectIds = [];
|
condition.unSelectIds = [];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getLabel(vueObj, type) {
|
export function getLabel(vueObj, type) {
|
||||||
let param = {}
|
let param = {}
|
||||||
|
|
Loading…
Reference in New Issue