lushihan 5 months ago
parent
commit
cd1690fb28
  1. 34
      hx-ai-intelligent/src/config/app.config.ts
  2. 4
      hx-ai-intelligent/src/router/equipmentManage.ts
  3. 2
      lib/saas/view/system/login.vue

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

@ -1,21 +1,20 @@
import { userInfo, userResource } from './../../../hx-op/src/api/user';
import { http } from '/nerv-lib/saas';
import { permission } from '/@/api/origanizemanage';
import { appConfigStore } from '/nerv-lib/saas/store/modules/app-config';
import { authorizationService } from '/nerv-base/store/modules/authorization-service';
import { isEmpty } from 'lodash-es';
import { get } from 'lodash-es';
import { computed, ref, toRef } from 'vue';
// const { permissionVos } = sessionStorage.getItem('userInfo');
// ? JSON.parse(sessionStorage.getItem('userInfo')!)
// : [{}];
// const value = ref(linkList[0]?.orgId);
const ORGID = sessionStorage.getItem('ORGID') ? Number(sessionStorage.getItem('ORGID')) : '';
const selectDefaultValue = ref(ORGID);
const transform = (data, map) => {
return Object.keys(map).reduce((pre, cur) => {
pre[cur] = data[map[cur]];
return pre;
}, {});
};
export const appConfig = {
projectType: 'web',
baseApi: '/api',
@ -57,15 +56,17 @@ export const appConfig = {
componentProps: {
style: { width: '200px' },
api: '/carbon-smart/user/login/logInInfo',
defaultValue: selectDefaultValue,
// autoSelectFirst: true,
placeholder: '请选择',
autoSelectFirst: true,
onChange: async (cur, record) => {
onSelect: async (cur, record) => {
console.log(cur, record);
const configStore = appConfigStore();
const useAuthorization = authorizationService();
const res = await configStore.userResource(record);
sessionStorage.setItem('ORGID', record.orgId);
const res = await configStore.userResource({ data: record });
useAuthorization.updateUserResource(res.data);
// value.value = cur;
},
resultField: 'data.linkList',
@ -80,13 +81,15 @@ export const appConfig = {
return http.post('/carbon-smart/user/login', { ...params });
},
userResourceApi: (params) => {
console.log(params, 'userResource');
const { orgId } = get(params, 'data') || { orgId: '' };
const finalId = orgId || ORGID;
// 解决初始化登录select无初始值的问题
selectDefaultValue.value = finalId;
const userInfo = JSON.parse(sessionStorage.getItem('userInfo')!);
const ownOrgInfo = userInfo.linkList?.filter(({ isOwn }) => isOwn)[0];
return http
.post('/carbon-smart/user/login/logInPermission', !isEmpty(params) ? params : ownOrgInfo)
.then((res) => {
const ownOrgInfo = userInfo.linkList?.filter(({ orgId: id }) => id === finalId)[0];
return http.post('/carbon-smart/user/login/logInPermission', ownOrgInfo).then((res) => {
return res;
});
},
@ -103,6 +106,7 @@ export const appConfig = {
linkList: 'linkList',
permissionVos: 'permissionVos',
});
sessionStorage.setItem('ORGID', info.orgId);
return { data: { ...trD } };
});
},

4
hx-ai-intelligent/src/router/equipmentManage.ts

@ -15,8 +15,8 @@ const equipment = {
{
path: 'index',
name: 'LedgerIndex',
component: () => import('/nerv-lib/saas/view/menuManage/index.vue'),
// component: () => import('/@/view/equipmentManage/ledger/index.vue'),
// component: () => import('/nerv-lib/saas/view/menuManage/index.vue'),
component: () => import('/@/view/equipmentManage/ledger/index.vue'),
meta: {
title: '设备台账',
keepAlive: true,

2
lib/saas/view/system/login.vue

@ -104,7 +104,7 @@
: '';
loading.value = false;
if (configStore.enablePermissions) {
const res = await configStore.userResource();
const res = await configStore.userResource(info);
if (configStore.customApplication) {
await useAuthorization.initMenuResource();

Loading…
Cancel
Save