You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.8 KiB
116 lines
3.8 KiB
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 { get } from 'lodash-es';
|
|
import { computed, ref, toRef } from 'vue';
|
|
|
|
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',
|
|
projectName: '济阳站_AI智能BAS系统',
|
|
enablePermissions: false,
|
|
// themeColor: '#eee',
|
|
siderPosition: 'left',
|
|
baseHeader: '/parkingManage',
|
|
baseRouter: '/parkingManage/parkingLotManage',
|
|
themeConfig: {
|
|
bgImageUrl: `${import.meta.env.VITE_PUBLIC_PATH}/asset/image/login/background.png`,
|
|
logoLessUrl: `${import.meta.env.VITE_PUBLIC_PATH}/asset/image/headerIcon.png`,
|
|
logoUrl: `${import.meta.env.VITE_PUBLIC_PATH}/asset/image/headerIcon.png`,
|
|
},
|
|
// userCustomRouterGuard: (to, from, next, whiteNameList, authorizationStore, appConfig) => {
|
|
// console.log({ to, from, next, whiteNameList, authorizationStore, appConfig }, 'routeConfig');
|
|
// next();
|
|
// },
|
|
|
|
// customUpdatePwd: () => import('/@/view/updatePassword/updatePassword.vue'),
|
|
|
|
headerSlotConfig: {
|
|
component: 'NsSelectApi',
|
|
componentProps: {
|
|
style: { width: '200px', color: '#2778FF', marginRight: '10px' },
|
|
api: '/carbon-smart/user/login/logInInfo',
|
|
size: 'large',
|
|
defaultValue: selectDefaultValue,
|
|
// autoSelectFirst: true,
|
|
placeholder: '请选择',
|
|
onSelect: async (cur, record) => {
|
|
console.log(cur, record);
|
|
const configStore = appConfigStore();
|
|
const useAuthorization = authorizationService();
|
|
sessionStorage.setItem('ORGID', record.orgId);
|
|
const res = await configStore.userResource({ data: record });
|
|
useAuthorization.updateUserResource(res.data);
|
|
|
|
// value.value = cur;
|
|
},
|
|
resultField: 'data.linkList',
|
|
labelField: 'orgName',
|
|
valueField: 'orgId',
|
|
immediate: true,
|
|
dropdownReload: true,
|
|
},
|
|
},
|
|
timeout: 60 * 1000,
|
|
userLoginApi: (params) => {
|
|
return http.post('/carbon-smart/user/login', { ...params });
|
|
},
|
|
userResourceApi: (params) => {
|
|
const { orgId } = get(params, 'data') || { orgId: '' };
|
|
const finalId = orgId || ORGID;
|
|
// 解决初始化登录select无初始值的问题
|
|
selectDefaultValue.value = finalId;
|
|
|
|
const userInfo = JSON.parse(sessionStorage.getItem(import.meta.env.VITE_PUBLIC_PATH)!);
|
|
const ownOrgInfo = userInfo.linkList?.filter(({ orgId: id }) => id === finalId)[0];
|
|
|
|
return http.post('/carbon-smart/user/login/logInPermission', ownOrgInfo).then((res) => {
|
|
return res;
|
|
});
|
|
},
|
|
userInfoApi: () => {
|
|
return http.post('/carbon-smart/user/login/logInInfo').then((res) => {
|
|
const info = res.data;
|
|
const trD = transform(info, {
|
|
accountCode: 'userId',
|
|
accountName: 'accountNo',
|
|
accountRealName: 'accountNo',
|
|
orgId: 'orgId',
|
|
orgName: 'orgName',
|
|
projectId: 'projectId',
|
|
linkList: 'linkList',
|
|
permissionVos: 'permissionVos',
|
|
});
|
|
sessionStorage.setItem('ORGID', info.orgId);
|
|
selectDefaultValue.value = info.orgId;
|
|
return { data: { ...trD } };
|
|
});
|
|
},
|
|
|
|
useHistoryTag: false,
|
|
// 修改密码配置
|
|
updatePassWordInfo: {
|
|
title: '修改密码',
|
|
subtitle: 'huaxing平台',
|
|
api: '/carbon-smart/api/user/password',
|
|
},
|
|
// headerBellInfo: {
|
|
// isShow: true,
|
|
// api: '/api/web/objs/bulletin/readCount',
|
|
// toRouterName: 'NoticeManageIndex',
|
|
// },
|
|
resourceInfo: {
|
|
api: permission.add,
|
|
},
|
|
};
|
|
|