fix: 切换租户从缓存获取

This commit is contained in:
dap 2024-08-08 15:14:10 +08:00
parent 66100d44b2
commit 68f6937b5b
3 changed files with 8 additions and 95 deletions

View File

@ -12,6 +12,7 @@ import { message, Select } from 'ant-design-vue';
import { storeToRefs } from 'pinia';
import { tenantDynamicClear, tenantDynamicToggle } from '#/api/system/tenant';
import { useDictStore } from '#/store/dict';
import { useTenantStore } from '#/store/tenant';
const { hasAccessByRoles } = useAccess();
@ -48,6 +49,7 @@ function close(checked: boolean) {
router.push(DEFAULT_HOME_PATH);
}
const dictStore = useDictStore();
/**
* 为什么要用any ide报错😅 实际类型为string
*/
@ -58,12 +60,14 @@ async function onSelected(tenantId: any, option: any) {
}
await tenantDynamicToggle(tenantId);
lastSelected.value = tenantId;
dictStore.resetCache();
message.success(`切换当前租户为: ${option.companyName}`);
close(true);
}
async function onDeselect() {
await tenantDynamicClear();
dictStore.resetCache();
message.success('还原为默认租户');
lastSelected.value = '';
close(false);

View File

@ -83,8 +83,7 @@ export const useDictStore = defineStore('app-dict', () => {
}
function $reset() {
dictMap.clear();
dictOptionsMap.clear();
resetCache();
}
return {

View File

@ -159,14 +159,10 @@ importers:
version: 10.11.0(vue@3.4.36(typescript@5.5.4))
ant-design-vue:
specifier: ^4.2.3
<<<<<<< HEAD
version: 4.2.3(vue@3.4.35(typescript@5.5.4))
version: 4.2.3(vue@3.4.36(typescript@5.5.4))
crypto-js:
specifier: ^4.2.0
version: 4.2.0
=======
version: 4.2.3(vue@3.4.36(typescript@5.5.4))
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
dayjs:
specifier: ^1.11.12
version: 1.11.12
@ -186,9 +182,8 @@ importers:
specifier: ^3.4.36
version: 3.4.36(typescript@5.5.4)
vue-router:
<<<<<<< HEAD
specifier: ^4.4.2
version: 4.4.2(vue@3.4.35(typescript@5.5.4))
specifier: ^4.4.3
version: 4.4.3(vue@3.4.36(typescript@5.5.4))
devDependencies:
'@types/crypto-js':
specifier: ^4.2.2
@ -196,10 +191,6 @@ importers:
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
=======
specifier: ^4.4.3
version: 4.4.3(vue@3.4.36(typescript@5.5.4))
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
apps/web-ele:
dependencies:
@ -3621,135 +3612,54 @@ packages:
cpu: [x64]
os: [darwin]
<<<<<<< HEAD
'@rollup/rollup-linux-arm-gnueabihf@4.19.2':
resolution: {integrity: sha512-r+SI2t8srMPYZeoa1w0o/AfoVt9akI1ihgazGYPQGRilVAkuzMGiTtexNZkrPkQsyFrvqq/ni8f3zOnHw4hUbA==}
cpu: [arm]
os: [linux]
libc: [glibc]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-arm-gnueabihf@4.20.0':
resolution: {integrity: sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==}
cpu: [arm]
os: [linux]
libc: [glibc]
<<<<<<< HEAD
'@rollup/rollup-linux-arm-musleabihf@4.19.2':
resolution: {integrity: sha512-+tYiL4QVjtI3KliKBGtUU7yhw0GMcJJuB9mLTCEauHEsqfk49gtUBXGtGP3h1LW8MbaTY6rSFIQV1XOBps1gBA==}
cpu: [arm]
os: [linux]
libc: [musl]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-arm-musleabihf@4.20.0':
resolution: {integrity: sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==}
cpu: [arm]
os: [linux]
libc: [musl]
<<<<<<< HEAD
'@rollup/rollup-linux-arm64-gnu@4.19.2':
resolution: {integrity: sha512-OR5DcvZiYN75mXDNQQxlQPTv4D+uNCUsmSCSY2FolLf9W5I4DSoJyg7z9Ea3TjKfhPSGgMJiey1aWvlWuBzMtg==}
cpu: [arm64]
os: [linux]
libc: [glibc]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-arm64-gnu@4.20.0':
resolution: {integrity: sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==}
cpu: [arm64]
os: [linux]
libc: [glibc]
<<<<<<< HEAD
'@rollup/rollup-linux-arm64-musl@4.19.2':
resolution: {integrity: sha512-Hw3jSfWdUSauEYFBSFIte6I8m6jOj+3vifLg8EU3lreWulAUpch4JBjDMtlKosrBzkr0kwKgL9iCfjA8L3geoA==}
cpu: [arm64]
os: [linux]
libc: [musl]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-arm64-musl@4.20.0':
resolution: {integrity: sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==}
cpu: [arm64]
os: [linux]
libc: [musl]
<<<<<<< HEAD
'@rollup/rollup-linux-powerpc64le-gnu@4.19.2':
resolution: {integrity: sha512-rhjvoPBhBwVnJRq/+hi2Q3EMiVF538/o9dBuj9TVLclo9DuONqt5xfWSaE6MYiFKpo/lFPJ/iSI72rYWw5Hc7w==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-powerpc64le-gnu@4.20.0':
resolution: {integrity: sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
<<<<<<< HEAD
'@rollup/rollup-linux-riscv64-gnu@4.19.2':
resolution: {integrity: sha512-EAz6vjPwHHs2qOCnpQkw4xs14XJq84I81sDRGPEjKPFVPBw7fwvtwhVjcZR6SLydCv8zNK8YGFblKWd/vRmP8g==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-riscv64-gnu@4.20.0':
resolution: {integrity: sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
<<<<<<< HEAD
'@rollup/rollup-linux-s390x-gnu@4.19.2':
resolution: {integrity: sha512-IJSUX1xb8k/zN9j2I7B5Re6B0NNJDJ1+soezjNojhT8DEVeDNptq2jgycCOpRhyGj0+xBn7Cq+PK7Q+nd2hxLA==}
cpu: [s390x]
os: [linux]
libc: [glibc]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-s390x-gnu@4.20.0':
resolution: {integrity: sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==}
cpu: [s390x]
os: [linux]
libc: [glibc]
<<<<<<< HEAD
'@rollup/rollup-linux-x64-gnu@4.19.2':
resolution: {integrity: sha512-OgaToJ8jSxTpgGkZSkwKE+JQGihdcaqnyHEFOSAU45utQ+yLruE1dkonB2SDI8t375wOKgNn8pQvaWY9kPzxDQ==}
cpu: [x64]
os: [linux]
libc: [glibc]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-x64-gnu@4.20.0':
resolution: {integrity: sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==}
cpu: [x64]
os: [linux]
libc: [glibc]
<<<<<<< HEAD
'@rollup/rollup-linux-x64-musl@4.19.2':
resolution: {integrity: sha512-5V3mPpWkB066XZZBgSd1lwozBk7tmOkKtquyCJ6T4LN3mzKENXyBwWNQn8d0Ci81hvlBw5RoFgleVpL6aScLYg==}
cpu: [x64]
os: [linux]
libc: [musl]
=======
>>>>>>> 8ffc853b86fc0342b2fef60976fe8b26d7d47758
'@rollup/rollup-linux-x64-musl@4.20.0':
resolution: {integrity: sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==}
cpu: [x64]