Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
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
zhaochengxiang
szse
Commits
e9594451
Commit
e9594451
authored
Nov 10, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix
parent
defa4eaa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
34 deletions
+73
-34
index.jsx
src/view/Manage/AssetBrowse/index.jsx
+35
-16
AssetTree.jsx
src/view/Manage/AssetManage/Component/AssetTree.jsx
+3
-2
index.jsx
src/view/Manage/AssetResourceBrowse/index.jsx
+35
-16
No files found.
src/view/Manage/AssetBrowse/index.jsx
View file @
e9594451
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
use
Effect
,
use
State
}
from
'react'
;
import
classNames
from
'classnames'
;
import
{
CaretLeftOutlined
,
CaretRightOutlined
}
from
'@ant-design/icons'
;
import
{
ResizableBox
}
from
'react-resizable'
;
...
...
@@ -17,12 +17,29 @@ const AssetBrowse = (props) => {
const
[
nodeParams
,
setNodeParams
]
=
useState
({
centerId
:
''
,
expandId
:
''
,
nodeType
:
''
});
const
[
expandTree
,
setExpandTree
]
=
useState
(
true
);
const
[
expandRelation
,
setExpandRelation
]
=
useState
(
true
);
const
[
assetCount
,
setAssetCount
]
=
useState
(
0
);
const
[
resizeRelation
,
setResizeRelation
]
=
useState
(
false
);
const
[
assetFullScreen
,
setAssetFullScreen
]
=
useState
(
false
);
const
[
treeList
,
setTreeList
]
=
useState
();
const
[
node
,
setNode
]
=
useState
();
const
{
centerId
,
expandId
}
=
nodeParams
;
useEffect
(()
=>
{
if
((
treeList
??[]).
length
>
0
)
{
if
(
expandId
)
{
const
index
=
(
treeList
??[]).
findIndex
(
item
=>
item
.
nodeId
===
expandId
)
if
(
index
!==
-
1
)
{
setNode
(
treeList
[
index
])
}
}
else
if
(
centerId
)
{
const
index
=
(
treeList
??[]).
findIndex
(
item
=>
item
.
nodeId
===
centerId
)
if
(
index
!==
-
1
)
{
setNode
(
treeList
[
index
])
}
}
}
},
[
centerId
,
expandId
,
treeList
])
const
onTreeSelect
=
(
value
,
type
)
=>
{
setNodeParams
({
centerId
:
value
||
''
,
expandId
:
''
,
nodeType
:
type
});
}
...
...
@@ -41,21 +58,10 @@ const AssetBrowse = (props) => {
setNodeParams
(
data
);
}
const
onAssetCountChange
=
(
count
)
=>
{
setAssetCount
(
count
);
}
const
onFullScreenChange
=
(
value
)
=>
{
setAssetFullScreen
(
value
);
}
let
nodeId
=
''
;
if
((
expandId
||
''
)
!==
''
)
{
nodeId
=
expandId
;
}
else
{
nodeId
=
centerId
;
}
const
classes
=
classNames
(
'asset-browse'
,
{
'asset-browse-tree-collapse'
:
!
expandTree
,
'asset-browse-relation-collapse'
:
!
expandRelation
,
...
...
@@ -74,13 +80,26 @@ const AssetBrowse = (props) => {
axis=
'x'
minConstraints=
{
[
230
,
Infinity
]
}
maxConstraints=
{
[
Infinity
,
Infinity
]
}
>
<
AssetTree
centerId=
{
centerId
}
onSelect=
{
onTreeSelect
}
reference=
{
AssetBrowseReference
}
{
...
props
}
/>
<
AssetTree
centerId=
{
centerId
}
onSelect=
{
onTreeSelect
}
reference=
{
AssetBrowseReference
}
getList=
{
(
val
)
=>
{
setTreeList
(
val
)
}
}
{
...
props
}
/>
</
ResizableBox
>
{
expandTree
&&
<
Separate
width=
{
15
}
/>
}
<
div
className=
{
rightClasses
}
>
<
AssetDirectory
id=
{
nodeId
}
assetCount=
{
assetCount
}
reference=
{
AssetBrowseReference
}
nodeType=
{
nodeParams
.
nodeType
}
/>
<
AssetDirectory
id=
{
node
?.
nodeId
}
assetCount=
{
node
?.
dataAssetAndSubDirCount
}
reference=
{
AssetBrowseReference
}
nodeType=
{
node
?.
type
}
/>
<
Separate
height=
{
15
}
/>
<
div
className=
'flex'
style=
{
{
flex
:
1
,
height
:
'100%'
,
overflow
:
'hidden'
}
}
>
{
...
...
@@ -92,7 +111,7 @@ const AssetBrowse = (props) => {
</
React
.
Fragment
>
}
<
div
style=
{
{
flex
:
1
,
overflow
:
'hidden'
}
}
>
<
AssetTable
node=
{
{
nodeId
,
type
:
nodeParams
.
nodeType
}
}
onFullScreenChange=
{
onFullScreenChange
}
{
...
props
}
/>
<
AssetTable
node=
{
node
}
onFullScreenChange=
{
onFullScreenChange
}
{
...
props
}
/>
</
div
>
</
div
>
<
div
className=
'tree-toggle'
onClick=
{
treeToggleClick
}
>
...
...
src/view/Manage/AssetManage/Component/AssetTree.jsx
View file @
e9594451
...
...
@@ -40,7 +40,7 @@ const AssetTree = (props) => {
id
:
MENU_ID
,
});
const
{
onSelect
,
onCheck
,
tableId
,
reference
=
AssetBrowseReference
,
centerId
}
=
props
;
const
{
onSelect
,
onCheck
,
tableId
,
reference
=
AssetBrowseReference
,
centerId
,
getList
}
=
props
;
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
([]);
...
...
@@ -185,6 +185,7 @@ const AssetTree = (props) => {
generateList
(
newData
,
_dataList
);
generateGroupIds
(
newData
,
_groupIds
);
setDataList
(
_dataList
);
getList
?.(
_dataList
)
treeDataRef
.
current
=
newData
;
dataListRef
.
current
=
_dataList
;
...
...
@@ -294,7 +295,7 @@ const AssetTree = (props) => {
const
{
nodeId
,
text
}
=
node
;
const
currentPath
=
path
?
`
${
path
}
/
${
text
}
`
:
text
;
list
.
push
({
key
:
nodeId
,
title
:
text
,
value
:
currentPath
});
list
.
push
({
...
node
,
key
:
nodeId
,
title
:
text
,
value
:
currentPath
});
if
(
node
.
children
)
{
generateList
(
node
.
children
,
list
,
currentPath
);
}
...
...
src/view/Manage/AssetResourceBrowse/index.jsx
View file @
e9594451
import
React
,
{
useState
}
from
'react'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
classNames
from
'classnames'
;
import
{
CaretLeftOutlined
,
CaretRightOutlined
}
from
'@ant-design/icons'
;
import
{
ResizableBox
}
from
'react-resizable'
;
...
...
@@ -16,12 +16,29 @@ const FC = (props) => {
const
[
nodeParams
,
setNodeParams
]
=
useState
({
centerId
:
''
,
expandId
:
''
,
nodeType
:
''
});
const
[
expandTree
,
setExpandTree
]
=
useState
(
true
);
const
[
expandRelation
,
setExpandRelation
]
=
useState
(
true
);
const
[
assetCount
,
setAssetCount
]
=
useState
(
0
);
const
[
resizeRelation
,
setResizeRelation
]
=
useState
(
false
);
const
[
assetFullScreen
,
setAssetFullScreen
]
=
useState
(
false
);
const
[
treeList
,
setTreeList
]
=
useState
();
const
[
node
,
setNode
]
=
useState
();
const
{
centerId
,
expandId
}
=
nodeParams
;
useEffect
(()
=>
{
if
((
treeList
??[]).
length
>
0
)
{
if
(
expandId
)
{
const
index
=
(
treeList
??[]).
findIndex
(
item
=>
item
.
nodeId
===
expandId
)
if
(
index
!==
-
1
)
{
setNode
(
treeList
[
index
])
}
}
else
if
(
centerId
)
{
const
index
=
(
treeList
??[]).
findIndex
(
item
=>
item
.
nodeId
===
centerId
)
if
(
index
!==
-
1
)
{
setNode
(
treeList
[
index
])
}
}
}
},
[
centerId
,
expandId
,
treeList
])
const
onTreeSelect
=
(
value
,
type
)
=>
{
setNodeParams
({
centerId
:
value
||
''
,
expandId
:
''
,
nodeType
:
type
});
}
...
...
@@ -40,21 +57,10 @@ const FC = (props) => {
setNodeParams
(
data
);
}
const
onAssetCountChange
=
(
count
)
=>
{
setAssetCount
(
count
);
}
const
onFullScreenChange
=
(
value
)
=>
{
setAssetFullScreen
(
value
);
}
let
nodeId
=
''
;
if
((
expandId
||
''
)
!==
''
)
{
nodeId
=
expandId
;
}
else
{
nodeId
=
centerId
;
}
const
classes
=
classNames
(
'asset-browse'
,
{
'asset-browse-tree-collapse'
:
!
expandTree
,
'asset-browse-relation-collapse'
:
!
expandRelation
,
...
...
@@ -73,13 +79,26 @@ const FC = (props) => {
axis=
'x'
minConstraints=
{
[
230
,
Infinity
]
}
maxConstraints=
{
[
Infinity
,
Infinity
]
}
>
<
AssetTree
centerId=
{
centerId
}
onSelect=
{
onTreeSelect
}
reference=
{
ResourceBrowseReference
}
{
...
props
}
/>
<
AssetTree
centerId=
{
centerId
}
onSelect=
{
onTreeSelect
}
reference=
{
ResourceBrowseReference
}
getList=
{
(
val
)
=>
{
setTreeList
(
val
)
}
}
{
...
props
}
/>
</
ResizableBox
>
{
expandTree
&&
<
Separate
width=
{
15
}
/>
}
<
div
className=
{
rightClasses
}
>
<
AssetDirectory
id=
{
nodeId
}
assetCount=
{
assetCount
}
reference=
{
ResourceBrowseReference
}
nodeType=
{
nodeParams
.
nodeType
}
/>
<
AssetDirectory
id=
{
node
?.
nodeId
}
assetCount=
{
node
?.
dataAssetAndSubDirCount
}
reference=
{
ResourceBrowseReference
}
nodeType=
{
node
?.
type
}
/>
<
Separate
height=
{
15
}
/>
<
div
className=
'flex'
style=
{
{
flex
:
1
,
height
:
'100%'
,
overflow
:
'hidden'
}
}
>
{
...
...
@@ -91,7 +110,7 @@ const FC = (props) => {
</
React
.
Fragment
>
}
<
div
style=
{
{
flex
:
1
,
overflow
:
'hidden'
}
}
>
<
AssetTable
node=
{
{
nodeId
,
type
:
nodeParams
.
nodeType
}
}
onFullScreenChange=
{
onFullScreenChange
}
{
...
props
}
/>
<
AssetTable
node=
{
node
}
onFullScreenChange=
{
onFullScreenChange
}
{
...
props
}
/>
</
div
>
</
div
>
<
div
className=
'tree-toggle'
onClick=
{
treeToggleClick
}
>
...
...
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