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',
component: TrackHome,
},
{
path: 'case/create/',
name: 'testCaseCreate',
component: TestCase,
},
{
path: 'case/:projectId',
name: 'testCase',

View File

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

View File

@ -23,6 +23,7 @@
<el-divider/>
<ms-show-all :index="'/track/case/all'"/>
<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 v-if="isCurrentWorkspaceUser" index="7" popper-class="submenu">