Browse Source

fix: 管理员禁用切换组织

deploy-dev
xuziqiang 4 months ago
parent
commit
1e4a3d61da
  1. 9
      hx-ai-intelligent/src/config/app.config.ts

9
hx-ai-intelligent/src/config/app.config.ts

@ -6,8 +6,11 @@ import { get } from 'lodash-es';
import { computed, ref, toRef } from 'vue';
const ORGID = sessionStorage.getItem('ORGID') ? Number(sessionStorage.getItem('ORGID')) : '';
const isAdmin = sessionStorage.getItem('ISADMIN')
? Boolean(sessionStorage.getItem('ISADMIN'))
: false;
const selectDefaultValue = ref(ORGID);
const selectDefaultDisabled = ref(isAdmin);
const transform = (data, map) => {
return Object.keys(map).reduce((pre, cur) => {
pre[cur] = data[map[cur]];
@ -43,6 +46,7 @@ export const appConfig = {
api: '/carbon-smart/user/login/logInInfo',
size: 'large',
defaultValue: selectDefaultValue,
disabled: selectDefaultDisabled,
// autoSelectFirst: true,
placeholder: '请选择',
onSelect: async (cur, record) => {
@ -91,8 +95,11 @@ export const appConfig = {
projectId: 'projectId',
linkList: 'linkList',
permissionVos: 'permissionVos',
adminFlag: 'adminFlag',
});
sessionStorage.setItem('ORGID', info.orgId);
sessionStorage.setItem('ISADMIN', trD?.adminFlag === '1');
selectDefaultDisabled.value = info?.adminFlag === '1';
selectDefaultValue.value = info.orgId;
return { data: { ...trD } };
});

Loading…
Cancel
Save