feat(测试跟踪): 测试用例批量移动
This commit is contained in:
parent
de6a585d17
commit
2d14ace67e
|
@ -29,6 +29,7 @@
|
|||
@testCaseEdit="editTestCase"
|
||||
@testCaseCopy="copyTestCase"
|
||||
@testCaseDetail="showTestCaseDetail"
|
||||
@batchMove="batchMove"
|
||||
@refresh="refresh"
|
||||
@moveToNode="moveToNode"
|
||||
ref="testCaseList">
|
||||
|
@ -46,6 +47,8 @@
|
|||
|
||||
<test-case-move @refresh="refresh" ref="testCaseMove"/>
|
||||
|
||||
<batch-move @refresh="refresh" ref="testBatchMove"/>
|
||||
|
||||
</ms-container>
|
||||
|
||||
</template>
|
||||
|
@ -62,12 +65,13 @@
|
|||
import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
|
||||
import BatchMove from "./components/BatchMove";
|
||||
|
||||
export default {
|
||||
name: "TestCase",
|
||||
components: {
|
||||
MsMainContainer,
|
||||
MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu},
|
||||
MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, BatchMove},
|
||||
comments: {},
|
||||
data() {
|
||||
return {
|
||||
|
@ -236,6 +240,9 @@
|
|||
}
|
||||
this.$refs.testCaseEditDialog.getModuleOptions();
|
||||
this.$refs.testCaseMove.open(this.$refs.testCaseEditDialog.moduleOptions, selectIds);
|
||||
},
|
||||
batchMove(selectIds) {
|
||||
this.$refs.testBatchMove.open(this.treeNodes, selectIds,this.$refs.testCaseEditDialog.moduleOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
<template>
|
||||
<div v-loading="result.loading">
|
||||
<el-dialog title="选择用例目录"
|
||||
:visible.sync="dialogVisible"
|
||||
:before-close="close"
|
||||
:destroy-on-close="true"
|
||||
width="20%"
|
||||
>
|
||||
<div>
|
||||
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small"/>
|
||||
<el-tree
|
||||
class="filter-tree node-tree"
|
||||
:data="treeNodes"
|
||||
node-key="id"
|
||||
:filter-node-method="filterNode"
|
||||
:expand-on-click-node="false"
|
||||
highlight-current
|
||||
@node-click="nodeClick"
|
||||
ref="tree"
|
||||
>
|
||||
<template v-slot:default="{node}">
|
||||
<span>
|
||||
<span class="node-icon">
|
||||
<i class="el-icon-folder"/>
|
||||
</span>
|
||||
<span class="node-title">{{node.label}}</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="close"
|
||||
@confirm="save"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsDialogFooter from "../../../common/components/MsDialogFooter";
|
||||
|
||||
export default {
|
||||
name: "BatchMove",
|
||||
components: {
|
||||
MsDialogFooter
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
treeNodes: [],
|
||||
selectIds: [],
|
||||
selectNode: {},
|
||||
dialogVisible: false,
|
||||
currentKey: "",
|
||||
moduleOptions: [],
|
||||
filterText: "",
|
||||
result: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(treeNodes, selectIds, moduleOptions) {
|
||||
this.dialogVisible = true;
|
||||
this.treeNodes = treeNodes;
|
||||
this.selectIds = selectIds;
|
||||
this.moduleOptions = moduleOptions;
|
||||
},
|
||||
save() {
|
||||
if (!this.currentKey) {
|
||||
this.$warning(this.$t('test_track.case.input_module'));
|
||||
return;
|
||||
}
|
||||
let param = {};
|
||||
param.nodeId = this.currentKey;
|
||||
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();
|
||||
this.$emit('refresh');
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.$emit("refresh");
|
||||
},
|
||||
close() {
|
||||
this.filterText = "";
|
||||
this.dialogVisible = false;
|
||||
this.selectNode = {};
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
nodeClick() {
|
||||
this.currentKey = this.$refs.tree.getCurrentKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.node-title {
|
||||
width: 0;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1 1 auto;
|
||||
padding: 0 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
</style>
|
|
@ -22,7 +22,7 @@
|
|||
},
|
||||
methods: {
|
||||
click() {
|
||||
console.log("click");
|
||||
// console.log("click");
|
||||
},
|
||||
clickStop(btn) {
|
||||
if (btn.stop instanceof Function) {
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
{
|
||||
name: '批量编辑用例', stop: this.handleClickStop
|
||||
}, {
|
||||
name: '批量移动用例', stop: this.handleClickStop
|
||||
name: '批量移动用例', stop: this.handleMove
|
||||
}, {
|
||||
name: '批量删除用例', stop: this.handleDeleteBatch
|
||||
}
|
||||
|
@ -430,6 +430,9 @@
|
|||
},
|
||||
handleClickStop() {
|
||||
this.$refs.batchEdit.open();
|
||||
},
|
||||
handleMove() {
|
||||
this.$emit("batchMove", Array.from(this.selectRows).map(row => row.id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue