Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
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
ReactWeb5
CivManage
Commits
976ebb43
Commit
976ebb43
authored
Nov 12, 2020
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: appconfig
parent
edd75859
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
212 additions
and
72 deletions
+212
-72
AppMenu.js
src/pages/appConfig/AppMenu.js
+150
-55
AppMenu.less
src/pages/appConfig/AppMenu.less
+7
-1
UserManage.js
src/pages/userCenter/UserManage.js
+17
-15
api.js
src/services/appConfig/api.js
+38
-1
No files found.
src/pages/appConfig/AppMenu.js
View file @
976ebb43
...
...
@@ -15,19 +15,31 @@ import {
FolderAddTwoTone
,
EditTwoTone
,
DeleteTwoTone
,
FolderOpenOutlined
,
FileOutlined
,
}
from
'@ant-design/icons'
;
import
{
getTree
,
addMenuApi
,
getRoleList
}
from
'../../services/appConfig/api'
;
import
{
getTree
,
addMenuApi
,
addMenuGroupApi
,
getRoleList
,
getMenuInfo
,
deleteMenuApi
,
}
from
'../../services/appConfig/api'
;
import
ListCardItem
from
'../orgnazation/listCardItem'
;
import
styles
from
'./AppMenu.less'
;
import
PicturesWall
from
'@/components/Upload/index'
;
const
SevenParams
=
()
=>
{
const
[
treeLoading
,
setTreeLoading
]
=
useState
(
true
);
const
[
treeData
,
setTreeData
]
=
useState
([]);
// 菜单树
const
[
rolelist
,
setRolelist
]
=
useState
([]);
const
[
roleValueList
,
setRoleValueList
]
=
useState
({});
const
[
menuID
,
setMenuID
]
=
useState
(
''
);
const
[
menuTitle
,
setMenuTitle
]
=
useState
(
'菜单管理'
);
const
[
menuLabel
,
setMenuLabel
]
=
useState
(
'在线图标'
);
const
[
addMenuVisible
,
setAddMenuVisible
]
=
useState
(
false
);
const
[
addMenuGroupVisible
,
setAddMenuGroupVisible
]
=
useState
(
false
);
...
...
@@ -38,8 +50,8 @@ const SevenParams = () => {
const
[
addMenuGroupForm
]
=
Form
.
useForm
();
const
getRoleValueCallback
=
useCallback
((
value
,
index
)
=>
{
//
roleValueList[index] = value;
//
setRoleValueList({ ...roleValueList });
roleValueList
[
index
]
=
value
;
setRoleValueList
({
...
roleValueList
});
},
[]);
// 获取菜单树
...
...
@@ -94,7 +106,12 @@ const SevenParams = () => {
<>
<
Tooltip
title
=
"添加菜单组"
>
<
FolderAddTwoTone
onClick
=
{
e
=>
addMenuGroup
(
e
,
menu
.
text
,
menu
.
menuID
)}
onClick
=
{()
=>
addMenuGroup
(
menu
,
'分组图标'
)}
/
>
<
/Tooltip
>
<
Tooltip
title
=
"添加菜单组"
>
<
EditTwoTone
onClick
=
{()
=>
editMenuGroup
(
menu
,
'在线图标'
)}
/
>
<
/Tooltip
>
<
/
>
...
...
@@ -102,35 +119,40 @@ const SevenParams = () => {
{
menu
.
menuType
===
'MiniAppMenuGroupTwo'
&&
(
<>
<
Tooltip
title
=
"添加菜单"
>
<
FileAddTwoTone
onClick
=
{
e
=>
addMenu
(
e
,
menu
.
text
,
menu
.
menuID
)}
<
FileAddTwoTone
onClick
=
{()
=>
addMenu
(
menu
)}
/
>
<
/Tooltip
>
<
Tooltip
title
=
"编辑菜单组"
>
<
EditTwoTone
onClick
=
{()
=>
editMenuGroup
(
menu
,
'分组图标'
)}
/
>
<
/Tooltip
>
<
/
>
)}
<
Tooltip
title
=
"编辑当前菜单"
>
<
EditTwoTone
onClick
=
{
e
=>
editMenu
(
e
,
menu
.
text
,
menu
.
menuID
)}
/
>
<
/Tooltip
>
<
Tooltip
title
=
"删除当前菜单"
>
<
DeleteTwoTone
onClick
=
{
e
=>
deleteMenu
(
e
,
menu
.
text
,
menu
.
menuID
)}
/
>
{
menu
.
menuType
===
'MiniAppMenuThree'
&&
(
<>
<
Tooltip
title
=
"编辑菜单"
>
<
EditTwoTone
onClick
=
{()
=>
editMenu
(
menu
)}
/
>
<
/Tooltip
>
<
/
>
)}
<
Tooltip
title
=
"删除菜单"
>
<
DeleteTwoTone
onClick
=
{()
=>
deleteMenu
(
menu
)}
/
>
<
/Tooltip
>
<
/div
>
<
/
>
),
key
:
menu
.
menuID
,
// icon: <Solutio
nOutlined />,
icon
:
menu
.
leaf
?
<
FileOutlined
/>
:
<
FolderOpe
nOutlined
/>
,
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children
:
haveChildren
?
menu
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
};
};
// 左侧目录树相关操作
const
addMenu
=
(
e
,
title
,
id
)
=>
{
const
addMenu
=
menu
=>
{
setAddMenuVisible
(
true
);
setMenuTitle
(
`在
${
title
}
下添加菜单`
);
setMenuID
(
id
);
setMenuTitle
(
`在
${
menu
.
text
}
下添加菜单`
);
setMenuID
(
menu
.
menuID
);
addMenuForm
.
setFieldsValue
({
menuName
:
''
,
shortName
:
''
,
...
...
@@ -139,31 +161,64 @@ const SevenParams = () => {
funParam
:
''
,
});
};
const
addMenuGroup
=
(
e
,
title
,
id
)
=>
{
const
addMenuGroup
=
(
menu
,
label
)
=>
{
setAddMenuGroupVisible
(
true
);
setMenuTitle
(
`在
${
title
}
下添加菜单组`
);
setMenuID
(
id
);
setMenuTitle
(
`在
${
menu
.
text
}
下添加菜单组`
);
setMenuLabel
(
label
);
addMenuGroupForm
.
setFieldsValue
({
menuName
:
''
,
shortName
:
''
,
imageUrl
:
''
,
offlineImgUrl
:
''
,
funParam
:
''
,
});
};
const
editMenu
=
(
e
,
title
,
id
)
=>
{
const
editMenu
=
menu
=>
{
setAddMenuVisible
(
true
);
setMenuTitle
(
`编辑
${
title
}
`
);
setMenuID
(
id
);
addMenuApi
(
`/Cityinterface/rest/services/OMS.svc/M_GetMenu`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
menuID
:
id
,
})
setMenuTitle
(
`编辑
${
menu
.
text
}
`
);
setMenuID
(
menu
.
menuID
);
getMenuInfo
(
menu
.
menuID
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
addMenuForm
.
setFieldsValue
({
menuName
:
res
.
menuName
,
menuAlias
:
res
.
menuAlias
,
menuIcon
:
res
.
menuIcon
,
shortName
:
res
.
menuShortName
,
imageUrl
:
res
.
imageUrl
,
pageUrl
:
res
.
pageUrl
,
funParam
:
res
.
funParam
,
relatedRoleList
:
res
.
relatedRoleList
||
[],
});
}
else
{
notification
.
error
({
message
:
'获取失败'
,
description
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
});
};
const
editMenuGroup
=
(
menu
,
label
)
=>
{
setAddMenuGroupVisible
(
true
);
setMenuTitle
(
`编辑
${
menu
.
text
}
`
);
setMenuID
(
menu
.
menuID
);
setMenuLabel
(
label
);
getMenuInfo
(
menu
.
menuID
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
addMenuGroupForm
.
setFieldsValue
({
menuName
:
res
.
menuName
,
shortName
:
res
.
menuShortName
,
imageUrl
:
res
.
imageUrl
,
pageUrl
:
res
.
pageUrl
,
offlineImgUrl
:
res
.
offlineImgUrl
,
funParam
:
res
.
funParam
,
relatedRoleList
:
res
.
relatedRoleList
||
[],
});
}
else
{
notification
.
error
({
message
:
'
提交
失败'
,
message
:
'
获取
失败'
,
description
:
res
.
message
,
});
}
...
...
@@ -172,10 +227,10 @@ const SevenParams = () => {
message
.
error
(
err
);
});
};
const
deleteMenu
=
(
e
,
title
,
id
)
=>
{
const
deleteMenu
=
menu
=>
{
setDeleteMenuVisible
(
true
);
setMenuTitle
(
`删除菜单
${
title
}
`
);
setMenuID
(
id
);
setMenuTitle
(
`删除菜单
${
menu
.
text
}
`
);
setMenuID
(
menu
.
menuID
);
};
// 提交添加菜单
const
submitAddMenu
=
()
=>
{
...
...
@@ -213,10 +268,17 @@ const SevenParams = () => {
let
menuName
=
addMenuGroupForm
.
getFieldValue
(
'menuName'
);
let
shortName
=
addMenuGroupForm
.
getFieldValue
(
'shortName'
);
let
imageUrl
=
addMenuGroupForm
.
getFieldValue
(
'imageUrl'
);
let
pageUrl
=
addMenuGroupForm
.
getFieldValue
(
'page
Url'
);
let
offlineImgUrl
=
addMenuGroupForm
.
getFieldValue
(
'offlineImg
Url'
);
let
funParam
=
addMenuGroupForm
.
getFieldValue
(
'funParam'
);
if
(
menuName
&&
shortName
&&
imageUrl
&&
pageUrl
)
{
addMenuApi
(
menuID
,
menuName
,
shortName
,
imageUrl
,
pageUrl
,
funParam
)
if
(
menuName
&&
shortName
&&
imageUrl
&&
offlineImgUrl
)
{
addMenuGroupApi
(
menuID
,
menuName
,
shortName
,
imageUrl
,
offlineImgUrl
,
funParam
,
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
setAddMenuGroupVisible
(
false
);
...
...
@@ -240,12 +302,7 @@ const SevenParams = () => {
};
// 提交删除菜单
const
submitDeleteMenu
=
()
=>
{
addMenuApi
(
`/Cityinterface/rest/services/OMS.svc/W4_DeleteMenu`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
menuID
,
subSystemValue
:
'手持系统'
,
})
deleteMenuApi
(
menuID
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
setDeleteMenuVisible
(
false
);
...
...
@@ -269,6 +326,32 @@ const SevenParams = () => {
return
(
<
div
className
=
{
styles
.
contentContainer
}
>
<
div
className
=
{
styles
.
menuContainer
}
>
<
div
style
=
{{
padding
:
'10px 10px 0 16px'
}}
>
菜单列表
<
Tooltip
title
=
"添加菜单"
>
<
FileAddTwoTone
style
=
{{
fontSize
:
'18px'
,
float
:
'right'
,
margin
:
'4px 4px 0px 12px'
,
color
:
'#1890FF'
,
}}
onClick
=
{()
=>
addMenu
({
text
:
'根目录'
,
menuID
:
-
1
})}
/
>
<
/Tooltip
>
<
Tooltip
title
=
"添加菜单组"
>
<
FolderAddTwoTone
style
=
{{
fontSize
:
'18px'
,
float
:
'right'
,
marginTop
:
'4px'
,
}}
onClick
=
{()
=>
addMenuGroup
({
text
:
'根目录'
,
menuID
:
-
1
},
'在线图标'
)
}
/
>
<
/Tooltip
>
<
/div
>
{
treeData
.
length
>
0
&&
(
<
Spin
spinning
=
{
treeLoading
}
tip
=
"loading..."
>
<
Tree
...
...
@@ -314,7 +397,7 @@ const SevenParams = () => {
cancelText
=
"取消"
centered
>
<
Form
form
=
{
addMenuForm
}
>
<
Form
form
=
{
addMenuForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"menuName"
label
=
"菜单名称"
...
...
@@ -337,11 +420,14 @@ const SevenParams = () => {
<
Input
placeholder
=
"请输入菜单图标"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"
p
ageUrl"
label
=
"
功能路径
"
name
=
"
im
ageUrl"
label
=
"
菜单图标
"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入功能路径"
/>
<
Input
placeholder
=
"请输入菜单图标"
/>
<
/Form.Item
>
<
Form
.
Item
label
=
"图标预览"
>
<
PicturesWall
maxLen
=
{
3
}
/
>
<
/Form.Item
>
<
Form
.
Item
name
=
"funParam"
label
=
"功能参数"
>
<
Input
placeholder
=
"请输入功能参数"
/>
...
...
@@ -365,7 +451,7 @@ const SevenParams = () => {
cancelText
=
"取消"
centered
>
<
Form
form
=
{
addMenuGroupForm
}
>
<
Form
form
=
{
addMenuGroupForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"menuName"
label
=
"分组名称"
...
...
@@ -382,17 +468,26 @@ const SevenParams = () => {
<
/Form.Item
>
<
Form
.
Item
name
=
"imageUrl"
label
=
"菜单图标"
label
=
{
menuLabel
}
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入菜单图标"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"pageUrl"
label
=
"离线图标"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入离线图标"
/>
<
Form
.
Item
label
=
"图标预览"
>
<
PicturesWall
maxLen
=
{
3
}
/
>
<
/Form.Item
>
{
/* 添加菜单组,label名称为在线图标才有离线图标 */
}
{
menuLabel
===
'在线图标'
&&
(
<
Form
.
Item
name
=
"offlineImgUrl"
label
=
"离线图标"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入离线图标"
/>
<
/Form.Item
>
)}
<
Form
.
Item
label
=
"图标预览"
>
<
PicturesWall
maxLen
=
{
3
}
/
>
<
/Form.Item
>
<
Form
.
Item
name
=
"funParam"
label
=
"功能参数"
>
<
Input
placeholder
=
"请输入功能参数"
/>
...
...
src/pages/appConfig/AppMenu.less
View file @
976ebb43
...
...
@@ -3,14 +3,20 @@
display: flex;
.menuContainer{
min-width: 300px;
border:1px solid #abaeb1;
min-height:calc(100vh - 300px);
overflow-y:auto;
.ant-tree-list{
padding: 10px;
border:1px solid #abaeb1;
height:calc(100vh - 300px);
.ant-tree-switcher{
line-height: 1;
color:#1890FF;
}
.ant-tree-iconEle{
line-height: 1.2;
color:#1890FF;
}
}
}
.previewContainer{
...
...
src/pages/userCenter/UserManage.js
View file @
976ebb43
...
...
@@ -27,6 +27,8 @@ import {
ApartmentOutlined
,
SearchOutlined
,
StopOutlined
,
FolderOpenOutlined
,
FileOutlined
,
}
from
'@ant-design/icons'
;
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
// import classnames from 'classnames';
...
...
@@ -272,7 +274,7 @@ const UserManage = () => {
<
/
>
),
key
:
org
.
id
,
// icon:
<Solutio
nOutlined />,
// icon:
org.leaf ? <FileOutlined /> : <FolderOpe
nOutlined />,
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children
:
haveChildren
?
org
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
};
...
...
@@ -282,7 +284,7 @@ const UserManage = () => {
return
{
title
:
`
${
org
.
text
}
`
,
key
:
org
.
id
,
// icon:
<Solutio
nOutlined />,
// icon:
org.leaf ? <FileOutlined /> : <FolderOpe
nOutlined />,
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children
:
haveChildren
?
org
.
children
.
map
(
i
=>
mapTree1
(
i
))
:
[],
};
...
...
@@ -852,7 +854,7 @@ const UserManage = () => {
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
addUserForm
}
>
<
Form
form
=
{
addUserForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"loginName"
label
=
"登录名称"
...
...
@@ -874,10 +876,10 @@ const UserManage = () => {
>
<
Input
placeholder
=
"请输入用户姓名"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"phone"
label
=
"手
机 号
码"
>
<
Form
.
Item
name
=
"phone"
label
=
"手
机号
码"
>
<
Input
placeholder
=
"请输入手机号码"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"email"
label
=
"电
子 邮
箱"
>
<
Form
.
Item
name
=
"email"
label
=
"电
子邮
箱"
>
<
Input
placeholder
=
"请输入电子邮箱"
/>
<
/Form.Item
>
<
/Form
>
...
...
@@ -891,7 +893,7 @@ const UserManage = () => {
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
addOrgForm
}
>
<
Form
form
=
{
addOrgForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"OUName"
label
=
"机构名称"
...
...
@@ -899,7 +901,7 @@ const UserManage = () => {
>
<
Input
placeholder
=
"请输入机构名称"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"description"
label
=
"
--描---述--
"
>
<
Form
.
Item
name
=
"description"
label
=
"
描述
"
>
<
Input
placeholder
=
"请输入相关描述"
/>
<
/Form.Item
>
<
/Form
>
...
...
@@ -913,7 +915,7 @@ const UserManage = () => {
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
editOrgForm
}
>
<
Form
form
=
{
editOrgForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"OUName"
label
=
"机构名称"
...
...
@@ -921,7 +923,7 @@ const UserManage = () => {
>
<
Input
placeholder
=
"请输入机构名称"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"description"
label
=
"
--描---述--
"
>
<
Form
.
Item
name
=
"description"
label
=
"
描述
"
>
<
Input
placeholder
=
"请输入相关描述"
/>
<
/Form.Item
>
<
/Form
>
...
...
@@ -1006,13 +1008,13 @@ const UserManage = () => {
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
passwordForm
}
>
<
Form
.
Item
name
=
"oldpassword"
label
=
"原
始 密
码"
>
<
Form
form
=
{
passwordForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"oldpassword"
label
=
"原
始密
码"
>
<
Input
disabled
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"newPassword"
label
=
"新
- 密-
码"
label
=
"新
密
码"
rules
=
{[{
required
:
true
,
message
:
'不能为空'
}]}
>
<
Input
placeholder
=
"请输入新密码"
/>
...
...
@@ -1035,7 +1037,7 @@ const UserManage = () => {
okText
=
"确认"
cancelText
=
"取消"
>
<
Form
form
=
{
editUserForm
}
>
<
Form
form
=
{
editUserForm
}
labelCol
=
{{
span
:
4
}}
>
<
Form
.
Item
name
=
"loginName"
label
=
"登录名称"
...
...
@@ -1050,10 +1052,10 @@ const UserManage = () => {
>
<
Input
placeholder
=
"请输入用户姓名"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"phone"
label
=
"手
机 号
码"
>
<
Form
.
Item
name
=
"phone"
label
=
"手
机号
码"
>
<
Input
placeholder
=
"请输入手机号码"
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"email"
label
=
"电
子 邮
箱"
>
<
Form
.
Item
name
=
"email"
label
=
"电
子邮
箱"
>
<
Input
placeholder
=
"请输入电子邮箱"
/>
<
/Form.Item
>
<
/Form
>
...
...
src/services/appConfig/api.js
View file @
976ebb43
...
...
@@ -54,11 +54,48 @@ export const addMenuApi = (
subSystemValue
:
'miniapp'
,
relatedRoleList
:
''
,
});
// 添加菜单组
export
const
addMenuGroupApi
=
(
menuID
,
menuName
,
shortName
,
imageUrl
,
offlineImgUrl
,
funParam
,
)
=>
get
(
`/Cityinterface/rest/services/OMS.svc/MiniApp_AddMenu`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
// 根目录添加,parentID 为-1
parentID
:
menuID
||
-
1
,
menuName
,
shortName
,
imageUrl
,
offlineImgUrl
,
funParam
,
subSystemValue
:
'miniapp'
,
relatedRoleList
:
''
,
});
//
添加菜单
//
获取角色列表
export
const
getRoleList
=
()
=>
get
(
`/Cityinterface/rest/services/OMS.svc/P_GetRoleListPlain`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
subSystemValue
:
'miniapp'
,
});
// 获取菜单
export
const
getMenuInfo
=
id
=>
get
(
`/Cityinterface/rest/services/OMS.svc/Mini_GetMenuInfo`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
menuID
:
id
,
});
// 获取菜单
export
const
deleteMenuApi
=
id
=>
get
(
`/Cityinterface/rest/services/OMS.svc/MiniApp_DeleteMenu`
,
{
_version
:
9999
,
_dc
:
new
Date
().
getTime
(),
menuID
:
id
,
subSystemValue
:
'miniapp'
,
});
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