refacotr: 重构测试跟踪模块树
This commit is contained in:
parent
f6d4f6257a
commit
62252a8725
|
@ -2,23 +2,15 @@
|
||||||
<ms-container>
|
<ms-container>
|
||||||
|
|
||||||
<ms-aside-container>
|
<ms-aside-container>
|
||||||
<node-tree
|
<test-case-node-tree
|
||||||
class="node-tree"
|
|
||||||
v-loading="result.loading"
|
|
||||||
@nodeSelectEvent="nodeChange"
|
@nodeSelectEvent="nodeChange"
|
||||||
@refresh="refresh"
|
@refreshTable="refresh"
|
||||||
:tree-nodes="treeNodes"
|
|
||||||
:type="'edit'"
|
:type="'edit'"
|
||||||
:draggable="nodeTreeDraggable"
|
|
||||||
:select-node.sync="selectNode"
|
|
||||||
@refreshTable="refreshTable"
|
|
||||||
:current-project="{id:currentProject}"
|
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</ms-aside-container>
|
</ms-aside-container>
|
||||||
|
|
||||||
<ms-main-container>
|
<ms-main-container>
|
||||||
<test-case-list
|
<test-case-list
|
||||||
:current-project="{id:currentProject}"
|
|
||||||
:select-node-ids="selectNodeIds"
|
:select-node-ids="selectNodeIds"
|
||||||
:select-parent-nodes="selectParentNodes"
|
:select-parent-nodes="selectParentNodes"
|
||||||
@testCaseEdit="editTestCase"
|
@testCaseEdit="editTestCase"
|
||||||
|
@ -36,7 +28,6 @@
|
||||||
:read-only="testCaseReadOnly"
|
:read-only="testCaseReadOnly"
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
:select-node="selectNode"
|
:select-node="selectNode"
|
||||||
:current-project="{id:currentProject}"
|
|
||||||
ref="testCaseEditDialog">
|
ref="testCaseEditDialog">
|
||||||
</test-case-edit>
|
</test-case-edit>
|
||||||
|
|
||||||
|
@ -52,7 +43,6 @@
|
||||||
|
|
||||||
import NodeTree from '../common/NodeTree';
|
import NodeTree from '../common/NodeTree';
|
||||||
import TestCaseEdit from './components/TestCaseEdit';
|
import TestCaseEdit from './components/TestCaseEdit';
|
||||||
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants';
|
|
||||||
import TestCaseList from "./components/TestCaseList";
|
import TestCaseList from "./components/TestCaseList";
|
||||||
import SelectMenu from "../common/SelectMenu";
|
import SelectMenu from "../common/SelectMenu";
|
||||||
import TestCaseMove from "./components/TestCaseMove";
|
import TestCaseMove from "./components/TestCaseMove";
|
||||||
|
@ -61,10 +51,12 @@ import MsAsideContainer from "../../common/components/MsAsideContainer";
|
||||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||||
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
|
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
|
||||||
import BatchMove from "./components/BatchMove";
|
import BatchMove from "./components/BatchMove";
|
||||||
|
import TestCaseNodeTree from "../common/TestCaseNodeTree";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCase",
|
name: "TestCase",
|
||||||
components: {
|
components: {
|
||||||
|
TestCaseNodeTree,
|
||||||
MsMainContainer,
|
MsMainContainer,
|
||||||
MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, BatchMove
|
MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, BatchMove
|
||||||
},
|
},
|
||||||
|
@ -76,35 +68,25 @@ export default {
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
total: 0,
|
total: 0,
|
||||||
projects: [],
|
projects: [],
|
||||||
currentProject: null,
|
|
||||||
treeNodes: [],
|
treeNodes: [],
|
||||||
selectNodeIds: [],
|
selectNodeIds: [],
|
||||||
selectParentNodes: [],
|
selectParentNodes: [],
|
||||||
testCaseReadOnly: true,
|
testCaseReadOnly: true,
|
||||||
selectNode: {},
|
selectNode: {},
|
||||||
nodeTreeDraggable: true,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activated() {
|
|
||||||
this.currentProject = localStorage.getItem(PROJECT_ID);
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init(this.$route);
|
this.init(this.$route);
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route'(to, from) {
|
'$route'(to, from) {
|
||||||
// console.log(this.$route.params.projectId)
|
|
||||||
this.init(to);
|
this.init(to);
|
||||||
},
|
},
|
||||||
currentProject() {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init(route) {
|
init(route) {
|
||||||
let path = route.path;
|
let path = route.path;
|
||||||
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
|
if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) {
|
||||||
// this.getProjects();
|
|
||||||
this.testCaseReadOnly = false;
|
this.testCaseReadOnly = false;
|
||||||
if (!checkoutTestManagerOrTestUser()) {
|
if (!checkoutTestManagerOrTestUser()) {
|
||||||
this.testCaseReadOnly = true;
|
this.testCaseReadOnly = true;
|
||||||
|
@ -113,50 +95,10 @@ export default {
|
||||||
this.openRecentTestCaseEditDialog(caseId);
|
this.openRecentTestCaseEditDialog(caseId);
|
||||||
this.$router.push('/track/case/all');
|
this.$router.push('/track/case/all');
|
||||||
}
|
}
|
||||||
// else if (route.params.projectId) {
|
|
||||||
// this.getProjects();
|
|
||||||
// this.getProjectById(route.params.projectId);
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
// getProjects() {
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
// this.$get("/project/listAll", (response) => {
|
|
||||||
// this.projects = response.data;
|
|
||||||
// let lastProject = JSON.parse(localStorage.getItem(CURRENT_PROJECT));
|
|
||||||
// if (lastProject) {
|
|
||||||
// let hasCurrentProject = false;
|
|
||||||
// for (let i = 0; i < this.projects.length; i++) {
|
|
||||||
// if (this.projects[i].id == lastProject.id) {
|
|
||||||
// this.currentProject = lastProject;
|
|
||||||
// hasCurrentProject = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (!hasCurrentProject) {
|
|
||||||
// this.setCurrentProject(this.projects[0]);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (this.projects.length > 0) {
|
|
||||||
// this.setCurrentProject(this.projects[0]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // this.checkProject();
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// checkProject() {
|
|
||||||
// if (this.currentProject === null) {
|
|
||||||
// this.$alert(this.$t('test_track.case.no_project'), {
|
|
||||||
// confirmButtonText: this.$t('project.create'),
|
|
||||||
// callback: action => {
|
|
||||||
// this.$router.push("/track/project/create");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// changeProject(project) {
|
|
||||||
// this.setCurrentProject(project);
|
|
||||||
// },
|
|
||||||
nodeChange(nodeIds, pNodes) {
|
|
||||||
this.selectNodeIds = nodeIds;
|
this.selectNodeIds = nodeIds;
|
||||||
|
this.selectNode = node;
|
||||||
this.selectParentNodes = pNodes;
|
this.selectParentNodes = pNodes;
|
||||||
},
|
},
|
||||||
refreshTable() {
|
refreshTable() {
|
||||||
|
@ -182,17 +124,11 @@ export default {
|
||||||
this.testCaseReadOnly = true;
|
this.testCaseReadOnly = true;
|
||||||
this.$refs.testCaseEditDialog.open(testCase);
|
this.$refs.testCaseEditDialog.open(testCase);
|
||||||
},
|
},
|
||||||
// getProjectByCaseId(caseId) {
|
|
||||||
// return this.$get('/test/case/project/' + caseId, async response => {
|
|
||||||
// this.setCurrentProject(response.data);
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.selectNodeIds = [];
|
this.selectNodeIds = [];
|
||||||
this.selectParentNodes = [];
|
this.selectParentNodes = [];
|
||||||
this.selectNode = {};
|
this.selectNode = {};
|
||||||
this.refreshTable();
|
this.refreshTable();
|
||||||
this.getNodeTree();
|
|
||||||
},
|
},
|
||||||
openRecentTestCaseEditDialog(caseId) {
|
openRecentTestCaseEditDialog(caseId) {
|
||||||
if (caseId) {
|
if (caseId) {
|
||||||
|
@ -206,35 +142,7 @@ export default {
|
||||||
this.$refs.testCaseEditDialog.open();
|
this.$refs.testCaseEditDialog.open();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// getProjectById(id) {
|
|
||||||
// if (id && id != 'all') {
|
|
||||||
// this.$get('/project/get/' + id, response => {
|
|
||||||
// let project = response.data;
|
|
||||||
// this.setCurrentProject(project);
|
|
||||||
// // this.$router.push('/track/case/all');
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// if (id === 'all') {
|
|
||||||
// this.refresh();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// setCurrentProject(project) {
|
|
||||||
// if (project) {
|
|
||||||
// this.currentProject = project;
|
|
||||||
// localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
|
|
||||||
// }
|
|
||||||
// this.refresh();
|
|
||||||
// },
|
|
||||||
getNodeTree() {
|
|
||||||
if (!hasRoles(ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
|
|
||||||
this.nodeTreeDraggable = false;
|
|
||||||
}
|
|
||||||
if (this.currentProject) {
|
|
||||||
this.result = this.$get("/case/node/list/" + this.currentProject, response => {
|
|
||||||
this.treeNodes = response.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
moveToNode(selectIds) {
|
moveToNode(selectIds) {
|
||||||
if (selectIds.size < 1) {
|
if (selectIds.size < 1) {
|
||||||
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
this.$warning(this.$t('test_track.plan_view.select_manipulate'));
|
||||||
|
|
|
@ -262,6 +262,7 @@ import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||||
|
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseEdit",
|
name: "TestCaseEdit",
|
||||||
|
@ -269,6 +270,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
|
projectId: "",
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
form: {
|
form: {
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -329,9 +331,6 @@ export default {
|
||||||
selectNode: {
|
selectNode: {
|
||||||
type: Object
|
type: Object
|
||||||
},
|
},
|
||||||
currentProject: {
|
|
||||||
type: Object
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getSelectOptions();
|
this.getSelectOptions();
|
||||||
|
@ -340,9 +339,6 @@ export default {
|
||||||
treeNodes() {
|
treeNodes() {
|
||||||
this.getModuleOptions();
|
this.getModuleOptions();
|
||||||
},
|
},
|
||||||
currentProject() {
|
|
||||||
this.getTestOptions();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
reload() {
|
reload() {
|
||||||
|
@ -351,7 +347,7 @@ export default {
|
||||||
},
|
},
|
||||||
open(testCase) {
|
open(testCase) {
|
||||||
this.resetForm();
|
this.resetForm();
|
||||||
|
this.projectId = getCurrentProjectID();
|
||||||
if (window.history && window.history.pushState) {
|
if (window.history && window.history.pushState) {
|
||||||
history.pushState(null, null, document.URL);
|
history.pushState(null, null, document.URL);
|
||||||
window.addEventListener('popstate', this.close);
|
window.addEventListener('popstate', this.close);
|
||||||
|
@ -489,8 +485,8 @@ export default {
|
||||||
param.nodePath = item.path;
|
param.nodePath = item.path;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.currentProject.id) {
|
if (this.projectId) {
|
||||||
param.projectId = this.currentProject.id;
|
param.projectId = this.projectId;
|
||||||
}
|
}
|
||||||
param.name = param.name.trim();
|
param.name = param.name.trim();
|
||||||
if (param.method != 'auto') {
|
if (param.method != 'auto') {
|
||||||
|
@ -563,8 +559,8 @@ export default {
|
||||||
},
|
},
|
||||||
getTestOptions() {
|
getTestOptions() {
|
||||||
this.testOptions = [];
|
this.testOptions = [];
|
||||||
if (this.currentProject.id && this.form.type != '' && this.form.type != 'functional') {
|
if (this.projectId && this.form.type != '' && this.form.type != 'functional') {
|
||||||
this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
|
this.result = this.$get('/' + this.form.type + '/list/' + this.projectId, response => {
|
||||||
this.testOptions = response.data;
|
this.testOptions = response.data;
|
||||||
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
|
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,8 +111,8 @@
|
||||||
<script>
|
<script>
|
||||||
import ElUploadList from "element-ui/packages/upload/src/upload-list";
|
import ElUploadList from "element-ui/packages/upload/src/upload-list";
|
||||||
import MsTableButton from '../../../../components/common/components/MsTableButton';
|
import MsTableButton from '../../../../components/common/components/MsTableButton';
|
||||||
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
||||||
import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants';
|
import {TokenKey} from '../../../../../common/js/constants';
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -129,11 +129,6 @@
|
||||||
isLoading: false
|
isLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
|
||||||
projectId: {
|
|
||||||
type: String
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
handleExceed(files, fileList) {
|
handleExceed(files, fileList) {
|
||||||
this.$warning(this.$t('test_track.case.import.upload_limit_count'));
|
this.$warning(this.$t('test_track.case.import.upload_limit_count'));
|
||||||
|
@ -176,6 +171,7 @@
|
||||||
},
|
},
|
||||||
open() {
|
open() {
|
||||||
listenGoBack(this.close);
|
listenGoBack(this.close);
|
||||||
|
this.projectId = getCurrentProjectID();
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<test-case-import :projectId="currentProject == null? null : currentProject.id" @refresh="refresh"
|
<test-case-import @refresh="refresh" ref="testCaseImport"/>
|
||||||
ref="testCaseImport"/>
|
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
border
|
border
|
||||||
|
@ -176,6 +175,7 @@ import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEve
|
||||||
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
|
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
|
||||||
import TestCaseDetail from "./TestCaseDetail";
|
import TestCaseDetail from "./TestCaseDetail";
|
||||||
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
||||||
|
import {getCurrentProjectID} from "../../../../../common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseList",
|
name: "TestCaseList",
|
||||||
|
@ -264,13 +264,11 @@ export default {
|
||||||
],
|
],
|
||||||
maintainer: [],
|
maintainer: [],
|
||||||
},
|
},
|
||||||
currentCaseId: null
|
currentCaseId: null,
|
||||||
|
projectId: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
currentProject: {
|
|
||||||
type: Object
|
|
||||||
},
|
|
||||||
selectNodeIds: {
|
selectNodeIds: {
|
||||||
type: Array
|
type: Array
|
||||||
},
|
},
|
||||||
|
@ -282,9 +280,6 @@ export default {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentProject() {
|
|
||||||
this.initTableData();
|
|
||||||
},
|
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
|
@ -292,6 +287,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initTableData() {
|
initTableData() {
|
||||||
|
this.projectId = getCurrentProjectID();
|
||||||
this.condition.planId = "";
|
this.condition.planId = "";
|
||||||
this.condition.nodeIds = [];
|
this.condition.nodeIds = [];
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
|
@ -302,13 +298,11 @@ export default {
|
||||||
// param.nodeIds = this.selectNodeIds;
|
// param.nodeIds = this.selectNodeIds;
|
||||||
this.condition.nodeIds = this.selectNodeIds;
|
this.condition.nodeIds = this.selectNodeIds;
|
||||||
}
|
}
|
||||||
if (this.currentProject.id) {
|
|
||||||
this.getData();
|
this.getData();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
getData() {
|
getData() {
|
||||||
if (this.currentProject) {
|
if (this.projectId) {
|
||||||
this.condition.projectId = this.currentProject.id;
|
this.condition.projectId = this.projectId;
|
||||||
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
|
@ -416,7 +410,7 @@ export default {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
// data: {ids: [...this.selectIds]}
|
// data: {ids: [...this.selectIds]}
|
||||||
data: {ids: ids, projectId: this.currentProject.id}
|
data: {ids: ids, projectId: this.projectId}
|
||||||
};
|
};
|
||||||
this.result = this.$request(config).then(response => {
|
this.result = this.$request(config).then(response => {
|
||||||
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
const filename = this.$t('test_track.case.test_case') + ".xlsx";
|
||||||
|
|
|
@ -41,6 +41,12 @@
|
||||||
},
|
},
|
||||||
filterData() {
|
filterData() {
|
||||||
this.data = this.nodes;
|
this.data = this.nodes;
|
||||||
|
for (let index in this.data) {
|
||||||
|
if (this.data[index].id === 'root') {
|
||||||
|
this.data.splice(index, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.data.length > 4) {
|
if (this.data.length > 4) {
|
||||||
let lastData = this.data[this.data.length - 1];
|
let lastData = this.data[this.data.length - 1];
|
||||||
this.data.splice(1, this.data.length);
|
this.data.splice(1, this.data.length);
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-loading="result.loading">
|
<div>
|
||||||
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small">
|
<slot name="header">
|
||||||
<template v-if="type == 'edit'" v-slot:append>
|
<el-input :placeholder="$t('test_track.module.search')" v-model="filterText" size="small" :clearable="true"/>
|
||||||
<el-button :disabled="disabled" icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button>
|
</slot>
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
|
|
||||||
<el-tree
|
<el-tree
|
||||||
class="filter-tree node-tree"
|
class="filter-tree node-tree"
|
||||||
:data="treeNodes"
|
:data="extendTreeNodes"
|
||||||
:default-expanded-keys="expandedNode"
|
:default-expanded-keys="expandedNode"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
@node-drag-end="handleDragEnd"
|
@node-drag-end="handleDragEnd"
|
||||||
|
@ -17,24 +15,30 @@
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
:expand-on-click-node="false"
|
:expand-on-click-node="false"
|
||||||
highlight-current
|
highlight-current
|
||||||
:draggable="draggable"
|
:draggable="!disabled"
|
||||||
ref="tree">
|
ref="tree">
|
||||||
|
|
||||||
<template v-slot:default="{node,data}">
|
<template v-slot:default="{node,data}">
|
||||||
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
<span class="custom-tree-node father" @click="handleNodeSelect(node)">
|
||||||
<span class="node-icon">
|
|
||||||
<i class="el-icon-folder"></i>
|
<span v-if="data.isEdit" @click.stop>
|
||||||
|
<el-input @blur.stop="save(node, data)" v-model="data.name" class="name-input" size="mini"/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class="node-title">{{node.label}}</span>
|
<span v-if="!data.isEdit" class="node-icon">
|
||||||
|
<i class="el-icon-folder"/>
|
||||||
|
</span>
|
||||||
|
<span v-if="!data.isEdit" class="node-title" v-text="data.name"/>
|
||||||
|
|
||||||
<span v-if="type == 'edit' && !disabled" class="node-operate child">
|
<span v-if="!disabled" class="node-operate child">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
|
v-if="data.id != 'root'"
|
||||||
class="item"
|
class="item"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:open-delay="200"
|
:open-delay="200"
|
||||||
:content="$t('test_track.module.rename')"
|
:content="$t('test_track.module.rename')"
|
||||||
placement="top">
|
placement="top">
|
||||||
<i @click.stop="openEditNodeDialog('edit', data)" class="el-icon-edit"></i>
|
<i @click.stop="edit(node, data)" class="el-icon-edit"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
class="item"
|
class="item"
|
||||||
|
@ -42,38 +46,39 @@
|
||||||
:open-delay="200"
|
:open-delay="200"
|
||||||
:content="$t('test_track.module.add_submodule')"
|
:content="$t('test_track.module.add_submodule')"
|
||||||
placement="top">
|
placement="top">
|
||||||
<i @click.stop="openEditNodeDialog('add', data)" class="el-icon-circle-plus-outline"></i>
|
<i @click.stop="append(node, data)" class="el-icon-circle-plus-outline"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip class="item" effect="dark"
|
<el-tooltip
|
||||||
:open-delay="200" :content="$t('commons.delete')" placement="top">
|
v-if="data.id != 'root'"
|
||||||
|
class="item" effect="dark"
|
||||||
|
:open-delay="200"
|
||||||
|
:content="$t('commons.delete')"
|
||||||
|
placement="top">
|
||||||
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
<i @click.stop="remove(node, data)" class="el-icon-delete"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
<node-edit ref="nodeEdit" :current-project="currentProject" :tree-nodes="treeNodes" @refresh="refreshNode" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import NodeEdit from "./NodeEdit";
|
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
|
||||||
import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "NodeTree",
|
name: "MsNodeTree",
|
||||||
components: { NodeEdit },
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
expandedNode: [],
|
|
||||||
filterText: "",
|
filterText: "",
|
||||||
|
expandedNode: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: "children",
|
children: "children",
|
||||||
label: "label"
|
label: "label"
|
||||||
},
|
},
|
||||||
disabled: false,
|
extendTreeNodes: []
|
||||||
list: []
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -84,43 +89,144 @@ export default {
|
||||||
treeNodes: {
|
treeNodes: {
|
||||||
type: Array
|
type: Array
|
||||||
},
|
},
|
||||||
selectNode: {
|
allLabel: {
|
||||||
type: Object
|
type: String,
|
||||||
},
|
default() {
|
||||||
draggable: {
|
return this.$t("commons.all_label.case");
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
currentProject: {
|
|
||||||
type: Object
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
treeNodes() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
filterText(val) {
|
filterText(val) {
|
||||||
this.$refs.tree.filter(val);
|
this.filter(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
computed: {
|
||||||
if (!checkoutTestManagerOrTestUser()) {
|
disabled() {
|
||||||
this.disabled = true;
|
return this.type != 'edit' || !checkoutTestManagerOrTestUser();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.extendTreeNodes = [];
|
||||||
|
this.extendTreeNodes.unshift({
|
||||||
|
"id": "root",
|
||||||
|
"name": this.allLabel,
|
||||||
|
"level": 0,
|
||||||
|
"children": this.treeNodes,
|
||||||
|
});
|
||||||
|
if (this.expandedNode.length === 0) {
|
||||||
|
this.expandedNode.push("root");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleNodeSelect(node) {
|
||||||
|
let nodeIds = [];
|
||||||
|
let pNodes = [];
|
||||||
|
this.getChildNodeId(node.data, nodeIds);
|
||||||
|
this.getParentNodes(node, pNodes);
|
||||||
|
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||||
|
},
|
||||||
|
filterNode(value, data) {
|
||||||
|
if (!value) return true;
|
||||||
|
if (data.label) {
|
||||||
|
return data.label.indexOf(value) !== -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
filter(val) {
|
||||||
|
this.$refs.tree.filter(val);
|
||||||
|
},
|
||||||
|
nodeExpand(data) {
|
||||||
|
if (data.id) {
|
||||||
|
this.expandedNode.push(data.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodeCollapse(data) {
|
||||||
|
if (data.id) {
|
||||||
|
this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
edit(node, data) {
|
||||||
|
this.$set(data, 'isEdit', true);
|
||||||
|
},
|
||||||
|
append(node, data) {
|
||||||
|
const newChild = {
|
||||||
|
id: undefined,
|
||||||
|
isEdit: false,
|
||||||
|
name: "",
|
||||||
|
children: []
|
||||||
|
};
|
||||||
|
if (!data.children) {
|
||||||
|
this.$set(data, 'children', [])
|
||||||
|
}
|
||||||
|
data.children.push(newChild);
|
||||||
|
this.edit(node, newChild);
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.tree.setCurrentKey(data.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
save(node, data) {
|
||||||
|
if (data.name.trim() === '') {
|
||||||
|
this.$warning(this.$t('test_track.case.input_name'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let param = {};
|
||||||
|
this.buildSaveParam(param, node.parent.data, data);
|
||||||
|
if (param.type === 'edit') {
|
||||||
|
this.$emit('edit', param);
|
||||||
|
} else {
|
||||||
|
this.$emit('add', param);
|
||||||
|
}
|
||||||
|
this.$set(data, 'isEdit', false);
|
||||||
|
},
|
||||||
|
remove(node, data) {
|
||||||
|
let tip = '确定删除节点 ' + data.label + ' 及其子节点下所有资源' + '?';
|
||||||
|
// let info = this.$t("test_track.module.delete_confirm") + data.label + "," + this.$t("test_track.module.delete_all_resource") + "?";
|
||||||
|
this.$alert(tip, "", {
|
||||||
|
confirmButtonText: this.$t("commons.confirm"),
|
||||||
|
callback: action => {
|
||||||
|
if (action === "confirm") {
|
||||||
|
let nodeIds = [];
|
||||||
|
this.getChildNodeId(node.data, nodeIds);
|
||||||
|
this.$emit('remove', nodeIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||||
if (dropType === "none" || dropType === undefined) {
|
if (dropType === "none" || dropType === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let param = this.buildParam(draggingNode, dropNode, dropType);
|
let param = this.buildParam(draggingNode, dropNode, dropType);
|
||||||
|
let list = [];
|
||||||
this.list = [];
|
this.getNodeTree(this.treeNodes, draggingNode.data.id, list);
|
||||||
this.getNodeTree(this.treeNodes,draggingNode.data.id, this.list);
|
if (param.parentId === 'root') {
|
||||||
this.$post("/case/node/drag", param, () => {
|
param.parentId = undefined;
|
||||||
draggingNode.data.level = param.level;
|
}
|
||||||
this.$post("/case/node/pos", this.list);
|
this.$emit('drag', param, list);
|
||||||
this.refreshTable();
|
},
|
||||||
}, (error) => {
|
buildSaveParam(param, parentData, data) {
|
||||||
this.refreshNode();
|
if (data.id) {
|
||||||
});
|
param.nodeIds = [];
|
||||||
|
param.type = 'edit';
|
||||||
|
param.id = data.id;
|
||||||
|
param.level = data.level;
|
||||||
|
this.getChildNodeId(data, param.nodeIds);
|
||||||
|
} else {
|
||||||
|
param.level = 1;
|
||||||
|
param.type = 'add';
|
||||||
|
if (parentData.id != 'root') {
|
||||||
|
// 非根节点
|
||||||
|
param.parentId = parentData.id;
|
||||||
|
param.level = parentData.level + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
param.name = data.name.trim();
|
||||||
|
param.label = data.name;
|
||||||
},
|
},
|
||||||
buildParam(draggingNode, dropNode, dropType) {
|
buildParam(draggingNode, dropNode, dropType) {
|
||||||
let param = {};
|
let param = {};
|
||||||
|
@ -141,7 +247,8 @@ export default {
|
||||||
}
|
}
|
||||||
let nodeIds = [];
|
let nodeIds = [];
|
||||||
this.getChildNodeId(draggingNode.data, nodeIds);
|
this.getChildNodeId(draggingNode.data, nodeIds);
|
||||||
if (dropNode.level == 1 && dropType != "inner") {
|
if (dropNode.data.level == 1 && dropType != "inner") {
|
||||||
|
// nodeTree 为需要修改的子节点
|
||||||
param.nodeTree = draggingNode.data;
|
param.nodeTree = draggingNode.data;
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < this.treeNodes.length; i++) {
|
for (let i = 0; i < this.treeNodes.length; i++) {
|
||||||
|
@ -151,7 +258,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
param.nodeIds = nodeIds;
|
param.nodeIds = nodeIds;
|
||||||
return param;
|
return param;
|
||||||
},
|
},
|
||||||
|
@ -171,9 +277,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refreshTable() {
|
|
||||||
this.$emit('refreshTable');
|
|
||||||
},
|
|
||||||
findTreeByNodeId(rootNode, nodeId) {
|
findTreeByNodeId(rootNode, nodeId) {
|
||||||
if (rootNode.id == nodeId) {
|
if (rootNode.id == nodeId) {
|
||||||
return rootNode;
|
return rootNode;
|
||||||
|
@ -186,41 +289,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove(node, data) {
|
|
||||||
this.$alert(
|
|
||||||
this.$t("test_track.module.delete_confirm") +
|
|
||||||
data.label +
|
|
||||||
"," +
|
|
||||||
this.$t("test_track.module.delete_all_resource") +
|
|
||||||
"?",
|
|
||||||
"",
|
|
||||||
{
|
|
||||||
confirmButtonText: this.$t("commons.confirm"),
|
|
||||||
callback: action => {
|
|
||||||
if (action === "confirm") {
|
|
||||||
let nodeIds = [];
|
|
||||||
this.getChildNodeId(node.data, nodeIds);
|
|
||||||
this.$post("/case/node/delete", nodeIds, () => {
|
|
||||||
const parent = node.parent;
|
|
||||||
const children = parent.data.children || parent.data;
|
|
||||||
const index = children.findIndex(d => d.id === data.id);
|
|
||||||
children.splice(index, 1);
|
|
||||||
this.$success(this.$t("commons.delete_success"));
|
|
||||||
this.$emit("refresh");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
handleNodeSelect(node) {
|
|
||||||
let nodeIds = [];
|
|
||||||
let pNodes = [];
|
|
||||||
this.getChildNodeId(node.data, nodeIds);
|
|
||||||
this.getParentNodes(node, pNodes);
|
|
||||||
this.$emit("nodeSelectEvent", nodeIds, pNodes);
|
|
||||||
this.$emit("update:selectNode", node);
|
|
||||||
},
|
|
||||||
getChildNodeId(rootNode, nodeIds) {
|
getChildNodeId(rootNode, nodeIds) {
|
||||||
//递归获取所有子节点ID
|
//递归获取所有子节点ID
|
||||||
nodeIds.push(rootNode.id);
|
nodeIds.push(rootNode.id);
|
||||||
|
@ -238,30 +306,6 @@ export default {
|
||||||
pNodes.push(rootNode.data);
|
pNodes.push(rootNode.data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filterNode(value, data) {
|
|
||||||
if (!value) return true;
|
|
||||||
return data.label.indexOf(value) !== -1;
|
|
||||||
},
|
|
||||||
openEditNodeDialog(type, data) {
|
|
||||||
let nodeIds = [];
|
|
||||||
if (type == 'edit') {
|
|
||||||
this.getChildNodeId(data, nodeIds);
|
|
||||||
}
|
|
||||||
this.$refs.nodeEdit.open(type, data, nodeIds);
|
|
||||||
},
|
|
||||||
refreshNode() {
|
|
||||||
this.$emit("refresh");
|
|
||||||
},
|
|
||||||
nodeExpand(data) {
|
|
||||||
if (data.id) {
|
|
||||||
this.expandedNode.push(data.id);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nodeCollapse(data) {
|
|
||||||
if (data.id) {
|
|
||||||
this.expandedNode.splice(this.expandedNode.indexOf(data.id), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -311,4 +355,14 @@ export default {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
margin: 0px 5px;
|
margin: 0px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.name-input {
|
||||||
|
height: 25px;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-input >>> .el-input__inner {
|
||||||
|
height: 25px;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
<template>
|
||||||
|
<ms-node-tree
|
||||||
|
v-loading="result.loading"
|
||||||
|
:tree-nodes="treeNodes"
|
||||||
|
:type="'edit'"
|
||||||
|
@add="add"
|
||||||
|
@edit="edit"
|
||||||
|
@drag="drag"
|
||||||
|
@remove="remove"
|
||||||
|
@nodeSelectEvent="nodeChange"
|
||||||
|
ref="nodeTree"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import NodeEdit from "./NodeEdit";
|
||||||
|
import {getCurrentProjectID} from "../../../../common/js/utils";
|
||||||
|
import MsNodeTree from "./NodeTree";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TestCaseNodeTree",
|
||||||
|
components: {MsNodeTree, NodeEdit },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
defaultProps: {
|
||||||
|
children: "children",
|
||||||
|
label: "label"
|
||||||
|
},
|
||||||
|
result: {},
|
||||||
|
treeNodes: [],
|
||||||
|
projectId: ""
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: "view"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.projectId = getCurrentProjectID();
|
||||||
|
this.list();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
list() {
|
||||||
|
if (this.projectId) {
|
||||||
|
this.result = this.$get("/case/node/list/" + this.projectId, response => {
|
||||||
|
this.treeNodes = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
edit(param) {
|
||||||
|
param.projectId = this.projectId;
|
||||||
|
this.$post("/case/node/edit", param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.list();
|
||||||
|
this.$emit("refreshTable");
|
||||||
|
}, (error) => {
|
||||||
|
this.list();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
add(param) {
|
||||||
|
param.projectId = this.projectId;
|
||||||
|
this.$post("/case/node/add", param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.list();
|
||||||
|
}, (error) => {
|
||||||
|
this.list();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
remove(nodeIds) {
|
||||||
|
this.$post("/case/node/delete", nodeIds, () => {
|
||||||
|
this.list();
|
||||||
|
this.$emit("refreshTable")
|
||||||
|
}, (error) => {
|
||||||
|
this.list();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
drag(param, list) {
|
||||||
|
this.$post("/case/node/drag", param, () => {
|
||||||
|
this.$post("/case/node/pos", list);
|
||||||
|
this.list();
|
||||||
|
}, (error) => {
|
||||||
|
this.list();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
|
this.$emit("nodeSelectEvent", node, nodeIds, pNodes);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
<template v-slot:aside>
|
<template v-slot:aside>
|
||||||
<node-tree class="node-tree"
|
<node-tree class="node-tree"
|
||||||
|
v-loading="result.loading"
|
||||||
@nodeSelectEvent="nodeChange"
|
@nodeSelectEvent="nodeChange"
|
||||||
@refresh="refresh"
|
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
this.selectIds.add(row.id);
|
this.selectIds.add(row.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nodeChange(nodeIds, nodeNames) {
|
nodeChange(node, nodeIds, nodeNames) {
|
||||||
this.selectNodeIds = nodeIds;
|
this.selectNodeIds = nodeIds;
|
||||||
this.selectNodeNames = nodeNames;
|
this.selectNodeNames = nodeNames;
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
<node-tree class="node-tree"
|
<node-tree class="node-tree"
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
@nodeSelectEvent="nodeChange"
|
@nodeSelectEvent="nodeChange"
|
||||||
@refresh="refresh"
|
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
:draggable="false"
|
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:main>
|
<template v-slot:main>
|
||||||
|
@ -81,7 +79,7 @@
|
||||||
openTestCaseRelevanceDialog() {
|
openTestCaseRelevanceDialog() {
|
||||||
this.$refs.testCaseRelevance.open();
|
this.$refs.testCaseRelevance.open();
|
||||||
},
|
},
|
||||||
nodeChange(nodeIds, pNodes) {
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
this.selectNodeIds = nodeIds;
|
this.selectNodeIds = nodeIds;
|
||||||
this.selectParentNodes = pNodes;
|
this.selectParentNodes = pNodes;
|
||||||
// 切换node后,重置分页数
|
// 切换node后,重置分页数
|
||||||
|
|
|
@ -32,7 +32,8 @@ export default {
|
||||||
|
|
||||||
.test-plan-header-bar {
|
.test-plan-header-bar {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
background-color: white;
|
background-color: #FFF;
|
||||||
|
border-bottom: 2px solid #E6E6E6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-info {
|
.header-info {
|
||||||
|
@ -48,4 +49,8 @@ export default {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-ul >>> .el-menu-item {
|
||||||
|
height: 51px !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -8,11 +8,10 @@
|
||||||
:title="$t('test_track.review_view.review')"
|
:title="$t('test_track.review_view.review')"
|
||||||
@dataChange="changeReview"/>
|
@dataChange="changeReview"/>
|
||||||
<node-tree class="node-tree"
|
<node-tree class="node-tree"
|
||||||
|
:all-label="$t('commons.all_label.review')"
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
@nodeSelectEvent="nodeChange"
|
@nodeSelectEvent="nodeChange"
|
||||||
@refresh="refresh"
|
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
:draggable="false"
|
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</ms-aside-container>
|
</ms-aside-container>
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ export default {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
nodeChange(nodeIds, pNodes) {
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
this.selectNodeIds = nodeIds;
|
this.selectNodeIds = nodeIds;
|
||||||
this.selectParentNodes = pNodes;
|
this.selectParentNodes = pNodes;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,16 +1,23 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
|
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
|
||||||
width="60%" v-loading="result.loading"
|
width="60%"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
top="50px">
|
top="50px">
|
||||||
|
|
||||||
<el-container class="main-content">
|
<el-container class="main-content">
|
||||||
<el-aside class="tree-aside" width="250px">
|
<el-aside class="tree-aside" width="250px">
|
||||||
<el-link type="primary" class="project-link" @click="switchProject">{{projectName ? projectName :
|
<select-menu
|
||||||
$t('test_track.switch_project') }}
|
:data="projects"
|
||||||
</el-link>
|
width="160px"
|
||||||
<node-tree class="node-tree" @nodeSelectEvent="nodeChange" @refresh="refresh" :tree-nodes="treeNodes"
|
:current-data="currentProject"
|
||||||
|
:title="$t('test_track.switch_project')"
|
||||||
|
@dataChange="changeProject"/>
|
||||||
|
<node-tree class="node-tree"
|
||||||
|
:all-label="$t('commons.all_label.review')"
|
||||||
|
v-loading="result.loading"
|
||||||
|
@nodeSelectEvent="nodeChange"
|
||||||
|
:tree-nodes="treeNodes"
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
|
||||||
|
@ -21,6 +28,7 @@
|
||||||
@filter-change="filter" row-key="id"
|
@filter-change="filter" row-key="id"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
@select="handleSelectionChange"
|
@select="handleSelectionChange"
|
||||||
|
v-loading="result.loading"
|
||||||
height="50vh"
|
height="50vh"
|
||||||
ref="table">
|
ref="table">
|
||||||
|
|
||||||
|
@ -98,10 +106,12 @@
|
||||||
import {_filter} from "../../../../../../common/js/utils";
|
import {_filter} from "../../../../../../common/js/utils";
|
||||||
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
|
||||||
import elTableInfiniteScroll from 'el-table-infinite-scroll';
|
import elTableInfiniteScroll from 'el-table-infinite-scroll';
|
||||||
|
import SelectMenu from "../../../common/SelectMenu";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestReviewRelevance",
|
name: "TestReviewRelevance",
|
||||||
components: {
|
components: {
|
||||||
|
SelectMenu,
|
||||||
NodeTree,
|
NodeTree,
|
||||||
MsDialogFooter,
|
MsDialogFooter,
|
||||||
PriorityTableItem,
|
PriorityTableItem,
|
||||||
|
@ -119,6 +129,7 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
|
currentProject: {},
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
isCheckAll: false,
|
isCheckAll: false,
|
||||||
testReviews: [],
|
testReviews: [],
|
||||||
|
@ -254,7 +265,7 @@
|
||||||
this.selectIds.add(row.id);
|
this.selectIds.add(row.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nodeChange(nodeIds, nodeNames) {
|
nodeChange(node, nodeIds, nodeNames) {
|
||||||
this.selectNodeIds = nodeIds;
|
this.selectNodeIds = nodeIds;
|
||||||
this.selectNodeNames = nodeNames;
|
this.selectNodeNames = nodeNames;
|
||||||
},
|
},
|
||||||
|
@ -297,6 +308,7 @@
|
||||||
this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => {
|
this.$post("/test/case/review/projects", {reviewId: this.reviewId}, res => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
this.currentProject = data[0];
|
||||||
this.projects = data;
|
this.projects = data;
|
||||||
this.projectId = data[0].id;
|
this.projectId = data[0].id;
|
||||||
this.projectName = data[0].name;
|
this.projectName = data[0].name;
|
||||||
|
@ -318,11 +330,15 @@
|
||||||
this.testReviews = [];
|
this.testReviews = [];
|
||||||
this.getReviews(true);
|
this.getReviews(true);
|
||||||
},
|
},
|
||||||
|
changeProject(project) {
|
||||||
|
this.projectId = project.id;
|
||||||
|
},
|
||||||
|
|
||||||
getProjectNode(projectId) {
|
getProjectNode(projectId) {
|
||||||
const index = this.projects.findIndex(project => project.id === projectId);
|
const index = this.projects.findIndex(project => project.id === projectId);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.projectName = this.projects[index].name;
|
this.projectName = this.projects[index].name;
|
||||||
|
this.currentProject = this.projects[index];
|
||||||
}
|
}
|
||||||
if (projectId) {
|
if (projectId) {
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
|
|
|
@ -165,7 +165,11 @@ export default {
|
||||||
current_user: "Current user"
|
current_user: "Current user"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
monitor: "monitor"
|
monitor: "monitor",
|
||||||
|
all_label: {
|
||||||
|
case: "all",
|
||||||
|
review: "all"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: 'Authorization management',
|
title: 'Authorization management',
|
||||||
|
|
|
@ -165,7 +165,11 @@ export default {
|
||||||
current_user: "是当前用户"
|
current_user: "是当前用户"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
monitor: "监控"
|
monitor: "监控",
|
||||||
|
all_label: {
|
||||||
|
case: "全部用例",
|
||||||
|
review: "全部评审"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: '授权管理',
|
title: '授权管理',
|
||||||
|
|
|
@ -165,7 +165,11 @@ export default {
|
||||||
current_user: "是當前用戶"
|
current_user: "是當前用戶"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
monitor:"監控"
|
monitor:"監控",
|
||||||
|
all_label: {
|
||||||
|
case: "全部用例",
|
||||||
|
review: "全部評審"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: '授權管理',
|
title: '授權管理',
|
||||||
|
|
Loading…
Reference in New Issue