refactor(系统设置): 优化查询项目开启模块的访问方式
This commit is contained in:
parent
22465364ef
commit
2358145a3c
|
@ -79,6 +79,12 @@ export default {
|
|||
sessionStorage.setItem("workspace_name", this.currentWorkspaceName);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getWorkspaceModules("workspace",getCurrentWorkspaceId())
|
||||
.then(res => {
|
||||
sessionStorage.setItem('workspace_modules', JSON.stringify(res.data));
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initMenuData() {
|
||||
getUserWorkspaceList()
|
||||
|
@ -90,10 +96,6 @@ export default {
|
|||
this.currentWorkspaceName = workspace[0].name;
|
||||
this.workspaceList = response.data.filter(r => r.id !== this.workspaceId);
|
||||
this.workspaceList.unshift(workspace[0]);
|
||||
getWorkspaceModules("workspace",workspace[0].id)
|
||||
.then(res => {
|
||||
sessionStorage.setItem('workspace_modules', JSON.stringify(res.data));
|
||||
});
|
||||
} else {
|
||||
// 工作空间不存在, 切换到查询的第一个
|
||||
this.currentWorkspaceName = response.data[0].name;
|
||||
|
@ -155,10 +157,6 @@ export default {
|
|||
})
|
||||
.catch(err => err);
|
||||
});
|
||||
getWorkspaceModules("workspace",response.data[0].id)
|
||||
.then(res => {
|
||||
sessionStorage.setItem('workspace_modules', JSON.stringify(res.data));
|
||||
});
|
||||
}
|
||||
},
|
||||
query(queryString) {
|
||||
|
|
|
@ -46,6 +46,13 @@ export default {
|
|||
inject: [
|
||||
'reload',
|
||||
],
|
||||
mounted() {
|
||||
getProjectModules("project", getCurrentProjectID())
|
||||
.then(res => {
|
||||
let modules = res.data;
|
||||
sessionStorage.setItem('project_modules', JSON.stringify(modules));
|
||||
});
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
|
@ -89,11 +96,6 @@ export default {
|
|||
this.change(this.items[0].id);
|
||||
}
|
||||
}
|
||||
getProjectModules("project", projectId)
|
||||
.then(res => {
|
||||
let modules = res.data;
|
||||
sessionStorage.setItem('project_modules', JSON.stringify(modules));
|
||||
});
|
||||
this.changeProjectName(projectId);
|
||||
});
|
||||
},
|
||||
|
@ -233,11 +235,6 @@ export default {
|
|||
.catch(() => {
|
||||
stopFullScreenLoading(loading);
|
||||
});
|
||||
getProjectModules("project", projectId)
|
||||
.then(res => {
|
||||
let modules = res.data;
|
||||
sessionStorage.setItem('project_modules', JSON.stringify(modules));
|
||||
});
|
||||
},
|
||||
changeProjectName(projectId) {
|
||||
if (projectId) {
|
||||
|
|
|
@ -120,6 +120,9 @@ export default {
|
|||
mounted() {
|
||||
if (this.$route.matched.length > 0) {
|
||||
this.activeIndex = this.$route.matched[0].path;
|
||||
if (!this.check(this.$route.matched[0].name.toLowerCase())) {
|
||||
window.location.href = "/#/";
|
||||
}
|
||||
}
|
||||
this.registerEvents();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue