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