|
|
@ -1,9 +1,9 @@ |
|
|
|
/** @format */ |
|
|
|
import { dateUtil } from '/nerv-lib/util/date-util'; |
|
|
|
import mockResource from './resource.json'; |
|
|
|
import { userInfo, userResource } from './../../../hx-op/src/api/user'; |
|
|
|
import { http } from '/nerv-lib/saas'; |
|
|
|
import { ref } from 'vue'; |
|
|
|
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'; |
|
|
|
|
|
|
|
// const { permissionVos } = sessionStorage.getItem('userInfo');
|
|
|
|
// ? JSON.parse(sessionStorage.getItem('userInfo')!)
|
|
|
@ -59,7 +59,13 @@ export const appConfig = { |
|
|
|
api: '/carbon-smart/user/login/logInInfo', |
|
|
|
placeholder: '请选择', |
|
|
|
autoSelectFirst: true, |
|
|
|
onChange: (cur) => { |
|
|
|
onChange: async (cur, record) => { |
|
|
|
console.log(cur, record); |
|
|
|
const configStore = appConfigStore(); |
|
|
|
const useAuthorization = authorizationService(); |
|
|
|
|
|
|
|
const res = await configStore.userResource(record); |
|
|
|
useAuthorization.updateUserResource(res.data); |
|
|
|
// value.value = cur;
|
|
|
|
}, |
|
|
|
resultField: 'data.linkList', |
|
|
@ -73,18 +79,24 @@ export const appConfig = { |
|
|
|
userLoginApi: (params) => { |
|
|
|
return http.post('/carbon-smart/user/login', { ...params }); |
|
|
|
}, |
|
|
|
userResourceApi: () => { |
|
|
|
return http.post('/carbon-smart/user/login/logInInfo').then((res) => { |
|
|
|
return { data: res.data.permissionVos }; |
|
|
|
}); |
|
|
|
userResourceApi: (params) => { |
|
|
|
console.log(params, 'userResource'); |
|
|
|
|
|
|
|
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) => { |
|
|
|
return res; |
|
|
|
}); |
|
|
|
}, |
|
|
|
userInfoApi: () => { |
|
|
|
return http.post('/carbon-smart/user/login/logInInfo').then((res) => { |
|
|
|
const info = res.data; |
|
|
|
const trD = transform(info, { |
|
|
|
accountCode: 'userId', |
|
|
|
accountName: 'realName', |
|
|
|
accountRealName: 'realName', |
|
|
|
accountName: 'accountNo', |
|
|
|
accountRealName: 'accountNo', |
|
|
|
orgId: 'orgId', |
|
|
|
orgName: 'orgName', |
|
|
|
projectId: 'projectId', |
|
|
|