diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index ac2323476e..80ca813fc9 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -2,23 +2,15 @@ - @@ -52,7 +43,6 @@ import NodeTree from '../common/NodeTree'; import TestCaseEdit from './components/TestCaseEdit'; -import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER} from '../../../../common/js/constants'; import TestCaseList from "./components/TestCaseList"; import SelectMenu from "../common/SelectMenu"; import TestCaseMove from "./components/TestCaseMove"; @@ -61,10 +51,12 @@ import MsAsideContainer from "../../common/components/MsAsideContainer"; import MsMainContainer from "../../common/components/MsMainContainer"; import {checkoutTestManagerOrTestUser, hasRoles} from "../../../../common/js/utils"; import BatchMove from "./components/BatchMove"; +import TestCaseNodeTree from "../common/TestCaseNodeTree"; export default { name: "TestCase", components: { + TestCaseNodeTree, MsMainContainer, MsAsideContainer, MsContainer, TestCaseMove, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, BatchMove }, @@ -76,35 +68,25 @@ export default { pageSize: 5, total: 0, projects: [], - currentProject: null, treeNodes: [], selectNodeIds: [], selectParentNodes: [], testCaseReadOnly: true, selectNode: {}, - nodeTreeDraggable: true, } }, - activated() { - this.currentProject = localStorage.getItem(PROJECT_ID); - }, mounted() { this.init(this.$route); }, watch: { '$route'(to, from) { - // console.log(this.$route.params.projectId) this.init(to); }, - currentProject() { - this.refresh(); - } }, methods: { init(route) { let path = route.path; if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0) { - // this.getProjects(); this.testCaseReadOnly = false; if (!checkoutTestManagerOrTestUser()) { this.testCaseReadOnly = true; @@ -113,50 +95,10 @@ export default { this.openRecentTestCaseEditDialog(caseId); this.$router.push('/track/case/all'); } - // else if (route.params.projectId) { - // this.getProjects(); - // this.getProjectById(route.params.projectId); - // } }, - // getProjects() { - // 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) { + nodeChange(node, nodeIds, pNodes) { this.selectNodeIds = nodeIds; + this.selectNode = node; this.selectParentNodes = pNodes; }, refreshTable() { @@ -182,17 +124,11 @@ export default { this.testCaseReadOnly = true; this.$refs.testCaseEditDialog.open(testCase); }, - // getProjectByCaseId(caseId) { - // return this.$get('/test/case/project/' + caseId, async response => { - // this.setCurrentProject(response.data); - // }); - // }, refresh() { this.selectNodeIds = []; this.selectParentNodes = []; this.selectNode = {}; this.refreshTable(); - this.getNodeTree(); }, openRecentTestCaseEditDialog(caseId) { if (caseId) { @@ -206,35 +142,7 @@ export default { 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) { if (selectIds.size < 1) { this.$warning(this.$t('test_track.plan_view.select_manipulate')); diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 6af1fa4ffc..6b3125dbd4 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -262,6 +262,7 @@ import {listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent"; import {Message} from "element-ui"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; +import {getCurrentProjectID} from "../../../../../common/js/utils"; export default { name: "TestCaseEdit", @@ -269,6 +270,7 @@ export default { data() { return { result: {}, + projectId: "", dialogFormVisible: false, form: { name: '', @@ -329,9 +331,6 @@ export default { selectNode: { type: Object }, - currentProject: { - type: Object - } }, mounted() { this.getSelectOptions(); @@ -340,9 +339,6 @@ export default { treeNodes() { this.getModuleOptions(); }, - currentProject() { - this.getTestOptions(); - } }, methods: { reload() { @@ -351,7 +347,7 @@ export default { }, open(testCase) { this.resetForm(); - + this.projectId = getCurrentProjectID(); if (window.history && window.history.pushState) { history.pushState(null, null, document.URL); window.addEventListener('popstate', this.close); @@ -489,8 +485,8 @@ export default { param.nodePath = item.path; } }); - if (this.currentProject.id) { - param.projectId = this.currentProject.id; + if (this.projectId) { + param.projectId = this.projectId; } param.name = param.name.trim(); if (param.method != 'auto') { @@ -563,8 +559,8 @@ export default { }, getTestOptions() { this.testOptions = []; - if (this.currentProject.id && this.form.type != '' && this.form.type != 'functional') { - this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => { + if (this.projectId && this.form.type != '' && this.form.type != 'functional') { + this.result = this.$get('/' + this.form.type + '/list/' + this.projectId, response => { this.testOptions = response.data; this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')}) }); diff --git a/frontend/src/business/components/track/case/components/TestCaseImport.vue b/frontend/src/business/components/track/case/components/TestCaseImport.vue index 16c2f0f723..8688c52489 100644 --- a/frontend/src/business/components/track/case/components/TestCaseImport.vue +++ b/frontend/src/business/components/track/case/components/TestCaseImport.vue @@ -111,8 +111,8 @@ @@ -311,4 +355,14 @@ export default { color: #409eff; margin: 0px 5px; } + +.name-input { + height: 25px; + line-height: 25px; +} + +.name-input >>> .el-input__inner { + height: 25px; + line-height: 25px; +} diff --git a/frontend/src/business/components/track/common/TestCaseNodeTree.vue b/frontend/src/business/components/track/common/TestCaseNodeTree.vue new file mode 100644 index 0000000000..6b37d31e1c --- /dev/null +++ b/frontend/src/business/components/track/common/TestCaseNodeTree.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/TestCaseFunctionalRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/functional/TestCaseFunctionalRelevance.vue index 6db1d91e41..60933b1857 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/TestCaseFunctionalRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/TestCaseFunctionalRelevance.vue @@ -8,8 +8,8 @@ @@ -237,7 +237,7 @@ this.selectIds.add(row.id); } }, - nodeChange(nodeIds, nodeNames) { + nodeChange(node, nodeIds, nodeNames) { this.selectNodeIds = nodeIds; this.selectNodeNames = nodeNames; }, diff --git a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue index 8a1161d781..c2a000dcb4 100644 --- a/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue +++ b/frontend/src/business/components/track/plan/view/comonents/functional/TestPlanFunctional.vue @@ -5,9 +5,7 @@