Commit c329c151 authored by krysent's avatar krysent

nihao

parent 394bf9ae
...@@ -15,6 +15,11 @@ export default [ ...@@ -15,6 +15,11 @@ export default [
path: '/setting/users', path: '/setting/users',
component: './setting/users', component: './setting/users',
}, },
{
name: '租户管理',
path: '/setting/tenants',
component: './setting/tenants',
},
{ {
name: '角色管理', name: '角色管理',
path: '/setting/role', path: '/setting/role',
......
...@@ -12,7 +12,7 @@ const Settings = { ...@@ -12,7 +12,7 @@ const Settings = {
logo: './LOGO.png', logo: './LOGO.png',
colorPrimary: '#1890ff', colorPrimary: '#1890ff',
siderMenuType: 'sub', siderMenuType: 'sub',
proxypath: '/emspro', proxypath: '/ems',
}; };
export default Settings; export default Settings;
...@@ -13,12 +13,16 @@ export default { ...@@ -13,12 +13,16 @@ export default {
dev: { dev: {
[defaultSetting.proxypath]: { [defaultSetting.proxypath]: {
// 要代理的地址 // 要代理的地址
target: 'http://192.168.40.64:28000', //jf哥 // target: 'http://192.168.40.64:28000', //jf哥
// target: 'http://192.168.40.248:8080', //jf哥 // target: 'http://192.168.40.248:8080', //jf哥
// target: 'http://192.168.40.64:28000', //gc哥 // target: 'http://192.168.40.64:28000', //gc哥
// target: 'http://192.168.40.203:8000', //dj哥 // target: 'http://192.168.40.203:8001', //dj哥
// target: 'http://192.168.40.35:8001', //测试 // target: 'http://192.168.40.35:8001', //测试
target: 'http://192.168.40.111:8001', //猛哥
changeOrigin: true, changeOrigin: true,
pathRewrite: {
'^/ems': '',
},
}, },
'/token': { '/token': {
// 要代理的地址 // 要代理的地址
......
public/LOGO.png

98.1 KB | W: | H:

public/LOGO.png

10 KB | W: | H:

public/LOGO.png
public/LOGO.png
public/LOGO.png
public/LOGO.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -32,7 +32,7 @@ export async function getInitialState() { ...@@ -32,7 +32,7 @@ export async function getInitialState() {
const msg = await queryCurrentUser(); const msg = await queryCurrentUser();
return msg.data; return msg.data;
} catch (error) { } catch (error) {
// history.push(loginPath); history.push(loginPath);
} }
return undefined; return undefined;
}; // 如果是登录页面,不执行 }; // 如果是登录页面,不执行
...@@ -42,6 +42,7 @@ export async function getInitialState() { ...@@ -42,6 +42,7 @@ export async function getInitialState() {
return res.data; return res.data;
} catch (error) { } catch (error) {
message.error(res.msg); message.error(res.msg);
history.push(loginPath);
} }
return undefined; return undefined;
}; // 如果是登录页面,不执行 }; // 如果是登录页面,不执行
...@@ -72,6 +73,7 @@ export async function getInitialState() { ...@@ -72,6 +73,7 @@ export async function getInitialState() {
// ProLayout 支持的api https://procomponents.ant.design/components/layout // ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout = ({ initialState, setInitialState }) => { export const layout = ({ initialState, setInitialState }) => {
console.log(initialState);
let token = localStorage.getItem('TOKENES'); let token = localStorage.getItem('TOKENES');
return { return {
disableContentMargin: false, disableContentMargin: false,
...@@ -85,7 +87,16 @@ export const layout = ({ initialState, setInitialState }) => { ...@@ -85,7 +87,16 @@ export const layout = ({ initialState, setInitialState }) => {
footerRender: () => <Footer />, footerRender: () => <Footer />,
onPageChange: async () => { onPageChange: async () => {
const { location } = history; const { location } = history;
let token = localStorage.getItem('TOKENES');
// 如果没有登录,重定向到 login // 如果没有登录,重定向到 login
if (location.pathname != '/user/login') {
if ((!initialState?.currentUser && location.pathname !== loginPath) || !token) {
setInitialState((s) => {
return { ...s, currentUser: undefined, newMenu: [] };
});
history.replace(loginPath);
}
}
if (!initialState?.currentUser && location.pathname !== loginPath) { if (!initialState?.currentUser && location.pathname !== loginPath) {
let userInfo = await initialState.fetchUserInfo(); let userInfo = await initialState.fetchUserInfo();
let menuData = await initialState.getmenuData(); let menuData = await initialState.getmenuData();
...@@ -153,6 +164,7 @@ export const layout = ({ initialState, setInitialState }) => { ...@@ -153,6 +164,7 @@ export const layout = ({ initialState, setInitialState }) => {
// 增加一个 loading 的状态 // 增加一个 loading 的状态
childrenRender: (children, props) => { childrenRender: (children, props) => {
// if (initialState?.loading) return <PageLoading />; // if (initialState?.loading) return <PageLoading />;
console.log(location.pathname);
return ( return (
<> <>
{initialState?.currentUser && location.pathname !== loginPath ? ( {initialState?.currentUser && location.pathname !== loginPath ? (
......
...@@ -1174,14 +1174,14 @@ function Slider({ item, colProps }) { ...@@ -1174,14 +1174,14 @@ function Slider({ item, colProps }) {
//uploadbtn //uploadbtn
function UploadBtn({ item, colProps }) { function UploadBtn({ item, colProps }) {
let token = `Bearer ${localStorage.getItem('TOKENES')}`; let token = `${localStorage.getItem('TOKENES')}`;
return ( return (
<> <>
<ProFormUploadButton <ProFormUploadButton
fieldProps={{ fieldProps={{
...item?.fieldProps, ...item?.fieldProps,
action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile', action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
headers: { Authorization: token }, headers: { token },
onPreview: (file) => { onPreview: (file) => {
let url = ''; let url = '';
if (file.response) { if (file.response) {
...@@ -1219,7 +1219,7 @@ function UploadBtn({ item, colProps }) { ...@@ -1219,7 +1219,7 @@ function UploadBtn({ item, colProps }) {
} }
function UploadImg({ value, onChange, fieldProps }) { function UploadImg({ value, onChange, fieldProps }) {
let token = `Bearer ${localStorage.getItem('TOKENES')}`; let token = `${localStorage.getItem('TOKENES')}`;
const [image, setImage] = useState({}); const [image, setImage] = useState({});
function beforeUpload(file) { function beforeUpload(file) {
const isJpgOrPng = const isJpgOrPng =
...@@ -1239,7 +1239,7 @@ function UploadImg({ value, onChange, fieldProps }) { ...@@ -1239,7 +1239,7 @@ function UploadImg({ value, onChange, fieldProps }) {
listType: 'picture-card', listType: 'picture-card',
beforeUpload: beforeUpload, beforeUpload: beforeUpload,
defaultFileList: value, defaultFileList: value,
headers: { Authorization: token }, headers: { token },
onChange(info) { onChange(info) {
let { let {
file: { name, status, response }, file: { name, status, response },
...@@ -1336,14 +1336,14 @@ function UploadImage({ item, colProps }) { ...@@ -1336,14 +1336,14 @@ function UploadImage({ item, colProps }) {
// uploadDragger // uploadDragger
function UploadDragger({ item, colProps }) { function UploadDragger({ item, colProps }) {
let token = `Bearer ${localStorage.getItem('TOKENES')}`; let token = `${localStorage.getItem('TOKENES')}`;
return ( return (
<> <>
<ProFormUploadDragger <ProFormUploadDragger
fieldProps={{ fieldProps={{
...item?.fieldProps, ...item?.fieldProps,
action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile', action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
headers: { Authorization: token }, headers: { token },
onPreview: (file) => { onPreview: (file) => {
let url = ''; let url = '';
if (file.response) { if (file.response) {
......
...@@ -18,18 +18,18 @@ import moment from 'moment'; ...@@ -18,18 +18,18 @@ import moment from 'moment';
* 退出登录,并且将当前的 url 保存 * 退出登录,并且将当前的 url 保存
*/ */
const loginOut = async () => { const loginOut = async () => {
const { logoutRedirectUrl } = await fakeAccountLoginOut(); const { code } = await fakeAccountLoginOut();
if (window.location.pathname !== '/user/login') { if (code === '0002') {
localStorage.clear(); localStorage.clear();
window.location.replace(logoutRedirectUrl); history.replace('/user/login');
} }
}; };
const AvatarDropdown = ({ menu }) => { const AvatarDropdown = ({ menu }) => {
const getUserApp = useRequest(async () => { // const getUserApp = useRequest(async () => {
let res = await doFetch({ url: '/auth/sysUser/userApp/selection', params: {} }); // let res = await doFetch({ url: '/auth/sysUser/userApp/selection', params: {} });
return res?.data || {}; // return res?.data || {};
}); // });
const { initialState, setInitialState } = useModel('@@initialState'); const { initialState, setInitialState } = useModel('@@initialState');
const [visible, cv] = useState(false), const [visible, cv] = useState(false),
[formRef] = Form.useForm(), [formRef] = Form.useForm(),
...@@ -191,14 +191,14 @@ const AvatarDropdown = ({ menu }) => { ...@@ -191,14 +191,14 @@ const AvatarDropdown = ({ menu }) => {
submitting={loading || !visible} submitting={loading || !visible}
/> />
</Modal> </Modal>
<Select {/* <Select
style={{ width: 150, marginRight: 8 }} style={{ width: 150, marginRight: 8 }}
value={ value={
getUserApp?.data?.dataList?.filter((it) => it?.appId == getUserApp?.data?.appId)[0]?.value getUserApp?.data?.dataList?.filter((it) => it?.appId == getUserApp?.data?.appId)[0]?.value
} }
options={getUserApp?.data?.dataList} options={getUserApp?.data?.dataList}
onChange={handleChange} onChange={handleChange}
/> /> */}
<HeaderDropdown overlay={menuHeaderDropdown}> <HeaderDropdown overlay={menuHeaderDropdown}>
<span className={`${styles.action} ${styles.account}`}> <span className={`${styles.action} ${styles.account}`}>
<Avatar style={{ backgroundColor: '#1890ff' }}> <Avatar style={{ backgroundColor: '#1890ff' }}>
......
...@@ -51,46 +51,52 @@ const Login = () => { ...@@ -51,46 +51,52 @@ const Login = () => {
const [visible, setvisible] = useState(false); const [visible, setvisible] = useState(false);
const [data, setdata] = useState(); const [data, setdata] = useState();
// const fetchUserInfo = async () => { const fetchUserInfo = async () => {
// const userInfo = await initialState?.fetchUserInfo(), const userInfo = await initialState?.fetchUserInfo(),
// menuData = await initialState?.getmenuData(); menuData = await initialState?.getmenuData();
// if (userInfo) { if (userInfo) {
// await setInitialState((s) => { await setInitialState((s) => {
// return { ...s, currentUser: userInfo?.data, newMenu: menuData }; return { ...s, currentUser: userInfo?.data, newMenu: menuData };
// }); });
// } }
// }; };
//登录 //登录
const handleLogin = async (values) => { const handleLogin = async (values) => {
// let timestamp = moment().valueOf().toString() + 'acb'; let timestamp = moment().valueOf().toString() + 'acb';
// let newtimestamp = AES.encrypt(timestamp, Utf8.parse('NANGAODEAESKEY--'), { let newtimestamp = AES.encrypt(timestamp, Utf8.parse('NANGAODEAESKEY--'), {
// mode: ECB, mode: ECB,
// padding: Pkcs7, padding: Pkcs7,
// }).toString(); }).toString();
// let password = AES.encrypt(values.password, Utf8.parse(timestamp), { let password = AES.encrypt(values.password, Utf8.parse(timestamp), {
// mode: ECB, mode: ECB,
// padding: Pkcs7, padding: Pkcs7,
// }).toString(); }).toString();
const postdata = { const postdata = {
accountName: values.userName, accountName: values.userName,
password: values.password, password: password,
encryptKey: newtimestamp,
}; };
try { try {
// history.push('/'); // history.push('/');
// return; // return;
// 登录 // 登录
const res = await doFetch({ // const res = await doFetch({
url: `/token/oauth/token?grant_type=password&client_id=NGEMS3&client_secret=ems_Nangao@2022&username=${values?.userName}&password=${values?.password}`, // url: `/token/oauth/token?grant_type=password&client_id=NGEMS3&client_secret=ems_Nangao@2022&username=${values?.userName}&password=${values?.password}`,
}); // });
if (res?.access_token) { const res = await fakeAccountLogin({ ...postdata });
let token = res?.access_token; if (res.code === '0000') {
let token = res?.data?.token;
localStorage.setItem('TOKENES', token); localStorage.setItem('TOKENES', token);
//await fetchUserInfo(); await fetchUserInfo();
message.success('🎉 🎉 🎉 登录成功!'); message.success('🎉 🎉 🎉 登录成功!');
history.push('/welcome');
/** 此方法会跳转到 redirect 参数所在的位置 */ /** 此方法会跳转到 redirect 参数所在的位置 */
if (!history) return; if (!history) return;
history.push('/'); const { query } = history.location;
const { redirect } = query;
history.push(redirect || '/');
return; return;
} }
} catch (error) {} } catch (error) {}
...@@ -125,7 +131,7 @@ const Login = () => { ...@@ -125,7 +131,7 @@ const Login = () => {
}} }}
> >
<div className="cover"> <div className="cover">
<img alt="logo" src={require('@/assets/logo_white.png')} /> <img alt="logo" src={require('@/assets/logobg.png')} />
</div> </div>
<Drawer visible={visible} placement="left" style={{ maxWidth: '100vw' }}> <Drawer visible={visible} placement="left" style={{ maxWidth: '100vw' }}>
<div className={styles.search}> <div className={styles.search}>
......
function getcolumns(setdrawer) {
return [
{
title: '租户名称',
dataIndex: 'companyName',
key: 'companyName',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '租户代码',
dataIndex: 'companyCode',
key: 'companyCode',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
fieldProps: {
placeHolder: '租户代码(支持1-10位字母或数字组合而成)',
},
},
{
title: '生效日期',
dataIndex: 'effectDate',
key: 'effectDateRange',
valueType: 'dateRange',
hideInForm: true,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '生效日期',
dataIndex: 'effectDate',
key: 'effectDate',
valueType: 'date',
hideInTable: true,
search: false,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '失效日期',
dataIndex: 'expireDate',
hideInForm: true,
valueType: 'dateRange',
key: 'expireDateRange',
},
{
title: '失效日期(不填则默认永久)',
dataIndex: 'expireDate',
hideInTable: true,
search: false,
valueType: 'date',
key: 'expireDate',
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
valueType: 'select',
options: [
{
value: 1,
label: '启用',
},
{
value: 2,
label: '停用',
},
],
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
render: (_, row) => {
return row?.status == 1 ? '启用' : '停用';
},
},
{
title: '地址',
dataIndex: 'companyAddress',
key: 'companyAddress',
search: false,
hideInTable: true,
},
{
title: '联系人',
dataIndex: 'contant',
key: 'contant',
search: false,
hideInTable: true,
},
{
title: '联系电话',
dataIndex: 'telephone',
key: 'telephone',
search: false,
hideInTable: true,
},
{
title: '邮箱',
dataIndex: 'mail',
key: 'mail',
search: false,
hideInTable: true,
},
{
title: '排序号',
dataIndex: 'sortNumber',
key: 'sortNumber',
search: false,
hideInTable: true,
valueType: 'digit',
precision: 0,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '备注',
dataIndex: 'remark',
key: 'remark',
search: false,
hideInTable: true,
valueType: 'textarea',
},
];
}
export default getcolumns;
/* 角色管理
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-09-12 13:54:41
*/
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { doFetch } from '@/utils/doFetch';
import { message } from 'antd';
import { Drawer } from 'antd';
import PermissionTree from '@/components/PermissionTree/Permissiontree';
function Role(props) {
let actionRef = useRef(),
formRef = useRef();
const [drawer, setDrawer] = useState({
visible: false,
authorityOpen: false,
});
const urlParams = {
save: '/auth/sysCompany/save',
remove: '/auth/sysCompany/deleteById',
list: '/auth/sysCompany/queryList',
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
item: row,
title: '编辑',
val: 'edit',
onFinish: async (vals) => {
let params = {
...vals,
id: row.id,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('编辑成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除该角色?',
okText: '确认',
cancelText: '取消',
onConfirm: async () => {
let res = await doFetch({ url: urlParams.remove, params: { id: row.id } });
if (res.code === '0000') {
message.success('删除成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
// 权限配置
const authority = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
// const { data } = doFetch({
// url: '/sysRolePermission/queryAll',
// params: { roleId: row.id },
// });
// //console.log(data);
//console.log(row);
setDrawer((s) => ({
...s,
authorityOpen: true,
item: row,
onFinish: async (vals) => {
//console.log(vals);
let res = await doFetch({
url: '/auth/sysRolePermission/save',
params: { ...vals },
});
//console.log(res);
if (res.code === '0000') {
message.success('修改成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
}));
},
}}
>
权限配置
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setDrawer);
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [edit(text, row, _, action), remove(text, row, _, action)],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle={<h3 className="page-title">租户管理</h3>}
columns={columns}
path={urlParams.list}
actionRef={actionRef}
pageextra={'add'}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
type: 'primary',
disabled: false,
onClick: () => {
setDrawer((s) => ({
...s,
visible: true,
item: null,
detailpath: null,
title: '新增',
val: 'add',
onFinish: async (vals) => {
//console.log(1);
let params = {
...vals,
};
let res = await doFetch({
url: urlParams.save,
params,
});
if (res.code === '0000') {
message.success('新增成功!');
setDrawer((s) => ({
...s,
visible: false,
}));
actionRef.current.reload();
}
},
}));
},
},
}}
/>
<DrawerPro
fields={columns}
// detailpath={urlParams.detail}
// params={{ id: drawer?.item?.id }}
defaultFormValue={drawer?.item ?? {}}
formRef={formRef}
placement="right"
onClose={() => {
setDrawer((s) => ({
...s,
visible: false,
}));
}}
{...drawer}
>
{drawer.type == 'person' ? <PersonTable /> : null}
</DrawerPro>
<Drawer
title="角色权限"
onClose={() => {
setDrawer((s) => ({
...s,
authorityOpen: false,
}));
}}
open={drawer.authorityOpen}
destroyOnClose
>
<PermissionTree
id={drawer?.item?.id}
close={() => {
setDrawer((s) => ({
...s,
authorityOpen: false,
item: null,
}));
actionRef.current.reload();
}}
treeType="auth"
/>
</Drawer>
</div>
);
}
export default Role;
This diff is collapsed.
...@@ -8,31 +8,10 @@ function getcolumns(setDrawer, ifs, formRef) { ...@@ -8,31 +8,10 @@ function getcolumns(setDrawer, ifs, formRef) {
// value: it?.id, // value: it?.id,
// })); // }));
return [ return [
{
title: '用户名-姓名',
dataIndex: 'username',
width: 120,
key: 'usernamefullname',
hideInTable: true,
search: false,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
fieldProps: {
placeholder: '请输入',
},
valueType: 'MyAutoComplete',
onSelect: (value, option) => {
formRef.current.setFieldValue('telephone', option?.phone);
formRef.current.setFieldValue('fullName', option?.fullName);
formRef.current.setFieldValue('mailNo', option?.mailbox);
formRef.current.setFieldValue('status', option?.enabled);
},
disabled: ifs,
},
{ {
title: '用户名', title: '用户名',
dataIndex: 'username', dataIndex: 'username',
hideInForm: true, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
width: 120,
key: 'username', key: 'username',
}, },
...@@ -50,7 +29,6 @@ function getcolumns(setDrawer, ifs, formRef) { ...@@ -50,7 +29,6 @@ function getcolumns(setDrawer, ifs, formRef) {
dataIndex: 'fullName', dataIndex: 'fullName',
width: 100, width: 100,
key: 'fullName', key: 'fullName',
hideInForm: true,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
render: (text, row) => { render: (text, row) => {
return ( return (
...@@ -151,28 +129,16 @@ function getcolumns(setDrawer, ifs, formRef) { ...@@ -151,28 +129,16 @@ function getcolumns(setDrawer, ifs, formRef) {
}, },
{ {
title: '手机号', title: '手机号',
hideInTable: true,
dataIndex: 'telephone', dataIndex: 'telephone',
key: 'telephone', key: 'telephone',
fieldProps: {
disabled: true,
},
hideInTable: true,
search: false,
}, },
{ {
title: '邮箱', title: '邮箱',
dataIndex: 'mailNo', dataIndex: 'mailNo',
key: 'mailNo', key: 'mailNo',
hideInTable: true,
search: false,
fieldProps: {
disabled: true,
},
}, },
{ {
title: '公司名称', title: '公司名称',
dataIndex: 'organizationName', dataIndex: 'organizationName',
width: 120, width: 120,
key: 'organizationId', key: 'organizationId',
...@@ -352,7 +318,6 @@ function getcolumns(setDrawer, ifs, formRef) { ...@@ -352,7 +318,6 @@ function getcolumns(setDrawer, ifs, formRef) {
dataIndex: 'statusName', dataIndex: 'statusName',
search: false, search: false,
key: 'status', key: 'status',
fieldProps: { disabled: true },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'radio', valueType: 'radio',
options: [ options: [
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44 * @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2023-02-10 17:54:56 * @Last Modified time: 2023-09-12 15:35:13
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -176,7 +176,6 @@ function User(props) { ...@@ -176,7 +176,6 @@ function User(props) {
} }
let params = { let params = {
...vals, ...vals,
username: vals?.usernamefullname.slice(0, vals?.usernamefullname?.indexOf('-')),
id: drawer?.title == '编辑' ? drawer?.item?.id : '', id: drawer?.title == '编辑' ? drawer?.item?.id : '',
userCharReqList, userCharReqList,
}; };
...@@ -233,7 +232,6 @@ function User(props) { ...@@ -233,7 +232,6 @@ function User(props) {
} }
let params = { let params = {
...vals, ...vals,
username: vals?.usernamefullname.slice(0, vals?.usernamefullname?.indexOf('-')),
id: drawer?.title == '编辑' ? drawer?.item?.id : '', id: drawer?.title == '编辑' ? drawer?.item?.id : '',
userCharReqList, userCharReqList,
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: Li Hanlin * @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56 * @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin * @Last Modified by: Li Hanlin
* @Last Modified time: 2023-01-31 14:06:49 * @Last Modified time: 2023-09-13 09:01:32
*/ */
import * as React from 'react'; import * as React from 'react';
...@@ -209,6 +209,7 @@ function Field(props) { ...@@ -209,6 +209,7 @@ function Field(props) {
fieldChar: '1', fieldChar: '1',
formName: drawer?.formName, formName: drawer?.formName,
formId: drawer?.formId, formId: drawer?.formId,
sort: 0,
}, },
title: '新增', title: '新增',
val: 'add', val: 'add',
......
...@@ -2,7 +2,7 @@ import request from '@/utils/request'; ...@@ -2,7 +2,7 @@ import request from '@/utils/request';
//登录 //登录
export function fakeAccountLogin(params) { export function fakeAccountLogin(params) {
return request('/ngic-auth/sysAccount/login', { return request('/auth/sysAccount/login', {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -10,7 +10,7 @@ export function fakeAccountLogin(params) { ...@@ -10,7 +10,7 @@ export function fakeAccountLogin(params) {
//登出 //登出
export function fakeAccountLoginOut(params) { export function fakeAccountLoginOut(params) {
return request(`/emspro/logout`, { return request(`/auth/sysAccount/logout`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -26,7 +26,7 @@ export function saveForRegister(params) { ...@@ -26,7 +26,7 @@ export function saveForRegister(params) {
//个人信息 //个人信息
export function queryCurrentUser(params) { export function queryCurrentUser(params) {
return request('/emspro/auth/sysUser/me', { return request('/auth/sysUser/me', {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -34,7 +34,7 @@ export function queryCurrentUser(params) { ...@@ -34,7 +34,7 @@ export function queryCurrentUser(params) {
//获取菜单/权限/菜单/公司类型 //获取菜单/权限/菜单/公司类型
export function getMenu(params) { export function getMenu(params) {
return request(`/emspro/auth/sysPermission/queryMenu`, { return request(`/auth/sysPermission/queryMenu`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -42,7 +42,7 @@ export function getMenu(params) { ...@@ -42,7 +42,7 @@ export function getMenu(params) {
/*---------------菜单收藏-------------------*/ /*---------------菜单收藏-------------------*/
export function collectPerms(params) { export function collectPerms(params) {
return request(`/emspro/auth/sysUserPermission/collectPerm`, { return request(`/auth/sysUserPermission/collectPerm`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
...@@ -50,14 +50,14 @@ export function collectPerms(params) { ...@@ -50,14 +50,14 @@ export function collectPerms(params) {
/*---------------取消菜单收藏-------------------*/ /*---------------取消菜单收藏-------------------*/
export function cancelCollectPerms(params) { export function cancelCollectPerms(params) {
return request(`/emspro/auth/sysUserPermission/cancelCollectPerm`, { return request(`/auth/sysUserPermission/cancelCollectPerm`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
} }
/*---------------菜单历史记录-------------------*/ /*---------------菜单历史记录-------------------*/
export function mtosave(params) { export function mtosave(params) {
return request(`/emspro/auth/sysUserVisitPermission/save`, { return request(`/auth/sysUserVisitPermission/save`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
......
...@@ -88,7 +88,7 @@ export async function sectionSelectByShops(params) { ...@@ -88,7 +88,7 @@ export async function sectionSelectByShops(params) {
} }
//授权前查询权限树 //授权前查询权限树
export async function roleTree(params) { export async function roleTree(params) {
return request(`emspro/auth/sysRolePermission/queryAll`, { return request(`/auth/sysRolePermission/queryAll`, {
method: 'POST', method: 'POST',
data: params, data: params,
}); });
......
...@@ -5,17 +5,11 @@ export async function doFetch({ url, params }) { ...@@ -5,17 +5,11 @@ export async function doFetch({ url, params }) {
if (!url) { if (!url) {
return; return;
} }
if (url.indexOf('token') != -1) {
return request(url, { return request(url, {
method: 'post', method: 'post',
data: params, data: params,
}); });
} else {
return request(defaultSetting.proxypath + url, {
method: 'post',
data: params,
});
}
} }
export async function postFetch({ url, params }) { export async function postFetch({ url, params }) {
......
...@@ -5,8 +5,10 @@ ...@@ -5,8 +5,10 @@
import { extend } from 'umi-request'; import { extend } from 'umi-request';
import { message, notification, Modal } from 'antd'; import { message, notification, Modal } from 'antd';
import { history } from '@umijs/max'; import { history } from '@umijs/max';
import qs from 'query-string'; const { NODE_ENV } = process.env; //development production
import qs from 'query-string';
const baseUrl = NODE_ENV == 'development' ? '/ems' : '';
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。', 201: '新建或修改数据成功。',
...@@ -55,30 +57,49 @@ const request = extend({ ...@@ -55,30 +57,49 @@ const request = extend({
// request拦截器, 改变url 或 options. // request拦截器, 改变url 或 options.
request.interceptors.request.use(async (url, options) => { request.interceptors.request.use(async (url, options) => {
const { location } = history;
let token = localStorage.getItem('TOKENES'); let token = localStorage.getItem('TOKENES');
if (token) { console.log(baseUrl, url, location.pathname);
if (location.pathname === '/user/login') {
const headers = const headers =
options.type == 'form' options.type == 'form'
? { ? {
Authorization: 'Bearer ' + token, token,
} }
: { : {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Accept: 'application/json', Accept: 'application/json',
Authorization: 'Bearer ' + token, token,
}; };
return { return {
url: url, url: baseUrl + url,
options: { ...options, headers: headers, useCache: true, ttl: 2000 }, options: { ...options, headers: headers, useCache: true, ttl: 2000 },
}; };
} else {
if (token) {
const headers =
options.type == 'form'
? {
token,
}
: {
'Content-Type': 'application/json',
Accept: 'application/json',
token,
};
return {
url: baseUrl + url,
options: { ...options, headers: headers, useCache: true, ttl: 2000 },
};
}
} }
}); });
// response拦截器, 处理response // response拦截器, 处理response
request.interceptors.response.use(async (response, options) => { request.interceptors.response.use(async (response, options) => {
if (response?.status == '401') { // if (response?.status == '401') {
window.location.href = '/'; // window.location.href = '/';
} // }
if (options.responseType == 'blob') { if (options.responseType == 'blob') {
const data = await response.clone().blob(); const data = await response.clone().blob();
let blobUrl = window.URL.createObjectURL(data); let blobUrl = window.URL.createObjectURL(data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment