feat(系统设置): 项目管理迁移至系统设置

This commit is contained in:
shiziyuan9527 2020-12-07 17:28:04 +08:00
parent 1aab595ab0
commit 48c82d2852
12 changed files with 238 additions and 53 deletions

View File

@ -83,4 +83,10 @@ public class ProjectController {
public void updateProject(@RequestBody Project Project) {
projectService.updateProject(Project);
}
@PostMapping("/search")
public List<ProjectDTO> searchProject(@RequestBody ProjectRequest projectRequest) {
projectRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return projectService.getProjectList(projectRequest);
}
}

View File

@ -3,6 +3,18 @@
<el-row type="flex">
<el-col :span="10">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
<el-submenu :class="{'deactivation':!isProjectActivation}" v-permission="['test_manager','test_user','test_viewer']" index="3">
<template v-slot:title>{{ $t('commons.project') }}</template>
<search-list ref="projectRecent" :options="projectRecent"/>
<el-divider class="menu-divider"/>
<el-menu-item :index="'/performance/project/create'">
<font-awesome-icon :icon="['fa', 'plus']"/>
<span style="padding-left: 7px;">创建项目</span>
</el-menu-item>
<ms-show-all :index="'/setting/project'"/>
</el-submenu>
<el-menu-item :index="'/api/home'">
{{ $t("i18n.home") }}
</el-menu-item>
@ -15,15 +27,6 @@
{{ $t("i18n.automation") }}
</el-menu-item>
<el-submenu :class="{'deactivation':!isProjectActivation}" v-permission="['test_manager','test_user','test_viewer']" index="3">
<template v-slot:title>{{ $t('commons.project') }}</template>
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
<el-divider class="menu-divider"/>
<ms-show-all :index="'/api/project/all'"/>
<ms-create-button v-permission="['test_manager','test_user']" :index="'/api/project/create'"
:title="$t('project.create')"/>
</el-submenu>
<el-submenu v-permission="['test_manager','test_user','test_viewer']" index="4">
<template v-slot:title>{{ $t('commons.test') }}</template>
<ms-recent-list ref="testRecent" :options="testRecent"/>
@ -65,10 +68,11 @@ import MsShowAll from "../../common/head/ShowAll";
import MsCreateButton from "../../common/head/CreateButton";
import MsCreateTest from "../../common/head/CreateTest";
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
import SearchList from "@/business/components/common/head/SearchList";
export default {
name: "MsApiHeaderMenus",
components: {MsCreateTest, MsCreateButton, MsShowAll, MsRecentList},
components: {SearchList, MsCreateTest, MsCreateButton, MsShowAll, MsRecentList},
data() {
return {
projectRecent: {

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-row class="table-title" type="flex" justify="space-between" align="middle">
<el-row v-if="title" class="table-title" type="flex" justify="space-between" align="middle">
<slot name="title">
{{title}}
</slot>

View File

@ -0,0 +1,28 @@
<template>
<span>
<el-submenu index="10">
<template v-slot:title>操作</template>
<el-input
placeholder="请输入内容"
prefix-icon="el-icon-search"
v-model="input2">
</el-input>
</el-submenu>
</span>
</template>
<script>
export default {
name: "ProjectMenu",
data() {
return {
input2: '1'
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,107 @@
<template>
<div v-loading="result.loading" class="search-list">
<el-input placeholder="搜索项目"
prefix-icon="el-icon-search"
v-model="search_text"
clearable
class="search-input"
size="small"/>
<div v-if="items.length === 0" style="text-align: center; margin: 15px 0">
<span style="font-size: 15px; color: #8a8b8d;">
无数据
</span>
</div>
<div v-else style="height: 120px;overflow: auto">
<el-menu-item :key="i.id" v-for="i in items" :index="getIndex(i)" :route="getRouter(i)">
<template slot="title">
<div class="title">{{ i.name }}</div>
</template>
</el-menu-item>
</div>
</div>
</template>
<script>
import {hasRoles} from "@/common/js/utils";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
export default {
name: "SearchList",
props: {
options: Object
},
mounted() {
this.recent();
},
data() {
return {
result: {},
items: [],
search_text: ''
}
},
watch: {
search_text(val) {
if (!val) {
this.recent();
} else {
this.search();
}
}
},
computed: {
getIndex: function () {
return function (item) {
return this.options.index(item);
}
},
getRouter: function () {
return function (item) {
if (this.options.router) {
return this.options.router(item);
}
}
}
},
methods: {
recent: function () {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.result = this.$get(this.options.url, (response) => {
this.items = response.data;
this.items = this.items.splice(0, 3);
});
}
},
search() {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.result = this.$post("/project/search", {name: this.search_text},response => {
this.items = response.data;
})
}
}
}
}
</script>
<style scoped>
.search-input {
padding: 0;
margin-top: -5px;
}
.search-input >>> .el-input__inner {
border-radius: 0;
}
.title {
display: inline-block;
padding-left: 20px;
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<el-menu-item :index="this.index" @click="changeRoute">
<el-menu-item :index="this.index">
<font-awesome-icon :icon="['fa', 'list-ul']"/>
<span>{{ $t('commons.show_all') }}</span>
</el-menu-item>
@ -10,14 +10,6 @@ export default {
name: "MsShowAll",
props: {
index: String
},
methods: {
changeRoute() {
//
if (this.$route.path === this.index) {
this.$router.replace({path: this.index, query: {type: 'all'}});
}
}
}
}
</script>

View File

@ -3,20 +3,23 @@
<el-row type="flex">
<el-col :span="8">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
<el-menu-item :index="'/performance/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
index="3" popper-class="submenu">
<template v-slot:title>{{ $t('commons.project') }}</template>
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
<search-list ref="projectRecent" :options="projectRecent"/>
<el-divider/>
<ms-show-all :index="'/performance/project/all'"/>
<ms-create-button v-permission="['test_manager','test_user']" :index="'/performance/project/create'"
:title="$t('project.create')"/>
<el-menu-item :index="'/performance/project/create'">
<font-awesome-icon :icon="['fa', 'plus']"/>
<span style="padding-left: 7px;">创建项目</span>
</el-menu-item>
<ms-show-all :index="'/setting/project'"/>
</el-submenu>
<el-menu-item :index="'/performance/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
index="4" popper-class="submenu">
<template v-slot:title>{{ $t('commons.test') }}</template>
@ -53,10 +56,12 @@ import MsRecentList from "../../common/head/RecentList";
import MsCreateButton from "../../common/head/CreateButton";
import MsShowAll from "../../common/head/ShowAll";
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
import SearchList from "@/business/components/common/head/SearchList";
export default {
name: "PerformanceHeaderMenus",
components: {
SearchList,
MsCreateButton,
MsShowAll,
MsRecentList,
@ -92,7 +97,8 @@ export default {
},
router(item) {
}
}
},
input2: ''
}
},
methods: {

View File

@ -4,7 +4,7 @@
<el-card class="table-card" v-loading="result.loading">
<template v-slot:header>
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="title"/>
:create-tip="btnTips" title=""/>
</template>
<el-table border class="adjust-table" @row-click="link" :data="items" style="width: 100%" @sort-change="sort">
<el-table-column prop="name" :label="$t('commons.name')" width="250" show-overflow-tooltip/>
@ -36,7 +36,7 @@
<template v-slot:default="scope">
<ms-table-operator :is-tester-permission="true" @editClick="edit(scope.row)"
@deleteClick="handleDelete(scope.row)">
<template v-if="baseUrl == 'api'" v-slot:behind>
<template v-slot:behind>
<ms-table-operator-button :is-tester-permission="true" :tip="$t('api_test.environment.environment_config')" icon="el-icon-setting"
type="info" @exec="openEnvironmentConfig(scope.row)"/>
</template>
@ -188,21 +188,19 @@ export default {
this.createVisible = true;
listenGoBack(this.handleClose);
this.form = Object.assign({}, row);
if (this.baseUrl === 'track') {
this.$get("/service/integration/all/" + getCurrentUser().lastOrganizationId, response => {
let data = response.data;
let platforms = data.map(d => d.platform);
if (platforms.indexOf("Tapd") !== -1) {
this.tapd = true;
}
if (platforms.indexOf("Jira") !== -1) {
this.jira = true;
}
if (platforms.indexOf("Zentao") !== -1) {
this.zentao = true;
}
});
}
this.$get("/service/integration/all/" + getCurrentUser().lastOrganizationId, response => {
let data = response.data;
let platforms = data.map(d => d.platform);
if (platforms.indexOf("Tapd") !== -1) {
this.tapd = true;
}
if (platforms.indexOf("Jira") !== -1) {
this.jira = true;
}
if (platforms.indexOf("Zentao") !== -1) {
this.zentao = true;
}
});
},
submit(formName) {

View File

@ -41,6 +41,14 @@
</el-menu-item>
</el-submenu>
<el-menu-item v-for="menu in project" :key="menu.index" :index="menu.index" class="setting-item"
v-permission="menu.roles">
<template v-slot:title>
<font-awesome-icon class="icon" :icon="['fa', 'bars']" size="lg"/>
<span>{{ $t(menu.title) }}</span>
</template>
</el-menu-item>
</el-menu>
</template>
@ -73,6 +81,7 @@
organizations: getMenus('organization'),
workspaces: getMenus('workspace'),
persons: getMenus('person'),
project: getMenus('project'),
isCurrentOrganizationAdmin: false,
isCurrentWorkspaceUser: false,
}

View File

@ -0,0 +1,26 @@
<template>
<el-card>
<el-tabs class="system-setting" v-model="activeName">
<el-tab-pane label="项目管理" name="project">
<ms-project/>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
<script>
import MsProject from "@/business/components/project/MsProject";
export default {
name: "Project",
components: {MsProject},
data() {
return {
activeName: 'project'
}
}
}
</script>
<style scoped>
</style>

View File

@ -79,6 +79,11 @@ export default {
roles: ['test_manager', 'test_user', 'test_viewer', 'org_admin', 'admin']
}
},
{
path: 'project',
component: () => import('@/business/components/settings/project/Project'),
meta: {project: true, title: '项目管理'}
},
]
}

View File

@ -5,19 +5,22 @@
<el-col :span="12">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router
:default-active='$route.path'>
<el-menu-item :index="'/track/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-submenu :class="{'deactivation':!isProjectActivation}"
v-permission="['test_manager','test_user','test_viewer']" index="3" popper-class="submenu">
<template v-slot:title>{{ $t('commons.project') }}</template>
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
<search-list ref="projectRecent" :options="projectRecent"/>
<el-divider/>
<ms-show-all :index="'/track/project/all'"/>
<ms-create-button v-permission="['test_manager','test_user']" :index="'/track/project/create'"
:title="$t('project.create')"/>
<el-menu-item :index="'/performance/project/create'">
<font-awesome-icon :icon="['fa', 'plus']"/>
<span style="padding-left: 7px;">创建项目</span>
</el-menu-item>
<ms-show-all :index="'/setting/project'"/>
</el-submenu>
<el-menu-item :index="'/track/home'">
{{ $t("i18n.home") }}
</el-menu-item>
<el-submenu v-permission="['test_manager','test_user','test_viewer']"
index="6" popper-class="submenu">
<template v-slot:title>{{ $t('test_track.case.test_case') }}</template>
@ -62,10 +65,11 @@ import MsShowAll from "../../common/head/ShowAll";
import MsRecentList from "../../common/head/RecentList";
import MsCreateButton from "../../common/head/CreateButton";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import SearchList from "@/business/components/common/head/SearchList";
export default {
name: "TrackHeaderMenus",
components: {MsShowAll, MsRecentList, MsCreateButton},
components: {SearchList, MsShowAll, MsRecentList, MsCreateButton},
data() {
return {
testPlanViewPath: '',