字典存入缓存

This commit is contained in:
孙景学
2025-07-23 16:49:35 +08:00
parent 3ce3ab0036
commit 1bd423b66a
4 changed files with 19 additions and 5 deletions

View File

@ -3,7 +3,7 @@ import { Form, Input, Button, Checkbox, Tabs, message } from 'antd';
import { UserOutlined, LockOutlined, EyeInvisibleOutlined, EyeTwoTone } from '@ant-design/icons';
import { history, useIntl } from 'umi';
import './login.less';
import { getCaptcha, supplierLogin, expertLogin, accountLogin, getUserinfo } from '@/servers/api/login';
import { getCaptcha, supplierLogin, expertLogin, accountLogin, getUserinfo, refreshDictCache } from '@/servers/api/login';
import { encryptWithRsa } from '@/utils/encryptWithRsa'
@ -80,6 +80,12 @@ const LoginPage: React.FC = () => {
}
sessionStorage.setItem('currentUser', JSON.stringify(loginRes.data));
refreshDictCache().then((res) => {
if(res.code == 200) {
sessionStorage.setItem('dict', JSON.stringify(res.data))
}
})
getUserinfo().then(async (res) => {
// if(res.code == 200) {
const roleIdList = res.authorityList.map((item: any) => {

View File

@ -178,7 +178,7 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
name: values.name,
termOfValidity: values.termOfValidity.format('YYYY-MM-DD'),
approveType: values.approveType,
applyDeptId: values.applyDeptId,
deptId: values.deptId,
area: values.area,
categoryIds: allCheckedKeys.map(id => ({ id, lockType: 0 })),
} as libraryData
@ -242,10 +242,10 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
</Form.Item>
<Form.Item
label="负责部门"
name="applyDeptId"
name="deptId"
rules={[{ required: true, message: '请选择品类库负责人' }]}
>
<AccessDepartmentSelect style={{ width: '100%' }} />
<AccessDepartmentSelect orgCategory='' style={{ width: '100%' }} />
</Form.Item>
<Form.Item
label="选择品类"

View File

@ -6,7 +6,7 @@ import request from '@/utils/request';
*/
export interface libraryData {
applyDeptId: number;
deptId: number;
approveType: string;
area: string;
categoryIds: CategoryId[];

View File

@ -45,6 +45,14 @@ export async function getUserinfo() {
method: 'GET'
});
}
/**
* 字典缓存接口
*/
export async function refreshDictCache() {
return request('/v1/dictProject/refreshDictCache', {
method: 'GET'
});
}
/**
* 退出