refactor(系统设置): 优化查询项目开启模块的访问方式

This commit is contained in:
wxg0103 2023-10-10 16:30:21 +08:00 committed by wxg0103
parent 22465364ef
commit 2358145a3c
3 changed files with 16 additions and 18 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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();
},