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
Expand all
Hide 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
:
{
...
...
@@ -107,10 +118,10 @@ export const layout = async (props) => {
},
request
:
(
params
,
defaultMenuData
)
=>
{
let
lastArr
=
initialState
?.
newMenu
?.
userHavePermList
?
JSON
.
parse
(
JSON
.
stringify
(
initialState
?.
newMenu
?.
userHavePermList
)
)
:
[],
?
JSON
.
parse
(
JSON
.
stringify
(
initialState
?.
newMenu
?.
userHavePermList
)
)
:
[],
newArr
=
[
{
path
:
"/welcome"
,
...
...
@@ -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
{
...
...
@@ -130,9 +143,9 @@ const AvatarDropdown = ({ menu }) => {
padding
:
Pkcs7
,
}).
toString
();
let
newPassword
=
AES
.
encrypt
(
values
.
newPassword
,
Utf8
.
parse
(
timestamp
),
{
mode
:
ECB
,
padding
:
Pkcs7
,
}).
toString
(),
mode
:
ECB
,
padding
:
Pkcs7
,
}).
toString
(),
password
=
AES
.
encrypt
(
values
.
password
,
Utf8
.
parse
(
timestamp
),
{
mode
:
ECB
,
padding
:
Pkcs7
,
...
...
@@ -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
,
requestOptions
:
{
url
:
"/ngic-auth/sysUser/queryLikeIotUsername"
,
params
:
"userName"
,
},
},
userName
:
{
value
:
null
,
type
:
"input"
,
title
:
"姓名"
,
name
:
[
"userName"
],
required
:
true
,
},
telephone
:
{
value
:
null
,
type
:
"input"
,
title
:
"联系电话"
,
name
:
[
"telephone"
],
required
:
false
,
},
// 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
This diff is collapsed.
Click to expand it.
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
,
};
}
else
{
headers
=
options
.
type
==
"form"
?
{}
:
{
"Content-Type"
:
"application/json"
,
Accept
:
"application/json"
,
};
return
{
url
:
url
,
options
:
{
...
options
,
headers
:
headers
},
};
}
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