Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
1307b4d854
|
@ -12,7 +12,7 @@
|
|||
</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)">
|
||||
<el-menu-item :key="i.id" v-for="i in items" @click="change(i.id)">
|
||||
<template slot="title">
|
||||
<div class="title">{{ i.name }}</div>
|
||||
</template>
|
||||
|
@ -23,8 +23,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {hasRoles} from "@/common/js/utils";
|
||||
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
|
||||
import {getCurrentUser, hasRoles} from "@/common/js/utils";
|
||||
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
|
||||
|
||||
export default {
|
||||
name: "SearchList",
|
||||
|
@ -32,13 +32,18 @@ export default {
|
|||
options: Object
|
||||
},
|
||||
mounted() {
|
||||
console.log('mounted')
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
console.log('beforeDestroy')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
items: [],
|
||||
search_text: ''
|
||||
search_text: '',
|
||||
userId: getCurrentUser().id,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -51,18 +56,18 @@ export default {
|
|||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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: {
|
||||
|
@ -80,6 +85,13 @@ export default {
|
|||
this.items = response.data;
|
||||
})
|
||||
}
|
||||
},
|
||||
change(projectId) {
|
||||
// todo 初始化的时候切换默认项目
|
||||
this.$post("/user/update/current", {id: this.userId, lastProjectId: projectId}, () => {
|
||||
localStorage.setItem(PROJECT_ID, projectId);
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-menu-item :index="this.index">
|
||||
<el-menu-item :index="this.index" @click="changeRoute">
|
||||
<font-awesome-icon :icon="['fa', 'list-ul']"/>
|
||||
<span>{{ $t('commons.show_all') }}</span>
|
||||
</el-menu-item>
|
||||
|
@ -10,6 +10,14 @@ 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>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8
|
||||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
|
@ -10,6 +10,7 @@ export const ROLE_TEST_VIEWER = 'test_viewer';
|
|||
|
||||
export const WORKSPACE_ID = 'workspace_id';
|
||||
export const CURRENT_PROJECT = 'current_project';
|
||||
export const PROJECT_ID = 'project_id';
|
||||
|
||||
export const REFRESH_SESSION_USER_URL = 'user/refresh';
|
||||
export const WORKSPACE = 'workspace';
|
||||
|
|
|
@ -279,7 +279,7 @@ export default {
|
|||
verified: '验证通过'
|
||||
}
|
||||
},
|
||||
edit: {
|
||||
project: {
|
||||
recent: '最近的项目',
|
||||
create: '创建项目',
|
||||
edit: '编辑项目',
|
||||
|
|
Loading…
Reference in New Issue