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
d906d18f
Commit
d906d18f
authored
Dec 04, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 'web配置菜单树增加搜索'
parent
53382b58
Pipeline
#82713
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
webMenu.jsx
src/pages/productCenter/webConfig/menuconfig/webMenu.jsx
+25
-19
api.js
src/services/webConfig/api.js
+5
-6
No files found.
src/pages/productCenter/webConfig/menuconfig/webMenu.jsx
View file @
d906d18f
...
...
@@ -3,7 +3,7 @@
/* eslint-disable no-plusplus */
/* eslint-disable consistent-return */
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
notification
,
Tooltip
,
Modal
,
Spin
,
Empty
}
from
'antd'
;
import
{
notification
,
Tooltip
,
Modal
,
Spin
,
Empty
,
Input
}
from
'antd'
;
import
Tree
from
'@/components/ExpendableTree'
;
import
{
FileAddTwoTone
,
...
...
@@ -29,6 +29,7 @@ import {
pEditWebMenu
,
}
from
'@/services/webConfig/api'
;
const
{
Search
}
=
Input
;
const
MiniMenu
=
props
=>
{
const
{
menu
,
...
...
@@ -63,6 +64,7 @@ const MiniMenu = props => {
const
[
menuList
,
setMenuList
]
=
useState
([]);
// 菜单树
const
[
keepId
,
setKeepId
]
=
useState
(
''
);
const
[
mapDataList
,
setMapDataList
]
=
useState
(
new
Set
());
const
[
keywords
,
setKeywords
]
=
useState
(
''
);
/* ***************************************************** */
const
[
curMenuType
,
setCurMenuType
]
=
useState
(
''
);
...
...
@@ -70,11 +72,9 @@ const MiniMenu = props => {
// 获取菜单信息
useEffect
(()
=>
{
console
.
log
(
menuID
,
flag
);
if
(
flag
===
1
)
{
setExpendKey
(
menuID
);
}
console
.
log
(
expendKey
);
getInfo
();
},
[
menuID
,
webid
]);
// useEffect(() => {
...
...
@@ -137,13 +137,10 @@ const MiniMenu = props => {
};
// 树的点击事件
const
handleSelect
=
(
prop
,
treeNode
)
=>
{
console
.
log
(
prop
);
console
.
log
(
treeNode
);
if
(
treeNode
)
{
const
{
node
:
{
menuType
},
}
=
treeNode
;
console
.
log
(
menuType
);
switch
(
menuType
)
{
case
'Web4MenuGroup'
:
setNodeType
(
2
);
...
...
@@ -208,8 +205,6 @@ const MiniMenu = props => {
// 删除的回调
const
deleteMenuTip
=
(
val
,
e
)
=>
{
e
.
stopPropagation
();
console
.
log
(
val
);
console
.
log
(
e
);
setModalTitle
(
val
.
text
);
setNodeObj
(
val
);
setDelVisible
(
true
);
...
...
@@ -249,7 +244,6 @@ const MiniMenu = props => {
})
.
catch
(
err
=>
{
setModalLoading
(
false
);
console
.
error
(
err
);
});
};
// 导入导出菜单组
...
...
@@ -314,11 +308,9 @@ const MiniMenu = props => {
.
then
(
res
=>
{
setSubmitLoading
(
false
);
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
setAddVisible
(
false
);
setAddTwoVisible
(
false
);
// setFlag(flag + 1);
console
.
log
(
prop
);
getTree
(
res
.
data
);
// updateMenuTree('add', item);
notification
.
success
({
...
...
@@ -336,7 +328,6 @@ const MiniMenu = props => {
})
.
catch
(
err
=>
{
setSubmitLoading
(
false
);
console
.
error
(
err
);
});
};
const
treeCallback
=
value
=>
{
...
...
@@ -349,7 +340,6 @@ const MiniMenu = props => {
setLoading
(
true
);
let
baseUrl
=
handleGeturl
(
prop
.
imageUrl
);
let
obj
=
{
...
prop
,
baseUrl
};
console
.
log
(
obj
);
if
(
nodeType
===
1
)
{
// obj.relatedRoleList = roleList || '';
editWebMenu
({
...
...
@@ -441,8 +431,8 @@ const MiniMenu = props => {
}
}
};
const
getTree
=
e
=>
{
getWebModuleTree
(
userMode
||
'super'
)
const
getTree
=
(
e
,
word
)
=>
{
getWebModuleTree
(
userMode
||
'super'
,
word
)
.
then
(
res
=>
{
setLoading
(
false
);
const
{
code
,
data
}
=
res
;
...
...
@@ -455,12 +445,9 @@ const MiniMenu = props => {
setMenuList
(
arr2
||
[]);
if
(
e
)
{
arr2
.
map
(
item
=>
mapData
(
item
,
e
));
console
.
log
([...
mapDataList
]);
let
aa
=
[...
mapDataList
].
find
(
i
=>
i
.
menuID
==
e
);
console
.
log
(
aa
);
setMenuID
(
aa
.
menuID
);
setExpendKey
(
aa
.
menuID
);
console
.
log
(
expendKey
);
switch
(
aa
.
menuType
)
{
case
'Web4MenuGroup'
:
setNodeType
(
2
);
...
...
@@ -583,6 +570,14 @@ const MiniMenu = props => {
}
});
};
const
onSearch
=
value
=>
{
getTree
(
''
,
value
);
};
const
onChangeSearch
=
e
=>
{
setKeywords
(
e
.
target
.
value
);
};
return
(
<
Spin
spinning=
{
loading
}
tip=
"loading..."
>
<
div
...
...
@@ -625,8 +620,19 @@ const MiniMenu = props => {
</
Tooltip
>
</
div
>
</
div
>
<
Search
style=
{
{
marginBottom
:
8
,
width
:
'98%'
,
marginLeft
:
'7px'
,
}
}
value=
{
keywords
}
placeholder=
"快速搜索菜单"
onChange=
{
onChangeSearch
}
onSearch=
{
onSearch
}
/>
{
menuList
.
length
>
0
&&
(
<
div
style=
{
{
height
:
'calc(100vh - 2
4
0px)'
,
overflowY
:
'scroll'
}
}
>
<
div
style=
{
{
height
:
'calc(100vh - 2
8
0px)'
,
overflowY
:
'scroll'
}
}
>
<
Tree
showIcon
onSelect=
{
handleSelect
}
...
...
src/services/webConfig/api.js
View file @
d906d18f
...
...
@@ -6,12 +6,11 @@ import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm, PANDA_GIS } from '.
* 获取所有网站配置
* @param {*} userMode
*/
export
const
getWebModuleTree
=
userMode
=>
get
(
`
${
PUBLISH_SERVICE
}
/PlatformCenter/WebModuleTree?
${
qs
.
stringify
({
userMode
,
})}
`
,
);
export
const
getWebModuleTree
=
(
userMode
,
keyword
)
=>
get
(
`
${
PUBLISH_SERVICE
}
/PlatformCenter/WebModuleTree`
,
{
userMode
,
keyword
,
});
/**
* 获取主题下拉选项
...
...
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