Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-content
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5d7dcd76
authored
Jun 01, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改menu为tree结构
1 parent
738b1c9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
114 deletions
src/views/discoverManager/components/Menu/index.vue
src/views/discoverManager/components/Menu/index.vue
View file @
5d7dcd7
<
template
>
<div
class=
"menu"
>
<div
v-for=
"(item,index) in menuList"
:key=
"index"
>
<!--
{'menu-active': menuForm.id == item.id} -->
<div
:class=
"['primary-level']"
>
<span>
<i
class=
"el-icon-caret-bottom icon-btn"
v-if=
"item.expansion"
></i>
<i
class=
"el-icon-caret-right icon-btn"
v-else
></i>
{{
item
.
name
}}
</span>
<div
class=
"son-operate-wrap"
ref=
"menuOpRef"
v-show=
"boxShow && menuForm.id == item.id"
>
<ul>
<li
class=
"operate-item"
v-for=
"oItem in primaryLevelOpList"
:key=
"oItem.name"
@
click
.
stop=
"addMenu(oItem)"
>
{{
oItem
.
name
}}
</li>
</ul>
</div>
<span>
<img
class=
"operate-btn"
@
click
.
stop=
"showOperateDialog(1, item)"
:src=
"require('@/assets/draggable.png')"
/>
<!--
<i
class=
"el-icon-edit-outline operate-btn"
></i>
-->
</span>
</div>
<div
class=
"second-level"
>
<div
:class=
"['level',
{'menu-active': curModuleInfo.subMenuId == ele.id}]" @click="slectedSubmenu(item, ele)" v-for="(ele,idx) in item.childList" :key="idx">
<span>
{{
ele
.
name
}}
</span>
<span>
<img
class=
"operate-btn"
@
click
.
stop=
"showOperateDialog(2, ele)"
:src=
"require('@/assets/draggable.png')"
/>
</span>
<div
class=
"son-operate-wrap"
ref=
"subMenuOpRef"
v-show=
"boxShow && menuForm.id == ele.id"
>
<ul>
<li
class=
"operate-item"
v-for=
"oItem in secondLevelOpList"
:key=
"oItem.name"
@
click
.
stop=
"addMenu(oItem)"
>
{{
oItem
.
name
}}
</li>
</ul>
</div>
</div>
</div>
</div>
<GLDialog
:title=
"title"
mode=
"small"
:visible
.
sync=
"menuVisible"
@
onOk=
"commitMenu"
:before-close=
"closeMenuDialog"
@
onCancel=
"closeMenuDialog"
>
<div
class=
"menu-dialog-body"
>
<el-form
ref=
"menuRef"
label-width=
"154px"
:rules=
"menuRules"
:model=
"menuForm"
>
<el-form-item
label=
"模块名称:"
prop=
"name"
class=
"m-t-20"
>
<el-input
style=
"width: 284px;"
:size=
"size"
type=
"text"
v-model=
"menuForm.name"
placeholder=
"请输入"
:maxlength=
"menuForm.level==1 && menuForm.type=='rename' ? 6 : 8"
show-word-limit
></el-input>
</el-form-item>
</el-form>
<div
class=
"menu"
>
<el-tree
class=
"menu-tree"
:data=
"menuList"
node-key=
"id"
default-expand-all
:props=
"defaultProps"
:expand-on-click-node=
"false"
>
<span
:class=
"['custom-tree-node',
{'menu-active': curModuleInfo.subMenuId == data.id}]" slot-scope="{ node, data }" @click="slectedSubmenu(node, data, 'tree')" >
<span>
{{
node
.
label
}}
</span>
<span
class=
"son-operate-wrap"
>
<img
class=
"operate-btn"
@
click
.
stop=
"showOperateDialog(node, data)"
:src=
"require('@/assets/draggable.png')"
/>
<div
class=
"son-operate-dialog"
ref=
"menuOpRef"
v-show=
"boxShow && menuForm.id == data.id"
>
<ul>
<li
class=
"operate-item"
v-for=
"oItem in node.level ==1 ? primaryLevelOpList : secondLevelOpList"
:key=
"oItem.name"
@
click
.
stop=
"addMenu(oItem)"
>
{{
oItem
.
name
}}
</li>
</ul>
</div>
</GLDialog>
</div>
</span>
</span>
</el-tree>
<GLDialog
:title=
"title"
mode=
"small"
:visible
.
sync=
"menuVisible"
@
onOk=
"commitMenu"
:before-close=
"closeMenuDialog"
@
onCancel=
"closeMenuDialog"
>
<div
class=
"menu-dialog-body"
>
<el-form
ref=
"menuRef"
label-width=
"154px"
:rules=
"menuRules"
:model=
"menuForm"
>
<el-form-item
label=
"模块名称:"
prop=
"name"
class=
"m-t-20"
>
<el-input
style=
"width: 284px;"
:size=
"size"
type=
"text"
v-model=
"menuForm.name"
placeholder=
"请输入"
:maxlength=
"menuForm.level==1 && menuForm.type=='rename' ? 6 : 8"
show-word-limit
></el-input>
</el-form-item>
</el-form>
</div>
</GLDialog>
</div>
</
template
>
<
script
>
...
...
@@ -61,6 +48,10 @@
data
()
{
return
{
menuVisible
:
false
,
defaultProps
:
{
children
:
'childList'
,
label
:
'name'
},
menuForm
:
{
id
:
''
,
name
:
''
,
...
...
@@ -156,7 +147,12 @@
}
})
},
slectedSubmenu
(
menuItem
,
subMenuItem
=
{}){
slectedSubmenu
(
menuItem
,
subMenuItem
=
{},
type
){
console
.
log
(
menuItem
,
subMenuItem
)
if
(
type
==
'tree'
)
{
if
(
menuItem
.
level
==
1
)
return
menuItem
=
menuItem
?.
parent
?.
data
||
{}
}
this
.
curModuleInfo
=
{
menuName
:
menuItem
.
name
,
menuId
:
menuItem
.
id
,
...
...
@@ -197,10 +193,10 @@
}
})
},
showOperateDialog
(
level
,
item
){
showOperateDialog
(
node
,
item
){
this
.
boxShow
=
true
const
{
id
,
sceneCode
,
name
}
=
item
this
.
menuForm
=
{...
this
.
menuForm
,
id
,
sceneCode
,
name
,
level
}
this
.
menuForm
=
{...
this
.
menuForm
,
id
,
sceneCode
,
name
,
level
:
node
.
level
}
},
closeMenuDialog
(){
this
.
menuVisible
=
false
...
...
@@ -213,82 +209,81 @@
padding
:
18px
4px
18px
16px
;
width
:
260px
;
box-sizing
:
border-box
;
.menu-dialog-body{
height
:
150px
;
display
:
flex
;
align-items
:
center
;
}
.son-operate-wrap
{
position
:
absolute
;
background-color
:
#fff
;
top
:
80%
;
right
:
4px
;
box-shadow
:
0
3px
6px
-4px
#0000001
f
,
0
6px
16px
0
#00000014
,
0
9px
28px
8px
#0000000
d
;
z-index
:
2
;
.operate-item{
height
:
36px
;
line-height
:
36px
;
padding
:
0
20px
;
font-size
:
14px
;
color
:
#666666
;
list-style
:
none
;
&:hover{
background
:
#F2F1FF
;
}
}
}
.operate-btn
{
height
:
16px
;
width
:
16px
;
vertical-align
:
middle
;
color
:
#5850FF
;
cursor
:
pointer
;
&:first-child{
margin-right
:
13px
;
}
}
.menu-active
{
background
:
#F2F1FF
;
}
.primary-level
{
height
:
28px
;
line-height
:
28px
;
.menu-tree{
color
:
#333333
;
text-align
:
left
;
display
:
flex
;
justify-content
:
space-between
;
font-size
:
14px
;
font-family
:
PingFangSC-Regular
;
cursor
:
default
;
position
:
relative
;
&:hover{
background
:
#F2F1FF
;
/deep/
.el-tree-node__content{
height
:
28px
;
line-height
:
28px
;
.el-tree-node__expand-icon
{
color
:
#333333
;
}
.custom-tree-node
{
width
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
.son-operate-wrap{
position
:
relative
;
.operate-btn{
height
:
16px
;
width
:
16px
;
vertical-align
:
middle
;
color
:
#5850FF
;
cursor
:
pointer
;
}
.son-operate-dialog
{
position
:
absolute
;
background-color
:
#fff
;
top
:
80%
;
right
:
4px
;
box-shadow
:
0
3px
6px
-4px
#0000001
f
,
0
6px
16px
0
#00000014
,
0
9px
28px
8px
#0000000
d
;
z-index
:
999
;
.operate-item{
height
:
36px
;
line-height
:
36px
;
padding
:
0
20px
;
font-size
:
14px
;
color
:
#666666
;
list-style
:
none
;
&:hover{
background
:
#F2F1FF
;
}
}
}
}
}
.menu-active
{
background
:
#F2F1FF
;
}
}
.son-operate-wrap
{
right
:
4px
;
/
deep
/
.el-tree-node__children
{
overflow
:
unset
;
.el-tree-node__content{
padding-left
:
0
!important
;
.custom-tree-node{
margin-left
:
30px
;
padding-left
:
10px
;
&:hover{
background-color
:
#F5F7FA
;
}
}
}
.is-current
{
background-color
:
#fff
!important
;
}
.el-tree-node__expand-icon
{
display
:
none
;
}
}
.icon-btn
{
cursor
:
pointer
;
/
deep
/
.el-tree-node.is-current
>
.el-tree-node__content
{
background-color
:
#fff
!important
;
}
}
.second-level
{
margin-left
:
32px
;
.level{
padding-left
:
8px
;
height
:
32px
;
line-height
:
32px
;
font-size
:
14px
;
color
:
#333333
;
cursor
:
default
;
position
:
relative
;
display
:
flex
;
justify-content
:
space-between
;
&:hover{
background
:
#F2F1FF
;
}
/
deep
/
.el-tree-node__content
:hover
,
.el-upload-list__item
:hover
{
background-color
:
#fff
!important
;
}
}
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment