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
438cec8b
Commit
438cec8b
authored
Jun 13, 2025
by
放生的三文鱼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理和浏览端的排序
parent
500d1da7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
51 deletions
+82
-51
dataassetmanager.js
src/service/dataassetmanager.js
+5
-2
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+77
-49
No files found.
src/service/dataassetmanager.js
View file @
438cec8b
...
...
@@ -32,8 +32,11 @@ export function listFilterElements() {
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements"
);
}
// export function listFilterElementsGroupByType(payload) {
// return GetJSON("/dataassetmanager/elementApi/listFilterElementsGroupByType", payload);
// }
export
function
listFilterElementsGroupByType
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements
GroupByType
"
,
payload
);
return
GetJSON
(
"/dataassetmanager/elementApi/listFilterElements"
,
payload
);
}
export
function
setupFilterElementIds
(
payload
)
{
...
...
@@ -373,7 +376,7 @@ export function getDrafts(payload) {
}
export
function
listDraftFilterElementsGroupByType
(
payload
)
{
return
GetJSON
(
"/dataassetmanager/elementApi/listDraftFilterElements
GroupByType
"
,
payload
);
return
GetJSON
(
"/dataassetmanager/elementApi/listDraftFilterElements"
,
payload
);
}
...
...
src/view/Manage/AssetManage/Component/AssetTable.jsx
View file @
438cec8b
...
...
@@ -35,6 +35,7 @@ import 'react-contexify/dist/ReactContexify.css';
import
{
getTemplateType
}
from
"../../../../util/axios"
;
import
{
useGetModalInfoAndAction
}
from
"@/hooks/common"
;
import
AssetFlow
from
"./AssetFlow"
import
{
assetsActionManageService
}
from
"@/services"
;
const
{
Text
}
=
Typography
;
const
{
Column
}
=
Table
;
...
...
@@ -107,7 +108,7 @@ export const listSubject = new Subject();
const
AssetTable
=
(
props
)
=>
{
const
{
className
,
nodeId
,
nodeType
,
nodeLevel
,
nodeAllowdLoadDataAsset
,
elementsChanged
,
assetActionChanged
,
onSelect
,
onCountChange
,
reference
=
AssetManageReference
,
onFullScreenChange
,
template
}
=
props
;
const
MENU_ID
=
'asset-table'
;
const
{
show
}
=
useContextMenu
({
...
...
@@ -167,6 +168,10 @@ const AssetTable = (props) => {
id
:
undefined
})
const
[
permissions
,
setPermissions
]
=
React
.
useState
([])
const
[
sorterParams
,
setSorterParams
]
=
React
.
useState
({
sortField
:
''
,
sortDirection
:
''
})
const
[
modal
,
contextHolder
]
=
Modal
.
useModal
();
const
anchorId
=
getQueryParam
(
AnchorId
,
props
?.
location
?.
search
);
...
...
@@ -266,6 +271,8 @@ const AssetTable = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[])
useEffect
(()
=>
{
setSelectItem
({});
setCheckedKeys
([]);
...
...
@@ -298,11 +305,11 @@ const AssetTable = (props) => {
},
[
timestamp
])
useDebounceEffect
(()
=>
{
if
(
reference
!==
AssetRecycleReference
&&
nodeId
)
{
if
(
reference
!==
AssetRecycleReference
&&
(
nodeId
||
nodeId
===
undefined
)
)
{
getFilterElementsGroupThenGetDataAssets
();
}
//eslint-disable-next-line react-hooks/exhaustive-deps
},
[
keyword
,
pagination
,
elementsChanged
,
assetActionChanged
,
recursive
,
fullSearch
,
currentElementId
,
nodeId
],
{
wait
:
3
0
0
})
},
[
keyword
,
pagination
,
elementsChanged
,
assetActionChanged
,
recursive
,
fullSearch
,
currentElementId
,
nodeId
],
{
wait
:
3
5
0
})
useEffect
(()
=>
{
if
(
reference
===
AssetRecycleReference
)
{
...
...
@@ -389,30 +396,21 @@ const AssetTable = (props) => {
return
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
]
},
[
permissions
,
selectedRows
])
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) => {
// indexArray?.forEach(index => {
// const user = users?.filter((user)=>(user.pernr===item[`element${index+1}`]));
// if (user && user.length > 0) {
// item[`element${index+1}`] = user[0].nachn?`${user[0].nachn}(${user[0].pernr})`:user[0].pernr;
// }
// })
// })
// }
return
newAssets
;
},
[
users
,
assets
,
columns
])
// 直接使用数组作为数据源,添加key
const
realAssets
=
useMemo
(()
=>
{
let
data
=
[]
assets
?.
map
((
asset
)
=>
{
let
temp
=
{}
asset
?.
elementValuesWithoutTypeAttribute
?.
map
((
row
,
rowIndex
)
=>
{
const
key
=
columns
?.[
rowIndex
]?.
dataIndex
temp
[
key
]
=
row
})
temp
=
{...
asset
,...
temp
}
data
.
push
(
temp
)
});
return
data
},[
assets
,
columns
])
const
menuData
=
React
.
useMemo
(()
=>
{
const
newMenuData
=
[]
...
...
@@ -561,14 +559,14 @@ const AssetTable = (props) => {
let
index
=
0
,
_metadataIndex
=
''
;
(
data
||
[]).
forEach
(
group
=>
{
(
group
.
names
||
[]).
forEach
((
name
,
i
)
=>
{
index
++
;
const
name
=
group
.
name
const
params
=
{
title
:
name
,
dataIndex
:
`element
${
index
}
`
,
dataIndex
:
group
.
enName
,
ellipsis
:
true
,
width
:
120
,
width
:
150
,
sorter
:
true
,
render
:
(
text
,
record
)
=>
{
return
(
<
Tooltip
title=
{
text
||
''
}
>
...
...
@@ -581,7 +579,7 @@ const AssetTable = (props) => {
};
if
(
name
===
'编号'
)
{
params
.
width
=
1
5
0
;
params
.
width
=
1
2
0
;
// params.fixed = 'left';
}
else
if
(
name
===
'中文名称'
||
name
===
'岗位中文名'
)
{
params
.
width
=
isSzseEnv
?
230
:
160
;
...
...
@@ -628,9 +626,8 @@ const AssetTable = (props) => {
}
_columns
.
push
(
params
);
})
})
setAssets
([]);
setColumns
(
_columns
);
...
...
@@ -654,6 +651,7 @@ const AssetTable = (props) => {
currentDirIsCustom
:
nodeType
===
'custom'
,
pageNum
,
pageSize
,
...
sorterParams
,
range
:
getAssetRange
(
reference
),
keyword
:
encodeURIComponent
(
keyword
)
};
...
...
@@ -688,20 +686,15 @@ const AssetTable = (props) => {
payload
:
params
,
callback
:
data
=>
{
const
_assets
=
[];
(
data
.
data
||
[]).
forEach
(
asset
=>
{
(
data
.
data
||
[]).
forEach
(
asset
=>
{
let
_asset
=
{...
asset
},
index
=
0
;
(
asset
.
elementValues
||
[]).
forEach
((
elementValue
)
=>
{
(
elementValue
.
values
||
[]).
forEach
((
value
,
i
)
=>
{
(
asset
?.
elementValuesWithoutTypeAttribute
||
[]).
forEach
((
value
)
=>
{
index
++
;
if
(
projectIndex
===
`element
${
index
}
`
)
{
let
metadata
=
{};
try
{
metadata
=
JSON
.
parse
(
value
);
_asset
[
'metadata'
]
=
metadata
;
_asset
[
`element
${
index
}
`
]
=
metadata
;
...
...
@@ -713,14 +706,11 @@ const AssetTable = (props) => {
}
else
{
_asset
[
`element
${
index
}
`
]
=
value
;
}
});
})
_assets
.
push
(
_asset
);
})
setAssets
(
_assets
);
if
(
shouldScrollRef
.
current
)
{
let
scrollId
=
null
;
if
(
remoteRelationRef
.
current
)
{
...
...
@@ -820,7 +810,9 @@ const AssetTable = (props) => {
title
:
'提示'
,
content
:
'是否导出所有资产目录?'
,
onOk
:
()
=>
{
window
.
open
(
`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true&templateType=
${
getTemplateType
()}
&queryElementId=
${
currentElementId
??
''
}
&
keyword
=
$
{
encodeURIComponent
(
keyword
??
''
)}
`);
const
exportAll
=
checkedKeys
?.
length
===
0
&&
!
nodeId
?
true
:
false
const
dirId
=
checkedKeys
?.
length
===
0
&&
nodeId
?
nodeId
:
''
window
.
open
(
`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=
${
exportAll
}
&dirId=
${
dirId
}
&templateType=
${
getTemplateType
()}
&queryElementId=
${
currentElementId
??
''
}
&
keyword
=
$
{
encodeURIComponent
(
keyword
??
''
)}
`);
}
})
} else {
...
...
@@ -828,6 +820,20 @@ const AssetTable = (props) => {
}
}
const exportAssetColumns = () => {
modal.confirm({
title: '提示',
content: '是否导出资源目录字段?',
async onOk(){
// await assetsActionManageService.exportAssetsColumns({templateType:getTemplateType(),dataAssetIds:checkedKeys.join(',')})
//window.open(`
/
api
/
dataassetmanager
/
dataAssetApi
/
exportByDataAssetIds
?
exportAll
=
true
&
templateType
=
$
{
getTemplateType
()}
&
queryElementId
=
$
{
currentElementId
??
''
}
&
keyword
=
$
{
encodeURIComponent
(
keyword
??
''
)}
`);
const exportAll = checkedKeys?.length === 0 && !nodeId ? true : false
const dirId = checkedKeys?.length === 0 && nodeId ? nodeId : ''
await assetsActionManageService.exportBusinessColumnsByDataAssetId({dirId,exportAll,templateType:getTemplateType(),dataAssetIds:checkedKeys.join(',')})
}
})
}
const subscriptAsset = () => {
if ((checkedKeys||[]).length === 0) return;
...
...
@@ -1204,7 +1210,27 @@ const AssetTable = (props) => {
}
}
console.log('questionModal',questionModal)
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(
<div className={classes}>
...
...
@@ -1385,6 +1411,8 @@ const AssetTable = (props) => {
rowKey='id'
dataSource={realAssets}
pagination={false}
onChange={handleTableChange}
sortDirections={['ascend', 'descend','']}
size='default'
scroll={{ y: scrollY }}
/>
...
...
@@ -1403,7 +1431,7 @@ const AssetTable = (props) => {
/>
<AssetFlow visible={questionModal.visible} onCancel={()=>{questionModal.cancelModal()}} item={questionModal.currentItem} />
</div>
<AddAsset
{...addAssetParams}
nodeId={nodeId}
...
...
@@ -1522,7 +1550,7 @@ const AssetTable = (props) => {
发起问责
</RcItem>
</RcMenu>
{contextHolder}
</div>
)
...
...
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