Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ems3.3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuhao
ems3.3
Commits
7fa62c3f
Commit
7fa62c3f
authored
Dec 15, 2022
by
wuhao
🎯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asder
parent
c7729c19
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
87 deletions
+83
-87
app.jsx
src/app.jsx
+35
-65
index.jsx
src/components/DrawerPro/index.jsx
+0
-1
index.jsx
src/components/InitForm/index.jsx
+21
-18
index.jsx
src/components/SiderMenu/index.jsx
+3
-3
global.less
src/global.less
+18
-0
index.jsx
src/pages/device/account/index.jsx
+6
-0
No files found.
src/app.jsx
View file @
7fa62c3f
...
@@ -8,12 +8,9 @@ import TagView from '@/components/TagView';
...
@@ -8,12 +8,9 @@ import TagView from '@/components/TagView';
import
SiderMenu
from
'@/components/SiderMenu'
;
import
SiderMenu
from
'@/components/SiderMenu'
;
import
*
as
Ant4Icons
from
'@ant-design/icons'
;
import
*
as
Ant4Icons
from
'@ant-design/icons'
;
import
{
createElement
}
from
'react'
;
import
{
createElement
}
from
'react'
;
import
routes
from
'../config/authRoutes'
;
const
{
LinkOutlined
}
=
Ant4Icons
;
const
{
LinkOutlined
}
=
Ant4Icons
;
// const isDev = process.env.NODE_ENV === 'development';
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
const
isDev
=
false
;
//console.log(isDev);
const
loginPath
=
'/user/login'
;
const
loginPath
=
'/user/login'
;
/**
/**
...
@@ -35,7 +32,7 @@ export async function getInitialState() {
...
@@ -35,7 +32,7 @@ export async function getInitialState() {
const
msg
=
await
queryCurrentUser
();
const
msg
=
await
queryCurrentUser
();
return
msg
.
data
;
return
msg
.
data
;
}
catch
(
error
)
{
}
catch
(
error
)
{
//
history.push(loginPath);
history
.
push
(
loginPath
);
}
}
return
undefined
;
return
undefined
;
};
// 如果是登录页面,不执行
};
// 如果是登录页面,不执行
...
@@ -48,23 +45,14 @@ export async function getInitialState() {
...
@@ -48,23 +45,14 @@ export async function getInitialState() {
message
.
error
(
res
.
msg
);
message
.
error
(
res
.
msg
);
}
}
return
undefined
;
return
undefined
;
};
};
// 如果是登录页面,不执行
// 如果是登录页面,不执行
if
(
history
.
location
.
pathname
!==
loginPath
&&
token
)
{
if
(
history
.
location
.
pathname
!==
loginPath
&&
token
)
{
const
currentUserData
=
await
fetchUserInfo
();
const
currentUserData
=
await
fetchUserInfo
();
let
menuData
;
let
menuData
;
if
(
currentUserData
?.
data
?.
username
)
{
if
(
currentUserData
?.
data
?.
username
)
{
menuData
=
await
getmenuData
();
menuData
=
await
getmenuData
();
}
}
/* isdev */
if
(
isDev
)
{
menuData
=
{
recentUsePermList
:
[],
collectPerm
:
[],
userHavePermList
:
routes
,
};
}
return
{
return
{
fetchUserInfo
,
fetchUserInfo
,
currentUser
:
currentUserData
?.
data
,
currentUser
:
currentUserData
?.
data
,
...
@@ -74,23 +62,12 @@ export async function getInitialState() {
...
@@ -74,23 +62,12 @@ export async function getInitialState() {
collapsed
:
false
,
collapsed
:
false
,
};
};
}
}
let
menuData
=
{};
if
(
isDev
)
{
menuData
=
{
recentUsePermList
:
[],
collectPerm
:
[],
userHavePermList
:
routes
,
};
}
return
{
return
{
fetchUserInfo
,
fetchUserInfo
,
settings
:
defaultSettings
,
settings
:
defaultSettings
,
getmenuData
,
getmenuData
,
collapsed
:
false
,
collapsed
:
false
,
tagList
:
[],
tagList
:
[],
newMenu
:
menuData
,
};
};
}
}
...
@@ -98,18 +75,6 @@ export async function getInitialState() {
...
@@ -98,18 +75,6 @@ export async function getInitialState() {
export
const
layout
=
({
initialState
,
setInitialState
})
=>
{
export
const
layout
=
({
initialState
,
setInitialState
})
=>
{
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
let
token
=
localStorage
.
getItem
(
'TOKENES'
);
let
menurender
=
isDev
?
{}
:
{
menuRender
:
(
props
,
defaultDom
)
=>
{
if
(
props
.
isMobile
)
{
return
defaultDom
;
}
else
{
return
<
SiderMenu
{
...
props
}
/>;
}
},
};
return
{
return
{
disableContentMargin
:
false
,
disableContentMargin
:
false
,
waterMarkProps
:
{
waterMarkProps
:
{
...
@@ -123,16 +88,16 @@ export const layout = ({ initialState, setInitialState }) => {
...
@@ -123,16 +88,16 @@ export const layout = ({ initialState, setInitialState }) => {
onPageChange
:
()
=>
{
onPageChange
:
()
=>
{
const
{
location
}
=
history
;
const
{
location
}
=
history
;
// 如果没有登录,重定向到 login
// 如果没有登录,重定向到 login
//
if (!initialState?.currentUser && location.pathname !== loginPath) {
if
(
!
initialState
?.
currentUser
&&
location
.
pathname
!==
loginPath
)
{
//
history.push(loginPath);
history
.
push
(
loginPath
);
//
}
}
},
},
links
:
isDev
links
:
isDev
?
[
?
[
//
<Link key="openapi" to="/umi/plugin/openapi" target="_blank">
<
Link
key=
"openapi"
to=
"/umi/plugin/openapi"
target=
"_blank"
>
//
<LinkOutlined />
<
LinkOutlined
/>
//
<span>OpenAPI 文档</span>
<
span
>
OpenAPI 文档
</
span
>
//
</Link>,
</
Link
>,
]
]
:
[],
:
[],
//接口获取菜单数据
//接口获取菜单数据
...
@@ -142,26 +107,25 @@ export const layout = ({ initialState, setInitialState }) => {
...
@@ -142,26 +107,25 @@ export const layout = ({ initialState, setInitialState }) => {
userId
:
initialState
?.
currentUser
?.
id
,
userId
:
initialState
?.
currentUser
?.
id
,
},
},
request
:
(
params
,
defaultMenuData
)
=>
{
request
:
(
params
,
defaultMenuData
)
=>
{
//console.log(initialState);
let
lastArr
=
initialState
?.
newMenu
?.
userHavePermList
let
lastArr
=
initialState
?.
newMenu
?.
userHavePermList
?
JSON
.
parse
(
JSON
.
stringify
(
initialState
?.
newMenu
?.
userHavePermList
))
?
JSON
.
parse
(
JSON
.
stringify
(
initialState
?.
newMenu
?.
userHavePermList
))
:
[];
:
[],
//
newArr = [
newArr
=
[
// //
{
{
// //
path: '/welcome',
path
:
'/welcome'
,
// //
name: '首页',
name
:
'首页'
,
// //
icon: 'smile',
icon
:
'smile'
,
// //
component: './Welcome',
component
:
'./Welcome'
,
// //
haveChildren: false,
haveChildren
:
false
,
// //
key: '000000',
key
:
'000000'
,
// //
parentKey: '0',
parentKey
:
'0'
,
// //
routes: [],
routes
:
[],
// //
children: null,
children
:
null
,
// //
title: null,
title
:
null
,
// //
},
},
//
].concat(lastArr);
].
concat
(
lastArr
);
return
last
Arr
.
map
((
item
,
index
)
=>
{
return
new
Arr
.
map
((
item
,
index
)
=>
{
if
(
item
.
icon
)
{
if
(
item
.
icon
)
{
const
icon
=
strToHump
(
item
.
icon
),
const
icon
=
strToHump
(
item
.
icon
),
ItemIcon
=
Ant4Icons
[
icon
];
ItemIcon
=
Ant4Icons
[
icon
];
...
@@ -172,7 +136,13 @@ export const layout = ({ initialState, setInitialState }) => {
...
@@ -172,7 +136,13 @@ export const layout = ({ initialState, setInitialState }) => {
},
},
locale
:
false
,
locale
:
false
,
},
},
...
menurender
,
menuRender
:
(
props
,
defaultDom
)
=>
{
if
(
props
.
isMobile
)
{
return
defaultDom
;
}
else
{
return
<
SiderMenu
{
...
props
}
/>;
}
},
// 自定义 403 页面
// 自定义 403 页面
unAccessible
:
<
div
>
unAccessible
</
div
>,
unAccessible
:
<
div
>
unAccessible
</
div
>,
noFound
:
<
div
>
noFound
</
div
>,
noFound
:
<
div
>
noFound
</
div
>,
...
...
src/components/DrawerPro/index.jsx
View file @
7fa62c3f
...
@@ -13,7 +13,6 @@ function DrawerPro(props) {
...
@@ -13,7 +13,6 @@ function DrawerPro(props) {
fields
:
props
.
fields
,
fields
:
props
.
fields
,
detailData
:
props
.
detailData
,
detailData
:
props
.
detailData
,
};
};
return
(
return
(
<
Drawer
<
Drawer
maskClosable=
{
false
}
maskClosable=
{
false
}
...
...
src/components/InitForm/index.jsx
View file @
7fa62c3f
...
@@ -83,24 +83,27 @@ let FormRender = memo(({ fields = [], colProps, proformRef }) => {
...
@@ -83,24 +83,27 @@ let FormRender = memo(({ fields = [], colProps, proformRef }) => {
);
);
});
});
function
InitForm
({
function
InitForm
(
props
)
{
formRef
,
let
{
onFinish
=
(
vals
)
=>
{
formRef
,
//console.log(vals);
onFinish
=
(
vals
)
=>
{
},
//console.log(vals);
formKey
,
},
params
=
{},
formKey
,
detailpath
=
''
,
params
=
{},
defaultFormValue
=
{},
detailpath
=
''
,
detailFormat
,
defaultFormValue
=
{},
submitter
,
detailFormat
,
fields
,
submitter
,
extendField
=
''
,
fields
,
colProps
=
{
xs
:
24
,
sm
:
24
,
md
:
12
,
lg
:
12
,
xl
:
12
,
xxl
:
12
},
extendField
=
''
,
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
colProps
=
{
xs
:
24
,
sm
:
24
,
md
:
12
,
lg
:
12
,
xl
:
12
,
xxl
:
12
},
//console.log(changedValues, allValues);
onValuesChange
=
(
changedValues
,
allValues
)
=>
{
},
//console.log(changedValues, allValues);
})
{
},
}
=
props
;
console
.
log
(
props
);
let
proformRef
=
useRef
();
let
proformRef
=
useRef
();
proformRef
=
formRef
??
proformRef
;
proformRef
=
formRef
??
proformRef
;
return
(
return
(
...
...
src/components/SiderMenu/index.jsx
View file @
7fa62c3f
...
@@ -141,7 +141,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
...
@@ -141,7 +141,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
const
collectList
=
useMemo
(()
=>
{
const
collectList
=
useMemo
(()
=>
{
return
collectPerm
.
map
((
item
,
i
)
=>
{
return
collectPerm
.
map
((
item
,
i
)
=>
{
const
icon
=
item
.
icon
?
?
strToHump
(
item
.
icon
)
,
const
icon
=
item
.
icon
?
strToHump
(
item
.
icon
)
:
'ToolOutlined'
,
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
.
ToolOutlined
;
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
.
ToolOutlined
;
return
{
return
{
key
:
item
.
path
,
key
:
item
.
path
,
...
@@ -316,7 +316,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
...
@@ -316,7 +316,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
<
div
className=
{
styles
.
column
}
>
<
div
className=
{
styles
.
column
}
>
{
getMenuData
&&
{
getMenuData
&&
filterMenu
(
getMenuData
,
search
).
map
((
item
,
i
)
=>
{
filterMenu
(
getMenuData
,
search
).
map
((
item
,
i
)
=>
{
const
icon
=
item
.
icon
?
?
strToHump
(
item
.
icon
)
,
const
icon
=
item
.
icon
?
strToHump
(
item
.
icon
)
:
'ToolOutlined'
,
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
[
'ToolOutlined'
];
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
[
'ToolOutlined'
];
return
(
return
(
<
div
className=
{
styles
.
item
}
key=
{
i
}
>
<
div
className=
{
styles
.
item
}
key=
{
i
}
>
...
@@ -341,7 +341,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
...
@@ -341,7 +341,7 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
<
div
className=
{
styles
.
rt
}
>
<
div
className=
{
styles
.
rt
}
>
{
getMenuData
&&
{
getMenuData
&&
getMenuData
.
map
((
item
,
i
)
=>
{
getMenuData
.
map
((
item
,
i
)
=>
{
const
icon
=
item
.
icon
?
?
strToHump
(
item
.
icon
)
,
const
icon
=
item
.
icon
?
strToHump
(
item
.
icon
)
:
'ToolOutlined'
,
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
[
'ToolOutlined'
];
ItemIcon
=
icon
?
Ant4Icons
[
icon
]
:
Ant4Icons
[
'ToolOutlined'
];
return
(
return
(
<
p
<
p
...
...
src/global.less
View file @
7fa62c3f
...
@@ -444,5 +444,23 @@ ol {
...
@@ -444,5 +444,23 @@ ol {
overflow: hidden !important;
overflow: hidden !important;
> div {
> div {
height: 100%;
height: 100%;
min-height: calc(100vh - 96px);
> div {
height: 100%;
}
}
.ant-drawer-content {
height: 100% !important;
}
}
// 横向滚动条
.scrollHoriz {
> div {
display: flex !important;
flex-wrap: nowrap !important;
align-items: center !important;
> div {
flex-shrink: 0 !important;
}
}
}
}
}
src/pages/device/account/index.jsx
View file @
7fa62c3f
...
@@ -2178,6 +2178,9 @@ function Model(props) {
...
@@ -2178,6 +2178,9 @@ function Model(props) {
}));
}));
}
}
}
}
{
...
drawer
}
{
...
drawer
}
colProps=
{
{
span
:
8
,
}
}
>
>
{
selectMoreDrawerType
(
drawer
?.
type
)
}
{
selectMoreDrawerType
(
drawer
?.
type
)
}
</
DrawerPro
>
</
DrawerPro
>
...
@@ -2192,6 +2195,9 @@ function Model(props) {
...
@@ -2192,6 +2195,9 @@ function Model(props) {
}));
}));
}
}
}
}
{
...
currDrawer
}
{
...
currDrawer
}
colProps=
{
{
span
:
8
,
}
}
>
>
<
ProDescriptions
<
ProDescriptions
title=
"设备信息"
title=
"设备信息"
...
...
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