feat:tenantList

pull/1491/head
吹泡泡的团子 2 years ago
parent 55a0161119
commit ddc8f14f59

@ -87,7 +87,7 @@
tenantInfo(newVal) { tenantInfo(newVal) {
this.tenant.tenantId = newVal.tenantId this.tenant.tenantId = newVal.tenantId
this.tenant.resource = newVal.resource this.tenant.resource = newVal.resource
console.log("ischangLang", newVal) console.log("ischangLang", newVal, this.tenantList)
} }
}, },
methods: { methods: {
@ -106,6 +106,7 @@
.getCurrentUser(userName) .getCurrentUser(userName)
.then((response) => { .then((response) => {
const { resources } = response; const { resources } = response;
console.log("isTenList1", resources, this.tenantList)
if (response.role == 'ROLE_ADMIN') { if (response.role == 'ROLE_ADMIN') {
resources.unshift({ resources.unshift({
action: "rw", action: "rw",
@ -115,15 +116,22 @@
index: 0, index: 0,
}) })
} }
const resourcesRes = resources.map((item, index) => ({ console.log("isTenList1111111", this.$t('common.allTenant'), resources, this.tenantList)
const resourcesRes = resources.map((item, index) => {
let query = {
...item, ...item,
tenantId: item.resource, tenantId: item.resource,
index: index, index: index,
})) }
console.log("=============", index, query, item)
return query
})
console.log("isTenList22222", resourcesRes, this.tenantList)
this.$store.dispatch('tenant/setTenantList', resourcesRes) this.$store.dispatch('tenant/setTenantList', resourcesRes)
this.tenant = JSON.parse(this.$cookie.get('tenantInfo')) || resourcesRes[0] this.tenant = JSON.parse(this.$cookie.get('tenantInfo')) || resourcesRes[0]
this.$store.dispatch('tenant/setTenantInfo', this.tenant || resourcesRes[0]) this.$store.dispatch('tenant/setTenantInfo', this.tenant || resourcesRes[0])
this.$cookie.set('tenantInfo', JSON.stringify(this.tenant)); this.$cookie.set('tenantInfo', JSON.stringify(this.tenant));
console.log("isTenList2", this.tenantList)
}) })
.catch(() => {}); .catch(() => {});

@ -584,6 +584,9 @@ export default {
created() { created() {
// this.fetchData() // this.fetchData()
// //
this.listQuery.tenantId = this?.tenantInfo?.tenantId || this.listQuery.tenantId
let isAllTenant = this.listQuery.tenantId == i18nConfig.messages.zh.common.allTenant || this.listQuery.tenantId == i18nConfig.messages.en.common.allTenant
this.listQuery.tenantId = isAllTenant ? '' : this.listQuery.tenantId
this.tenantSelectList(); this.tenantSelectList();
}, },
methods: { methods: {
@ -819,6 +822,7 @@ export default {
this.itemOptions = []; this.itemOptions = [];
this.threadPoolOptions = []; this.threadPoolOptions = [];
const tenantId = { tenantId: this.listQuery.tenantId, size: this.size }; const tenantId = { tenantId: this.listQuery.tenantId, size: this.size };
console.log("XXXXXXXXXXXXXXX", tenantId)
itemApi itemApi
.list(tenantId) .list(tenantId)
.then((response) => { .then((response) => {

Loading…
Cancel
Save