Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Iot_mobile
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
Iot_mobile
Commits
b123c292
Commit
b123c292
authored
Feb 21, 2023
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first step
parent
ec87ef93
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
496 additions
and
531 deletions
+496
-531
authRoutes.js
config/authRoutes.js
+1
-1
defaultSettings.js
config/defaultSettings.js
+2
-2
proxy.js
config/proxy.js
+48
-43
default.png
src/assets/default.png
+0
-0
index.jsx
src/components/AutoTable/index.jsx
+2
-6
index.less
src/components/AutoTable/index.less
+2
-0
index.jsx
src/components/IconFont/index.jsx
+8
-0
FormItems.jsx
src/components/InitForm/FormItems.jsx
+17
-16
index.jsx
src/components/InitForm/index.jsx
+8
-1
global.less
src/global.less
+44
-7
BasicLayout.jsx
src/layouts/BasicLayout.jsx
+221
-34
index.less
src/layouts/index.less
+28
-6
columns.js
src/pages/home/columns.js
+27
-306
index.jsx
src/pages/home/index.jsx
+76
-60
index.jsx
src/pages/login/index.jsx
+7
-44
doFetch.js
src/utils/doFetch.js
+2
-1
request.js
src/utils/request.js
+3
-4
No files found.
config/authRoutes.js
View file @
b123c292
...
...
@@ -13,7 +13,7 @@ export default [
redirect
:
'/home'
,
},
{
name
:
'
首页
'
,
name
:
'
设备
'
,
path
:
'/home'
,
component
:
'./home'
,
icon
:
'HomeOutlined'
,
...
...
config/defaultSettings.js
View file @
b123c292
const
Settings
=
{
name
:
'BASEPRO'
,
logo
:
'./logo.png'
,
proxypath
:
'/
sfx
'
,
proxypath
:
'/
basics
'
,
put_on_record
:
'江苏南高智能装备创新中心有限公司 版权所有 备案号: 苏ICP备18015471号'
,
output_path
:
'prods'
,
dev_env
:
'http://192.168.40.1
8/wms/
'
,
dev_env
:
'http://192.168.40.1
11:8000/basics
'
,
test_env
:
'http://192.168.40.18/wms/'
,
pro_env
:
'http://192.168.40.18/wms/'
,
};
...
...
config/proxy.js
View file @
b123c292
...
...
@@ -6,46 +6,51 @@
* For details, please see
* https://pro.ant.design/docs/deploy
*/
import
defaultSetting
from
'./defaultSettings'
;
let
rewrite
=
`^
${
defaultSetting
.
proxypath
}
`
;
export
default
{
dev
:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
target
:
defaultSetting
?.
dev_env
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
'/staticfile/'
:
{
target
:
'http://192.168.40.2/'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/staticfile'
:
''
,
},
},
},
test
:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
target
:
defaultSetting
?.
test_env
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
},
pre
:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
target
:
defaultSetting
?.
pro_env
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
},
};
\ No newline at end of file
import
defaultSetting
from
'./defaultSettings'
;
let
rewrite
=
`^
${
defaultSetting
.
proxypath
}
`
;
export
default
{
dev
:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
target
:
defaultSetting
?.
dev_env
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
'/token'
:
{
// 要代理的地址
target
:
'http://192.168.40.111:8000'
,
changeOrigin
:
true
,
},
'/staticfile/'
:
{
target
:
'http://192.168.40.2/'
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/staticfile'
:
''
,
},
},
},
test
:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
target
:
defaultSetting
?.
test_env
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
},
pre
:
{
[
defaultSetting
.
proxypath
]:
{
// 要代理的地址
target
:
defaultSetting
?.
pro_env
,
changeOrigin
:
true
,
pathRewrite
:
{
[
rewrite
]:
''
,
},
},
},
};
src/assets/default.png
0 → 100644
View file @
b123c292
103 KB
src/components/AutoTable/index.jsx
View file @
b123c292
...
...
@@ -58,7 +58,7 @@ export default (props) => {
...
searchparams
,
},
});
const
dataes
=
append
?.
data
?.
page
?.
list
??
append
?.
data
?.
dataList
??
[];
const
dataes
=
append
?.
data
?.
page
?.
records
??
append
?.
data
?.
dataList
??
[];
setData
((
val
)
=>
[...
val
,
...
dataes
]);
return
append
?.
data
?.
page
??
{
hasNextPage
:
false
};
}
...
...
@@ -108,6 +108,7 @@ export default (props) => {
<
SearchBar
style=
{
{
flex
:
1
}
}
placeholder=
"设备名称"
onChange=
{
(
val
)
=>
{
setsearchparams
((
s
)
=>
({
...
s
,
...
...
@@ -116,11 +117,6 @@ export default (props) => {
}
}
/>
</
div
>
<
div
className=
{
styles
.
right
}
>
<
Button
size=
"small"
color=
"primary"
onClick=
{
reFresh
}
>
搜索
</
Button
>
</
div
>
</
div
>
<
div
className=
{
styles
.
searchbar
}
style=
{
{
height
:
open
?
'40vh'
:
0
}
}
>
<
div
></
div
>
...
...
src/components/AutoTable/index.less
View file @
b123c292
...
...
@@ -11,6 +11,8 @@
width: 100%;
padding: 12px;
backdrop-filter: blur(2px);
background: linear-gradient(to bottom, #18344f, #1d3854) !important;
}
.left {
flex: auto;
...
...
src/components/IconFont/index.jsx
0 → 100644
View file @
b123c292
import
{
createFromIconfontCN
}
from
'@ant-design/icons'
;
//import scriptUrl from '@/renderer/assets/font_source/iconfont';
// <IconFont type="icon-tuichu" />
const
IconFont
=
createFromIconfontCN
({
scriptUrl
:
"//at.alicdn.com/t/c/font_3865952_4hid4n6dpng.js"
,
});
export
default
IconFont
;
src/components/InitForm/FormItems.jsx
View file @
b123c292
...
...
@@ -180,7 +180,7 @@ function Input({ item, colProps }) {
return
(
<>
<
ProFormText
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
{
...
item
.
formItemProps
,
rules
:
[
defaultrule
,
...(
item
?.
formItemProps
?.
rules
??
[])],
...
...
@@ -189,6 +189,7 @@ function Input({ item, colProps }) {
colProps=
{
item
.
colProps
??
colProps
}
label=
{
item
.
title
}
placeholder=
{
`请输入${item.title}`
}
/>
</>
);
...
...
@@ -198,7 +199,7 @@ function Password({ item, colProps }) {
return
(
<>
<
ProFormText
.
Password
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -214,7 +215,7 @@ function Money({ item, colProps }) {
<>
<
ProFormMoney
locale=
"zh-CN"
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -232,7 +233,7 @@ function Textarea({ item, colProps }) {
return
(
<>
<
ProFormTextArea
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
{
span
:
24
}
}
...
...
@@ -284,7 +285,7 @@ function Date({ item, colProps }) {
return
(
<>
<
ProFormDatePicker
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -375,7 +376,7 @@ function DateTime({ item, colProps }) {
return
(
<>
<
ProFormDateTimePicker
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -391,7 +392,7 @@ function DateRange({ item, colProps }) {
return
(
<>
<
ProFormDateRangePicker
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -407,7 +408,7 @@ function DateTimeRange({ item, colProps }) {
return
(
<>
<
ProFormDateTimeRangePicker
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -423,7 +424,7 @@ function Time({ item, colProps }) {
return
(
<>
<
ProFormTimePicker
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -439,7 +440,7 @@ function TimeRange({ item, colProps }) {
return
(
<>
<
ProFormTimePicker
.
RangePicker
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -464,7 +465,7 @@ function LinkSelect({ item, colProps, formRef, name, curindex }) {
convertValue=
{
(
value
)
=>
{
return
item
?.
fieldProps
?.
mode
==
'multiple'
?
(
!
value
?
[]
:
null
)
:
null
;
}
}
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
curkey
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -708,7 +709,7 @@ function LinkCheckbox({ item, colProps, formRef, name, curindex }) {
const
curkey
=
item
.
key
??
item
.
dataIndex
;
return
(
<
ProFormCheckbox
.
Group
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
curkey
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -824,7 +825,7 @@ function LinkRadio({ item, colProps, formRef, name, curindex }) {
const
curkey
=
item
.
key
??
item
.
dataIndex
;
return
(
<
ProFormRadio
.
Group
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
curkey
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -1036,7 +1037,7 @@ function Switch({ item, colProps }) {
return
(
<>
<
ProFormSwitch
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -1052,7 +1053,7 @@ function Rate({ item, colProps }) {
return
(
<>
<
ProFormRate
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
@@ -1068,7 +1069,7 @@ function Slider({ item, colProps }) {
<>
<
ProFormSlider
{
...
item
?
.
fieldProps
}
fieldProps=
{
item
?.
fieldProps
}
fieldProps=
{
{...
item
?.
fieldProps
,
size
:
"large"
}
}
formItemProps=
{
item
.
formItemProps
}
name=
{
item
.
key
??
item
.
dataIndex
}
colProps=
{
item
.
colProps
??
colProps
}
...
...
src/components/InitForm/index.jsx
View file @
b123c292
...
...
@@ -108,7 +108,14 @@ function InitForm({
onFinish=
{
onFinish
}
formKey=
{
formKey
??
parseInt
(
Math
.
random
()
*
1000000
)
}
params=
{
params
}
submitter=
{
submitter
??
true
}
submitter=
{
submitter
??
{
resetButtonProps
:{
size
:
"large"
,
},
submitButtonProps
:{
size
:
"large"
}
}
}
grid=
{
true
}
rowProps=
{
{
gutter
:
12
,
...
...
src/global.less
View file @
b123c292
...
...
@@ -5,7 +5,13 @@ body,
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow-x: hidden;
}
body {
background: linear-gradient(to bottom, #142f4d, #657b90) !important;
}
.ant-layout-content {
padding: 0 !important;
}
...
...
@@ -34,11 +40,19 @@ a {
:root:root {
--adm-color-primary: #3878e4;
--adm-color-background: #0d2152;
--adm-color-background: #546e84;
--adm-color-danger: #ff6d6d;
--adm-color-border: #ffffff5a;
}
.adm-action-sheet-button-item {
background-color: #546e84 !important;
div {
color: #fff;
}
}
.adm-list-item{
.adm-list-item
{
background-color: transparent;
a:hover{
a:hover
{
color: #fff !important;
}
}
...
...
@@ -59,7 +73,6 @@ a {
border-bottom: none !important;
border-radius: 0;
background-color: transparent !important;
}
.ant-input-affix-wrapper,
...
...
@@ -69,20 +82,44 @@ a {
background-color: transparent !important;
}
}
.split{
.split
{
padding: 6px 0;
margin: 0px 12px;
border-top: 1px dashed #f0f0f01d;
border-bottom: 1px dashed #f0f0f01a;
}
.ant-drawer-content{
.ant-drawer-content
{
background: linear-gradient(to bottom, #142f4d, #657b90) !important;
}
*:focus {
outline: none;
}
.spread{
.spread
{
display: flex;
justify-content: space-between;
align-items: center;
}
.popcontian{
form{
.ant-space:last-child{
display: flex;
width: 100%;
justify-content: flex-end;
}
}
}
a:active{
color: #fff;
}
.rightsection{
margin: 22px 0;
height: 112px;
display: flex;
justify-content: space-between;
flex-direction: column;
padding-left: 12px;
h2,h3,p{
margin: 0;
margin-bottom: 0;
}
}
\ No newline at end of file
src/layouts/BasicLayout.jsx
View file @
b123c292
This diff is collapsed.
Click to expand it.
src/layouts/index.less
View file @
b123c292
.container {
background: linear-gradient(to bottom, #142f4d, #657b90) !important;
min-height: 100vh;
div {
>
div {
color: #fff;
}
}
.popcontian {
padding: 24px;
h2 {
color: #fff;
margin-top: 0;
}
}
.top {
position: fixed;
top: 0;
...
...
@@ -16,6 +21,7 @@
right: 0;
margin: auto;
backdrop-filter: blur(2px);
background: linear-gradient(to bottom, #142f4d, #18344f) !important;
}
.bottom {
...
...
@@ -32,13 +38,29 @@
justify-content: center;
align-items: center;
border-radius: 12px 12px 0 0;
box-shadow: 0px -2px 16px rgba(0, 0, 0, 0.
8
);
box-shadow: 0px -2px 16px rgba(0, 0, 0, 0.
474
);
> div {
width: 100%;
}
}
.userinfo{
.userinfo {
color: #fff;
}
.adm-tab-bar-item {
color: #fff;
}
\ No newline at end of file
}
.adm-tab-bar-item-active {
color: #3878e4;
.adm-tab-bar-item-title {
opacity: 0;
}
.adm-tab-bar-item-icon {
font-size: 30px !important;
margin-top: 8px;
}
}
src/pages/home/columns.js
View file @
b123c292
function
getcolumns
(
setdrawer
)
{
return
[
{
tab
:
'123'
,
key
:
'1'
,
columns
:
[
{
title
:
'基础信息'
,
valueType
:
'split'
,
},
{
title
:
'用户名'
,
dataIndex
:
'accountName'
,
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
initialValue
:
'默认值'
,
hideInForm
:
false
,
convertValue
:
(
value
)
=>
{
return
`标题:
${
value
}
`
;
},
transform
:
(
value
)
=>
{
return
{
title
:
`
${
value
}
-转换`
,
};
},
search
:
false
,
render
:
(
text
,
row
)
=>
{
return
<
a
onClick
=
{()
=>
{}}
>
{
text
}
<
/a>
;
},
},
{
title
:
'姓名'
,
dataIndex
:
'userName'
,
key
:
'userId'
,
hideInForm
:
{
accountName
:
{
reverse
:
[
'1'
,
'2'
,
'5'
],
},
remark
:
[
'3'
],
},
search
:
false
,
},
{
title
:
'组织'
,
dataIndex
:
'departmentName'
,
key
:
'departmentId'
,
valueType
:
'Cascader'
,
mode
:
'multiple'
,
fieldProps
:
{
placeholder
:
'请选择'
,
},
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
options
:
{
path
:
'/ngic-auth/sysDepartment/query/tree'
,
params
:
{},
},
},
{
title
:
'工厂'
,
dataIndex
:
'factoryName'
,
key
:
'factoryIdList'
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
mode
:
'multiple'
,
allowClear
:
true
,
},
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
options
:
{
path
:
'/ngic-auth/sysFactory/selectionBox'
,
params
:
{},
},
},
{
title
:
'负责仓库'
,
dataIndex
:
'chargeStoreName'
,
key
:
'storeIdList'
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
mode
:
'multiple'
,
},
options
:
{
path
:
'/ngic-auth/sysStore/selectionBox'
,
linkParams
:
{
factoryIdList
:
''
,
},
},
hideInTable
:
true
,
},
{
title
:
'角色'
,
dataIndex
:
'roleName'
,
key
:
'roleIdList'
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
mode
:
'multiple'
,
},
options
:
[{
label
:
'12'
,
value
:
'12'
}],
hideInTable
:
true
,
},
{
title
:
'直属领导'
,
dataIndex
:
'parentName'
,
key
:
'parentId'
,
valueType
:
'select'
,
fieldProps
:
{
placeholder
:
'请选择'
,
showSearch
:
true
,
},
options
:
{
path
:
'/ngic-auth/sysUser/queryParentSelectionByUserId'
,
params
:
{},
},
hideInTable
:
true
,
},
{
title
:
'额外信息'
,
valueType
:
'split'
,
},
{
title
:
'联系电话'
,
dataIndex
:
'telephone'
,
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
search
:
false
,
},
{
title
:
'邮箱'
,
dataIndex
:
'mailNo'
,
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
search
:
false
,
},
{
title
:
'备注'
,
dataIndex
:
'remark'
,
valueType
:
'editor'
,
search
:
false
,
colProps
:
{
span
:
24
},
initialValue
:
'<p>Hello <b>World!</b></p>'
,
hideInTable
:
true
,
},
{
title
:
'上传样式-图片'
,
dataIndex
:
'uploadImage'
,
key
:
'uploadImage'
,
valueType
:
'uploadImage'
,
fieldProps
:
{
limit
:
2
,
},
formItemProps
:
{
rules
:
[
{
required
:
false
,
message
:
'此项为必填项'
,
},
],
},
hideInTable
:
true
},
{
title
:
'列表可选择'
,
valueType
:
'formSelectList'
,
rowKey
:
'id'
,
rowName
:
'accountName'
,
dataIndex
:
'lists'
,
hideInTable
:
true
,
colProps
:
{
xs
:
24
,
sm
:
24
,
},
columns
:
[
{
title
:
'用户名'
,
dataIndex
:
'accountName'
,
colProps
:
{
sm
:
8
,
},
editable
:
false
,
},
{
title
:
'姓名'
,
dataIndex
:
'userName'
,
valueType
:
'digit'
,
colProps
:
{
sm
:
8
,
},
},
{
title
:
'手机号'
,
dataIndex
:
'telephone'
,
colProps
:
{
sm
:
8
,
},
},
],
path
:
'/ngic-auth/sysUser/query/page'
,
linkParams
:
{
accountName
:
'userName'
,
},
//params 则不联动
search
:
false
,
rowSelection
:
{
type
:
'checkbox'
,
getCheckboxProps
:
(
record
)
=>
({
disabled
:
record
.
accountName
==
'GF'
,
}),
},
},
],
pathconfig
:
{
enableadd
:
true
,
enableedit
:
true
,
enabledelete
:
true
,
enabledetail
:
true
,
return
{
columns
:
[
{
title
:
'设备名称'
,
dataIndex
:
'deviceName'
,
key
:
'deviceName'
,
},
},
{
tab
:
'456'
,
key
:
'2'
,
columns
:
[
{
title
:
'维修单号'
,
dataIndex
:
'repairOrderNo'
,
key
:
'repairOrderNo'
,
},
{
title
:
'设备编号'
,
dataIndex
:
'equipmentNo'
,
key
:
'equipmentNo'
,
},
{
title
:
'设备名称'
,
dataIndex
:
'equipmentName'
,
key
:
'equipmentName'
,
},
{
title
:
'故障描述'
,
dataIndex
:
'faultDescription'
,
key
:
'faultDescription'
,
},
{
title
:
'报修人员'
,
dataIndex
:
'repairUserName'
,
key
:
'repairUserName'
,
},
{
title
:
'报修时间'
,
dataIndex
:
'repairTime'
,
key
:
'repairTimeList'
,
valueType
:
'dateTimeRange'
,
},
{
title
:
'报修单号'
,
dataIndex
:
'repairNo'
,
key
:
'repairNo'
,
},
{
title
:
'工单状态'
,
dataIndex
:
'statusName'
,
key
:
'statusName'
,
},
],
pathconfig
:
{
enableadd
:
true
,
enableedit
:
true
,
enabledelete
:
true
,
enabledetail
:
true
,
{
title
:
'设备状态'
,
dataIndex
:
'deviceStatusName'
,
key
:
'deviceStatusName'
,
},
{
title
:
'活跃时间'
,
dataIndex
:
'lastActivityTime'
,
key
:
'lastActivityTime'
,
},
{
title
:
'日均开动率'
,
dataIndex
:
'powerOnRate'
,
key
:
'powerOnRate'
,
},
],
pathconfig
:
{
enableadd
:
true
,
enableedit
:
true
,
enabledelete
:
true
,
enabledetail
:
true
,
},
]
;
}
;
}
export
default
getcolumns
;
src/pages/home/index.jsx
View file @
b123c292
/* eslint-disable eqeqeq */
import
*
as
React
from
'react'
;
import
{
useState
,
useMemo
,
useRef
}
from
'react'
;
import
DrawerPro
from
'@/components/DrawerPro'
;
...
...
@@ -7,9 +8,12 @@ import getcolumns from './columns';
import
{
useAsyncEffect
,
useRequest
}
from
'ahooks'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
ReactECharts
from
'echarts-for-react'
;
import
Settings
from
'../../../config/defaultSettings'
;
const
{
proxypath
}
=
Settings
;
function
cropImage
(
url
)
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
(
resolve
)
=>
{
const
img
=
new
Image
();
img
.
crossOrigin
=
'Anonymous'
;
img
.
src
=
url
;
...
...
@@ -22,8 +26,18 @@ function cropImage(url) {
ctx
.
beginPath
();
ctx
.
arc
(
size
/
2
,
size
/
2
,
size
/
2
,
0
,
2
*
Math
.
PI
);
ctx
.
clip
();
ctx
.
drawImage
(
img
,
(
img
.
width
-
size
)
/
2
,
(
img
.
height
-
size
)
/
2
,
size
,
size
,
0
,
0
,
size
,
size
);
canvas
.
toBlob
(
blob
=>
{
ctx
.
drawImage
(
img
,
(
img
.
width
-
size
)
/
2
,
(
img
.
height
-
size
)
/
2
,
size
,
size
,
0
,
0
,
size
,
size
,
);
canvas
.
toBlob
((
blob
)
=>
{
const
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
blob
);
reader
.
onloadend
=
()
=>
{
...
...
@@ -33,28 +47,51 @@ function cropImage(url) {
};
});
}
const
Cards
=
({
item
,
columns
})
=>
{
const
[
option
,
setoption
]
=
useState
({});
const
{
statusColorList
,
deviceStatusDurationList
}
=
item
;
useAsyncEffect
(
async
()
=>
{
let
img
=
item
?.
image
?.
length
>
0
?
proxypath
+
item
.
image
?.[
0
]?.
url
:
require
(
'@/assets/default.png'
);
const
image
=
await
cropImage
(
img
);
let
normalColor
=
statusColorList
.
filter
((
el
)
=>
el
.
type
==
3
)?.[
0
]?.
color
??
''
;
let
data
=
deviceStatusDurationList
?.
map
((
it
)
=>
{
let
label
=
statusColorList
.
filter
((
el
)
=>
el
.
type
==
it
.
name
)?.[
0
]?.
name
??
''
,
itemColor
=
statusColorList
.
filter
((
el
)
=>
el
.
type
==
it
.
name
)?.[
0
]?.
color
??
''
;
return
{
...
it
,
label
,
itemStyle
:
{
color
:
itemColor
,
},
};
})
??
[
{
name
:
'关机'
,
value
:
1
,
itemStyle
:
{
color
:
normalColor
,
},
},
];
useAsyncEffect
(
async
()
=>
{
const
image
=
await
cropImage
(
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fci.xiaohongshu.com%2F5fa1e703-a04f-b373-0e3f-f0afd5e12a9d%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fci.xiaohongshu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1679472844&t=e0db0d99ce81259343ab29af461e7722"
)
const
options
=
{
series
:
[
{
type
:
'pie'
,
radius
:
[
'
50%'
,
'70
%'
],
radius
:
[
'
85%'
,
'95
%'
],
avoidLabelOverlap
:
false
,
label
:
{
show
:
false
,
position
:
'center'
position
:
'center'
,
},
data
:
[
{
value
:
335
,
name
:
'直接访问'
},
{
value
:
310
,
name
:
'邮件营销'
},
{
value
:
234
,
name
:
'联盟广告'
},
{
value
:
135
,
name
:
'视频广告'
},
{
value
:
1548
,
name
:
'搜索引擎'
},
],
data
,
},
],
graphic
:
{
...
...
@@ -63,37 +100,43 @@ const Cards = ({ item, columns }) => {
type
:
'image'
,
style
:
{
image
:
image
,
width
:
56
,
height
:
56
,
width
:
88
,
height
:
88
,
},
left
:
"center"
,
top
:
"center"
left
:
'center'
,
top
:
'center'
,
},
],
},
};
setoption
(
options
)
},[
item
])
setoption
(
options
);
},
[
item
]);
return
(
<
div
className=
"split"
>
<
div
className=
"spread"
style=
{
{
justifyContent
:
"flex-start"
}
}
>
<
div
style=
{
{
width
:
120
,
height
:
120
,
flexShrink
:
0
}
}
>
<
ReactECharts
option=
{
option
}
style=
{
{
height
:
"100%"
}
}
/>
<
div
className=
"spread"
style=
{
{
justifyContent
:
'flex-start'
}
}
>
<
div
style=
{
{
width
:
120
,
height
:
120
,
flexShrink
:
0
}
}
>
<
ReactECharts
option=
{
option
}
style=
{
{
height
:
'100%'
}
}
/>
</
div
>
<
div
style=
{
{
flex
:
1
}
}
>
<
div
style=
{
{
flex
:
1
}
}
className=
"rightsection"
>
{
columns
?.
filter
((
it
)
=>
!
(
it
.
valueType
===
'split'
||
it
?.
hideInTable
))
?.
map
((
it
)
=>
{
?.
map
((
it
,
i
)
=>
{
const
Bod
=
({
children
})
=>
i
==
0
?
(
<
h2
>
{
children
}
</
h2
>
)
:
i
==
1
?
(
<
h3
>
{
children
}
</
h3
>
)
:
(
<
p
>
{
children
}
</
p
>
);
return
(
<
div
key=
{
it
?.
dataIndex
}
arrow=
{
false
}
style=
{
{
fontSize
:
15
}
}
>
<
Bod
key=
{
it
?.
dataIndex
}
>
{
it
?.
title
}
{
item
[
it
?.
dataIndex
]
}
</
div
>
</
Bod
>
);
})
}
</
div
>
...
...
@@ -124,48 +167,21 @@ function Home(props) {
});
const
columns
=
useMemo
(()
=>
{
let
defcolumn
=
getcolumns
(
setdrawer
).
filter
(
(
it
)
=>
it
.
key
===
activeTabKey
,
)[
0
]?.
columns
;
let
defcolumn
=
getcolumns
(
setdrawer
)?.
columns
;
return
defcolumn
;
},
[
activeTabKey
]);
const
pathconfig
=
useMemo
(()
=>
{
let
defpath
=
getcolumns
(
setdrawer
).
filter
((
it
)
=>
it
.
key
===
activeTabKey
)[
0
]
?.
pathconfig
??
{};
let
defpath
=
getcolumns
()?.
pathconfig
??
{};
return
defpath
;
},
[
activeTabKey
]);
return
(
<
div
style=
{
{
position
:
'relative'
}
}
>
<
AutoTable
pagetitle=
"左金玲"
columns=
{
columns
}
path=
{
pathconfig
?.
list
||
'/ngic-auth/sysUser/query/page
'
}
path=
{
'/app/device/index
'
}
actionRef=
{
actionRef
}
pageextra=
{
pathconfig
?.
enableadd
?
'add'
:
null
}
resizeable=
{
true
}
addconfig=
{
{
// access: 'sysDepartment_save',
btn
:
{
disabled
:
false
,
onClick
:
()
=>
{
setdrawer
((
s
)
=>
({
...
s
,
open
:
true
,
item
:
null
,
title
:
'新增'
,
val
:
'add'
,
}));
},
},
}
}
tabList=
{
getcolumns
()
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
(
key
)
=>
{
setactiveTabKey
(
key
);
}
}
>
<
Cards
/>
</
AutoTable
>
...
...
src/pages/login/index.jsx
View file @
b123c292
...
...
@@ -17,19 +17,8 @@ import { message, Space, Button } from 'antd';
import
{
useState
}
from
'react'
;
import
'./index.less'
;
import
{
history
}
from
'@umijs/max'
;
import
{
doFetch
}
from
'@/utils/doFetch'
;
import
AES
from
'crypto-js/aes'
;
import
ECB
from
'crypto-js/mode-ecb'
;
import
Pkcs7
from
'crypto-js/pad-pkcs7'
;
import
Utf8
from
'crypto-js/enc-utf8'
;
import
{
postFetch
,
getFetch
}
from
'@/utils/doFetch'
;
const
iconStyles
=
{
marginInlineStart
:
'16px'
,
color
:
'rgba(0, 0, 0, 0.2)'
,
fontSize
:
'24px'
,
verticalAlign
:
'middle'
,
cursor
:
'pointer'
,
};
export
default
()
=>
{
const
[
loginType
,
setLoginType
]
=
useState
(
'account'
);
...
...
@@ -58,39 +47,13 @@ export default () => {
</>
}
onFinish=
{
(
values
)
=>
{
let
timestamp
=
new
Date
().
getTime
()
+
'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
,
};
doFetch
({
url
:
'/ngic-auth/sysAccount/login'
,
params
:
postdata
,
postFetch
({
url
:
`/token/oauth/token?grant_type=password&client_id=admin&client_secret=123456&username=${values?.username}&password=${values?.password}`
,
}).
then
((
res
)
=>
{
if
(
res
.
code
===
'0000'
)
{
let
token
=
res
?.
data
?.
token
;
localStorage
.
setItem
(
'TOKENES'
,
token
);
message
.
success
(
'🎉 🎉 🎉 登录成功!'
);
history
.
push
(
'/'
);
return
;
}
let
token
=
res
?.
access_token
;
localStorage
.
setItem
(
'TOKENES'
,
token
);
message
.
success
(
'🎉 🎉 🎉 登录成功!'
);
history
.
push
(
'/'
);
});
}
}
>
...
...
src/utils/doFetch.js
View file @
b123c292
import
request
from
'./request'
;
import
defaultSetting
from
'../../config/defaultSettings'
;
export
async
function
doFetch
({
url
,
params
})
{
if
(
!
url
)
{
return
;
}
return
request
(
''
+
url
,
{
return
request
(
defaultSetting
.
proxypath
+
url
,
{
method
:
'post'
,
data
:
params
,
});
...
...
src/utils/request.js
View file @
b123c292
...
...
@@ -7,7 +7,6 @@ import { extend } from 'umi-request';
import
{
message
,
notification
,
Modal
}
from
'antd'
;
import
{
history
}
from
'@umijs/max'
;
import
qs
from
'query-string'
;
import
defaultSetting
from
'../../config/defaultSettings'
;
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
...
...
@@ -57,7 +56,7 @@ const errorHandler = (error) => {
*/
const
request
=
extend
({
prefix
:
defaultSetting
.
proxypath
,
//前缀代理
//
prefix: defaultSetting.proxypath, //前缀代理
errorHandler
,
// 默认错误处理
credentials
:
'include'
,
// 默认请求是否带上cookie
...
...
@@ -70,12 +69,12 @@ request.interceptors.request.use(async (url, options) => {
const
headers
=
options
.
type
==
'form'
?
{
token
:
token
,
Authorization
:
'Bearer '
+
token
,
}
:
{
'Content-Type'
:
'application/json'
,
Accept
:
'application/json'
,
token
:
token
,
Authorization
:
'Bearer '
+
token
,
};
return
{
url
:
url
,
...
...
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