Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
q4speed 2020-06-01 11:48:54 +08:00
commit 00c60388f1
3 changed files with 29 additions and 16 deletions

View File

@ -204,6 +204,11 @@ const router = new VueRouter({
name: 'trackHome', name: 'trackHome',
component: TrackHome, component: TrackHome,
}, },
{
path: 'case/create/',
name: 'testCaseCreate',
component: TestCase,
},
{ {
path: 'case/:projectId', path: 'case/:projectId',
name: 'testCase', name: 'testCase',

View File

@ -88,25 +88,23 @@
mounted() { mounted() {
this.getProjects(); this.getProjects();
this.refresh(); this.refresh();
if (this.$route.params.projectId){ if (this.$route.path.indexOf("/track/case/edit") >= 0 || this.$route.path.indexOf("/track/case/create") >= 0){
this.getProjectById(this.$route.params.projectId)
}
if (this.$route.path.indexOf("/track/case/edit") >= 0){
this.openRecentTestCaseEditDialog(); this.openRecentTestCaseEditDialog();
this.$router.push('/track/case/all'); this.$router.push('/track/case/all');
} else if (this.$route.params.projectId){
this.getProjectById(this.$route.params.projectId)
} }
}, },
watch: { watch: {
'$route'(to, from) { '$route'(to, from) {
let path = to.path; let path = to.path;
if (to.params.projectId){ if (path.indexOf("/track/case/edit") >= 0 || path.indexOf("/track/case/create") >= 0){
this.getProjectById(to.params.projectId)
this.getProjects();
}
if (path.indexOf("/track/case/edit") >= 0){
this.openRecentTestCaseEditDialog(); this.openRecentTestCaseEditDialog();
this.$router.push('/track/case/all'); this.$router.push('/track/case/all');
this.getProjects(); this.getProjects();
} else if (to.params.projectId){
this.getProjectById(to.params.projectId);
this.getProjects();
} }
}, },
currentProject() { currentProject() {
@ -161,7 +159,7 @@
editTestCase(testCase) { editTestCase(testCase) {
this.testCaseReadOnly = false; this.testCaseReadOnly = false;
if (this.treeNodes.length < 1) { if (this.treeNodes.length < 1) {
this.$warning('请先新建模块'); this.$warning(this.$t('test_track.case.create_module_first'));
return; return;
} }
this.$refs.testCaseEditDialog.open(testCase); this.$refs.testCaseEditDialog.open(testCase);
@ -191,13 +189,22 @@
}, },
openRecentTestCaseEditDialog() { openRecentTestCaseEditDialog() {
let caseId = this.$route.params.caseId; let caseId = this.$route.params.caseId;
this.getProjectByCaseId(caseId); if (caseId) {
this.$get('/test/case/get/' + caseId, response => { this.getProjectByCaseId(caseId);
if (response.data) { this.$get('/test/case/get/' + caseId, response => {
this.testCaseReadOnly = false; if (response.data) {
this.$refs.testCaseEditDialog.open(response.data); this.testCaseReadOnly = false;
this.$refs.testCaseEditDialog.open(response.data);
}
});
} else {
this.testCaseReadOnly = false;
if (this.treeNodes.length < 1) {
this.$warning(this.$t('test_track.case.create_module_first'));
return;
} }
}); this.$refs.testCaseEditDialog.open();
}
}, },
getProjectById(id) { getProjectById(id) {
if (id && id != 'all') { if (id && id != 'all') {

View File

@ -23,6 +23,7 @@
<el-divider/> <el-divider/>
<ms-show-all :index="'/track/case/all'"/> <ms-show-all :index="'/track/case/all'"/>
<el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item> <el-menu-item :index="testCaseEditPath" class="blank_item"></el-menu-item>
<ms-create-button v-permission="['test_manager', 'test_user']" :index="'/track/case/create'" :title="$t('test_track.case.create_case')"/>
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" index="7" popper-class="submenu"> <el-submenu v-if="isCurrentWorkspaceUser" index="7" popper-class="submenu">