Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wms
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
wms
Commits
5f64d2dc
Commit
5f64d2dc
authored
Aug 16, 2023
by
krysent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jicheng
parent
777f6d43
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
536 additions
and
287 deletions
+536
-287
proxy.js
config/proxy.js
+5
-3
app.jsx
src/app.jsx
+35
-25
index.jsx
src/components/Autocomplete/index.jsx
+60
-0
index.jsx
src/components/InitForm/index.jsx
+20
-0
AvatarDropdown.jsx
src/components/RightContent/AvatarDropdown.jsx
+67
-18
fields.jsx
src/pages/system/Staff/fields.jsx
+44
-30
index.jsx
src/pages/user/Login/index.jsx
+204
-159
login.js
src/services/login.js
+14
-6
system.js
src/services/system.js
+34
-34
doFetch.js
src/utils/doFetch.js
+1
-1
request.js
src/utils/request.js
+52
-11
No files found.
config/proxy.js
View file @
5f64d2dc
...
...
@@ -9,12 +9,14 @@
export
default
{
dev
:
{
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
"/wms/"
:
{
"/wms
pro
/"
:
{
// 要代理的地址
target
:
"http://192.168.40.18/wms/"
,
//39:28040 18/wms/
target
:
"http://192.168.40.203:8000"
,
//39:28040 18/wms/
// target: "http://192.168.40.18/wms/", //39:28040 18/wms/
// target: "http://192.168.40.18/wms/", //39:28040 18/wms/
changeOrigin
:
true
,
pathRewrite
:
{
"^/wms"
:
""
,
"^/wms
pro
"
:
""
,
},
},
"/staticfile/"
:
{
...
...
src/app.jsx
View file @
5f64d2dc
...
...
@@ -24,7 +24,7 @@ export async function getInitialState() {
const
msg
=
await
queryCurrentUser
();
return
msg
.
data
;
}
catch
(
error
)
{
history
.
push
(
loginPath
);
//
history.push(loginPath);
}
return
undefined
;
};
// 如果是登录页面,不执行
...
...
@@ -51,7 +51,7 @@ export async function getInitialState() {
settings
:
defaultSettings
,
newMenu
:
menuData
,
getmenuData
,
collapsed
:
false
collapsed
:
false
,
};
}
return
{
...
...
@@ -59,7 +59,7 @@ export async function getInitialState() {
settings
:
defaultSettings
,
getmenuData
,
collapsed
:
false
,
tagList
:
[]
tagList
:
[]
,
};
}
// ProLayout 支持的api https://procomponents.ant.design/components/layout
export
const
layout
=
async
(
props
)
=>
{
...
...
@@ -74,25 +74,36 @@ export const layout = async (props) => {
},
collapsed
:
initialState
.
collapsed
,
onCollapse
:
(
cols
)
=>
{
setInitialState
(
s
=>
({
...
s
,
collapsed
:
cols
}))
setInitialState
(
(
s
)
=>
({
...
s
,
collapsed
:
cols
}));
},
onPageChange
:
()
=>
{
onPageChange
:
async
()
=>
{
// const { location } = history; // 如果没有登录,重定向到 login
// if (location.pathname != "/user/logon") {
// if (
// (!initialState?.currentUser && location.pathname !== loginPath) ||
// !token
// ) {
// setInitialState((s) => {
// return { ...s, currentUser: undefined, newMenu: [] };
// });
// history.replace(loginPath);
// }
// }
// if (location.pathname == loginPath) {
// setInitialState((s) => {
// return { ...s, currentUser: undefined, newMenu: [] };
// });
// }
const
{
location
}
=
history
;
// 如果没有登录,重定向到 login
if
(
location
.
pathname
!=
"/user/logon"
)
{
if
(
(
!
initialState
?.
currentUser
&&
location
.
pathname
!==
loginPath
)
||
!
token
)
{
setInitialState
((
s
)
=>
{
return
{
...
s
,
currentUser
:
undefined
,
newMenu
:
[]
};
});
history
.
replace
(
loginPath
);
}
}
if
(
location
.
pathname
==
loginPath
)
{
setInitialState
((
s
)
=>
{
return
{
...
s
,
currentUser
:
undefined
,
newMenu
:
[]
};
});
let
Token
=
localStorage
.
getItem
(
"TOKEN_MES"
);
if
(
!
initialState
?.
currentUser
&&
location
.
pathname
!==
loginPath
)
{
let
userInfo
=
await
initialState
.
fetchUserInfo
();
let
menuData
=
await
initialState
.
getmenuData
();
setInitialState
((
s
)
=>
({
...
s
,
currentUser
:
userInfo
?.
data
,
newMenu
:
menuData
,
}));
}
},
contentStyle
:
{
...
...
@@ -138,7 +149,6 @@ export const layout = async (props) => {
}
},
// 自定义 403 页面
// unAccessible: <div>unAccessible</div>,
// 增加一个 loading 的状态
...
...
src/components/Autocomplete/index.jsx
0 → 100644
View file @
5f64d2dc
import
React
,
{
useState
,
useEffect
}
from
"react"
;
import
{
AutoComplete
,
Input
}
from
"antd"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
useRequest
}
from
"ahooks"
;
export
default
(
item
)
=>
{
const
{
requestOptions
,
name
,
value
,
onChange
}
=
item
;
const
[
options
,
setoptions
]
=
useState
([]);
const
[
username
,
setusername
]
=
useState
();
// const [value, setvalue] = useState();
const
{
data
,
run
,
runAsync
}
=
useRequest
(
async
()
=>
{
let
res
=
await
doFetch
({
url
:
requestOptions
?.
url
??
""
,
// params: { [requestOptions.params]: username },
params
:
requestOptions
.
params
&&
{
[
requestOptions
.
params
]:
username
},
});
return
res
?.
data
?.
dataList
;
},
{
manual
:
true
,
debounceWait
:
300
,
}
);
useEffect
(()
=>
{
runAsync
()
.
then
((
data
)
=>
{
const
options
=
data
?.
map
((
it
)
=>
({
...
it
,
label
:
`
${
it
?.
username
}
-
$
{
it
?.
fullName
}
-
$
{
it
?.
phone
}
-
$
{
it
?.
mailbox
}
`,
value: `
$
{
it
?.
username
}
-
$
{
it
?.
fullName
}
-
$
{
it
?.
phone
}
-
$
{
it
?.
mailbox
}
`,
}));
setoptions(options);
})
.catch((error) => {
console.log(error);
});
}, [username]);
const onChangeHandle = (val) => {
setusername(val)
onChange(val)
// setvalue(val);
};
const selectValue = (val) => {
onChange(val)
};
return (
<AutoComplete
allowClear
placeholder={item.title}
disabled={item.disabled}
options={options}
onChange={onChangeHandle}
onSelect={selectValue}
value={value}
/>
);
};
src/components/InitForm/index.jsx
View file @
5f64d2dc
...
...
@@ -28,6 +28,7 @@ import Editor from "../Editor";
import
mockfile
from
"./mockfile.js"
;
import
zhCN
from
"antd/lib/locale/zh_CN"
;
import
Diyrule
from
"../Diyrule"
;
import
Autocomplete
from
"../Autocomplete"
;
moment
.
locale
(
"zh-cn"
);
const
{
TreeNode
}
=
TreeSelect
;
...
...
@@ -729,6 +730,25 @@ let InitForm = ({
</
Form
.
Item
>
</
Col
>
)
:
null
;
}
else
if
(
item
.
type
==
"autocompleteinput"
)
{
return
!
extraprops
.
hides
?
(
<
Col
key=
{
i
}
{
...
getCol
(
item
.
col
)}
>
<
Form
.
Item
style=
{
{}
}
label=
{
item
.
title
}
name=
{
item
.
name
[
0
]
}
rules=
{
[
{
required
:
item
.
required
,
message
:
`请输入${item.title}`
,
},
]
}
>
<
Autocomplete
{
...
item
}
/>
{
/* <span style={{position:'relative',fontSize:"12px",color:'#c0c0c0c0'}}>登录账号为"用户名",登录密码为IoT设置的密码</span> */
}
</
Form
.
Item
>
</
Col
>
)
:
null
;
}
else
if
(
item
.
type
==
"textarea"
)
{
return
!
extraprops
.
hides
?
(
<
Col
key=
{
i
}
{
...
getCol
(
item
.
col
)}
>
...
...
src/components/RightContent/AvatarDropdown.jsx
View file @
5f64d2dc
import
React
,
{
useCallback
,
useState
,
useMemo
}
from
"react"
;
import
{
LogoutOutlined
,
LockOutlined
}
from
"@ant-design/icons"
;
import
{
Menu
,
Spin
,
Form
,
Modal
,
message
,
Avatar
}
from
"antd"
;
import
{
history
,
useModel
,
useRequest
}
from
"umi"
;
import
{
stringify
}
from
"querystring"
;
import
{
LogoutOutlined
,
LockOutlined
,
UserOutlined
,
DownOutlined
,
}
from
"@ant-design/icons"
;
import
{
Menu
,
Spin
,
Form
,
Modal
,
message
,
Select
}
from
"antd"
;
import
{
history
,
useModel
}
from
"umi"
;
import
{
useRequest
}
from
"ahooks"
;
import
HeaderDropdown
from
"../HeaderDropdown"
;
import
styles
from
"./index.less"
;
import
{
fakeAccountLoginOut
,
changePwd
}
from
"@/services/login"
;
...
...
@@ -13,17 +18,19 @@ import ECB from "crypto-js/mode-ecb";
import
Pkcs7
from
"crypto-js/pad-pkcs7"
;
import
Utf8
from
"crypto-js/enc-utf8"
;
import
moment
from
"moment"
;
const
{
Option
}
=
Select
;
/**
* 退出登录,并且将当前的 url 保存
*/
const
loginOut
=
async
()
=>
{
await
fakeAccountLoginOut
();
const
{
query
=
{}
}
=
history
.
location
;
const
{
redirect
}
=
query
;
// Note: There may be security issues, please note
const
{
logoutRedirectUrl
}
=
await
fakeAccountLoginOut
();
const
{
query
=
{}
}
=
history
.
location
;
const
{
redirect
}
=
query
;
// Note: There may be security issues, please not
if
(
window
.
location
.
pathname
!==
"/user/login"
&&
!
redirect
)
{
localStorage
.
clear
();
history
.
replace
(
"/user/login"
);
// history.replace("/user/login");
window
.
location
.
replace
(
logoutRedirectUrl
);
}
};
...
...
@@ -33,7 +40,6 @@ const AvatarDropdown = ({ menu }) => {
[
formRef
]
=
Form
.
useForm
(),
{
run
,
loading
}
=
useRequest
(
doFetch
,
{
manual
:
true
,
formatResult
:
(
res
)
=>
res
,
onSuccess
:
(
result
,
params
)
=>
{
if
(
result
.
code
==
"0000"
)
{
cv
(
false
);
...
...
@@ -47,6 +53,13 @@ const AvatarDropdown = ({ menu }) => {
});
}
},
}),
getUserApp
=
useRequest
(
async
()
=>
{
let
res
=
await
doFetch
({
url
:
"/ngic-auth/sysUser/userApp/selection"
,
params
:
{},
});
return
res
?.
data
??
{};
});
const
fields
=
useMemo
(()
=>
{
return
{
...
...
@@ -160,7 +173,7 @@ const AvatarDropdown = ({ menu }) => {
</
Menu
>
);
return
(
<
div
>
<
div
className=
"center"
>
<
Modal
title=
"修改密码"
visible=
{
visible
}
...
...
@@ -175,21 +188,57 @@ const AvatarDropdown = ({ menu }) => {
formRef=
{
formRef
}
fields=
{
fields
}
col=
{
{
span
:
24
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{
}
}
onChange=
{
(
changedValues
,
allValues
)
=>
{}
}
submitData=
{
(
values
,
fn
)
=>
{
saveData
(
values
,
fn
);
}
}
submitting=
{
loading
||
!
visible
}
>
</
InitForm
>
></
InitForm
>
</
Modal
>
<
Select
style=
{
{
width
:
200
,
}
}
onChange=
{
(
value
)
=>
{
window
.
open
(
value
,
"_self"
);
}
}
value=
{
getUserApp
?.
data
?.
dataList
?.
filter
(
(
it
)
=>
it
.
appId
==
getUserApp
?.
data
?.
appId
)?.[
0
]?.
value
}
tagRender=
{
(
props
)
=>
{}
}
>
{
getUserApp
?.
data
?.
dataList
?.
map
((
it
)
=>
{
return
(
<
Option
value=
{
it
.
value
}
label=
{
it
.
label
}
key=
{
it
.
value
}
>
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
}
}
>
{
it
?.
appImgList
?.
length
>
0
&&
(
<
img
src=
{
it
?.
appImgList
?.[
0
]?.
url
}
style=
{
{
width
:
26
,
height
:
26
,
objectFit
:
"cover"
,
marginRight
:
6
,
}
}
/>
)
}
<
span
>
{
it
.
label
}
</
span
>
</
div
>
</
Option
>
);
})
}
</
Select
>
<
HeaderDropdown
overlay=
{
menuHeaderDropdown
}
>
<
span
className=
{
`${styles.action} ${styles.account}`
}
>
<
Avatar
style=
{
{
marginRight
:
12
,
backgroundColor
:
"#1890ff"
}
}
>
{
currentUser
.
userName
.
substr
(
0
,
1
)
}
</
Avatar
>
<
UserOutlined
style=
{
{
color
:
"#57b9c6"
,
fontSize
:
20
,
margin
:
"0 4px"
}
}
/>
<
span
className=
{
`${styles.name} anticon`
}
>
{
currentUser
.
userName
}
</
span
>
<
DownOutlined
style=
{
{
fontSize
:
14
,
marginLeft
:
4
}
}
/>
</
span
>
</
HeaderDropdown
>
</
div
>
...
...
src/pages/system/Staff/fields.jsx
View file @
5f64d2dc
...
...
@@ -9,27 +9,37 @@ import {
}
from
"@/services/system"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
export
default
{
// accountName: {
// value: null,
// type: "input",
// title: "用户名",
// name: ["accountName"],
// required: true,
// },
// userName: {
// value: null,
// type: "input",
// title: "姓名",
// name: ["userName"],
// required: true,
// },
accountName
:
{
value
:
null
,
type
:
"input"
,
title
:
"用户名"
,
type
:
"autocompleteinput"
,
title
:
"用户名-姓名-联系电话-邮箱"
,
name
:
[
"accountName"
],
required
:
true
,
},
userName
:
{
value
:
null
,
type
:
"input"
,
title
:
"姓名"
,
name
:
[
"userName"
],
required
:
true
,
},
telephone
:
{
value
:
null
,
type
:
"input"
,
title
:
"联系电话"
,
name
:
[
"telephone"
],
required
:
false
,
},
requestOptions
:
{
url
:
"/ngic-auth/sysUser/queryLikeIotUsername"
,
params
:
"userName"
,
},
},
// telephone: {
// value: null,
// type: "input",
// title: "联系电话",
// name: ["telephone"],
// required: false,
// },
departmentId
:
{
value
:
null
,
type
:
"treeselect"
,
...
...
@@ -63,10 +73,14 @@ export default {
required
:
false
,
belinked
:
{
options
:
{
database
:
(
params
)
=>
doFetch
({
url
:
"/ngic-auth/sysStore/selectionBox"
,
params
:
{
...
params
}
}),
database
:
(
params
)
=>
doFetch
({
url
:
"/wmspro/ngic-auth/sysStore/selectionBox"
,
params
:
{
...
params
},
}),
params
:
{
factoryIdList
:
"linked"
}
factoryIdList
:
"linked"
,
}
,
},
},
multiple
:
true
,
...
...
@@ -98,16 +112,16 @@ export default {
},
},
},
mailNo
:
{
value
:
null
,
type
:
"input"
,
title
:
"邮箱"
,
name
:
[
"mailNo"
],
required
:
false
,
col
:
{
span
:
12
,
},
},
//
mailNo: {
//
value: null,
//
type: "input",
//
title: "邮箱",
//
name: ["mailNo"],
//
required: false,
//
col: {
//
span: 12,
//
},
//
},
remark
:
{
value
:
null
,
type
:
"textarea"
,
...
...
src/pages/user/Login/index.jsx
View file @
5f64d2dc
...
...
@@ -3,7 +3,7 @@ import {
UserOutlined
,
LoginOutlined
,
ArrowRightOutlined
,
CloseOutlined
CloseOutlined
,
}
from
"@ant-design/icons"
;
import
{
Alert
,
message
,
Tabs
,
Row
,
Col
,
Button
,
Input
}
from
"antd"
;
import
React
,
{
useState
,
useRef
}
from
"react"
;
...
...
@@ -15,7 +15,7 @@ import {
LoginForm
,
ProFormTreeSelect
,
ProFormSelect
,
ProFormTextArea
ProFormTextArea
,
}
from
"@ant-design/pro-form"
;
import
{
Link
,
history
,
FormattedMessage
,
useModel
}
from
"umi"
;
import
{
fakeAccountLogin
,
saveForRegister
}
from
"@/services/login"
;
...
...
@@ -36,8 +36,7 @@ import {
roleSelectRegister
,
}
from
"@/services/system"
;
import
{
doFetch
}
from
"@/utils/doFetch"
;
import
{
ProDescriptions
}
from
'@ant-design/pro-components'
;
import
{
ProDescriptions
}
from
"@ant-design/pro-components"
;
const
{
Search
}
=
Input
;
...
...
@@ -65,35 +64,54 @@ const Login = () => {
//登录
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
();
const
postdata
=
{
accountName
:
values
.
userName
,
password
:
password
,
encryptKey
:
newtimestamp
,
};
//
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: password,
//
encryptKey: newtimestamp,
//
};
try
{
// 登录
const
res
=
await
fakeAccountLogin
({
...
postdata
});
if
(
res
.
code
===
"0000"
)
{
let
token
=
res
?.
data
?.
token
;
// const res = await fakeAccountLogin({ ...postdata });
const
res
=
await
doFetch
({
url
:
`/token/oauth/token?grant_type=password&client_id=NGWMS3&client_secret=wms_Nangao@2022&username=
${
values
.
userName
}
&password=
${
values
.
password
}
`
,
});
if
(
res
.
access_token
)
{
let
token
=
res
?.
access_token
;
localStorage
.
setItem
(
"TOKEN_MES"
,
token
);
await
fetchUserInfo
();
message
.
success
(
"🎉 🎉 🎉 登录成功!"
);
/** 此方法会跳转到 redirect 参数所在的位置 */
console
.
log
(
history
);
if
(
!
history
)
return
;
const
{
query
}
=
history
.
location
;
const
{
redirect
}
=
query
;
history
.
push
(
redirect
||
"/"
);
return
;
//
const { query } = history.location;
//
const { redirect } = query;
history
.
push
(
"/"
);
//
return;
}
// 旧的登录
// if (res.code === "0000") {
// let token = res?.data?.token;
// localStorage.setItem("TOKEN_MES", token);
// await fetchUserInfo();
// message.success("🎉 🎉 🎉 登录成功!");
// /** 此方法会跳转到 redirect 参数所在的位置 */
// console.log(history);
// if (!history) return;
// const { query } = history.location;
// const { redirect } = query;
// history.push(redirect || "/");
// return;
// }
}
catch
(
error
)
{
message
.
error
(
res
.
msg
);
}
...
...
@@ -109,16 +127,13 @@ const Login = () => {
}
};
const
handleSubmit
=
async
(
values
)
=>
{
if
(
tabkey
==
"1"
)
{
await
handleLogin
(
values
)
await
handleLogin
(
values
)
;
}
else
{
await
handleReg
(
values
)
}
await
handleReg
(
values
);
}
};
return
(
<
Row
className=
{
styles
.
container
}
>
...
...
@@ -133,16 +148,24 @@ const Login = () => {
<
div
className=
"cover"
>
<
img
alt=
"logo"
src=
{
require
(
"@/assets/logo_white.png"
)
}
/>
</
div
>
{
visible
&&
<
div
className=
{
styles
.
search
}
>
<
h2
style=
{
{
fontSize
:
16
,
borderBottom
:
"6px solid #eee"
,
marginBottom
:
12
,
paddingBottom
:
12
}
}
className=
"spread"
>
<
a
>
查询注册进度
</
a
>
<
CloseOutlined
style=
{
{
color
:
"red"
}
}
onClick=
{
()
=>
{
setvisible
(
false
)
}
}
>
</
CloseOutlined
>
{
visible
&&
(
<
div
className=
{
styles
.
search
}
>
<
h2
style=
{
{
fontSize
:
16
,
borderBottom
:
"6px solid #eee"
,
marginBottom
:
12
,
paddingBottom
:
12
,
}
}
className=
"spread"
>
<
a
>
查询注册进度
</
a
>
<
CloseOutlined
style=
{
{
color
:
"red"
}
}
onClick=
{
()
=>
{
setvisible
(
false
);
}
}
></
CloseOutlined
>
</
h2
>
<
Search
placeholder=
"请输入用户名"
...
...
@@ -166,129 +189,139 @@ const Login = () => {
<
ProDescriptions
columns=
{
[
{
"title"
:
"用户名"
,
"dataIndex"
:
"accountName"
,
"key"
:
"accountName"
title
:
"用户名"
,
dataIndex
:
"accountName"
,
key
:
"accountName"
,
},
{
"title"
:
"姓名"
,
"dataIndex"
:
"userName"
,
"key"
:
"userName"
title
:
"姓名"
,
dataIndex
:
"userName"
,
key
:
"userName"
,
},
{
"title"
:
"联系电话"
,
"dataIndex"
:
"telephone"
,
"key"
:
"telephone"
title
:
"联系电话"
,
dataIndex
:
"telephone"
,
key
:
"telephone"
,
},
{
"title"
:
"工厂"
,
"dataIndex"
:
"factoryName"
,
"key"
:
"factoryName"
title
:
"工厂"
,
dataIndex
:
"factoryName"
,
key
:
"factoryName"
,
},
{
"title"
:
"组织"
,
"dataIndex"
:
"departmentName"
,
"key"
:
"departmentName"
title
:
"组织"
,
dataIndex
:
"departmentName"
,
key
:
"departmentName"
,
},
{
"title"
:
"负责仓库"
,
"dataIndex"
:
"chargeStoreName"
,
"key"
:
"chargeStoreName"
title
:
"负责仓库"
,
dataIndex
:
"chargeStoreName"
,
key
:
"chargeStoreName"
,
},
{
"title"
:
"角色"
,
"dataIndex"
:
"roleName"
,
"key"
:
"roleName"
title
:
"角色"
,
dataIndex
:
"roleName"
,
key
:
"roleName"
,
},
{
"title"
:
"直属领导"
,
"dataIndex"
:
"parentName"
,
"key"
:
"parentName"
title
:
"直属领导"
,
dataIndex
:
"parentName"
,
key
:
"parentName"
,
},
{
"title"
:
"邮箱"
,
"dataIndex"
:
"mailNo"
,
"key"
:
"mailNo"
title
:
"邮箱"
,
dataIndex
:
"mailNo"
,
key
:
"mailNo"
,
},
{
"title"
:
"审批结果"
,
"dataIndex"
:
"auditResultName"
,
"key"
:
"auditResultName"
title
:
"审批结果"
,
dataIndex
:
"auditResultName"
,
key
:
"auditResultName"
,
},
{
"title"
:
"审批意见"
,
"dataIndex"
:
"auditOpinion"
,
"key"
:
"auditOpinion"
title
:
"审批意见"
,
dataIndex
:
"auditOpinion"
,
key
:
"auditOpinion"
,
},
{
"title"
:
"审批状态"
,
"dataIndex"
:
"statusName"
,
"key"
:
"statusName"
title
:
"审批状态"
,
dataIndex
:
"statusName"
,
key
:
"statusName"
,
},
{
"title"
:
"备注"
,
"dataIndex"
:
"remark"
,
"key"
:
"remark"
title
:
"备注"
,
dataIndex
:
"remark"
,
key
:
"remark"
,
},
{
"title"
:
"申请时间"
,
"dataIndex"
:
"applyTime"
,
"key"
:
"applyTime"
title
:
"申请时间"
,
dataIndex
:
"applyTime"
,
key
:
"applyTime"
,
},
{
"title"
:
"审批时间"
,
"dataIndex"
:
"auditTime"
,
"key"
:
"auditTime"
title
:
"审批时间"
,
dataIndex
:
"auditTime"
,
key
:
"auditTime"
,
},
{
"title"
:
"审批人"
,
"dataIndex"
:
"auditUserName"
,
"key"
:
"auditUserName"
}
title
:
"审批人"
,
dataIndex
:
"auditUserName"
,
key
:
"auditUserName"
,
}
,
]
}
column=
{
1
}
dataSource=
{
data
}
></
ProDescriptions
>
</
div
>
}
)
}
</
div
>
</
Col
>
<
Col
{
...
cols
}
onClick=
{
()
=>
{
setvisible
(
false
)
}
}
>
<
div
className=
"logincontent"
style=
{
{
width
:
"100%"
,
height
:
"100%"
,
display
:
"flex"
,
flexDirection
:
"column"
}
}
>
<
Col
{
...
cols
}
onClick=
{
()
=>
{
setvisible
(
false
);
}
}
>
<
div
className=
"logincontent"
style=
{
{
width
:
"100%"
,
height
:
"100%"
,
display
:
"flex"
,
flexDirection
:
"column"
,
}
}
>
<
div
className=
{
styles
.
content
}
>
<
LoginForm
submitter=
{
{
render
:
(
props
)
=>
{
return
<
Button
return
(
<
Button
{
...
props
}
style=
{
{
width
:
"100%"
}
}
type=
"primary"
size=
"large"
icon=
{
tabkey
===
"1"
?
<
LoginOutlined
/>
:
<
ArrowRightOutlined
/>
}
icon=
{
tabkey
===
"1"
?
(
<
LoginOutlined
/>
)
:
(
<
ArrowRightOutlined
/>
)
}
onClick=
{
async
()
=>
{
let
values
=
await
formRef
.
current
.
validateFields
()
let
values
=
await
formRef
.
current
.
validateFields
();
await
handleSubmit
(
values
);
}
}
>
{
tabkey
===
"1"
?
"登录"
:
"注册"
}
</
Button
>
}
);
},
}
}
onValuesChange=
{
async
(
values
)
=>
{
if
(
Object
.
keys
(
values
)[
0
]
==
"factoryIdList"
)
{
formRef
.
current
.
setFieldsValue
({
storeIdList
:
[]
});
}
}
}
title=
{
<
span
style=
{
{
color
:
"#fff"
}
}
>
WMS
</
span
>
}
subTitle=
{
...
...
@@ -302,7 +335,10 @@ const Login = () => {
onFinish=
{
async
(
values
)
=>
{
await
handleSubmit
(
values
);
}
}
style=
{
{
width
:
tabkey
==
"2"
?
560
:
328
,
marginLeft
:
tabkey
==
"2"
?
-
116
:
0
}
}
//样式适配
style=
{
{
width
:
tabkey
==
"2"
?
560
:
328
,
marginLeft
:
tabkey
==
"2"
?
-
116
:
0
,
}
}
//样式适配
formRef=
{
formRef
}
>
<
Tabs
...
...
@@ -310,10 +346,17 @@ const Login = () => {
activeKey=
{
tabkey
}
onChange=
{
settabkey
}
tabBarStyle=
{
{
color
:
"#fff"
}
}
tabBarExtraContent=
{
<
a
style=
{
{
color
:
"rgba(255,255,255,0.6)"
}
}
onClick=
{
(
e
)
=>
{
tabBarExtraContent=
{
<
a
style=
{
{
color
:
"rgba(255,255,255,0.6)"
}
}
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
();
setvisible
(
true
)
}
}
>
查询注册进度
</
a
>
}
setvisible
(
true
);
}
}
>
查询注册进度
</
a
>
}
>
<
TabPane
tab=
"登录"
key=
"1"
>
{
tabkey
==
"1"
&&
(
...
...
@@ -322,7 +365,9 @@ const Login = () => {
name=
"userName"
fieldProps=
{
{
size
:
"large"
,
prefix
:
<
UserOutlined
className=
{
styles
.
prefixIcon
}
/>,
prefix
:
(
<
UserOutlined
className=
{
styles
.
prefixIcon
}
/>
),
}
}
placeholder=
"用户名"
rules=
{
[
...
...
@@ -336,7 +381,9 @@ const Login = () => {
name=
"password"
fieldProps=
{
{
size
:
"large"
,
prefix
:
<
LockOutlined
className=
{
styles
.
prefixIcon
}
/>,
prefix
:
(
<
LockOutlined
className=
{
styles
.
prefixIcon
}
/>
),
}
}
placeholder=
"密码"
rules=
{
[
...
...
@@ -356,8 +403,8 @@ const Login = () => {
<
ProFormText
fieldProps=
{
{
style
:
{
height
:
32
}
height
:
32
,
}
,
}
}
name=
"accountName"
label=
{
<
b
>
用户名
</
b
>
}
...
...
@@ -375,8 +422,8 @@ const Login = () => {
<
ProFormText
fieldProps=
{
{
style
:
{
height
:
32
}
height
:
32
,
}
,
}
}
name=
"userName"
label=
{
<
b
>
姓名
</
b
>
}
...
...
@@ -394,8 +441,8 @@ const Login = () => {
<
ProFormText
fieldProps=
{
{
style
:
{
height
:
32
}
height
:
32
,
}
,
}
}
name=
"telephone"
label=
{
<
b
>
联系电话
</
b
>
}
...
...
@@ -406,7 +453,8 @@ const Login = () => {
message
:
"请输入联系电话!"
,
},
{
pattern
:
/^
(((\d
{3,4}-
)?[
0-9
]
{7,8}
)
|
(
1
(
3|4|5|6|7|8|9
)\d
{9}
))
$/
,
pattern
:
/^
(((\d
{3,4}-
)?[
0-9
]
{7,8}
)
|
(
1
(
3|4|5|6|7|8|9
)\d
{9}
))
$/
,
message
:
"手机号格式错误!"
,
},
]
}
...
...
@@ -422,18 +470,18 @@ const Login = () => {
fieldNames
:
{
label
:
"title"
,
value
:
"key"
,
children
:
"children"
}
children
:
"children"
,
}
,
}
}
request=
{
async
()
=>
{
let
res
=
await
departmentTree
({});
return
res
?.
data
?.
dataList
??
[]
return
res
?.
data
?.
dataList
??
[]
;
}
}
rules=
{
[
{
required
:
true
,
message
:
"请选择组织!"
,
}
}
,
]
}
/>
</
Col
>
...
...
@@ -442,28 +490,28 @@ const Login = () => {
<
ProFormSelect
fieldProps=
{
{
mode
:
"multiple"
,
maxTagCount
:
1
maxTagCount
:
1
,
}
}
name=
"factoryIdList"
label=
{
<
b
>
工厂
</
b
>
}
placeholder=
"请选择工厂"
request=
{
async
()
=>
{
let
res
=
await
factorySelectRegister
({});
return
res
?.
data
?.
dataList
??
[]
return
res
?.
data
?.
dataList
??
[]
;
}
}
rules=
{
[
{
required
:
true
,
message
:
"请选择工厂!"
,
}
}
,
]
}
/>
</
Col
>
<
Col
span=
{
8
}
>
<
ProFormDependency
name=
{
[
"factoryIdList"
]
}
>
{
({
factoryIdList
})
=>
{
return
<
ProFormSelect
{
({
factoryIdList
})
=>
{
return
(
<
ProFormSelect
fieldProps=
{
{
mode
:
"multiple"
,
maxTagCount
:
1
,
...
...
@@ -474,19 +522,17 @@ const Login = () => {
params=
{
{
factoryIdList
}
}
request=
{
async
(
params
)
=>
{
let
res
=
await
storeselectionBoxAll
(
params
);
return
res
?.
data
?.
dataList
??
[]
return
res
?.
data
?.
dataList
??
[]
;
}
}
rules=
{
[
{
required
:
false
,
message
:
"请选择负责仓库!"
,
}
}
,
]
}
/>
}
}
);
}
}
</
ProFormDependency
>
</
Col
>
...
...
@@ -494,20 +540,20 @@ const Login = () => {
<
ProFormSelect
fieldProps=
{
{
mode
:
"multiple"
,
maxTagCount
:
1
maxTagCount
:
1
,
}
}
name=
"roleIdList"
label=
{
<
b
>
角色配置
</
b
>
}
placeholder=
"请选择角色配置"
request=
{
async
()
=>
{
let
res
=
await
roleSelectRegister
({});
return
res
?.
data
?.
dataList
??
[]
return
res
?.
data
?.
dataList
??
[]
;
}
}
rules=
{
[
{
required
:
false
,
message
:
"请选择角色配置!"
,
}
}
,
]
}
/>
</
Col
>
...
...
@@ -519,13 +565,13 @@ const Login = () => {
placeholder=
"请选择直属领导"
request=
{
async
()
=>
{
let
res
=
await
allUserSelect
({});
return
res
?.
data
?.
dataList
??
[]
return
res
?.
data
?.
dataList
??
[]
;
}
}
rules=
{
[
{
required
:
false
,
message
:
"请选择直属领导!"
,
}
}
,
]
}
/>
</
Col
>
...
...
@@ -533,8 +579,8 @@ const Login = () => {
<
ProFormText
fieldProps=
{
{
style
:
{
height
:
32
}
height
:
32
,
}
,
}
}
name=
"mailNo"
label=
{
<
b
>
邮箱
</
b
>
}
...
...
@@ -543,7 +589,7 @@ const Login = () => {
{
required
:
false
,
message
:
"请输入邮箱!"
,
}
}
,
]
}
/>
</
Col
>
...
...
@@ -555,13 +601,13 @@ const Login = () => {
placeholder=
"请输入备注"
request=
{
async
()
=>
{
let
res
=
await
allUserSelect
({});
return
res
?.
data
?.
dataList
??
[]
return
res
?.
data
?.
dataList
??
[]
;
}
}
rules=
{
[
{
required
:
false
,
message
:
"请输入备注!"
,
}
}
,
]
}
/>
</
Col
>
...
...
@@ -589,7 +635,6 @@ const Login = () => {
</
div
>
<
Footer
></
Footer
>
</
div
>
</
Col
>
</
Row
>
);
...
...
src/services/login.js
View file @
5f64d2dc
...
...
@@ -10,7 +10,7 @@ export async function fakeAccountLogin(params) {
//登出
export
async
function
fakeAccountLoginOut
(
params
)
{
return
request
(
`/
wms/ngic-auth/sysAccount
/logout`
,
{
return
request
(
`/
mespro
/logout`
,
{
method
:
"POST"
,
body
:
params
,
});
...
...
@@ -27,15 +27,23 @@ export async function saveForRegister(params) {
//个人信息
export
async
function
queryCurrentUser
(
params
)
{
return
request
(
"/wms
/ngic-auth/sysUser/query
"
,
{
return
request
(
"/wms
pro/ngic-auth/sysUser/me
"
,
{
method
:
"POST"
,
data
:
params
,
});
}
// //获取菜单/权限/菜单/公司类型
// export async function getMenu(params) {
// return request(`/wms/ngic-auth/sysPermission/queryMenu`, {
// method: "POST",
// data: params,
// });
// }
//获取菜单/权限/菜单/公司类型
export
async
function
getMenu
(
params
)
{
return
request
(
`/wms/ngic-auth/sysPermission/queryMenu`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysPermission/queryMenu`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -43,7 +51,7 @@ export async function getMenu(params) {
/*---------------菜单收藏-------------------*/
export
async
function
collectPerms
(
params
)
{
return
request
(
`/wms/ngic-auth/sysUserPermission/collectPerm`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysUserPermission/collectPerm`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -51,14 +59,14 @@ export async function collectPerms(params) {
/*---------------取消菜单收藏-------------------*/
export
async
function
cancelCollectPerms
(
params
)
{
return
request
(
`/wms/ngic-auth/sysUserPermission/cancelCollectPerm`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysUserPermission/cancelCollectPerm`
,
{
method
:
"POST"
,
data
:
params
,
});
}
/*---------------菜单历史记录-------------------*/
export
async
function
mtosave
(
params
)
{
return
request
(
`/wms/ngic-auth/sysUserVisitPermission/save`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysUserVisitPermission/save`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
src/services/system.js
View file @
5f64d2dc
...
...
@@ -2,21 +2,21 @@ import request from "@/utils/request";
//工厂下拉框
export
async
function
factorySelect
(
params
)
{
return
request
(
`/wms/ngic-auth/sysFactory/selectionBox`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysFactory/selectionBox`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//查询个人所属工厂下拉框
export
async
function
factorySelectByuser
(
params
)
{
return
request
(
`/wms/ngic-auth/sysFactory/selectionBoxU`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysFactory/selectionBoxU`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//查询工厂下拉框---注册
export
async
function
factorySelectRegister
(
params
)
{
return
request
(
`/wms/ngic-auth/sysFactory/selectionBoxAll`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysFactory/selectionBoxAll`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -24,28 +24,28 @@ export async function factorySelectRegister(params) {
//全部车间下拉框
export
async
function
shopSelect
(
params
)
{
return
request
(
`/wms/ngic-auth/sysShop/selectionBox`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysShop/selectionBox`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//仓库下拉
export
async
function
storeselectionBoxAll
(
params
)
{
return
request
(
`/wms/ngic-auth/sysStore/selectionBox`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysStore/selectionBox`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//根据工厂id查询车间下拉
export
async
function
storeselectionBox
(
params
)
{
return
request
(
`/wms/ngic-auth/sysStore/selectionBox`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysStore/selectionBox`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//全部组织下拉
export
async
function
allDepartment
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/selectbox/depart`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysDepartment/query/selectbox/depart`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -53,77 +53,77 @@ export async function allDepartment(params) {
//根据工厂id查询车间下拉
export
async
function
shopSelectByFactory
(
params
)
{
return
request
(
`/wms/ngic-auth/sysShop/query/selectbox/factory`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysShop/query/selectbox/factory`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//根据车间id查询产线下拉
export
async
function
productionLineSelectByShop
(
params
)
{
return
request
(
`/wms/ngic-auth/sysProductionLine/query/selectbox/shopId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysProductionLine/query/selectbox/shopId`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//根据车间id集合查询产线下拉
export
async
function
productionLineSelectByShops
(
params
)
{
return
request
(
`/wms/ngic-auth/sysProductionLine/query/selectbox/shopIds`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysProductionLine/query/selectbox/shopIds`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//根据车间id查询工段下拉
export
async
function
sectionSelectByShop
(
params
)
{
return
request
(
`/wms/ngic-auth/sysSection/query/selectbox/shopId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysSection/query/selectbox/shopId`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//根据车间id集合查询工段下拉
export
async
function
sectionSelectByShops
(
params
)
{
return
request
(
`/wms/ngic-auth/sysSection/query/selectbox/shopIds`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysSection/query/selectbox/shopIds`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//授权前查询权限树
export
async
function
roleTree
(
params
)
{
return
request
(
`/wms/ngic-auth/sysRolePermission/queryAll`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysRolePermission/queryAll`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//角色下权限数据
export
async
function
adminDataqueryAll
(
params
)
{
return
request
(
`/wms/ngic-auth/sysRoleDataPermission/queryAll`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysRoleDataPermission/queryAll`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//不包含自己在内的全部用户下拉框
export
async
function
userSelect
(
params
)
{
return
request
(
`/wms/ngic-auth/sysUser/queryParentSelectionByUserId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysUser/queryParentSelectionByUserId`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//全部用户下拉框
export
async
function
allUserSelect
(
params
)
{
return
request
(
`/wms/ngic-auth/sysUser/query/selectbox/company`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysUser/query/selectbox/company`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//根据工厂id查询树结构
export
async
function
departmentTree
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/tree`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysDepartment/query/tree`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//查询角色下拉框
export
async
function
roleSelect
(
params
)
{
return
request
(
`/wms/ngic-auth/sysRole/queryAllSelectList`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysRole/queryAllSelectList`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -131,14 +131,14 @@ export async function roleSelect(params) {
//查询角色下拉框---注册
export
async
function
roleSelectRegister
(
params
)
{
return
request
(
`/wms/ngic-auth/sysRole/queryAllSelectByComId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysRole/queryAllSelectByComId`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//查询全部编号类型下拉框(登录人公司)
export
async
function
bmNoRule
(
params
)
{
return
request
(
`/wms/ngic-base-business/bmNoRule/querySelect`
,
{
return
request
(
`/wms
pro
/ngic-base-business/bmNoRule/querySelect`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -146,7 +146,7 @@ export async function bmNoRule(params) {
//根据物料查询产线下拉框
export
async
function
productionLineSelectByMaterieId
(
params
)
{
return
request
(
`/wms/ngic-auth/sysProductionLine/query/selectbox/materieId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysProductionLine/query/selectbox/materieId`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -154,7 +154,7 @@ export async function productionLineSelectByMaterieId(params) {
//根据物料查询班组下拉框
export
async
function
groupSelectByMaterieId
(
params
)
{
return
request
(
`/wms/ngic-auth/sysGroup/query/selectbox/materieId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysGroup/query/selectbox/materieId`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -162,7 +162,7 @@ export async function groupSelectByMaterieId(params) {
//根据物料查询班次下拉框
export
async
function
shiftSelectByMaterieId
(
params
)
{
return
request
(
`/wms/ngic-auth/sysShift/query/selectbox/materieId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysShift/query/selectbox/materieId`
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
@@ -170,21 +170,21 @@ export async function shiftSelectByMaterieId(params) {
//根据车间id查询班次下拉框
export
async
function
shiftSelectByShopId
(
params
)
{
return
request
(
`/wms/ngic-auth/sysShift/query/selectbox/shopId`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysShift/query/selectbox/shopId`
,
{
method
:
"POST"
,
data
:
params
,
});
}
//角色下拉框
export
async
function
roleList
(
params
)
{
return
request
(
`/wms/ngic-auth/sysRole/queryAllSelectList`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysRole/queryAllSelectList`
,
{
method
:
'POST'
,
data
:
params
,
});
}
//集团下拉框
export
async
function
factory
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/selectbox/factory`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysDepartment/query/selectbox/factory`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -193,21 +193,21 @@ export async function factory(params) {
// 4 :
//集团下拉框
export
async
function
zuzhi
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/tree`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysDepartment/query/tree`
,
{
method
:
'POST'
,
data
:
params
,
});
}
//集团下拉框
export
async
function
depart
(
params
)
{
return
request
(
`/wms/ngic-auth/sysDepartment/query/selectbox/depart`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysDepartment/query/selectbox/depart`
,
{
method
:
'POST'
,
data
:
params
,
});
}
//集团下拉框
export
async
function
selectionBoxAll
(
params
)
{
return
request
(
`/wms/ngic-auth/sysStore/selectionBoxAll`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysStore/selectionBoxAll`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -216,21 +216,21 @@ export async function selectionBoxAll(params) {
//下拉框---当前公司下
export
async
function
currentUserList
(
params
)
{
return
request
(
`/wms/ngic-auth/sysUser/query/selectbox/current/company`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysUser/query/selectbox/current/company`
,
{
method
:
'POST'
,
data
:
params
,
});
}
//当前公司所有工厂下拉
export
async
function
allShop
(
params
)
{
return
request
(
`/wms/ngic-auth/sysShop/query/selectbox/current/company`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysShop/query/selectbox/current/company`
,
{
method
:
'POST'
,
data
:
params
,
});
}
//当前公司所有车间下拉
export
async
function
allSection
(
params
)
{
return
request
(
`/wms/ngic-auth/sysSection/query/selectbox`
,
{
return
request
(
`/wms
pro
/ngic-auth/sysSection/query/selectbox`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -238,7 +238,7 @@ export async function allSection(params) {
//查询全部编号类型下拉框(登录人公司)
export
async
function
bmNoTypeadd
(
params
)
{
return
request
(
`/wms/ngic-base-business/bmNoType/querySelect`
,
{
return
request
(
`/wms
pro
/ngic-base-business/bmNoType/querySelect`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
@@ -246,7 +246,7 @@ export async function bmNoTypeadd(params) {
//查询全部编号类型下拉框(登录人公司)
export
async
function
bmNoType
(
params
)
{
return
request
(
`/wms/ngic-base-business/bmNoType/queryAllSelect`
,
{
return
request
(
`/wms
pro
/ngic-base-business/bmNoType/queryAllSelect`
,
{
method
:
'POST'
,
data
:
params
,
});
...
...
src/utils/doFetch.js
View file @
5f64d2dc
...
...
@@ -11,7 +11,7 @@ export async function doFetch({ url, params }) {
if
(
!
url
){
return
}
return
request
(
"/wms"
+
url
,
{
return
request
(
"/wms
pro
"
+
url
,
{
method
:
"POST"
,
data
:
params
,
});
...
...
src/utils/request.js
View file @
5f64d2dc
...
...
@@ -5,7 +5,8 @@
import
{
extend
}
from
"umi-request"
;
import
{
message
,
notification
,
Modal
}
from
"antd"
;
import
{
history
}
from
"umi"
;
const
{
NODE_ENV
}
=
process
.
env
;
const
baseUrl
=
NODE_ENV
==
"development"
?
"/wmspro"
:
""
;
const
codeMessage
=
{
200
:
"服务器成功返回请求的数据。"
,
201
:
"新建或修改数据成功。"
,
...
...
@@ -61,28 +62,67 @@ const request = extend({
// request拦截器, 改变url 或 options.
request
.
interceptors
.
request
.
use
(
async
(
url
,
options
)
=>
{
let
token
=
localStorage
.
getItem
(
"TOKEN_MES"
)
??
"9410b3f7de5d63f2be42d80ec8241d2d"
;
if
(
token
)
{
const
headers
=
let
token
=
localStorage
.
getItem
(
"TOKEN_MES"
)
??
""
,
headers
=
{};
if
(
NODE_ENV
==
"development"
&&
token
)
{
headers
=
options
.
type
==
"form"
?
{
token
:
token
,
Authorization
:
"Bearer "
+
token
,
}
:
{
"Content-Type"
:
"application/json"
,
Accept
:
"application/json"
,
token
:
token
,
Authorization
:
"Bearer "
+
token
,
};
return
{
url
:
url
,
options
:
{
...
options
,
headers
:
headers
},
}
else
{
headers
=
options
.
type
==
"form"
?
{}
:
{
"Content-Type"
:
"application/json"
,
Accept
:
"application/json"
,
};
}
return
{
url
:
baseUrl
+
url
,
options
:
{
...
options
,
headers
},
};
});
// response拦截器, 处理response
request
.
interceptors
.
response
.
use
(
async
(
response
,
options
)
=>
{
if
(
response
&&
response
.
status
)
{
const
errorText
=
codeMessage
[
response
.
status
]
||
response
.
statusText
;
const
{
status
,
url
}
=
response
;
if
(
response
?.
url
.
indexOf
(
"api/user_token"
)
==
-
1
&&
Object
.
keys
(
codeMessage
).
indexOf
(
String
(
response
.
status
))
>
-
1
)
{
notification
.
error
({
// message: `请求错误 ${status}: ${url}`,
description
:
errorText
,
});
}
if
(
status
==
"401"
)
{
clearCookie
();
}
if
(
status
==
"401"
||
status
==
"302"
||
status
==
"400"
)
{
if
(
NODE_ENV
==
"development"
)
{
}
else
{
window
.
location
.
href
=
"/"
;
}
}
}
else
if
(
!
response
)
{
if
(
response
?.
url
.
indexOf
(
"api/user_token"
)
==
-
1
)
{
notification
.
error
({
description
:
"您的网络发生异常,无法连接服务器"
,
message
:
"网络异常"
,
});
}
}
if
(
options
.
responseType
==
"blob"
)
{
const
data
=
await
response
.
clone
().
blob
();
let
blobUrl
=
window
.
URL
.
createObjectURL
(
data
);
...
...
@@ -102,6 +142,7 @@ request.interceptors.response.use(async (response, options) => {
}
else
{
const
data
=
await
response
.
clone
().
json
();
// 详情返回的response处理
if
(
data
?.
code
!=
"0000"
)
{
message
.
destroy
();
message
.
warn
(
data
?.
msg
);
...
...
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