Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
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
fulixin
dsk-operate-sys-cscec
Commits
de398331
Commit
de398331
authored
Feb 19, 2024
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
634f8fc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
8 deletions
+36
-8
index.vue
...ectCostLedger/detail/components/ProjectSideMenu/index.vue
+36
-8
No files found.
dsk-operate-ui/src/views/projectCostLedger/detail/components/ProjectSideMenu/index.vue
View file @
de398331
<
template
>
<
template
>
<div
class=
"project-side-menu-container"
>
<div
class=
"project-side-menu-container"
>
<el-menu
mode=
"vertical"
class=
"project-side-menu-instance"
>
<el-menu
mode=
"vertical"
class=
"project-side-menu-instance"
>
<project-menu-item></project-menu-item>
<template
v-for=
"(item,index) of tempMenuTree"
>
<project-menu-item
:menuItem=
"item"
:key=
"item.nodeValue"
></project-menu-item>
</
template
>
</el-menu>
</el-menu>
</div>
</div>
</template>
</template>
...
@@ -75,6 +77,10 @@ export default {
...
@@ -75,6 +77,10 @@ export default {
this
.
tempMenuOptions
=
_options
;
this
.
tempMenuOptions
=
_options
;
// 映射配置
// 映射配置
const
resultData
=
this
.
mapDataByMenuOptions
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
comMenuTree
)),
_options
);
const
resultData
=
this
.
mapDataByMenuOptions
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
comMenuTree
)),
_options
);
console
.
log
(
resultData
);
if
(
resultData
)
{
this
.
tempMenuTree
=
resultData
;
}
}
}
},
},
mergeMenuOptions
(
options
)
{
mergeMenuOptions
(
options
)
{
...
@@ -86,10 +92,31 @@ export default {
...
@@ -86,10 +92,31 @@ export default {
return
options
;
return
options
;
},
},
mapDataByMenuOptions
(
menuList
,
options
)
{
mapDataByMenuOptions
(
menuList
,
options
)
{
// 分组源数据
const
_groupData
=
this
.
groupData
(
menuList
,
options
);
// 映射过后的树
// 映射过后的树
const
_mapedData
=
this
.
mapData
(
menuList
,
options
);
const
_mapedData
=
this
.
mapData
(
_groupData
,
options
);
// 处理层级 以及删除空children
// 处理层级 以及删除空children
this
.
buildTree
(
_mapedData
);
return
this
.
buildTree
(
_mapedData
);
},
groupData
(
data
,
options
,
originData
=
[])
{
if
(
data
?.
length
)
{
const
{
children
}
=
options
;
const
len
=
data
.
length
;
for
(
let
index
=
0
;
index
<
len
;
index
++
)
{
const
_item
=
data
[
index
];
const
_newItem
=
JSON
.
parse
(
JSON
.
stringify
(
_item
));
originData
.
push
({
originData
:
_newItem
});
if
(
_item
[
children
]
instanceof
Array
&&
_item
[
children
].
length
)
{
_newItem
[
children
]
=
this
.
groupData
(
_item
[
children
],
options
);
}
else
{
delete
_newItem
[
children
];
}
}
}
return
originData
;
},
},
mapData
(
data
=
[],
mapOptions
)
{
mapData
(
data
=
[],
mapOptions
)
{
const
keys
=
Object
.
keys
(
mapOptions
);
const
keys
=
Object
.
keys
(
mapOptions
);
...
@@ -97,12 +124,13 @@ export default {
...
@@ -97,12 +124,13 @@ export default {
data
.
forEach
(
item
=>
{
data
.
forEach
(
item
=>
{
// 循环key映射到 树
// 循环key映射到 树
keys
.
forEach
(
key
=>
{
keys
.
forEach
(
key
=>
{
const
mapKey
=
mapOptions
[
key
];
const
_mapKey
=
mapOptions
[
key
];
if
(
Object
.
hasOwnProperty
.
call
(
item
,
mapKey
))
{
const
_origin
=
item
[
"originData"
];
item
[
key
]
=
item
[
mapKey
];
if
(
Object
.
hasOwnProperty
.
call
(
_origin
,
_mapKey
))
{
item
[
key
]
=
JSON
.
parse
(
JSON
.
stringify
(
_origin
[
_mapKey
]));
}
}
});
});
if
(
item
?.
children
)
{
if
(
item
?.
children
instanceof
Array
&&
item
.
children
.
length
)
{
// 递归映射
// 递归映射
this
.
mapData
(
item
?.
children
,
mapOptions
);
this
.
mapData
(
item
?.
children
,
mapOptions
);
}
}
...
@@ -115,7 +143,7 @@ export default {
...
@@ -115,7 +143,7 @@ export default {
// 添加层级
// 添加层级
addTreeLevel
(
mapedData
);
addTreeLevel
(
mapedData
);
addNodeParent
(
mapedData
);
addNodeParent
(
mapedData
);
console
.
log
(
mapedData
)
;
return
mapedData
;
}
}
}
}
},
},
...
...
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