diff --git a/threadpool/console/src/App.vue b/threadpool/console/src/App.vue index 7e145d79..d25307a0 100755 --- a/threadpool/console/src/App.vue +++ b/threadpool/console/src/App.vue @@ -18,11 +18,16 @@ export default { .getCurrentUser(userName) .then((response) => { const { resources } = response; + resources.map((item) => ({ + ...item, + tenantId: item.resource + })) if (response.role == 'ROLE_ADMIN') { resources.unshift({ action: "rw", - resource: "所有租户", - username: userName + resource: this.$t('common.allTenant'), + username: userName, + tenantId: this.$t('common.allTenant'), }) } this.$store.dispatch('tenant/setTenantList', resources) diff --git a/threadpool/console/src/layout/components/Navbar.vue b/threadpool/console/src/layout/components/Navbar.vue index 06cfb243..086375bd 100755 --- a/threadpool/console/src/layout/components/Navbar.vue +++ b/threadpool/console/src/layout/components/Navbar.vue @@ -56,6 +56,7 @@ import Hamburger from '@/components/Hamburger' import ErrorLog from '@/components/ErrorLog' import langChange from '@/locale/langChange' + import { i18nConfig } from '@/locale/config' export default { data() { @@ -82,6 +83,13 @@ 'tenantInfo' ]) }, + watch: { + tenantInfo(newVal) { + this.tenant.tenantId = newVal.tenantId + this.tenant.resource = newVal.resource + console.log("ischangLang", newVal) + } + }, methods: { toggleSideBar() { this.$store.dispatch('app/toggleSideBar') @@ -97,29 +105,38 @@ .getCurrentUser(userName) .then((response) => { const { resources } = response; + resources.map((item) => ({ + ...item, + tenantId: item.resource + })) if (response.role == 'ROLE_ADMIN') { resources.unshift({ action: "rw", - resource: "所有租户", - username: userName + resource: this.$t('common.allTenant'), + username: userName, + tenantId: this.$t('common.allTenant'), }) } this.$store.dispatch('tenant/setTenantList', resources) this.$store.dispatch('tenant/setTenantInfo', this.tenantInfo || resources[0]) this.tenant = this.tenantInfo || resources[0] + console.log("isResour", resources[0], this.tenant) }) .catch(() => {}); }, async changeTenant(index) { + console.log("isTenList", this.tenantList) let tenant = { tenantId: this.tenantList[index].resource, + resource: this.tenantList[index].resource, current: 1, desc: true, size: 10, } this.$store.dispatch('tenant/setTenantInfo', tenant) - tenant.tenantId = tenant.tenantId == '所有租户' ? '' : tenant.tenantId + let isAllTenant = tenant.tenantId == i18nConfig.messages.zh.common.allTenant || tenant.tenantId == i18nConfig.messages.en.common.allTenant + tenant.tenantId = isAllTenant ? '' : tenant.tenantId await jobProjectApi.list(tenant).then((response) => { console.log("isRes", response) // this.$store.dispatch('tenant/setTenantList', resources) diff --git a/threadpool/console/src/locale/lang/en.js b/threadpool/console/src/locale/lang/en.js index e9cce7f1..0cce96bc 100644 --- a/threadpool/console/src/locale/lang/en.js +++ b/threadpool/console/src/locale/lang/en.js @@ -51,6 +51,7 @@ export default { audit: 'Audit', yes: 'Yes', no: 'No', + allTenant: 'ALL TENANT' }, // 运行报表 diff --git a/threadpool/console/src/locale/lang/zh.js b/threadpool/console/src/locale/lang/zh.js index c1e419b9..1cc9dc6c 100644 --- a/threadpool/console/src/locale/lang/zh.js +++ b/threadpool/console/src/locale/lang/zh.js @@ -49,6 +49,7 @@ export default { audit: '审核', yes: '是', no: '否', + allTenant: '所有租户' }, // 运行报表 diff --git a/threadpool/console/src/locale/langChange.vue b/threadpool/console/src/locale/langChange.vue index c14dbe3c..34c50251 100644 --- a/threadpool/console/src/locale/langChange.vue +++ b/threadpool/console/src/locale/langChange.vue @@ -18,7 +18,9 @@