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);
|
||||
}
|
||||
|
||||
@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();
|
||||
});
|
||||
|
|
|
@ -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"
|
||||
|
@ -60,18 +62,19 @@
|
|||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.id == 'path'"
|
||||
sortable="custom"
|
||||
prop="path"
|
||||
min-width="180px"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
v-if="item.id == 'path'"
|
||||
sortable="custom"
|
||||
prop="path"
|
||||
min-width="180px"
|
||||
:label="$t('api_test.definition.api_path')"
|
||||
show-overflow-tooltip
|
||||
:key="index"/>
|
||||
|
||||
<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>
|
||||
|
||||
|
@ -83,12 +86,12 @@
|
|||
:key="index"/>
|
||||
|
||||
<el-table-column
|
||||
v-if="item.id=='updateTime'"
|
||||
sortable="updateTime"
|
||||
min-width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime"
|
||||
:key="index">
|
||||
v-if="item.id=='updateTime'"
|
||||
sortable="updateTime"
|
||||
min-width="160"
|
||||
:label="$t('api_test.definition.api_last_time')"
|
||||
prop="updateTime"
|
||||
:key="index">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
|
@ -179,108 +182,117 @@ export default {
|
|||
ShowMoreBtn,
|
||||
MsBatchEdit,
|
||||
MsApiCaseTableExtendBtns,
|
||||
MsReferenceView,
|
||||
MsTableAdvSearchBar
|
||||
MsReferenceView,
|
||||
MsTableAdvSearchBar
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: API_CASE_LIST,
|
||||
headerItems: Api_Case_List,
|
||||
tableLabel: [],
|
||||
condition: {
|
||||
components: API_CASE_CONFIGS
|
||||
},
|
||||
selectCase: {},
|
||||
result: {},
|
||||
moduleId: "",
|
||||
selectDataRange: "all",
|
||||
deletePath: "/test/case/delete",
|
||||
selectRows: new Set(),
|
||||
clickRow: {},
|
||||
buttons: [
|
||||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
valueArr: {
|
||||
priority: CASE_PRIORITY,
|
||||
method: REQ_METHOD,
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||
environmentId: undefined,
|
||||
selectAll: false,
|
||||
unSelection: [],
|
||||
selectDataCounts: 0,
|
||||
environments: [],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
selectNodeIds: Array,
|
||||
activeDom: String,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: API_CASE_LIST,
|
||||
headerItems: Api_Case_List,
|
||||
tableLabel: [],
|
||||
condition: {
|
||||
components: API_CASE_CONFIGS
|
||||
},
|
||||
selectCase: {},
|
||||
result: {},
|
||||
moduleId: "",
|
||||
selectDataRange: "all",
|
||||
deletePath: "/test/case/delete",
|
||||
selectRows: new Set(),
|
||||
clickRow: {},
|
||||
buttons: [
|
||||
{name: this.$t('api_test.definition.request.batch_delete'), handleClick: this.handleDeleteBatch},
|
||||
{name: this.$t('api_test.definition.request.batch_edit'), handleClick: this.handleEditBatch}
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
{text: 'P1', value: 'P1'},
|
||||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
valueArr: {
|
||||
priority: CASE_PRIORITY,
|
||||
method: REQ_METHOD,
|
||||
},
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
screenHeight: document.documentElement.clientHeight - 330,//屏幕高度
|
||||
environmentId: undefined,
|
||||
selectAll: false,
|
||||
unSelection: [],
|
||||
selectDataCounts: 0,
|
||||
environments: [],
|
||||
trashEnable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isCaseRelevance: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
relevanceProjectId: String,
|
||||
model: {
|
||||
type: String,
|
||||
default() {
|
||||
'api'
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
selectNodeIds: Array,
|
||||
activeDom: String,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
trashEnable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isCaseRelevance: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
relevanceProjectId: String,
|
||||
model: {
|
||||
type: String,
|
||||
default() {
|
||||
'api'
|
||||
}
|
||||
},
|
||||
planId: String
|
||||
},
|
||||
created: function () {
|
||||
planId: String
|
||||
},
|
||||
created: function () {
|
||||
this.initTable();
|
||||
getSystemLabel(this, this.type)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.caseTable.bodyWrapper.scrollTop = 5
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
this.selectAll = false;
|
||||
this.unSelection = [];
|
||||
this.selectDataCounts = 0;
|
||||
this.initTable();
|
||||
getSystemLabel(this, this.type)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.caseTable.bodyWrapper.scrollTop = 5
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
selectNodeIds() {
|
||||
this.initTable();
|
||||
},
|
||||
currentProtocol() {
|
||||
this.initTable();
|
||||
},
|
||||
trashEnable() {
|
||||
if (this.trashEnable) {
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
relevanceProjectId() {
|
||||
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();
|
||||
}
|
||||
},
|
||||
relevanceProjectId() {
|
||||
this.initTable();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 接口定义用例列表
|
||||
isApiModel() {
|
||||
|
@ -299,353 +311,385 @@ export default {
|
|||
this.condition.status = "";
|
||||
this.condition.moduleIds = this.selectNodeIds;
|
||||
if (this.trashEnable) {
|
||||
this.condition.status = "Trash";
|
||||
this.condition.moduleIds = [];
|
||||
}
|
||||
this.condition.status = "Trash";
|
||||
this.condition.moduleIds = [];
|
||||
}
|
||||
if(!this.selectAll){
|
||||
this.selectAll = false;
|
||||
this.unSelection = [];
|
||||
this.selectDataCounts = 0;
|
||||
this.condition.projectId = this.projectId;
|
||||
}
|
||||
this.condition.projectId = this.projectId;
|
||||
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
if (this.currentProtocol != null) {
|
||||
this.condition.protocol = this.currentProtocol;
|
||||
}
|
||||
|
||||
//检查是否只查询本周数据
|
||||
this.isSelectThissWeekData();
|
||||
this.condition.selectThisWeedData = false;
|
||||
this.condition.id = null;
|
||||
if (this.selectDataRange == 'thisWeekCount') {
|
||||
this.condition.selectThisWeedData = true;
|
||||
} else if (this.selectDataRange != null) {
|
||||
let selectParamArr = this.selectDataRange.split("single:");
|
||||
|
||||
if (selectParamArr.length == 2) {
|
||||
this.condition.id = selectParamArr[1];
|
||||
}
|
||||
}
|
||||
if (this.condition.projectId) {
|
||||
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.isSelectThissWeekData();
|
||||
this.condition.selectThisWeedData = false;
|
||||
this.condition.id = null;
|
||||
if (this.selectDataRange == 'thisWeekCount') {
|
||||
this.condition.selectThisWeedData = true;
|
||||
} else if (this.selectDataRange != null) {
|
||||
let selectParamArr = this.selectDataRange.split("single:");
|
||||
|
||||
if (selectParamArr.length == 2) {
|
||||
this.condition.id = selectParamArr[1];
|
||||
}
|
||||
}
|
||||
if (this.condition.projectId) {
|
||||
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) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
})
|
||||
if (this.$refs.caseTable) {
|
||||
setTimeout(this.$refs.caseTable.doLayout, 200)
|
||||
this.tableData.forEach(item => {
|
||||
if (item.tags && item.tags.length > 0) {
|
||||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
});
|
||||
}
|
||||
getLabel(this, API_CASE_LIST);
|
||||
|
||||
},
|
||||
open() {
|
||||
this.$refs.searchBar.open();
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
_handleSelect(this, selection, row, this.selectRows);
|
||||
this.selectRowsCount(this.selectRows)
|
||||
},
|
||||
showExecResult(row) {
|
||||
this.visible = false;
|
||||
this.$emit('showExecResult', row);
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
||||
this.selectRowsCount(this.selectRows)
|
||||
},
|
||||
search() {
|
||||
this.changeSelectDataRangeAll();
|
||||
this.initTable();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
|
||||
handleTestCase(testCase) {
|
||||
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
|
||||
let api = response.data;
|
||||
let selectApi = api;
|
||||
let request = {};
|
||||
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
||||
request = api.request;
|
||||
} else {
|
||||
request = JSON.parse(api.request);
|
||||
}
|
||||
if (!request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
selectApi.url = request.path;
|
||||
this.$refs.caseList.open(selectApi, testCase.id);
|
||||
});
|
||||
},
|
||||
reductionApi(row) {
|
||||
let ids = [row.id];
|
||||
this.$post('/api/testcase/reduction/', ids, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
// if (this.trashEnable) {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let obj = {};
|
||||
obj.projectId = this.projectId;
|
||||
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'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
// confirmButtonText: this.$t('commons.confirm'),
|
||||
// callback: (action) => {
|
||||
// if (action === 'confirm') {
|
||||
// let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
// this.$post('/api/testcase/removeToGc/', ids, () => {
|
||||
// this.selectRows.clear();
|
||||
// this.initTable();
|
||||
// this.$success(this.$t('commons.delete_success'));
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
},
|
||||
handleEditBatch() {
|
||||
if (this.currentProtocol == 'HTTP') {
|
||||
this.valueArr.method = REQ_METHOD;
|
||||
} else if (this.currentProtocol == 'TCP') {
|
||||
this.valueArr.method = TCP_METHOD;
|
||||
} else if (this.currentProtocol == 'SQL') {
|
||||
this.valueArr.method = SQL_METHOD;
|
||||
} else if (this.currentProtocol == 'DUBBO') {
|
||||
this.valueArr.method = DUBBO_METHOD;
|
||||
}
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
batchEdit(form) {
|
||||
let arr = Array.from(this.selectRows);
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
param.projectId = this.projectId;
|
||||
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();
|
||||
});
|
||||
},
|
||||
handleDelete(apiCase) {
|
||||
// if (this.trashEnable) {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + apiCase.name + " ?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$get('/api/testcase/delete/' + apiCase.id, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTable();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
},
|
||||
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);
|
||||
}
|
||||
},
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
isSelectThissWeekData() {
|
||||
this.selectDataRange = "all";
|
||||
let routeParam = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
if (dataType === 'apiTestCase') {
|
||||
this.selectDataRange = routeParam;
|
||||
}
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll", "testCase");
|
||||
},
|
||||
getIds(rowSets) {
|
||||
let rowArray = Array.from(rowSets)
|
||||
let ids = rowArray.map(s => s.id);
|
||||
return ids;
|
||||
},
|
||||
showCaseRef(row) {
|
||||
let param = {};
|
||||
Object.assign(param, row);
|
||||
param.moduleId = undefined;
|
||||
this.$refs.viewRef.open(param);
|
||||
},
|
||||
showEnvironment(row) {
|
||||
|
||||
let projectID = this.projectId;
|
||||
if (this.projectId) {
|
||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.environment = undefined;
|
||||
}
|
||||
this.clickRow = row;
|
||||
this.$refs.setEnvironment.open(row);
|
||||
},
|
||||
headerDragend(newWidth, oldWidth, column, event) {
|
||||
let finalWidth = newWidth;
|
||||
if (column.minWidth > finalWidth) {
|
||||
finalWidth = column.minWidth;
|
||||
}
|
||||
column.width = finalWidth;
|
||||
column.realWidth = finalWidth;
|
||||
},
|
||||
createPerformance(row, environment) {
|
||||
/**
|
||||
* 思路:调用后台创建性能测试的方法,把当前案例的hashTree在后台转化为jmx并文件创建性能测试。
|
||||
* 然后跳转到修改性能测试的页面
|
||||
*
|
||||
* 性能测试保存地址: performance/save
|
||||
*
|
||||
*/
|
||||
if (!environment) {
|
||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
let runData = [];
|
||||
let singleLoading = true;
|
||||
row.request = JSON.parse(row.request);
|
||||
row.request.name = row.id;
|
||||
row.request.useEnvironment = environment.id;
|
||||
runData.push(row.request);
|
||||
/*触发执行操作*/
|
||||
let testPlan = new TestPlan();
|
||||
let threadGroup = new ThreadGroup();
|
||||
threadGroup.hashTree = [];
|
||||
testPlan.hashTree = [threadGroup];
|
||||
runData.forEach(item => {
|
||||
threadGroup.hashTree.push(item);
|
||||
})
|
||||
let reqObj = {
|
||||
id: row.id,
|
||||
testElement: testPlan,
|
||||
name: row.name,
|
||||
projectId: this.projectId,
|
||||
};
|
||||
let bodyFiles = getBodyUploadFiles(reqObj, runData);
|
||||
reqObj.reportId = "run";
|
||||
|
||||
let url = "/api/genPerformanceTestXml";
|
||||
|
||||
this.$fileUpload(url, null, bodyFiles, reqObj, response => {
|
||||
let jmxObj = {};
|
||||
jmxObj.name = response.data.name;
|
||||
jmxObj.xml = response.data.xml;
|
||||
jmxObj.attachFiles = response.data.attachFiles;
|
||||
jmxObj.attachByteFiles = response.data.attachByteFiles;
|
||||
jmxObj.caseId = reqObj.id;
|
||||
this.$store.commit('setTest', {
|
||||
name: row.name,
|
||||
jmx: jmxObj
|
||||
})
|
||||
this.$router.push({
|
||||
path: "/performance/test/create"
|
||||
if (this.$refs.caseTable) {
|
||||
setTimeout(this.$refs.caseTable.doLayout, 200)
|
||||
}
|
||||
this.$nextTick(function(){
|
||||
this.checkTableRowIsSelect();
|
||||
})
|
||||
// let performanceId = response.data;
|
||||
// if(performanceId!=null){
|
||||
// this.$router.push({
|
||||
// path: "/performance/test/edit/"+performanceId,
|
||||
// })
|
||||
// }
|
||||
}, erro => {
|
||||
this.$emit('runRefresh', {});
|
||||
});
|
||||
},
|
||||
}
|
||||
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();
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
_handleSelect(this, selection, row, this.selectRows);
|
||||
this.selectRowsCount(this.selectRows)
|
||||
},
|
||||
showExecResult(row) {
|
||||
this.visible = false;
|
||||
this.$emit('showExecResult', row);
|
||||
},
|
||||
filter(filters) {
|
||||
_filter(filters, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
if (this.condition.orders) {
|
||||
this.condition.orders = [];
|
||||
}
|
||||
_sort(column, this.condition);
|
||||
this.initTable();
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
_handleSelectAll(this, selection, this.tableData, this.selectRows);
|
||||
this.selectRowsCount(this.selectRows)
|
||||
},
|
||||
search() {
|
||||
this.changeSelectDataRangeAll();
|
||||
this.initTable();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
|
||||
handleTestCase(testCase) {
|
||||
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
|
||||
let api = response.data;
|
||||
let selectApi = api;
|
||||
let request = {};
|
||||
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
||||
request = api.request;
|
||||
} else {
|
||||
request = JSON.parse(api.request);
|
||||
}
|
||||
if (!request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
selectApi.url = request.path;
|
||||
this.$refs.caseList.open(selectApi, testCase.id);
|
||||
});
|
||||
},
|
||||
reductionApi(row) {
|
||||
let ids = [row.id];
|
||||
this.$post('/api/testcase/reduction/', ids, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
});
|
||||
},
|
||||
handleDeleteBatch() {
|
||||
// if (this.trashEnable) {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
let obj = {};
|
||||
obj.projectId = this.projectId;
|
||||
obj.selectAllDate = this.selectAll;
|
||||
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'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// this.$alert(this.$t('api_test.definition.request.delete_confirm') + "?", '', {
|
||||
// confirmButtonText: this.$t('commons.confirm'),
|
||||
// callback: (action) => {
|
||||
// if (action === 'confirm') {
|
||||
// let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
// this.$post('/api/testcase/removeToGc/', ids, () => {
|
||||
// this.selectRows.clear();
|
||||
// this.initTable();
|
||||
// this.$success(this.$t('commons.delete_success'));
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
},
|
||||
handleEditBatch() {
|
||||
if (this.currentProtocol == 'HTTP') {
|
||||
this.valueArr.method = REQ_METHOD;
|
||||
} else if (this.currentProtocol == 'TCP') {
|
||||
this.valueArr.method = TCP_METHOD;
|
||||
} else if (this.currentProtocol == 'SQL') {
|
||||
this.valueArr.method = SQL_METHOD;
|
||||
} else if (this.currentProtocol == 'DUBBO') {
|
||||
this.valueArr.method = DUBBO_METHOD;
|
||||
}
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
batchEdit(form) {
|
||||
let arr = Array.from(this.selectRows);
|
||||
let ids = arr.map(row => row.id);
|
||||
let param = {};
|
||||
param[form.type] = form.value;
|
||||
param.ids = ids;
|
||||
param.projectId = this.projectId;
|
||||
param.selectAllDate = this.selectAll;
|
||||
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();
|
||||
});
|
||||
},
|
||||
handleDelete(apiCase) {
|
||||
// if (this.trashEnable) {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + apiCase.name + " ?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.$get('/api/testcase/delete/' + apiCase.id, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTable();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
},
|
||||
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.selectAll) {
|
||||
this.selectDataCounts = this.total - this.unSelection.length;
|
||||
} else {
|
||||
this.selectDataCounts = selection.size;
|
||||
}
|
||||
},
|
||||
isSelectDataAll(dataType) {
|
||||
this.selectAll = dataType;
|
||||
this.selectRowsCount(this.selectRows)
|
||||
//如果已经全选,不需要再操作了
|
||||
if (this.selectRows.size != this.tableData.length) {
|
||||
this.$refs.caseTable.toggleAllSelection(true);
|
||||
}
|
||||
},
|
||||
//判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数
|
||||
isSelectThissWeekData() {
|
||||
this.selectDataRange = "all";
|
||||
let routeParam = this.$route.params.dataSelectRange;
|
||||
let dataType = this.$route.params.dataType;
|
||||
if (dataType === 'apiTestCase') {
|
||||
this.selectDataRange = routeParam;
|
||||
}
|
||||
},
|
||||
changeSelectDataRangeAll() {
|
||||
this.$emit("changeSelectDataRangeAll", "testCase");
|
||||
},
|
||||
getIds(rowSets) {
|
||||
let rowArray = Array.from(rowSets)
|
||||
let ids = rowArray.map(s => s.id);
|
||||
return ids;
|
||||
},
|
||||
showCaseRef(row) {
|
||||
let param = {};
|
||||
Object.assign(param, row);
|
||||
param.moduleId = undefined;
|
||||
this.$refs.viewRef.open(param);
|
||||
},
|
||||
showEnvironment(row) {
|
||||
|
||||
let projectID = this.projectId;
|
||||
if (this.projectId) {
|
||||
this.$get('/api/environment/list/' + this.projectId, response => {
|
||||
this.environments = response.data;
|
||||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.environment = undefined;
|
||||
}
|
||||
this.clickRow = row;
|
||||
this.$refs.setEnvironment.open(row);
|
||||
},
|
||||
headerDragend(newWidth, oldWidth, column, event) {
|
||||
let finalWidth = newWidth;
|
||||
if (column.minWidth > finalWidth) {
|
||||
finalWidth = column.minWidth;
|
||||
}
|
||||
column.width = finalWidth;
|
||||
column.realWidth = finalWidth;
|
||||
},
|
||||
createPerformance(row, environment) {
|
||||
/**
|
||||
* 思路:调用后台创建性能测试的方法,把当前案例的hashTree在后台转化为jmx并文件创建性能测试。
|
||||
* 然后跳转到修改性能测试的页面
|
||||
*
|
||||
* 性能测试保存地址: performance/save
|
||||
*
|
||||
*/
|
||||
if (!environment) {
|
||||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
let runData = [];
|
||||
let singleLoading = true;
|
||||
row.request = JSON.parse(row.request);
|
||||
row.request.name = row.id;
|
||||
row.request.useEnvironment = environment.id;
|
||||
runData.push(row.request);
|
||||
/*触发执行操作*/
|
||||
let testPlan = new TestPlan();
|
||||
let threadGroup = new ThreadGroup();
|
||||
threadGroup.hashTree = [];
|
||||
testPlan.hashTree = [threadGroup];
|
||||
runData.forEach(item => {
|
||||
threadGroup.hashTree.push(item);
|
||||
})
|
||||
let reqObj = {
|
||||
id: row.id,
|
||||
testElement: testPlan,
|
||||
name: row.name,
|
||||
projectId: this.projectId,
|
||||
};
|
||||
let bodyFiles = getBodyUploadFiles(reqObj, runData);
|
||||
reqObj.reportId = "run";
|
||||
|
||||
let url = "/api/genPerformanceTestXml";
|
||||
|
||||
this.$fileUpload(url, null, bodyFiles, reqObj, response => {
|
||||
let jmxObj = {};
|
||||
jmxObj.name = response.data.name;
|
||||
jmxObj.xml = response.data.xml;
|
||||
jmxObj.attachFiles = response.data.attachFiles;
|
||||
jmxObj.attachByteFiles = response.data.attachByteFiles;
|
||||
jmxObj.caseId = reqObj.id;
|
||||
this.$store.commit('setTest', {
|
||||
name: row.name,
|
||||
jmx: jmxObj
|
||||
})
|
||||
this.$router.push({
|
||||
path: "/performance/test/create"
|
||||
})
|
||||
// let performanceId = response.data;
|
||||
// if(performanceId!=null){
|
||||
// this.$router.push({
|
||||
// path: "/performance/test/edit/"+performanceId,
|
||||
// })
|
||||
// }
|
||||
}, erro => {
|
||||
this.$emit('runRefresh', {});
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.operate-button > div {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.request-method {
|
||||
padding: 0 5px;
|
||||
color: #1E90FF;
|
||||
}
|
||||
.request-method {
|
||||
padding: 0 5px;
|
||||
color: #1E90FF;
|
||||
}
|
||||
|
||||
.api-el-tag {
|
||||
color: white;
|
||||
}
|
||||
.api-el-tag {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
float: right;
|
||||
width: 300px;
|
||||
/*margin-bottom: 20px;*/
|
||||
margin-right: 10px;
|
||||
}
|
||||
.search-input {
|
||||
float: right;
|
||||
width: 300px;
|
||||
/*margin-bottom: 20px;*/
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.ms-select-all >>> th:first-child {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.ms-select-all >>> th:first-child {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
|
||||
top: -2px;
|
||||
}
|
||||
.ms-select-all >>> th:nth-child(2) .el-icon-arrow-down {
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
/deep/ .el-table__fixed {
|
||||
height: 100% !important;
|
||||
}
|
||||
/deep/ .el-table__fixed {
|
||||
height: 100% !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue