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
c7abb5e1
Commit
c7abb5e1
authored
Oct 10, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
变更目录
parent
47700a11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
4 deletions
+47
-4
change-catalog.jsx
src/view/Manage/AssetResourceManage/change-catalog.jsx
+47
-4
No files found.
src/view/Manage/AssetResourceManage/change-catalog.jsx
View file @
c7abb5e1
...
...
@@ -4,23 +4,47 @@ import { Button, Modal, Spin, Tree, AutoComplete } from 'antd'
import
{
dispatch
}
from
'../../../model'
import
{
generateList
}
from
'./tree'
import
produce
from
'immer'
import
{
highlightSearchContentByTerms
,
showMessage
}
from
'../../../util'
import
{
highlightSearchContentByTerms
,
showMessage
,
showNotifaction
}
from
'../../../util'
const
FC
=
(
props
)
=>
{
const
{
visible
,
items
,
onCancel
}
=
props
const
[
waiting
,
setWaiting
]
=
React
.
useState
(
false
)
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
basicRef
=
React
.
useRef
()
const
close
=
(
refresh
=
false
)
=>
{
setWaiting
(
false
)
setLoading
(
false
)
onCancel
?.(
refresh
)
}
const
save
=
()
=>
{
const
checkedKeys
=
basicRef
.
current
?.
getCheckedKeys
()
if
((
checkedKeys
??[]).
length
===
0
)
{
showMessage
(
'warn'
,
'请先选择资产目录'
)
return
}
setWaiting
(
true
)
dispatch
({
type
:
'assetmanage.loadDataAssets'
,
payload
:
{
params
:
{
dirId
:
checkedKeys
.
join
(
","
),
},
data
:
(
items
??[]).
map
(
item
=>
item
.
id
)
},
callback
:
data
=>
{
setWaiting
(
false
)
if
(
data
?.
message
)
{
showNotifaction
(
'提示'
,
data
?.
message
,
5
)
}
onCancel
?.(
true
)
},
error
:
()
=>
{
setWaiting
(
false
)
}
})
}
const
footer
=
React
.
useMemo
(()
=>
{
...
...
@@ -45,7 +69,7 @@ const FC = (props) => {
centered
destroyOnClose
onCancel=
{
()
=>
{
close
()
}
}
>
<
Spin
spinning=
{
loading
||
waiting
}
>
<
Spin
spinning=
{
waiting
}
>
<
Basic
ref=
{
basicRef
}
items=
{
items
}
/>
</
Spin
>
</
Modal
>
...
...
@@ -64,8 +88,13 @@ const Basic = React.forwardRef(function ({ items }, ref) {
const
[
options
,
setOptions
]
=
React
.
useState
()
const
[
keyword
,
setKeyword
]
=
React
.
useState
()
React
.
useImperativeHandle
(
ref
,
()
=>
({
getCheckedKeys
:
()
=>
checkedKeys
}),
[
checkedKeys
])
React
.
useEffect
(()
=>
{
getTreeData
()
getAssetPaths
()
},
[])
const
treeData
=
React
.
useMemo
(()
=>
{
...
...
@@ -90,6 +119,20 @@ const Basic = React.forwardRef(function ({ items }, ref) {
return
[]
},
[
data
])
const
getAssetPaths
=
()
=>
{
if
((
items
??[]).
length
>
0
)
{
dispatch
({
type
:
'assetmanage.getAssetPaths'
,
payload
:
{
dataAssetId
:
items
[
0
].
id
,
},
callback
:
data
=>
{
setCheckedKeys
((
data
??[]).
map
(
item
=>
item
.
dirId
))
}
})
}
}
const
getTreeData
=
()
=>
{
setLoading
(
true
)
dispatch
({
...
...
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