feat: 场景列表批量移动

This commit is contained in:
chenjianxing 2021-01-21 19:45:12 +08:00
parent 5d9cf69916
commit 27603bbf90
9 changed files with 73 additions and 47 deletions

View File

@ -652,6 +652,9 @@ public class ApiAutomationService {
}
public void bathEdit(SaveApiScenarioRequest request) {
if (CollectionUtils.isEmpty(request.getScenarioIds())) {
return;
}
if (request.isSelectAllDate()) {
request.setScenarioIds(this.getAllScenarioIdsByFontedSelect(
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds()));

View File

@ -6,6 +6,7 @@
@refreshTable="refresh"
@saveAsEdit="editScenario"
@setModuleOptions="setModuleOptions"
@setNodeTree="setNodeTree"
@enableTrash="enableTrash"
:type="'edit'"
ref="nodeTree"/>
@ -15,6 +16,8 @@
<el-tabs v-model="activeName" @tab-click="addTab" @tab-remove="removeTab">
<el-tab-pane name="default" :label="$t('api_test.automation.scenario_test')">
<ms-api-scenario-list
:module-tree="nodeTree"
:module-options="moduleOptions"
:select-node-ids="selectNodeIds"
:trash-enable="trashEnable"
:checkRedirectID="checkRedirectID"
@ -98,6 +101,7 @@
tabs: [],
trashEnable: false,
selectNodeIds: [],
nodeTree: []
}
},
watch: {
@ -209,6 +213,9 @@
setModuleOptions(data) {
this.moduleOptions = data;
},
setNodeTree(data) {
this.nodeTree = data;
},
changeSelectDataRangeAll(tableType) {
this.$route.params.dataSelectRange = 'all';
},

View File

@ -108,6 +108,8 @@
</template>
</batch-edit>
<batch-move @refresh="search" @moveSave="moveSave" ref="testBatchMove"/>
</div>
</template>
@ -129,10 +131,12 @@
import BatchEdit from "../../../track/case/components/BatchEdit";
import {WORKSPACE_ID} from "../../../../../common/js/constants";
import EnvironmentSelect from "../../definition/components/environment/EnvironmentSelect";
import BatchMove from "../../../track/case/components/BatchMove";
export default {
name: "MsApiScenarioList",
components: {
BatchMove,
EnvironmentSelect,
BatchEdit,
PlanStatusTableItem,
@ -157,6 +161,18 @@
trashEnable: {
type: Boolean,
default: false,
},
moduleTree: {
type: Array,
default() {
return []
},
},
moduleOptions: {
type: Array,
default() {
return []
},
}
},
data() {
@ -188,16 +204,15 @@
{
name: this.$t('api_test.automation.batch_add_plan'), handleClick: this.handleBatchAddCase
},
{
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
},
{
name: this.$t('test_track.case.batch_edit_case'), handleClick: this.handleBatchEdit
},
{
name: this.$t('api_test.automation.batch_execute'), handleClick: this.handleBatchExecute
},
// {
// name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove
// }
name: this.$t('test_track.case.batch_move_case'), handleClick: this.handleBatchMove
}
],
isSelectAllDate: false,
unSelection: [],
@ -319,31 +334,22 @@
handleBatchAddCase() {
this.planVisible = true;
},
handleDeleteBatch() {
this.$alert(this.$t('test_track.case.delete_confirm') + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
let ids = Array.from(this.selectRows).map(row => row.id);
this.$post('/test/case/batch/delete', {ids: ids}, () => {
this.selectRows.clear();
this.$emit("refresh");
this.$success(this.$t('commons.delete_success'));
// 广 head
});
}
}
});
},
handleBatchEdit() {
this.$refs.batchEdit.open(this.selectDataCounts);
},
handleBatchMove() {
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
this.$refs.testBatchMove.open(this.moduleTree, [], this.moduleOptions);
},
moveSave(param) {
this.buildBatchParam(param);
param.apiScenarioModuleId = param.nodeId;
this.$post('/api/automation/batch/edit', param, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.testBatchMove.close();
this.search();
});
},
batchEdit(form) {
let arr = this.selection;
let ids = this.selection;
let param = {};
param[form.type] = form.value;
this.buildBatchParam(param);

View File

@ -119,6 +119,7 @@
buildNodePath(node, {path: ''}, moduleOptions);
});
this.$emit('setModuleOptions', moduleOptions);
this.$emit('setNodeTree', this.data);
if (this.$refs.nodeTree) {
this.$refs.nodeTree.filter(this.condition.filterText);
}

