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

This commit is contained in:
wenyann 2020-06-02 16:48:11 +08:00
commit 89eaebebdd
9 changed files with 43 additions and 68 deletions

View File

@ -2,38 +2,35 @@
<div id="menu-bar"> <div id="menu-bar">
<el-row type="flex"> <el-row type="flex">
<el-col :span="8"> <el-col :span="8">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'> <el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'
menu-trigger="click">
<el-menu-item :index="'/api/home'"> <el-menu-item :index="'/api/home'">
{{ $t("i18n.home") }} {{ $t("i18n.home") }}
</el-menu-item> </el-menu-item>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser" index="3">
index="3" popper-class="submenu">
<template v-slot:title>{{$t('commons.project')}}</template> <template v-slot:title>{{$t('commons.project')}}</template>
<ms-recent-list :options="projectRecent"/> <ms-recent-list :options="projectRecent"/>
<el-divider/> <el-divider class="menu-divider"/>
<ms-show-all :index="'/api/project/all'"/> <ms-show-all :index="'/api/project/all'"/>
<ms-create-button v-permission="['test_manager', 'test_user']" :index="'/api/project/create'" :title="$t('project.create')"/> <ms-create-button v-permission="['test_manager', 'test_user']" :index="'/api/project/create'"
:title="$t('project.create')"/>
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser" index="4">
index="4" popper-class="submenu">
<template v-slot:title>{{$t('commons.test')}}</template> <template v-slot:title>{{$t('commons.test')}}</template>
<ms-recent-list :options="testRecent"/> <ms-recent-list :options="testRecent"/>
<el-divider/> <el-divider class="menu-divider"/>
<ms-show-all :index="'/api/test/list/all'"/> <ms-show-all :index="'/api/test/list/all'"/>
<ms-create-button v-permission="['test_manager', 'test_user']" :index="'/api/test/create'" :title="$t('load_test.create')"/> <ms-create-button v-permission="['test_manager', 'test_user']" :index="'/api/test/create'"
<!-- <el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>--> :title="$t('load_test.create')"/>
<!-- <el-menu-item :index="testEditPath" class="blank_item"></el-menu-item>-->
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser" index="5">
index="5" popper-class="submenu">
<template v-slot:title>{{$t('commons.report')}}</template> <template v-slot:title>{{$t('commons.report')}}</template>
<ms-recent-list :options="reportRecent"/> <ms-recent-list :options="reportRecent"/>
<el-divider/> <el-divider class="menu-divider"/>
<ms-show-all :index="'/api/report/list/all'"/> <ms-show-all :index="'/api/report/list/all'"/>
<!-- <el-menu-item :index="reportViewPath" class="blank_item"></el-menu-item>-->
</el-submenu> </el-submenu>
</el-menu> </el-menu>
</el-col> </el-col>
@ -62,10 +59,6 @@
data() { data() {
return { return {
isCurrentWorkspaceUser: false, isCurrentWorkspaceUser: false,
// testCaseProjectPath: '',
// testEditPath: '',
// reportViewPath: '',
// isRouterAlive: true,
projectRecent: { projectRecent: {
title: this.$t('project.recent'), title: this.$t('project.recent'),
url: "/project/recent/5", url: "/project/recent/5",
@ -96,55 +89,20 @@
} }
} }
}, },
// watch: {
// '$route'(to, from) {
// let path = to.path;
// //
// if (path.indexOf("/api/test/") >= 0) {
// this.testCaseProjectPath = '/api/test/' + this.$route.params.projectId;
// this.reload();
// }
// if (path.indexOf("/api/test/edit/") >= 0) {
// this.testEditPath = '/api/test/edit/' + this.$route.params.testId;
// this.reload();
// }
// if (path.indexOf("/api/report/view/") >= 0) {
// this.reportViewPath = '/api/report/view/' + this.$route.params.reportId;
// this.reload();
// }
// }
// },
mounted() { mounted() {
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace(); this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
}, },
// methods: {
// reload() {
// this.isRouterAlive = false;
// this.$nextTick(function () {
// this.isRouterAlive = true;
// })
// }
// }
} }
</script> </script>
<style scoped> <style scoped>
.el-divider--horizontal {
margin: 0;
}
.el-menu.el-menu--horizontal {
border-bottom: none;
}
#menu-bar { #menu-bar {
border-bottom: 1px solid #E6E6E6; border-bottom: 1px solid #E6E6E6;
background-color: #FFF; background-color: #FFF;
} }
.blank_item { .menu-divider {
display: none; margin: 0;
} }
</style> </style>

