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
01139da3
Commit
01139da3
authored
Mar 04, 2022
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 'web配置,移动应用配置左侧树结构交互修改'
parent
129171c3
Pipeline
#45113
skipped with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
115 deletions
+144
-115
AddForm.jsx
src/pages/productCenter/mobileConfig/menuconfig/AddForm.jsx
+3
-2
miniMenu.jsx
src/pages/productCenter/mobileConfig/menuconfig/miniMenu.jsx
+90
-23
productConfig.jsx
src/pages/productCenter/productConfig/productConfig.jsx
+3
-81
webMenu.jsx
src/pages/productCenter/webConfig/menuconfig/webMenu.jsx
+48
-9
No files found.
src/pages/productCenter/mobileConfig/menuconfig/AddForm.jsx
View file @
01139da3
...
@@ -11,6 +11,7 @@ const AddForm = props => {
...
@@ -11,6 +11,7 @@ const AddForm = props => {
submitCallback
,
submitCallback
,
nodeType
,
nodeType
,
nodeObj
,
nodeObj
,
keepType
,
addType
,
addType
,
submitLoading
,
submitLoading
,
valueCallback
,
valueCallback
,
...
@@ -27,11 +28,11 @@ const AddForm = props => {
...
@@ -27,11 +28,11 @@ const AddForm = props => {
const
submit
=
()
=>
{
const
submit
=
()
=>
{
if
(
addType
===
1
||
addType
===
2
)
{
if
(
addType
===
1
||
addType
===
2
)
{
let
obj
=
form
.
getFieldsValue
();
let
obj
=
form
.
getFieldsValue
();
submitCallback
(
obj
,
nodeObj
);
submitCallback
(
obj
,
nodeObj
,
keepType
);
}
}
if
(
addType
===
3
||
addType
===
4
)
{
if
(
addType
===
3
||
addType
===
4
)
{
let
obj
=
otherForm
.
getFieldsValue
();
let
obj
=
otherForm
.
getFieldsValue
();
submitCallback
(
obj
,
nodeObj
);
submitCallback
(
obj
,
nodeObj
,
keepType
);
}
}
};
};
const
finish
=
()
=>
{
const
finish
=
()
=>
{
...
...
src/pages/productCenter/mobileConfig/menuconfig/miniMenu.jsx
View file @
01139da3
...
@@ -32,7 +32,7 @@ const MiniMenu = props => {
...
@@ -32,7 +32,7 @@ const MiniMenu = props => {
const
[
treeData
,
setTreeData
]
=
useState
([]);
// 树的数据
const
[
treeData
,
setTreeData
]
=
useState
([]);
// 树的数据
const
[
loading
,
setLoading
]
=
useState
(
false
);
// 加载
const
[
loading
,
setLoading
]
=
useState
(
false
);
// 加载
const
[
menuID
,
setMenuID
]
=
useState
(
''
);
// 选中的树ID
const
[
menuID
,
setMenuID
]
=
useState
(
''
);
// 选中的树ID
const
[
saveID
,
setSaveID
]
=
useState
(
''
);
// 保存选择的树id
//
const [saveID, setSaveID] = useState(''); // 保存选择的树id
const
[
nodeType
,
setNodeType
]
=
useState
(
''
);
// 选中的节点类型
const
[
nodeType
,
setNodeType
]
=
useState
(
''
);
// 选中的节点类型
const
[
info
,
setInfo
]
=
useState
({});
const
[
info
,
setInfo
]
=
useState
({});
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
// 新增弹窗
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
// 新增弹窗
...
@@ -47,6 +47,9 @@ const MiniMenu = props => {
...
@@ -47,6 +47,9 @@ const MiniMenu = props => {
const
[
addList
,
setAddList
]
=
useState
([]);
const
[
addList
,
setAddList
]
=
useState
([]);
const
[
newTreeList
,
setNewTreeList
]
=
useState
([]);
const
[
newTreeList
,
setNewTreeList
]
=
useState
([]);
const
[
expendKey
,
setExpendKey
]
=
useState
(
''
);
// 保存默认展开项
const
[
expendKey
,
setExpendKey
]
=
useState
(
''
);
// 保存默认展开项
const
[
keepId
,
setKeepId
]
=
useState
(
''
);
const
[
mapDataList
,
setMapDataList
]
=
useState
(
new
Set
());
const
[
keepType
,
setKeepType
]
=
useState
(
''
);
// 获取菜单树
// 获取菜单树
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -68,14 +71,14 @@ const MiniMenu = props => {
...
@@ -68,14 +71,14 @@ const MiniMenu = props => {
// 获取菜单信息
// 获取菜单信息
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
flag
,
'flag'
);
console
.
log
(
flag
,
'flag'
);
if
(
flag
===
2
)
{
if
(
flag
===
1
)
{
setExpendKey
(
menuID
);
setExpendKey
(
menuID
);
}
}
getInfo
();
getInfo
();
},
[
menuID
]);
},
[
menuID
]);
// 更新树
// 更新树
const
updateTrees
=
()
=>
{
const
updateTrees
=
(
e
,
h
)
=>
{
getMiniAppModuleTree
({
getMiniAppModuleTree
({
userMode
:
userMode
||
'super'
,
userMode
:
userMode
||
'super'
,
})
})
...
@@ -92,17 +95,45 @@ const MiniMenu = props => {
...
@@ -92,17 +95,45 @@ const MiniMenu = props => {
console
.
log
(
result
,
'result'
);
console
.
log
(
result
,
'result'
);
setTreeData
(
result
);
setTreeData
(
result
);
if
(
result
.
length
>
0
)
{
if
(
result
.
length
>
0
)
{
setFlag
(
flag
+
1
);
if
(
e
)
{
result
.
map
(
item
=>
mapData
(
item
,
e
));
let
aa
=
[...
mapDataList
].
find
(
i
=>
i
.
text
===
e
&&
i
.
menuType
===
h
);
console
.
log
(
aa
);
console
.
log
(
h
);
setMenuID
(
aa
.
menuID
);
setExpendKey
(
aa
.
menuID
);
switch
(
aa
.
menuType
)
{
case
'MiniAppMenuGroup'
:
setNodeType
(
1
);
setAddType
(
1
);
break
;
case
'MiniAppMenuGroupTwo'
:
setNodeType
(
2
);
setAddType
(
2
);
break
;
case
'MiniAppMenu'
:
setNodeType
(
3
);
setAddType
(
3
);
break
;
case
'MiniAppMenuThree'
:
setNodeType
(
4
);
setAddType
(
4
);
break
;
default
:
break
;
}
}
if
(
flag
===
1
)
{
if
(
flag
===
1
)
{
setMenuID
(
result
[
0
].
menuID
);
setMenuID
(
result
[
0
].
menuID
);
switch
(
result
[
0
].
menuType
)
{
switch
(
result
[
0
].
menuType
)
{
case
'MiniAppMenuGroup'
:
case
'MiniAppMenuGroup'
:
setNodeType
(
1
);
setNodeType
(
1
);
setAddType
(
2
);
setAddType
(
1
);
break
;
break
;
case
'MiniAppMenuGroupTwo'
:
case
'MiniAppMenuGroupTwo'
:
setNodeType
(
2
);
setNodeType
(
2
);
setAddType
(
4
);
setAddType
(
2
);
break
;
break
;
case
'MiniAppMenu'
:
case
'MiniAppMenu'
:
setNodeType
(
3
);
setNodeType
(
3
);
...
@@ -115,9 +146,11 @@ const MiniMenu = props => {
...
@@ -115,9 +146,11 @@ const MiniMenu = props => {
default
:
default
:
break
;
break
;
}
}
setFlag
(
flag
+
1
);
}
}
}
}
setLoading
(
false
);
setLoading
(
false
);
setKeepId
(
result
[
0
]);
// 第一次加载,默认选择第一个组织
// 第一次加载,默认选择第一个组织
// if (treeFlag) {
// if (treeFlag) {
// handleSelect([result[0].menuID], false);
// handleSelect([result[0].menuID], false);
...
@@ -147,17 +180,17 @@ const MiniMenu = props => {
...
@@ -147,17 +180,17 @@ const MiniMenu = props => {
<
div
className=
{
styles
.
tip
}
>
<
div
className=
{
styles
.
tip
}
>
{
obj
.
menuType
===
'MiniAppMenuGroup'
&&
(
{
obj
.
menuType
===
'MiniAppMenuGroup'
&&
(
<
Tooltip
title=
"新增菜单组"
className=
{
styles
.
fsize
}
>
<
Tooltip
title=
"新增菜单组"
className=
{
styles
.
fsize
}
>
<
FolderAddTwoTone
onClick=
{
()
=>
addMenuGroupTip
(
obj
)
}
/>
<
FolderAddTwoTone
onClick=
{
e
=>
addMenuGroupTip
(
obj
,
e
)
}
/>
</
Tooltip
>
</
Tooltip
>
)
}
)
}
{
obj
.
menuType
===
'MiniAppMenuGroupTwo'
&&
(
{
obj
.
menuType
===
'MiniAppMenuGroupTwo'
&&
(
<
Tooltip
title=
"新增功能菜单"
className=
{
styles
.
fsize
}
>
<
Tooltip
title=
"新增功能菜单"
className=
{
styles
.
fsize
}
>
<
FileAddTwoTone
onClick=
{
()
=>
addMenuTip
(
obj
)
}
/>
<
FileAddTwoTone
onClick=
{
e
=>
addMenuTip
(
obj
,
e
)
}
/>
</
Tooltip
>
</
Tooltip
>
)
}
)
}
<
Tooltip
title=
"删除菜单"
className=
{
styles
.
fsize
}
>
<
Tooltip
title=
"删除菜单"
className=
{
styles
.
fsize
}
>
<
DeleteTwoTone
onClick=
{
()
=>
deleteMenuTip
(
obj
)
}
/>
<
DeleteTwoTone
onClick=
{
e
=>
deleteMenuTip
(
obj
,
e
)
}
/>
</
Tooltip
>
</
Tooltip
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -174,6 +207,15 @@ const MiniMenu = props => {
...
@@ -174,6 +207,15 @@ const MiniMenu = props => {
children
:
hasChild
?
obj
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
children
:
hasChild
?
obj
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
};
};
};
};
const
mapData
=
(
val
,
e
)
=>
{
const
obj
=
{
...
val
};
const
hasChild
=
obj
.
children
.
length
>
0
;
if
(
hasChild
)
{
obj
.
children
.
map
(
i
=>
mapData
(
i
));
}
mapDataList
.
add
(
obj
);
};
// 树的点击事件
// 树的点击事件
const
handleSelect
=
(
prop
,
treeNode
)
=>
{
const
handleSelect
=
(
prop
,
treeNode
)
=>
{
console
.
log
(
prop
,
treeNode
);
console
.
log
(
prop
,
treeNode
);
...
@@ -184,18 +226,22 @@ const MiniMenu = props => {
...
@@ -184,18 +226,22 @@ const MiniMenu = props => {
}
=
treeNode
;
}
=
treeNode
;
console
.
log
(
menuType
);
console
.
log
(
menuType
);
switch
(
menuType
)
{
switch
(
menuType
)
{
// 最上级菜单组
case
'MiniAppMenuGroup'
:
case
'MiniAppMenuGroup'
:
setNodeType
(
1
);
setNodeType
(
1
);
setAddType
(
2
);
setAddType
(
1
);
break
;
break
;
// 第二级菜单组
case
'MiniAppMenuGroupTwo'
:
case
'MiniAppMenuGroupTwo'
:
setNodeType
(
2
);
setNodeType
(
2
);
setAddType
(
4
);
setAddType
(
2
);
break
;
break
;
// 最上级菜单
case
'MiniAppMenu'
:
case
'MiniAppMenu'
:
setNodeType
(
3
);
setNodeType
(
3
);
setAddType
(
3
);
setAddType
(
3
);
break
;
break
;
// 第三季功能菜单
case
'MiniAppMenuThree'
:
case
'MiniAppMenuThree'
:
setNodeType
(
4
);
setNodeType
(
4
);
setAddType
(
4
);
setAddType
(
4
);
...
@@ -206,12 +252,14 @@ const MiniMenu = props => {
...
@@ -206,12 +252,14 @@ const MiniMenu = props => {
}
}
if
(
prop
[
0
])
{
if
(
prop
[
0
])
{
setMenuID
(
prop
[
0
]);
setMenuID
(
prop
[
0
]);
setSaveID
(
prop
[
0
]);
// setSaveID(prop[0]);
}
else
{
setMenuID
(
saveID
);
}
}
};
};
const
handleExpand
=
(
keys
,
{
expanded
,
node
})
=>
{
console
.
log
(
keys
);
};
const
getInfo
=
id
=>
{
const
getInfo
=
id
=>
{
if
(
!
menuID
)
{
if
(
!
menuID
)
{
return
;
return
;
...
@@ -239,7 +287,8 @@ const MiniMenu = props => {
...
@@ -239,7 +287,8 @@ const MiniMenu = props => {
});
});
};
};
// 删除的回调
// 删除的回调
const
deleteMenuTip
=
val
=>
{
const
deleteMenuTip
=
(
val
,
e
)
=>
{
e
.
stopPropagation
();
console
.
log
(
val
,
'val'
);
console
.
log
(
val
,
'val'
);
setModalTitle
(
val
.
text
);
setModalTitle
(
val
.
text
);
setNodeObj
(
val
);
setNodeObj
(
val
);
...
@@ -257,9 +306,14 @@ const MiniMenu = props => {
...
@@ -257,9 +306,14 @@ const MiniMenu = props => {
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
setDelVisible
(
false
);
setDelVisible
(
false
);
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
updateTrees
();
if
(
nodeObj
.
menuID
==
menuID
)
{
setNodeType
(
''
);
updateTrees
();
setNodeObj
(
''
);
setMenuID
(
keepId
.
menuID
);
setNodeType
(
1
);
setNodeObj
(
keepId
);
}
else
{
updateTrees
();
}
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
duration
:
3
,
duration
:
3
,
...
@@ -279,11 +333,14 @@ const MiniMenu = props => {
...
@@ -279,11 +333,14 @@ const MiniMenu = props => {
});
});
};
};
// 新增菜单组
// 新增菜单组
const
addMenuGroupTip
=
val
=>
{
const
addMenuGroupTip
=
(
val
,
e
)
=>
{
e
.
stopPropagation
();
console
.
log
(
val
,
'addgroup'
);
console
.
log
(
val
,
'addgroup'
);
setModalTitle
(
`在
${
val
.
text
}
下新增菜单组`
);
setModalTitle
(
`在
${
val
.
text
}
下新增菜单组`
);
setNodeObj
(
val
);
setNodeObj
(
val
);
setAddType
(
2
);
setAddVisible
(
true
);
setAddVisible
(
true
);
setKeepType
(
'MiniAppMenuGroupTwo'
);
};
};
const
rootAddGroup
=
()
=>
{
const
rootAddGroup
=
()
=>
{
setNodeObj
(
''
);
setNodeObj
(
''
);
...
@@ -291,13 +348,17 @@ const MiniMenu = props => {
...
@@ -291,13 +348,17 @@ const MiniMenu = props => {
setModalTitle
(
'新增最上级菜单组'
);
setModalTitle
(
'新增最上级菜单组'
);
setAddType
(
1
);
setAddType
(
1
);
setAddVisible
(
true
);
setAddVisible
(
true
);
setKeepType
(
'MiniAppMenuGroup'
);
};
};
// 新增功能菜单
// 新增功能菜单
const
addMenuTip
=
val
=>
{
const
addMenuTip
=
(
val
,
e
)
=>
{
e
.
stopPropagation
();
console
.
log
(
val
,
'add'
);
console
.
log
(
val
,
'add'
);
setNodeObj
(
val
);
setNodeObj
(
val
);
setModalTitle
(
`在
${
val
.
text
}
下新增功能菜单`
);
setModalTitle
(
`在
${
val
.
text
}
下新增功能菜单`
);
setAddType
(
4
);
setAddTwoVisible
(
true
);
setAddTwoVisible
(
true
);
setKeepType
(
'MiniAppMenuThree'
);
};
};
const
rootAdd
=
()
=>
{
const
rootAdd
=
()
=>
{
setModalTitle
(
'新增最上级功能菜单'
);
setModalTitle
(
'新增最上级功能菜单'
);
...
@@ -305,15 +366,17 @@ const MiniMenu = props => {
...
@@ -305,15 +366,17 @@ const MiniMenu = props => {
// setNodeType(3);
// setNodeType(3);
setAddType
(
3
);
setAddType
(
3
);
setAddTwoVisible
(
true
);
setAddTwoVisible
(
true
);
setKeepType
(
'MiniAppMenu'
);
};
};
// 新增提交的回调
// 新增提交的回调
const
submitCallback
=
(
prop
,
item
)
=>
{
const
submitCallback
=
(
prop
,
item
,
e
)
=>
{
setSubmitLoading
(
true
);
setSubmitLoading
(
true
);
let
obj
=
{
...
prop
};
let
obj
=
{
...
prop
};
// if (addType === 3 || addType === 4) {
// if (addType === 3 || addType === 4) {
// obj.relatedRoleList = String(roleList) || '';
// obj.relatedRoleList = String(roleList) || '';
// }
// }
console
.
log
(
obj
);
console
.
log
(
obj
);
console
.
log
(
e
);
const
parentID
=
item
.
menuID
?
item
.
menuID
:
'-1'
;
const
parentID
=
item
.
menuID
?
item
.
menuID
:
'-1'
;
addMenu
({
addMenu
({
_dc
:
Date
.
now
(),
_dc
:
Date
.
now
(),
...
@@ -328,7 +391,9 @@ const MiniMenu = props => {
...
@@ -328,7 +391,9 @@ const MiniMenu = props => {
setAddVisible
(
false
);
setAddVisible
(
false
);
setAddTwoVisible
(
false
);
setAddTwoVisible
(
false
);
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
updateTrees
();
console
.
log
(
prop
);
console
.
log
(
item
);
updateTrees
(
prop
.
menuName
,
e
);
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
description
:
'新增成功'
,
description
:
'新增成功'
,
...
@@ -602,7 +667,7 @@ const MiniMenu = props => {
...
@@ -602,7 +667,7 @@ const MiniMenu = props => {
draggable
draggable
autoExpandParent
autoExpandParent
onDrop=
{
handleDrop
}
onDrop=
{
handleDrop
}
// onDragEnter=
{
handleDragEnter
}
onExpand=
{
handleExpand
}
selectedKeys=
{
[
menuID
]
}
selectedKeys=
{
[
menuID
]
}
expandedKeys=
{
expendKey
}
expandedKeys=
{
expendKey
}
/>
/>
...
@@ -627,6 +692,7 @@ const MiniMenu = props => {
...
@@ -627,6 +692,7 @@ const MiniMenu = props => {
<
AddForm
<
AddForm
nodeType=
{
nodeType
}
nodeType=
{
nodeType
}
nodeObj=
{
nodeObj
}
nodeObj=
{
nodeObj
}
keepType=
{
keepType
}
addType=
{
addType
}
addType=
{
addType
}
submitCallback=
{
submitCallback
}
submitCallback=
{
submitCallback
}
submitLoading=
{
submitLoading
}
submitLoading=
{
submitLoading
}
...
@@ -656,6 +722,7 @@ const MiniMenu = props => {
...
@@ -656,6 +722,7 @@ const MiniMenu = props => {
submitLoading=
{
submitLoading
}
submitLoading=
{
submitLoading
}
nodeType=
{
nodeType
}
nodeType=
{
nodeType
}
nodeObj=
{
nodeObj
}
nodeObj=
{
nodeObj
}
keepType=
{
keepType
}
addType=
{
addType
}
addType=
{
addType
}
addList=
{
addList
}
addList=
{
addList
}
submitCallback=
{
submitCallback
}
submitCallback=
{
submitCallback
}
...
...
src/pages/productCenter/productConfig/productConfig.jsx
View file @
01139da3
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Card
,
List
,
Drawer
,
Button
,
Empty
,
Spin
,
notification
,
Switch
,
message
}
from
'antd'
;
import
{
Card
,
List
,
Empty
,
Spin
,
notification
,
Switch
}
from
'antd'
;
import
{
modifyProduct
,
getProductList
,
delProductList
}
from
'@/services/webConfig/api'
;
import
{
modifyProduct
,
getProductList
,
delProductList
}
from
'@/services/webConfig/api'
;
import
classnames
from
'classnames'
;
import
classnames
from
'classnames'
;
import
EditForm
from
'./components/editForm'
;
import
EditForm
from
'./components/editForm'
;
import
styles
from
'./productConfig.less'
;
import
styles
from
'./productConfig.less'
;
const
ProductConfig
=
props
=>
{
const
ProductConfig
=
props
=>
{
const
[
addVisible
,
setAddVisible
]
=
useState
(
false
);
const
[
productList
,
setProductList
]
=
useState
([]);
const
[
productList
,
setProductList
]
=
useState
([]);
const
[
userProductsList
,
setUserProductsList
]
=
useState
([]);
const
[
userProductsList
,
setUserProductsList
]
=
useState
([]);
const
[
productObj
,
setProductObj
]
=
useState
(
''
);
const
[
productObj
,
setProductObj
]
=
useState
(
''
);
...
@@ -91,10 +90,6 @@ const ProductConfig = props => {
...
@@ -91,10 +90,6 @@ const ProductConfig = props => {
});
});
},
[
flag
]);
},
[
flag
]);
// 展示新增抽屉
const
handleAdd
=
()
=>
{
setAddVisible
(
true
);
};
// 删除
// 删除
const
handleDel
=
item
=>
{
const
handleDel
=
item
=>
{
setLoading
(
true
);
setLoading
(
true
);
...
@@ -123,11 +118,7 @@ const ProductConfig = props => {
...
@@ -123,11 +118,7 @@ const ProductConfig = props => {
console
.
error
(
err
);
console
.
error
(
err
);
});
});
};
};
// 新增提交回调
const
addCallback
=
val
=>
{
setAddVisible
(
false
);
setFlag
(
flag
+
1
);
};
// 编辑的回调
// 编辑的回调
const
editCallback
=
val
=>
{
const
editCallback
=
val
=>
{
setLoading
(
true
);
setLoading
(
true
);
...
@@ -167,8 +158,6 @@ const ProductConfig = props => {
...
@@ -167,8 +158,6 @@ const ProductConfig = props => {
duration
:
3
,
duration
:
3
,
});
});
item
.
IsUsed
=
true
;
item
.
IsUsed
=
true
;
console
.
log
(
item
,
'item'
);
console
.
log
(
productObj
,
'productObj33333'
);
setProductObj
({
...
item
});
setProductObj
({
...
item
});
setFlag
(
flag
+
1
);
setFlag
(
flag
+
1
);
}
else
{
}
else
{
...
@@ -190,34 +179,8 @@ const ProductConfig = props => {
...
@@ -190,34 +179,8 @@ const ProductConfig = props => {
}
}
};
};
const
handleClickItem
=
value
=>
{
const
handleClickItem
=
value
=>
{
// console.log(productList);
// console.log(value);
// let obj = productList.find(i => i.PackageName === value.PackageName);
setProductObj
({
...
value
});
setProductObj
({
...
value
});
// if (userProductsList.length > 0) {
// let obj = userProductsList.find(i => i.PackageName === value.PackageName);
// console.log(value);
// console.log(obj);
// if (obj) {
// setProductObj(obj);
// } else {
// message.warning({
// content: '请先启用产品',
// duration: 3,
// });
// }
// } else {
// message.warning({
// content: '请先启用产品',
// duration: 3,
// });
// }
};
};
// const changeBut = value => {
// let obj = userProductsList.find(i => i.PackageName === value.PackageName);
// setProductObj(obj);
// };
const
renderListItem
=
arr
=>
(
const
renderListItem
=
arr
=>
(
<
div
style=
{
{
marginBottom
:
'25px'
,
borderBottom
:
'1px solid #ccc'
,
paddingBottom
:
'25px'
}
}
>
<
div
style=
{
{
marginBottom
:
'25px'
,
borderBottom
:
'1px solid #ccc'
,
paddingBottom
:
'25px'
}
}
>
{
arr
.
map
(
item
=>
(
{
arr
.
map
(
item
=>
(
...
@@ -231,20 +194,14 @@ const ProductConfig = props => {
...
@@ -231,20 +194,14 @@ const ProductConfig = props => {
>
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
div
onClick=
{
e
=>
e
.
stopPropagation
()
}
>
<
Switch
<
Switch
// size="small"
// defaultChecked=
{
item
.
IsUsed
}
checked=
{
item
.
IsUsed
}
checked=
{
item
.
IsUsed
}
checkedChildren=
"启用"
checkedChildren=
"启用"
unCheckedChildren=
"关闭"
unCheckedChildren=
"关闭"
onClick=
{
e
=>
{
onClick=
{
e
=>
{
handleSwitchClick
(
e
,
item
,
userProductsList
);
handleSwitchClick
(
e
,
item
,
userProductsList
);
}
}
}
}
// onChange=
{
changeBut
(
item
)}
/>
/>
</
div
>
</
div
>
{
/* <span className={classnames({ [styles.itemspan]: true })}>{`${item.ProductName}【${
item.ProductType
}】`}</span> */
}
<
span
className=
{
classnames
({
[
styles
.
itemspan
]:
true
})
}
>
<
span
className=
{
classnames
({
[
styles
.
itemspan
]:
true
})
}
>
{
item
.
ProductType
?
`${item.ProductName}【${item.ProductType}】`
:
item
.
ProductName
}
{
item
.
ProductType
?
`${item.ProductName}【${item.ProductType}】`
:
item
.
ProductName
}
</
span
>
</
span
>
...
@@ -256,15 +213,7 @@ const ProductConfig = props => {
...
@@ -256,15 +213,7 @@ const ProductConfig = props => {
<
Spin
spinning=
{
loading
}
tip=
"loading..."
>
<
Spin
spinning=
{
loading
}
tip=
"loading..."
>
<
div
className=
{
styles
.
box
}
>
<
div
className=
{
styles
.
box
}
>
<
Card
className=
{
classnames
(
`${styles.leftList}`
)
}
>
<
Card
className=
{
classnames
(
`${styles.leftList}`
)
}
>
<
div
className=
{
styles
.
listTop
}
>
<
div
className=
{
styles
.
listTop
}
>
产品选择:
</
div
>
产品选择:
{
/* <Button type="primary" onClick={handleAdd}>
新增
</Button> */
}
{
/* <Button type="primary" danger onClick={handleDel}>
删除
</Button> */
}
</
div
>
{
productList
&&
productList
.
length
>
0
?
(
{
productList
&&
productList
.
length
>
0
?
(
productList
.
map
(
item
=>
renderListItem
(
item
))
productList
.
map
(
item
=>
renderListItem
(
item
))
)
:
(
)
:
(
...
@@ -278,33 +227,6 @@ const ProductConfig = props => {
...
@@ -278,33 +227,6 @@ const ProductConfig = props => {
handleDel=
{
handleDel
}
handleDel=
{
handleDel
}
userProductsList=
{
userProductsList
}
userProductsList=
{
userProductsList
}
/>
/>
{
/* {productList && productList.length > 0 && productObj ? (
<EditForm
productObj={productObj}
editCallback={editCallback}
handleDel={handleDel}
userProductsList={userProductsList}
/>
) : (
<Empty
style={{ marginTop: '60px' }}
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="当前未选中产品类型"
/>
)} */
}
{
/* <Drawer
title="新增产品"
destroyOnClose
maskClosable={false}
width={600}
onClose={() => {
setAddVisible(false);
}}
visible={addVisible}
>
<AddForm addCallback={addCallback} />
</Drawer> */
}
</
Card
>
</
Card
>
</
div
>
</
div
>
</
Spin
>
</
Spin
>
...
...
src/pages/productCenter/webConfig/menuconfig/webMenu.jsx
View file @
01139da3
/* eslint-disable array-callback-return */
/* eslint-disable array-callback-return */
/* eslint-disable no-plusplus */
/* eslint-disable no-plusplus */
/* eslint-disable consistent-return */
/* eslint-disable consistent-return */
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
,
useRef
}
from
'react'
;
import
{
notification
,
Tooltip
,
Modal
,
Spin
,
Empty
}
from
'antd'
;
import
{
notification
,
Tooltip
,
Modal
,
Spin
,
Empty
}
from
'antd'
;
import
Tree
from
'@/components/ExpendableTree'
;
import
Tree
from
'@/components/ExpendableTree'
;
import
{
import
{
...
@@ -52,9 +52,11 @@ const MiniMenu = props => {
...
@@ -52,9 +52,11 @@ const MiniMenu = props => {
const
[
expendKey
,
setExpendKey
]
=
useState
(
''
);
// 保存默认展开项
const
[
expendKey
,
setExpendKey
]
=
useState
(
''
);
// 保存默认展开项
const
[
menuList
,
setMenuList
]
=
useState
([]);
// 菜单树
const
[
menuList
,
setMenuList
]
=
useState
([]);
// 菜单树
const
[
keepId
,
setKeepId
]
=
useState
(
''
);
const
[
keepId
,
setKeepId
]
=
useState
(
''
);
const
[
mapDataList
,
setMapDataList
]
=
useState
(
new
Set
());
/* ***************************************************** */
/* ***************************************************** */
const
[
curMenuType
,
setCurMenuType
]
=
useState
(
''
);
const
[
curMenuType
,
setCurMenuType
]
=
useState
(
''
);
const
parentRef
=
useRef
();
// 获取菜单信息
// 获取菜单信息
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -62,6 +64,7 @@ const MiniMenu = props => {
...
@@ -62,6 +64,7 @@ const MiniMenu = props => {
if
(
flag
===
1
)
{
if
(
flag
===
1
)
{
setExpendKey
(
menuID
);
setExpendKey
(
menuID
);
}
}
console
.
log
(
expendKey
);
getInfo
();
getInfo
();
},
[
menuID
,
webid
]);
},
[
menuID
,
webid
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -114,14 +117,23 @@ const MiniMenu = props => {
...
@@ -114,14 +117,23 @@ const MiniMenu = props => {
children
:
hasChild
?
obj
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
children
:
hasChild
?
obj
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
};
};
};
};
const
mapData
=
(
val
,
e
)
=>
{
const
obj
=
{
...
val
};
const
hasChild
=
obj
.
children
.
length
>
0
;
if
(
hasChild
)
{
obj
.
children
.
map
(
i
=>
mapData
(
i
));
}
mapDataList
.
add
(
obj
);
};
// 树的点击事件
// 树的点击事件
const
handleSelect
=
(
prop
,
treeNode
)
=>
{
const
handleSelect
=
(
prop
,
treeNode
)
=>
{
console
.
log
(
prop
);
console
.
log
(
treeNode
);
if
(
treeNode
)
{
if
(
treeNode
)
{
const
{
const
{
node
:
{
menuType
},
node
:
{
menuType
},
}
=
treeNode
;
}
=
treeNode
;
console
.
log
(
menuType
);
console
.
log
(
menuType
);
setCurMenuType
(
menuType
);
switch
(
menuType
)
{
switch
(
menuType
)
{
case
'Web4MenuGroup'
:
case
'Web4MenuGroup'
:
setNodeType
(
2
);
setNodeType
(
2
);
...
@@ -138,6 +150,10 @@ const MiniMenu = props => {
...
@@ -138,6 +150,10 @@ const MiniMenu = props => {
}
}
};
};
const
handleExpand
=
(
keys
,
{
expanded
,
node
})
=>
{
console
.
log
(
keys
);
};
const
getInfo
=
id
=>
{
const
getInfo
=
id
=>
{
if
(
!
menuID
)
{
if
(
!
menuID
)
{
return
;
return
;
...
@@ -291,10 +307,12 @@ const MiniMenu = props => {
...
@@ -291,10 +307,12 @@ const MiniMenu = props => {
.
then
(
res
=>
{
.
then
(
res
=>
{
setSubmitLoading
(
false
);
setSubmitLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
setAddVisible
(
false
);
setAddVisible
(
false
);
setAddTwoVisible
(
false
);
setAddTwoVisible
(
false
);
// setFlag(flag + 1);
// setFlag(flag + 1);
getTree
();
console
.
log
(
prop
);
getTree
(
res
.
data
);
// updateMenuTree('add', item);
// updateMenuTree('add', item);
notification
.
success
({
notification
.
success
({
message
:
'提示'
,
message
:
'提示'
,
...
@@ -304,7 +322,7 @@ const MiniMenu = props => {
...
@@ -304,7 +322,7 @@ const MiniMenu = props => {
}
else
{
}
else
{
notification
.
error
({
notification
.
error
({
message
:
'提示'
,
message
:
'提示'
,
description
:
res
.
m
essage
||
'新增失败'
,
description
:
res
.
m
sg
||
'新增失败'
,
duration
:
10
,
duration
:
10
,
});
});
}
}
...
@@ -314,6 +332,9 @@ const MiniMenu = props => {
...
@@ -314,6 +332,9 @@ const MiniMenu = props => {
console
.
error
(
err
);
console
.
error
(
err
);
});
});
};
};
const
treeCallback
=
prop
=>
{
console
.
log
(
prop
);
};
// 编辑的回调
// 编辑的回调
const
editSubmitCallback
=
prop
=>
{
const
editSubmitCallback
=
prop
=>
{
setLoading
(
true
);
setLoading
(
true
);
...
@@ -411,7 +432,7 @@ const MiniMenu = props => {
...
@@ -411,7 +432,7 @@ const MiniMenu = props => {
}
}
}
}
};
};
const
getTree
=
()
=>
{
const
getTree
=
e
=>
{
getWebModuleTree
(
userMode
||
'super'
)
getWebModuleTree
(
userMode
||
'super'
)
.
then
(
res
=>
{
.
then
(
res
=>
{
setLoading
(
false
);
setLoading
(
false
);
...
@@ -422,14 +443,32 @@ const MiniMenu = props => {
...
@@ -422,14 +443,32 @@ const MiniMenu = props => {
.
map
(
r
=>
r
.
children
.
filter
(
i
=>
i
.
id
===
webid
))
.
map
(
r
=>
r
.
children
.
filter
(
i
=>
i
.
id
===
webid
))
.
flat
(
2
);
.
flat
(
2
);
let
arr2
=
arr
[
0
].
children
.
find
(
item
=>
item
.
text
===
'菜单管理'
).
children
||
[];
let
arr2
=
arr
[
0
].
children
.
find
(
item
=>
item
.
text
===
'菜单管理'
).
children
||
[];
console
.
log
(
arr2
[
0
]);
setKeepId
(
arr2
[
0
]);
setMenuList
(
arr2
||
[]);
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
);
setAddType
(
2
);
break
;
default
:
setNodeType
(
1
);
setAddType
(
1
);
break
;
}
}
setKeepId
(
arr2
[
0
]);
// 进页面后默认展示第一条数据
// 进页面后默认展示第一条数据
if
(
arr2
.
length
>
0
)
{
if
(
arr2
.
length
>
0
)
{
if
(
flag
===
1
)
{
if
(
flag
===
1
)
{
setMenuID
(
arr2
[
0
].
menuID
);
setMenuID
(
arr2
[
0
].
menuID
);
setCurMenuType
(
arr2
[
0
].
menuType
);
switch
(
arr2
[
0
].
menuType
)
{
switch
(
arr2
[
0
].
menuType
)
{
case
'Web4MenuGroup'
:
case
'Web4MenuGroup'
:
setNodeType
(
2
);
setNodeType
(
2
);
...
@@ -524,7 +563,6 @@ const MiniMenu = props => {
...
@@ -524,7 +563,6 @@ const MiniMenu = props => {
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
// updateMenuTree();
// updateMenuTree();
console
.
log
(
11111111
);
getTree
();
getTree
();
// setFlag(flag + 1);
// setFlag(flag + 1);
}
else
{
}
else
{
...
@@ -583,6 +621,7 @@ const MiniMenu = props => {
...
@@ -583,6 +621,7 @@ const MiniMenu = props => {
<
Tree
<
Tree
showIcon
showIcon
onSelect=
{
handleSelect
}
onSelect=
{
handleSelect
}
onExpand=
{
handleExpand
}
treeData=
{
menuList
.
map
(
item
=>
mapTree
(
item
))
}
treeData=
{
menuList
.
map
(
item
=>
mapTree
(
item
))
}
blockNode
blockNode
draggable
draggable
...
...
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