View File

@ -35,7 +35,7 @@
<test-case-move @refresh="refresh" ref="testCaseMove"/>
<batch-move @refresh="refresh" ref="testBatchMove"/>
<batch-move @refresh="refresh" @moveSave="moveSave" ref="testBatchMove"/>
</ms-container>
@ -54,6 +54,7 @@ import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, hasRoles} from "../../../../common/js/utils";
import BatchMove from "./components/BatchMove";
import TestCaseNodeTree from "../common/TestCaseNodeTree";
import {TrackEvent,LIST_CHANGE} from "@/business/components/common/head/ListEvent";
export default {
name: "TestCase",
@ -163,6 +164,15 @@ export default {
},
setTreeNodes(data) {
this.treeNodes = data;
},
moveSave(param) {
this.result = this.$post('/test/case/batch/edit', param, () => {
this.$success(this.$t('commons.save_success'));
this.$refs.testBatchMove.close();
// 广 head
TrackEvent.$emit(LIST_CHANGE);
this.refresh();
});
}
}
}

View File

@ -1,5 +1,5 @@
<template>
<div v-loading="result.loading">
<div class="batch-move" v-loading="result.loading">
<el-dialog :title="this.$t('test_track.case.select_catalog')"
:visible.sync="dialogVisible"
:before-close="close"
@ -39,7 +39,6 @@
<script>
import MsDialogFooter from "../../../common/components/MsDialogFooter";
import {TrackEvent,LIST_CHANGE} from "@/business/components/common/head/ListEvent";
export default {
name: "BatchMove",
@ -77,19 +76,15 @@
}
let param = {};
param.nodeId = this.currentKey;
this.moduleOptions.forEach(item => {
if (item.id === this.currentKey) {
param.nodePath = item.path;
}
});
if (this.moduleOptions) {
this.moduleOptions.forEach(item => {
if (item.id === this.currentKey) {
param.nodePath = item.path;
}
});
}
param.ids = this.selectIds;
this.result = this.$post('/test/case/batch/edit', param, () => {
this.$success(this.$t('commons.save_success'));
this.close();
// 广 head
TrackEvent.$emit(LIST_CHANGE);
this.$emit('refresh');
});
this.$emit('moveSave', param);
},
refresh() {
this.$emit("refresh");
@ -120,4 +115,8 @@
overflow: hidden;
}
.batch-move {
height: 500px;
}
</style>

View File

@ -1042,7 +1042,7 @@ export default {
batch_operate: 'Batch operation',
please_select_attr: 'Please select attributes',
please_select_attr_value: 'Please select the value corresponding to the attribute',
batch_edit_case: 'Batch editing test cases',
batch_edit_case: 'Batch editing',
batch_move_case: 'Batch move',
batch_delete_case: 'Batch delete',
batch_unlink: 'Batch Unlink',

View File

@ -1045,9 +1045,9 @@ export default {
batch_operate: '批量操作',
please_select_attr: '请选择属性',
please_select_attr_value: '请选择属性对应的值',
batch_edit_case: '批量编辑用例',
batch_move_case: '批量移动用例',
batch_delete_case: '批量删除用例',
batch_edit_case: '批量编辑',
batch_move_case: '批量移动',
batch_delete_case: '批量删除',
batch_unlink: '批量取消关联',
project_name: '所属项目',
status: '评审状态',

View File

@ -1043,9 +1043,9 @@ export default {
batch_operate: '批量操作',
please_select_attr: '請選擇屬性',
please_select_attr_value: '請選擇屬性對應的值',
batch_edit_case: '批量編輯用例',
batch_move_case: '批量移動用例',
batch_delete_case: '批量刪除用例',
batch_edit_case: '批量編輯',
batch_move_case: '批量移動',
batch_delete_case: '批量刪除',
batch_unlink: '批量取消關聯',
project_name: '所屬項目',
status: '評審狀態',