Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
ems3.3
Commits
c329c151
Commit
c329c151
authored
Sep 13, 2023
by
krysent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nihao
parent
394bf9ae
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
884 additions
and
113 deletions
+884
-113
authRoutes.js
config/authRoutes.js
+5
-0
defaultSettings.js
config/defaultSettings.js
+1
-1
proxy.js
config/proxy.js
+6
-2
LOGO.png
public/LOGO.png
+0
-0
app.jsx
src/app.jsx
+13
-1
logobg.png
src/assets/logobg.png
+0
-0
FormItems.jsx
src/components/InitForm/FormItems.jsx
+6
-6
AvatarDropdown.jsx
src/components/RightContent/AvatarDropdown.jsx
+9
-9
index.jsx
src/pages/User/Login/index.jsx
+33
-27
columns.js
src/pages/setting/tenants/columns.js
+120
-0
index.jsx
src/pages/setting/tenants/index.jsx
+245
-0
columns copy.js
src/pages/setting/users/columns copy.js
+400
-0
columns.js
src/pages/setting/users/columns.js
+1
-36
index.jsx
src/pages/setting/users/index.jsx
+1
-3
index.jsx
src/pages/system/field/index.jsx
+2
-1
login.js
src/services/login.js
+7
-7
system.js
src/services/system.js
+1
-1
doFetch.js
src/utils/doFetch.js
+5
-11
request.js
src/utils/request.js
+29
-8
No files found.
config/authRoutes.js
View file @
c329c151
...
...
@@ -15,6 +15,11 @@ export default [
path
:
'/setting/users'
,
component
:
'./setting/users'
,
},
{
name
:
'租户管理'
,
path
:
'/setting/tenants'
,
component
:
'./setting/tenants'
,
},
{
name
:
'角色管理'
,
path
:
'/setting/role'
,
...
...
config/defaultSettings.js
View file @
c329c151
...
...
@@ -12,7 +12,7 @@ const Settings = {
logo
:
'./LOGO.png'
,
colorPrimary
:
'#1890ff'
,
siderMenuType
:
'sub'
,
proxypath
:
'/ems
pro
'
,
proxypath
:
'/ems'
,
};
export
default
Settings
;
config/proxy.js
View file @
c329c151
...
...
@@ -13,12 +13,16 @@ export default {
dev
:
{
[
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.64:28000', //gc哥
// target: 'http://192.168.40.203:800
0
', //dj哥
// target: 'http://192.168.40.203:800
1
', //dj哥
// target: 'http://192.168.40.35:8001', //测试
target
:
'http://192.168.40.111:8001'
,
//猛哥
changeOrigin
:
true
,
pathRewrite
:
{
'^/ems'
:
''
,
},
},
'/token'
:
{
// 要代理的地址
...
...
public/LOGO.png
View replaced file @
394bf9ae
View file @
c329c151
98.1 KB
|
W:
|
H:
10 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/app.jsx
View file @
c329c151
...
...
@@ -32,7 +32,7 @@ export async function getInitialState() {
const
msg
=
await
queryCurrentUser
();
return
msg
.
data
;
}
catch
(
error
)
{
//
history.push(loginPath);
history
.
push
(
loginPath
);
}
return
undefined
;
};
// 如果是登录页面,不执行
...
...
@@ -42,6 +42,7 @@ export async function getInitialState() {
return
res
.
data
;
}
catch
(
error
)
{
message
.
error
(
res
.
msg
);
history
.
push
(
loginPath
);
}
return
undefined
;
};
// 如果是登录页面,不执行
...
...
@@ -72,6 +73,7 @@ export async function getInitialState() {
// ProLayout 支持的api https://procomponents.ant.design/components/layout
export
const
layout
=
({
initialState
,
setInitialState
})
=>
{
console
.
log
(
initialState
);
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
return
{
disableContentMargin
:
false
,
...
...
@@ -85,7 +87,16 @@ export const layout = ({ initialState, setInitialState }) => {
footerRender
:
()
=>
<
Footer
/>,
onPageChange
:
async
()
=>
{
const
{
location
}
=
history
;
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
// 如果没有登录,重定向到 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
)
{
let
userInfo
=
await
initialState
.
fetchUserInfo
();
let
menuData
=
await
initialState
.
getmenuData
();
...
...
@@ -153,6 +164,7 @@ export const layout = ({ initialState, setInitialState }) => {
// 增加一个 loading 的状态
childrenRender
:
(
children
,
props
)
=>
{
// if (initialState?.loading) return <PageLoading />;
console
.
log
(
location
.
pathname
);
return
(
<>
{
initialState
?.
currentUser
&&
location
.
pathname
!==
loginPath
?
(
...
...
src/assets/logobg.png
0 → 100644
View file @
c329c151
10 KB
src/components/InitForm/FormItems.jsx
View file @
c329c151
...
...
@@ -1174,14 +1174,14 @@ function Slider({ item, colProps }) {
//uploadbtn
function UploadBtn({ item, colProps }) {
let token = `
Bearer
$
{
localStorage
.
getItem
(
'TOKENES'
)}
`;
let token = `
$
{
localStorage
.
getItem
(
'TOKENES'
)}
`;
return (
<>
<ProFormUploadButton
fieldProps={{
...item?.fieldProps,
action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
headers: {
Authorization:
token },
headers: { token },
onPreview: (file) => {
let url = '';
if (file.response) {
...
...
@@ -1219,7 +1219,7 @@ function UploadBtn({ item, colProps }) {
}
function UploadImg({ value, onChange, fieldProps }) {
let token = `
Bearer
$
{
localStorage
.
getItem
(
'TOKENES'
)}
`;
let token = `
$
{
localStorage
.
getItem
(
'TOKENES'
)}
`;
const [image, setImage] = useState({});
function beforeUpload(file) {
const isJpgOrPng =
...
...
@@ -1239,7 +1239,7 @@ function UploadImg({ value, onChange, fieldProps }) {
listType: 'picture-card',
beforeUpload: beforeUpload,
defaultFileList: value,
headers: {
Authorization:
token },
headers: { token },
onChange(info) {
let {
file: { name, status, response },
...
...
@@ -1336,14 +1336,14 @@ function UploadImage({ item, colProps }) {
// uploadDragger
function UploadDragger({ item, colProps }) {
let token = `
Bearer
$
{
localStorage
.
getItem
(
'TOKENES'
)}
`;
let token = `
$
{
localStorage
.
getItem
(
'TOKENES'
)}
`;
return (
<>
<ProFormUploadDragger
fieldProps={{
...item?.fieldProps,
action: defaultSetting.proxypath + '/base/sysAttachment/uploadFile',
headers: {
Authorization:
token },
headers: { token },
onPreview: (file) => {
let url = '';
if (file.response) {
...
...
src/components/RightContent/AvatarDropdown.jsx
View file @
c329c151
...
...
@@ -18,18 +18,18 @@ import moment from 'moment';
* 退出登录,并且将当前的 url 保存
*/
const
loginOut
=
async
()
=>
{
const
{
logoutRedirectUrl
}
=
await
fakeAccountLoginOut
();
if
(
window
.
location
.
pathname
!==
'/user/login
'
)
{
const
{
code
}
=
await
fakeAccountLoginOut
();
if
(
code
===
'0002
'
)
{
localStorage
.
clear
();
window
.
location
.
replace
(
logoutRedirectUrl
);
history
.
replace
(
'/user/login'
);
}
};
const
AvatarDropdown
=
({
menu
})
=>
{
const
getUserApp
=
useRequest
(
async
()
=>
{
let
res
=
await
doFetch
({
url
:
'/auth/sysUser/userApp/selection'
,
params
:
{}
});
return
res
?.
data
||
{};
});
//
const getUserApp = useRequest(async () => {
//
let res = await doFetch({ url: '/auth/sysUser/userApp/selection', params: {} });
//
return res?.data || {};
//
});
const
{
initialState
,
setInitialState
}
=
useModel
(
'@@initialState'
);
const
[
visible
,
cv
]
=
useState
(
false
),
[
formRef
]
=
Form
.
useForm
(),
...
...
@@ -191,14 +191,14 @@ const AvatarDropdown = ({ menu }) => {
submitting=
{
loading
||
!
visible
}
/>
</
Modal
>
<
Select
{
/*
<Select
style={{ width: 150, marginRight: 8 }}
value={
getUserApp?.data?.dataList?.filter((it) => it?.appId == getUserApp?.data?.appId)[0]?.value
}
options={getUserApp?.data?.dataList}
onChange={handleChange}
/>
/>
*/
}
<
HeaderDropdown
overlay=
{
menuHeaderDropdown
}
>
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
Avatar
style=
{
{
backgroundColor
:
'#1890ff'
}
}
>
...
...
src/pages/User/Login/index.jsx
View file @
c329c151
...
...
@@ -51,46 +51,52 @@ const Login = () => {
const
[
visible
,
setvisible
]
=
useState
(
false
);
const
[
data
,
setdata
]
=
useState
();
//
const fetchUserInfo = async () => {
//
const userInfo = await initialState?.fetchUserInfo(),
//
menuData = await initialState?.getmenuData();
//
if (userInfo) {
//
await setInitialState((s) => {
//
return { ...s, currentUser: userInfo?.data, newMenu: menuData };
//
});
//
}
//
};
const
fetchUserInfo
=
async
()
=>
{
const
userInfo
=
await
initialState
?.
fetchUserInfo
(),
menuData
=
await
initialState
?.
getmenuData
();
if
(
userInfo
)
{
await
setInitialState
((
s
)
=>
{
return
{
...
s
,
currentUser
:
userInfo
?.
data
,
newMenu
:
menuData
};
});
}
};
//登录
const
handleLogin
=
async
(
values
)
=>
{
//
let timestamp = moment().valueOf().toString() + 'acb';
//
let newtimestamp = AES.encrypt(timestamp, Utf8.parse('NANGAODEAESKEY--'), {
//
mode: ECB,
//
padding: Pkcs7,
//
}).toString();
//
let password = AES.encrypt(values.password, Utf8.parse(timestamp), {
//
mode: ECB,
//
padding: Pkcs7,
//
}).toString();
let
timestamp
=
moment
().
valueOf
().
toString
()
+
'acb'
;
let
newtimestamp
=
AES
.
encrypt
(
timestamp
,
Utf8
.
parse
(
'NANGAODEAESKEY--'
),
{
mode
:
ECB
,
padding
:
Pkcs7
,
}).
toString
();
let
password
=
AES
.
encrypt
(
values
.
password
,
Utf8
.
parse
(
timestamp
),
{
mode
:
ECB
,
padding
:
Pkcs7
,
}).
toString
();
const
postdata
=
{
accountName
:
values
.
userName
,
password
:
values
.
password
,
password
:
password
,
encryptKey
:
newtimestamp
,
};
try
{
// history.push('/');
// return;
// 登录
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
}
`,
});
if (res?.access_token) {
let token = res?.access_token;
// 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}`,
// });
const
res
=
await
fakeAccountLogin
({
...
postdata
});
if
(
res
.
code
===
'0000'
)
{
let
token
=
res
?.
data
?.
token
;
localStorage
.
setItem
(
'TOKENES'
,
token
);
//
await fetchUserInfo();
await
fetchUserInfo
();
message
.
success
(
'🎉 🎉 🎉 登录成功!'
);
history
.
push
(
'/welcome'
);
/** 此方法会跳转到 redirect 参数所在的位置 */
if
(
!
history
)
return
;
history.push('/');
const
{
query
}
=
history
.
location
;
const
{
redirect
}
=
query
;
history
.
push
(
redirect
||
'/'
);
return
;
}
}
catch
(
error
)
{}
...
...
@@ -125,7 +131,7 @@ const Login = () => {
}
}
>
<
div
className=
"cover"
>
<img alt="logo" src={require('@/assets/logo
_white
.png')} />
<
img
alt=
"logo"
src=
{
require
(
'@/assets/logo
bg
.png'
)
}
/>
</
div
>
<
Drawer
visible=
{
visible
}
placement=
"left"
style=
{
{
maxWidth
:
'100vw'
}
}
>
<
div
className=
{
styles
.
search
}
>
...
...
src/pages/setting/tenants/columns.js
0 → 100644
View file @
c329c151
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
;
src/pages/setting/tenants/index.jsx
0 → 100644
View file @
c329c151
/* 角色管理
* @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
;
src/pages/setting/users/columns copy.js
0 → 100644
View file @
c329c151
This diff is collapsed.
Click to expand it.
src/pages/setting/users/columns.js
View file @
c329c151
...
...
@@ -8,31 +8,10 @@ function getcolumns(setDrawer, ifs, formRef) {
// value: it?.id,
// }));
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
:
'用户名'
,
dataIndex
:
'username'
,
hideInForm
:
true
,
width
:
120
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
key
:
'username'
,
},
...
...
@@ -50,7 +29,6 @@ function getcolumns(setDrawer, ifs, formRef) {
dataIndex
:
'fullName'
,
width
:
100
,
key
:
'fullName'
,
hideInForm
:
true
,
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
render
:
(
text
,
row
)
=>
{
return
(
...
...
@@ -151,28 +129,16 @@ function getcolumns(setDrawer, ifs, formRef) {
},
{
title
:
'手机号'
,
hideInTable
:
true
,
dataIndex
:
'telephone'
,
key
:
'telephone'
,
fieldProps
:
{
disabled
:
true
,
},
hideInTable
:
true
,
search
:
false
,
},
{
title
:
'邮箱'
,
dataIndex
:
'mailNo'
,
key
:
'mailNo'
,
hideInTable
:
true
,
search
:
false
,
fieldProps
:
{
disabled
:
true
,
},
},
{
title
:
'公司名称'
,
dataIndex
:
'organizationName'
,
width
:
120
,
key
:
'organizationId'
,
...
...
@@ -352,7 +318,6 @@ function getcolumns(setDrawer, ifs, formRef) {
dataIndex
:
'statusName'
,
search
:
false
,
key
:
'status'
,
fieldProps
:
{
disabled
:
true
},
formItemProps
:
{
rules
:
[{
required
:
true
,
message
:
'此项为必填项'
}]
},
valueType
:
'radio'
,
options
:
[
...
...
src/pages/setting/users/index.jsx
View file @
c329c151
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-09 14:44:44
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-0
2-10 17:54:56
* @Last Modified time: 2023-0
9-12 15:35:13
*/
import
*
as
React
from
'react'
;
...
...
@@ -176,7 +176,6 @@ function User(props) {
}
let
params
=
{
...
vals
,
username
:
vals
?.
usernamefullname
.
slice
(
0
,
vals
?.
usernamefullname
?.
indexOf
(
'-'
)),
id
:
drawer
?.
title
==
'编辑'
?
drawer
?.
item
?.
id
:
''
,
userCharReqList
,
};
...
...
@@ -233,7 +232,6 @@ function User(props) {
}
let
params
=
{
...
vals
,
username
:
vals
?.
usernamefullname
.
slice
(
0
,
vals
?.
usernamefullname
?.
indexOf
(
'-'
)),
id
:
drawer
?.
title
==
'编辑'
?
drawer
?.
item
?.
id
:
''
,
userCharReqList
,
};
...
...
src/pages/system/field/index.jsx
View file @
c329c151
...
...
@@ -2,7 +2,7 @@
* @Author: Li Hanlin
* @Date: 2022-11-10 09:39:56
* @Last Modified by: Li Hanlin
* @Last Modified time: 2023-0
1-31 14:06:49
* @Last Modified time: 2023-0
9-13 09:01:32
*/
import
*
as
React
from
'react'
;
...
...
@@ -209,6 +209,7 @@ function Field(props) {
fieldChar
:
'1'
,
formName
:
drawer
?.
formName
,
formId
:
drawer
?.
formId
,
sort
:
0
,
},
title
:
'新增'
,
val
:
'add'
,
...
...
src/services/login.js
View file @
c329c151
...
...
@@ -2,7 +2,7 @@ import request from '@/utils/request';
//登录
export
function
fakeAccountLogin
(
params
)
{
return
request
(
'/
ngic-
auth/sysAccount/login'
,
{
return
request
(
'/auth/sysAccount/login'
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -10,7 +10,7 @@ export function fakeAccountLogin(params) {
//登出
export
function
fakeAccountLoginOut
(
params
)
{
return
request
(
`/
emspro
/logout`
,
{
return
request
(
`/
auth/sysAccount
/logout`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -26,7 +26,7 @@ export function saveForRegister(params) {
//个人信息
export
function
queryCurrentUser
(
params
)
{
return
request
(
'/
emspro/
auth/sysUser/me'
,
{
return
request
(
'/auth/sysUser/me'
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -34,7 +34,7 @@ export function queryCurrentUser(params) {
//获取菜单/权限/菜单/公司类型
export
function
getMenu
(
params
)
{
return
request
(
`/
emspro/
auth/sysPermission/queryMenu`
,
{
return
request
(
`/auth/sysPermission/queryMenu`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -42,7 +42,7 @@ export function getMenu(params) {
/*---------------菜单收藏-------------------*/
export
function
collectPerms
(
params
)
{
return
request
(
`/
emspro/
auth/sysUserPermission/collectPerm`
,
{
return
request
(
`/auth/sysUserPermission/collectPerm`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -50,14 +50,14 @@ export function collectPerms(params) {
/*---------------取消菜单收藏-------------------*/
export
function
cancelCollectPerms
(
params
)
{
return
request
(
`/
emspro/
auth/sysUserPermission/cancelCollectPerm`
,
{
return
request
(
`/auth/sysUserPermission/cancelCollectPerm`
,
{
method
:
'POST'
,
data
:
params
,
});
}
/*---------------菜单历史记录-------------------*/
export
function
mtosave
(
params
)
{
return
request
(
`/
emspro/
auth/sysUserVisitPermission/save`
,
{
return
request
(
`/auth/sysUserVisitPermission/save`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
src/services/system.js
View file @
c329c151
...
...
@@ -88,7 +88,7 @@ export async function sectionSelectByShops(params) {
}
//授权前查询权限树
export
async
function
roleTree
(
params
)
{
return
request
(
`
emspro
/auth/sysRolePermission/queryAll`
,
{
return
request
(
`/auth/sysRolePermission/queryAll`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
src/utils/doFetch.js
View file @
c329c151
...
...
@@ -5,17 +5,11 @@ export async function doFetch({ url, params }) {
if
(
!
url
)
{
return
;
}
if
(
url
.
indexOf
(
'token'
)
!=
-
1
)
{
return
request
(
url
,
{
method
:
'post'
,
data
:
params
,
});
}
else
{
return
request
(
defaultSetting
.
proxypath
+
url
,
{
method
:
'post'
,
data
:
params
,
});
}
return
request
(
url
,
{
method
:
'post'
,
data
:
params
,
});
}
export
async
function
postFetch
({
url
,
params
})
{
...
...
src/utils/request.js
View file @
c329c151
...
...
@@ -5,8 +5,10 @@
import
{
extend
}
from
'umi-request'
;
import
{
message
,
notification
,
Modal
}
from
'antd'
;
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
=
{
200
:
'服务器成功返回请求的数据。'
,
201
:
'新建或修改数据成功。'
,
...
...
@@ -55,30 +57,49 @@ const request = extend({
// request拦截器, 改变url 或 options.
request
.
interceptors
.
request
.
use
(
async
(
url
,
options
)
=>
{
const
{
location
}
=
history
;
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
if
(
token
)
{
console
.
log
(
baseUrl
,
url
,
location
.
pathname
);
if
(
location
.
pathname
===
'/user/login'
)
{
const
headers
=
options
.
type
==
'form'
?
{
Authorization
:
'Bearer '
+
token
,
token
,
}
:
{
'Content-Type'
:
'application/json'
,
Accept
:
'application/json'
,
Authorization
:
'Bearer '
+
token
,
token
,
};
return
{
url
:
url
,
url
:
baseUrl
+
url
,
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
request
.
interceptors
.
response
.
use
(
async
(
response
,
options
)
=>
{
if
(
response
?.
status
==
'401'
)
{
window
.
location
.
href
=
'/'
;
}
//
if (response?.status == '401') {
//
window.location.href = '/';
//
}
if
(
options
.
responseType
==
'blob'
)
{
const
data
=
await
response
.
clone
().
blob
();
let
blobUrl
=
window
.
URL
.
createObjectURL
(
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment