Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
1307b4d854
|
@ -12,7 +12,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else style="height: 120px;overflow: auto">
|
<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">
|
<template slot="title">
|
||||||
<div class="title">{{ i.name }}</div>
|
<div class="title">{{ i.name }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {hasRoles} from "@/common/js/utils";
|
import {getCurrentUser, hasRoles} from "@/common/js/utils";
|
||||||
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
|
import {PROJECT_ID, ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "@/common/js/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SearchList",
|
name: "SearchList",
|
||||||
|
@ -32,13 +32,18 @@ export default {
|
||||||
options: Object
|
options: Object
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
console.log('mounted')
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
console.log('beforeDestroy')
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
items: [],
|
items: [],
|
||||||
search_text: ''
|
search_text: '',
|
||||||
|
userId: getCurrentUser().id,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -51,18 +56,18 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
getIndex: function () {
|
// getIndex: function () {
|
||||||
return function (item) {
|
// return function (item) {
|
||||||
return this.options.index(item);
|
// return this.options.index(item);
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
getRouter: function () {
|
// getRouter: function () {
|
||||||
return function (item) {
|
// return function (item) {
|
||||||
if (this.options.router) {
|
// if (this.options.router) {
|
||||||
return this.options.router(item);
|
// return this.options.router(item);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -80,6 +85,13 @@ export default {
|
||||||
this.items = response.data;
|
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>
|
<template>
|
||||||
<el-menu-item :index="this.index">
|
<el-menu-item :index="this.index" @click="changeRoute">
|
||||||
<font-awesome-icon :icon="['fa', 'list-ul']"/>
|
<font-awesome-icon :icon="['fa', 'list-ul']"/>
|
||||||
<span>{{ $t('commons.show_all') }}</span>
|
<span>{{ $t('commons.show_all') }}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
@ -10,6 +10,14 @@ export default {
|
||||||
name: "MsShowAll",
|
name: "MsShowAll",
|
||||||
props: {
|
props: {
|
||||||
index: String
|
index: String
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeRoute() {
|
||||||
|
// 解决在列表页面点击 显示全部 无效的问题(点击显示全部后改变路由)
|
||||||
|
if (this.$route.path === this.index) {
|
||||||
|
this.$router.replace({path: this.index, query: {type: 'all'}});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</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 WORKSPACE_ID = 'workspace_id';
|
||||||
export const CURRENT_PROJECT = 'current_project';
|
export const CURRENT_PROJECT = 'current_project';
|
||||||
|
export const PROJECT_ID = 'project_id';
|
||||||
|
|
||||||
export const REFRESH_SESSION_USER_URL = 'user/refresh';
|
export const REFRESH_SESSION_USER_URL = 'user/refresh';
|
||||||
export const WORKSPACE = 'workspace';
|
export const WORKSPACE = 'workspace';
|
||||||
|
|
|
@ -279,7 +279,7 @@ export default {
|
||||||
verified: '验证通过'
|
verified: '验证通过'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
edit: {
|
project: {
|
||||||
recent: '最近的项目',
|
recent: '最近的项目',
|
||||||
create: '创建项目',
|
create: '创建项目',
|
||||||
edit: '编辑项目',
|
edit: '编辑项目',
|
||||||
|
|
Loading…
Reference in New Issue