Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
ed6b27ed
Unverified
Commit
ed6b27ed
authored
Aug 11, 2023
by
zhu-mingye
Committed by
GitHub
Aug 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify some style (#2199)
parent
7b38967f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
function.tsx
dinky-web/src/pages/AuthCenter/Menu/function.tsx
+27
-5
No files found.
dinky-web/src/pages/AuthCenter/Menu/function.tsx
View file @
ed6b27ed
...
@@ -21,6 +21,8 @@ import {SysMenu} from "@/types/RegCenter/data";
...
@@ -21,6 +21,8 @@ import {SysMenu} from "@/types/RegCenter/data";
import
{
searchTreeNode
}
from
"@/utils/function"
;
import
{
searchTreeNode
}
from
"@/utils/function"
;
import
*
as
Icons
from
'@ant-design/icons'
;
import
*
as
Icons
from
'@ant-design/icons'
;
import
*
as
React
from
"react"
;
import
*
as
React
from
"react"
;
import
{
Space
}
from
"antd"
;
import
{
l
}
from
"@/utils/intl"
;
/**
/**
* render icon
* render icon
...
@@ -29,9 +31,29 @@ import * as React from "react";
...
@@ -29,9 +31,29 @@ import * as React from "react";
*/
*/
const
renderIcon
=
(
iconName
:
string
)
=>
{
const
renderIcon
=
(
iconName
:
string
)
=>
{
// @ts-ignore
// @ts-ignore
return
iconName
?
React
.
createElement
(
Icons
[
iconName
]):
null
;
return
iconName
?
React
.
createElement
(
Icons
[
iconName
])
:
null
;
}
}
const
renderMenuType
=
(
menuYype
:
string
)
=>
{
switch
(
menuYype
)
{
case
'F'
:
return
<>
{
l
(
'menu.type.button'
)
}
</>
case
'M'
:
return
<>
{
l
(
'menu.type.dir'
)
}
</>
case
'C'
:
return
<>
{
l
(
'menu.type.menu'
)
}
</>
default
:
return
null
}
}
const
renderTitle
=
(
value
:
SysMenu
)
=>
(<
Space
>
{
value
.
perms
&&
<
span
style=
{
{
color
:
'grey'
}
}
>
{
value
.
perms
}
</
span
>
}
{
value
.
type
&&
<
span
style=
{
{
color
:
'grey'
}
}
>
{
renderMenuType
(
value
.
type
)
}
</
span
>
}
{
value
.
note
&&
<
span
style=
{
{
color
:
'grey'
}
}
>
{
value
.
note
}
</
span
>
}
</
Space
>
);
/**
/**
* build menu tree
* build menu tree
* @param {SysMenu[]} data
* @param {SysMenu[]} data
...
@@ -40,7 +62,7 @@ const renderIcon = (iconName: string) => {
...
@@ -40,7 +62,7 @@ const renderIcon = (iconName: string) => {
* @returns {any}
* @returns {any}
*/
*/
export
const
buildMenuTree
=
(
data
:
SysMenu
[],
searchValue
:
string
=
''
):
any
=>
data
.
filter
((
sysMenu
:
SysMenu
)
=>
(
sysMenu
.
name
.
toLowerCase
().
indexOf
(
searchValue
.
toLowerCase
())
>
-
1
)).
map
((
item
:
SysMenu
)
=>
{
export
const
buildMenuTree
=
(
data
:
SysMenu
[],
searchValue
:
string
=
''
):
any
=>
data
.
filter
((
sysMenu
:
SysMenu
)
=>
(
sysMenu
.
name
.
toLowerCase
().
indexOf
(
searchValue
.
toLowerCase
())
>
-
1
)).
map
((
item
:
SysMenu
)
=>
{
// const renderTitle = (value: SysMenu) =>( <>{value.name} {value.perms && <span style={{color: 'grey'}}> ----- {value.perms}</span>}</>)
return
{
return
{
isLeaf
:
!
item
.
children
||
item
.
children
.
length
===
0
,
isLeaf
:
!
item
.
children
||
item
.
children
.
length
===
0
,
...
@@ -51,7 +73,7 @@ export const buildMenuTree = (data: SysMenu[], searchValue: string = ''): any =>
...
@@ -51,7 +73,7 @@ export const buildMenuTree = (data: SysMenu[], searchValue: string = ''): any =>
content
:
item
.
note
,
content
:
item
.
note
,
path
:
item
.
path
,
path
:
item
.
path
,
value
:
item
.
id
,
value
:
item
.
id
,
title
:
searchTreeNode
(
item
.
name
,
searchValue
)
,
title
:
<>
{
searchTreeNode
(
item
.
name
,
searchValue
)
}{
renderTitle
(
item
)
}
</>
,
fullInfo
:
item
,
fullInfo
:
item
,
key
:
item
.
id
,
key
:
item
.
id
,
children
:
buildMenuTree
(
item
.
children
,
searchValue
),
children
:
buildMenuTree
(
item
.
children
,
searchValue
),
...
@@ -78,9 +100,9 @@ export const buildMenuFormTree = (data: SysMenu[], searchValue: string = '', fil
...
@@ -78,9 +100,9 @@ export const buildMenuFormTree = (data: SysMenu[], searchValue: string = '', fil
content
:
item
.
note
,
content
:
item
.
note
,
path
:
item
.
path
,
path
:
item
.
path
,
value
:
item
.
id
,
value
:
item
.
id
,
title
:
searchTreeNode
(
item
.
name
,
searchValue
)
,
title
:
<>
{
searchTreeNode
(
item
.
name
,
searchValue
)
}{
renderTitle
(
item
)
}
</>
,
fullInfo
:
item
,
fullInfo
:
item
,
key
:
item
.
id
,
key
:
item
.
id
,
children
:
buildMenuFormTree
(
item
.
children
,
searchValue
,
filterButton
),
children
:
buildMenuFormTree
(
item
.
children
,
searchValue
,
filterButton
),
}
}
});
});
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