diff --git a/threadpool/console/src/App.vue b/threadpool/console/src/App.vue index 0816b2f5..7e145d79 100755 --- a/threadpool/console/src/App.vue +++ b/threadpool/console/src/App.vue @@ -5,7 +5,33 @@ diff --git a/threadpool/console/src/layout/components/Navbar.vue b/threadpool/console/src/layout/components/Navbar.vue index 57cbb912..06cfb243 100755 --- a/threadpool/console/src/layout/components/Navbar.vue +++ b/threadpool/console/src/layout/components/Navbar.vue @@ -16,8 +16,16 @@ - + + + + +
@@ -41,13 +49,24 @@ @@ -113,6 +171,17 @@ outline: none; } + ::v-deep .el-input__inner { + border: none; + box-shadow: none; + } + + .select-tenant { + margin-right: 20px; + border: 0; + width: 150px; + } + .right-menu-item { display: inline-block; padding: 0 8px; diff --git a/threadpool/console/src/store/getters.js b/threadpool/console/src/store/getters.js index 8fcf5a59..3521a8fc 100755 --- a/threadpool/console/src/store/getters.js +++ b/threadpool/console/src/store/getters.js @@ -10,6 +10,8 @@ const getters = { introduction: state => state.user.introduction, roles: state => state.user.roles, permission_routes: state => state.permission.routes, - errorLogs: state => state.errorLog.logs + errorLogs: state => state.errorLog.logs, + tenantList: state => state.tenant.tenantList, + tenantInfo: state => state.tenant.tenantInfo, } export default getters diff --git a/threadpool/console/src/store/modules/tenant.js b/threadpool/console/src/store/modules/tenant.js new file mode 100644 index 00000000..574645f2 --- /dev/null +++ b/threadpool/console/src/store/modules/tenant.js @@ -0,0 +1,53 @@ +import * as user from '@/api/hippo4j-user'; + +const state = { + tenantList: [], + tenantInfo: {} +} + +const mutations = { + SET_TENANT_LIST: (state, log) => { + state.tenantList = log; + console.log("sssssss", state.tenantList) + }, + SET_GLOBAL_TENANT: (state, log) => { + state.tenantInfo = log; + } +} + +const actions = { + async getTenantList({commit}) { + debugger + const userName = this.$cookie.get('userName'); + user + .getCurrentUser(userName) + .then((response) => { + const { resources } = response; + if (response.role == 'ROLE_ADMIN') { + resources.unshift({ + action: "rw", + resource: "所有租户", + username: userName + }) + } + commit('SET_TENANT_LIST', resources) + if (!state.tenantInfo) { + commit('SET_GLOBAL_TENANT', resources[0]) + } + }) + .catch(() => {}); + }, + setTenantList({commit}, log) { + commit('SET_TENANT_LIST', log) + }, + setTenantInfo({commit}, log) { + commit('SET_GLOBAL_TENANT', log) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/threadpool/console/src/views/hippo4j/tenant/index.vue b/threadpool/console/src/views/hippo4j/tenant/index.vue index 4f646623..c20c382a 100755 --- a/threadpool/console/src/views/hippo4j/tenant/index.vue +++ b/threadpool/console/src/views/hippo4j/tenant/index.vue @@ -1,36 +1,9 @@