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
519753ea
Commit
519753ea
authored
Oct 16, 2023
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定位
parent
906ad613
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
10 deletions
+72
-10
Table.tsx
src/util/Component/Table.tsx
+1
-0
table.jsx
src/view/Manage/AssetResourceManage/table.jsx
+71
-10
No files found.
src/util/Component/Table.tsx
View file @
519753ea
...
...
@@ -131,6 +131,7 @@ function FC<RowType extends object = any>({ width, maxHeight, pageSize, pageNum,
}
}
onRow=
{
(
record
,
index
)
=>
{
return
{
id
:
record
.
id
,
onClick
:
event
=>
{
onRowClick
?.(
event
,
record
)
},
...
...
src/view/Manage/AssetResourceManage/table.jsx
View file @
519753ea
...
...
@@ -7,7 +7,7 @@ import { debounceTime, Subject } from 'rxjs'
import
{
defaultPage
,
usePage
}
from
'../../../util/hooks/page'
import
Table
from
'../../../util/Component/Table'
import
{
dispatch
}
from
'../../../model'
import
{
getAssetRange
,
getAssetType
,
isSzseEnv
,
showMessage
,
showNotifaction
}
from
'../../../util'
import
{
getAssetRange
,
getAssetType
,
getQueryParam
,
isSzseEnv
,
showMessage
,
showNotifaction
}
from
'../../../util'
import
{
ResourceManageReference
}
from
'../../../util/constant'
import
PermissionButton
from
'../../../util/Component/PermissionButton'
import
PermissionMenuItem
from
'../../../util/Component/PermissionMenuItem'
...
...
@@ -96,6 +96,9 @@ const FC = (props) => {
const
[
page
,
setPage
]
=
usePage
()
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
()
const
locationIdRef
=
React
.
useRef
(
'id'
,
props
?.
location
?.
search
)
const
locationDidRef
=
React
.
useRef
(
'did'
,
props
?.
location
?.
search
)
const
setArgsAndPage
=
React
.
useCallback
((
params
)
=>
{
// 设置查询参数时将分页置为1
setPage
(
prevpg
=>
{
...
...
@@ -121,6 +124,12 @@ const FC = (props) => {
const
storageChange
=
(
e
)
=>
{
if
(
e
.
key
===
'editAssetsChange'
)
{
getAssets
()
}
else
if
(
e
.
key
===
'assetRelationOnClickEvent'
)
{
locationIdRef
.
current
=
e
.
relation
?.
dataAssetId
locationDidRef
.
current
=
e
.
relation
?.
dirId
}
else
if
(
e
.
key
===
'assetPathOnClickEvent'
)
{
locationIdRef
.
current
=
e
.
id
locationDidRef
.
current
=
e
.
dirId
}
}
...
...
@@ -161,7 +170,11 @@ const FC = (props) => {
if
(
node
)
{
setRow
()
setSelectedRows
([])
setPageAndArgs
({
pageNum
:
1
,
pageSize
:
page
.
pageSize
})
if
(
locationIdRef
.
current
&&
locationDidRef
.
current
)
{
getDataAssetLocation
()
}
else
{
setPageAndArgs
({
pageNum
:
1
,
pageSize
:
page
.
pageSize
})
}
}
},
[
node
])
...
...
@@ -434,22 +447,49 @@ const FC = (props) => {
setLoading
(
false
)
setData
(
data
?.
data
)
setTotal
(
data
?.
total
)
setRow
(
prevRow
=>
{
if
(
!
prevRow
||
(
data
?.
data
??[]).
findIndex
(
item
=>
item
.
id
===
prevRow
.
id
)
===
-
1
)
{
if
(
locationIdRef
.
current
)
{
const
index
=
(
data
?.
data
??[]).
findIndex
(
item
=>
item
.
id
===
locationIdRef
.
current
)
console
.
log
(
'index'
,
index
)
if
(
index
!==
-
1
)
{
onClick
?.(
data
?.
data
[
index
])
setRow
(
data
?.
data
[
index
])
}
else
{
if
((
data
?.
data
??[]).
length
>
0
)
{
onClick
?.(
data
?.
data
[
0
])
return
data
?.
data
[
0
]
setRow
(
data
?.
data
[
0
])
}
else
{
onClick
?.(
undefined
)
return
undefined
setRow
()
}
}
return
prevRow
})
}
setTimeout
(()
=>
{
var
anchor
=
document
.
getElementById
(
`
${
locationIdRef
.
current
}
`
)
anchor
?.
scrollIntoView
()
locationIdRef
.
current
=
null
locationDidRef
.
current
=
null
},
500
)
}
else
{
setRow
(
prevRow
=>
{
if
(
!
prevRow
||
(
data
?.
data
??[]).
findIndex
(
item
=>
item
.
id
===
prevRow
.
id
)
===
-
1
)
{
if
((
data
?.
data
??[]).
length
>
0
)
{
onClick
?.(
data
?.
data
[
0
])
return
data
?.
data
[
0
]
}
else
{
onClick
?.(
undefined
)
return
undefined
}
}
return
prevRow
})
}
},
error
:
()
=>
{
setLoading
(
false
)
locationIdRef
.
current
=
null
locationDidRef
.
current
=
null
}
})
}
...
...
@@ -475,6 +515,27 @@ const FC = (props) => {
}
}
const
getDataAssetLocation
=
()
=>
{
setLoading
(
true
)
dispatch
({
type
:
'assetmanage.getDataAssetLocation'
,
payload
:
{
dataAssetId
:
locationIdRef
.
current
,
dirId
:
locationDidRef
.
current
,
},
callback
:
data
=>
{
const
newPageNum
=
parseInt
(
data
.
offset
/
page
.
pageSize
+
((
data
.
offset
%
page
.
pageSize
===
0
)?
0
:
1
))
setPageAndArgs
({
...
page
,
pageNum
:
newPageNum
})
},
error
:
()
=>
{
setLoading
(
false
)
locationIdRef
.
current
=
null
locationDidRef
.
current
=
null
setPageAndArgs
({
...
page
,
pageNum
:
1
})
}
})
}
const
onAddClick
=
()
=>
{
setAddAssetParams
({
visible
:
true
,
...
...
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