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

Loading…
Cancel
Save