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
33dbe6b6
Commit
33dbe6b6
authored
May 12, 2025
by
放生的三文鱼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理和浏览端完成排序
parent
7c4f8953
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
31 deletions
+57
-31
dataassetmanager.js
src/service/dataassetmanager.js
+4
-1
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+53
-30
No files found.
src/service/dataassetmanager.js
View file @
33dbe6b6
...
@@ -32,8 +32,11 @@ export function listFilterElements() {
...
@@ -32,8 +32,11 @@ export function listFilterElements() {
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements"
);
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements"
);
}
}
// export function listFilterElementsGroupByType(payload) {
// return GetJSON("/dataassetmanager/elementApi/listFilterElementsGroupByType", payload);
// }
export
function
listFilterElementsGroupByType
(
payload
)
{
export
function
listFilterElementsGroupByType
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements
GroupByType
"
,
payload
);
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements"
,
payload
);
}
}
export
function
setupFilterElementIds
(
payload
)
{
export
function
setupFilterElementIds
(
payload
)
{
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
33dbe6b6
...
@@ -5,7 +5,7 @@ import { Resizable } from 'react-resizable';
...
@@ -5,7 +5,7 @@ import { Resizable } from 'react-resizable';
import
ResizeObserver
from
'rc-resize-observer'
;
import
ResizeObserver
from
'rc-resize-observer'
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
{
useContextMenu
,
Menu
as
RcMenu
,
Item
as
RcItem
}
from
"react-contexify"
;
import
LocalStorage
from
'local-storage'
;
import
LocalStorage
from
'local-storage'
;
import
{
Subject
}
from
"rxjs"
;
import
{
filter
,
Subject
}
from
"rxjs"
;
import
produce
from
'immer'
import
produce
from
'immer'
import
{
useDebounceEffect
}
from
'ahooks'
import
{
useDebounceEffect
}
from
'ahooks'
...
@@ -166,6 +166,10 @@ const AssetTable = (props) => {
...
@@ -166,6 +166,10 @@ const AssetTable = (props) => {
id
:
undefined
id
:
undefined
})
})
const
[
permissions
,
setPermissions
]
=
React
.
useState
([])
const
[
permissions
,
setPermissions
]
=
React
.
useState
([])
const
[
sorterParams
,
setSorterParams
]
=
React
.
useState
({
sortField
:
''
,
sortDirection
:
''
})
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
anchorId
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
const
anchorId
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
...
@@ -265,6 +269,8 @@ const AssetTable = (props) => {
...
@@ -265,6 +269,8 @@ const AssetTable = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
},
[])
useEffect
(()
=>
{
useEffect
(()
=>
{
setSelectItem
({});
setSelectItem
({});
setCheckedKeys
([]);
setCheckedKeys
([]);
...
@@ -358,7 +364,6 @@ const AssetTable = (props) => {
...
@@ -358,7 +364,6 @@ const AssetTable = (props) => {
let
[
allowChangeDirectory
,
allowDelete
,
allowOffline
,
allowAddTag
,
allowSubscribe
,
allowAddDir
]
=
[
true
,
true
,
true
,
true
,
true
,
true
]
let
[
allowChangeDirectory
,
allowDelete
,
allowOffline
,
allowAddTag
,
allowSubscribe
,
allowAddDir
]
=
[
true
,
true
,
true
,
true
,
true
,
true
]
for
(
const
row
of
selectedRows
??[])
{
for
(
const
row
of
selectedRows
??[])
{
console
.
log
(
'tt'
,
row
)
const
changeDirecotoryIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'changeDir'
)
const
changeDirecotoryIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'changeDir'
)
const
deleteIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'delete'
)
const
deleteIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'delete'
)
const
offlineIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'offline'
)
const
offlineIndex
=
(
row
.
allowButtons
??[]).
findIndex
(
item
=>
item
===
'offline'
)
...
@@ -394,30 +399,23 @@ const AssetTable = (props) => {
...
@@ -394,30 +399,23 @@ const AssetTable = (props) => {
setAddDir
?.(
adddirAble
)
setAddDir
?.(
adddirAble
)
},[
adddirAble
])
},[
adddirAble
])
const
realAssets
=
useMemo
(()
=>
{
const
newAssets
=
[...
assets
];
// if (users?.length > 0 && assets?.length > 0 && columns?.length > 0) {
// const specialCol = ['数据关键用户', '业务数据owner', 'it责任人', '创建人', '更新人'];
// const indexArray = [];
// columns.forEach((item, index) => {
// if (specialCol.indexOf(item.title?.toLowerCase()) !== -1) {
// indexArray.push(index);
// }
// });
// newAssets?.forEach((item) => {
// 直接使用数组作为数据源,添加key
// indexArray?.forEach(index => {
const
dataSource
=
useMemo
(()
=>
{
// const user = users?.filter((user)=>(user.pernr===item[`element${index+1}`]));
let
data
=
[]
// if (user && user.length > 0) {
assets
?.
map
((
asset
)
=>
{
// item[`element${index+1}`] = user[0].nachn?`${user[0].nachn}(${user[0].pernr})`:user[0].pernr;
let
temp
=
{}
// }
asset
?.
elementValuesWithoutTypeAttribute
?.
map
((
row
,
rowIndex
)
=>
{
// })
const
key
=
columns
?.[
rowIndex
]?.
dataIndex
// })
temp
[
key
]
=
row
// }
})
temp
=
{...
asset
,...
temp
}
data
.
push
(
temp
)
});
console
.
log
(
'data'
,
data
);
return
newAssets
;
return
data
},
[
users
,
assets
,
columns
])
},
[
assets
,
columns
])
const
menuData
=
React
.
useMemo
(()
=>
{
const
menuData
=
React
.
useMemo
(()
=>
{
const
newMenuData
=
[]
const
newMenuData
=
[]
...
@@ -564,14 +562,14 @@ const AssetTable = (props) => {
...
@@ -564,14 +562,14 @@ const AssetTable = (props) => {
let
index
=
0
,
_metadataIndex
=
''
;
let
index
=
0
,
_metadataIndex
=
''
;
(
data
||
[]).
forEach
(
group
=>
{
(
data
||
[]).
forEach
(
group
=>
{
(
group
.
names
||
[]).
forEach
((
name
,
i
)
=>
{
index
++
;
index
++
;
const
name
=
group
.
name
const
params
=
{
const
params
=
{
title
:
name
,
title
:
name
,
dataIndex
:
`element
${
index
}
`
,
dataIndex
:
group
.
enName
,
ellipsis
:
true
,
ellipsis
:
true
,
width
:
150
,
width
:
150
,
sorter
:
true
,
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
return
(
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
Tooltip
title=
{
text
||
''
}
>
...
@@ -632,7 +630,7 @@ const AssetTable = (props) => {
...
@@ -632,7 +630,7 @@ const AssetTable = (props) => {
_columns
.
push
(
params
);
_columns
.
push
(
params
);
})
})
})
console
.
log
(
'columns'
,
_columns
);
setAssets
([]);
setAssets
([]);
...
@@ -657,6 +655,7 @@ const AssetTable = (props) => {
...
@@ -657,6 +655,7 @@ const AssetTable = (props) => {
currentDirIsCustom
:
nodeType
===
'custom'
,
currentDirIsCustom
:
nodeType
===
'custom'
,
pageNum
,
pageNum
,
pageSize
,
pageSize
,
...
sorterParams
,
range
:
getAssetRange
(
reference
),
range
:
getAssetRange
(
reference
),
keyword
:
encodeURIComponent
(
keyword
)
keyword
:
encodeURIComponent
(
keyword
)
};
};
...
@@ -695,7 +694,7 @@ const AssetTable = (props) => {
...
@@ -695,7 +694,7 @@ const AssetTable = (props) => {
(
data
.
data
||
[]).
forEach
(
asset
=>
{
(
data
.
data
||
[]).
forEach
(
asset
=>
{
let
_asset
=
{...
asset
},
index
=
0
;
let
_asset
=
{...
asset
},
index
=
0
;
(
asset
.
elementValues
||
[]).
forEach
((
elementValue
)
=>
{
(
asset
.
elementValues
WithoutTypeAttribute
||
[]).
forEach
((
elementValue
)
=>
{
(
elementValue
.
values
||
[]).
forEach
((
value
,
i
)
=>
{
(
elementValue
.
values
||
[]).
forEach
((
value
,
i
)
=>
{
...
@@ -1208,6 +1207,28 @@ const AssetTable = (props) => {
...
@@ -1208,6 +1207,28 @@ const AssetTable = (props) => {
}
}
}
}
const handleTableChange = (pagination, filters, sorter) => {
const temp = sorter?.order; // 或 'descend' 或 ''
let sortDirection;
if (temp === 'ascend') {
sortDirection = 'ASC';
} else if (temp === 'descend') {
sortDirection = 'DESC';
} else {
sortDirection = ''; // 或者其他默认值
}
setSorterParams({
sortField:sorter?.field,
sortDirection
})
};
useEffect(()=>{
if(sorterParams.sortDirection||sorterParams.sortField) {
getDataAssets()
}
},[sorterParams])
return(
return(
<div className={classes}>
<div className={classes}>
<div
<div
...
@@ -1393,8 +1414,10 @@ const AssetTable = (props) => {
...
@@ -1393,8 +1414,10 @@ const AssetTable = (props) => {
// columns={reference===AssetManageReference?[indexCol, ...columns, tagCol]:[indexCol, ...columns]}
// columns={reference===AssetManageReference?[indexCol, ...columns, tagCol]:[indexCol, ...columns]}
columns={reference===AssetManageReference?[indexCol, ...columns, tagCol]:[indexCol, ...columns, tagCol]}
columns={reference===AssetManageReference?[indexCol, ...columns, tagCol]:[indexCol, ...columns, tagCol]}
rowKey='id'
rowKey='id'
dataSource={
realAssets
}
dataSource={
dataSource
}
pagination={false}
pagination={false}
onChange={handleTableChange}
sortDirections={['ascend', 'descend','']}
size='default'
size='default'
scroll={{ y: scrollY }}
scroll={{ y: scrollY }}
/>
/>
...
...
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