View File

@ -85,9 +85,7 @@
methods: { methods: {
init() { init() {
this.result = this.$get("/project/listAll", response => { let projectId;
this.projects = response.data;
})
if (this.id) { if (this.id) {
this.create = false; this.create = false;
this.getTest(this.id); this.getTest(this.id);
@ -97,7 +95,14 @@
if (this.$refs.config) { if (this.$refs.config) {
this.$refs.config.reset(); this.$refs.config.reset();
} }
//
projectId = this.$store.state.common.projectId;
} }
this.result = this.$get("/project/listAll", response => {
this.projects = response.data;
//
if (projectId) this.test.projectId = projectId;
})
}, },
getTest(id) { getTest(id) {
this.result = this.$get("/api/get/" + id, response => { this.result = this.$get("/api/get/" + id, response => {

View File

@ -148,6 +148,9 @@
}, },
init() { init() {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
if (this.projectId && this.projectId !== "all") {
this.$store.commit('setProjectId', this.projectId);
}
this.search(); this.search();
}, },
/* filter(value, row) { /* filter(value, row) {

View File

@ -205,7 +205,7 @@ const router = new VueRouter({
component: TrackHome, component: TrackHome,
}, },
{ {
path: 'case/create/', path: 'case/create',
name: 'testCaseCreate', name: 'testCaseCreate',
component: TestCase, component: TestCase,
}, },

View File

@ -199,10 +199,6 @@
}); });
} else { } else {
this.testCaseReadOnly = false; this.testCaseReadOnly = false;
if (this.treeNodes.length < 1) {
this.$warning(this.$t('test_track.case.create_module_first'));
return;
}
this.$refs.testCaseEditDialog.open(); this.$refs.testCaseEditDialog.open();
} }
}, },

View File

@ -3,6 +3,17 @@ import Vuex from 'vuex'
Vue.use(Vuex); Vue.use(Vuex);
const Common = {
state: {
projectId: ""
},
mutations: {
setProjectId(state, projectId) {
state.projectId = projectId;
}
}
}
const API = { const API = {
state: { state: {
test: {} test: {}
@ -14,13 +25,12 @@ const API = {
clearTest(state) { clearTest(state) {
state.test = {}; state.test = {};
} }
}, }
actions: {},
getters: {}
} }
export default new Vuex.Store({ export default new Vuex.Store({
modules: { modules: {
api: API api: API,
common: Common
} }
}) })

View File

@ -4,6 +4,7 @@ export default {
'organization': 'Organization', 'organization': 'Organization',
'setting': 'Setting', 'setting': 'Setting',
'project': 'Project', 'project': 'Project',
current_project: 'Current Project',
'name': 'Name', 'name': 'Name',
'description': 'Description', 'description': 'Description',
'clear': 'Clear', 'clear': 'Clear',

View File

@ -4,6 +4,7 @@ export default {
'organization': '组织', 'organization': '组织',
'setting': '设置', 'setting': '设置',
'project': '项目', 'project': '项目',
current_project: '当前项目',
'name': '名称', 'name': '名称',
'description': '描述', 'description': '描述',
'clear': '清空', 'clear': '清空',

View File

@ -4,6 +4,7 @@ export default {
'organization': '組織', 'organization': '組織',
'setting': '設置', 'setting': '設置',
'project': '項目', 'project': '項目',
current_project: '當前項目',
'name': '名稱', 'name': '名稱',
'description': '描述', 'description': '描述',
'clear': '清空', 'clear': '清空',