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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
44 deletions
+75
-44
dataassetmanager.js
src/service/dataassetmanager.js
+5
-2
AssetTable.jsx
src/view/Manage/AssetManage/Component/AssetTable.jsx
+70
-42
No files found.
src/service/dataassetmanager.js
View file @
438cec8b
...
@@ -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
)
{
...
@@ -373,7 +376,7 @@ export function getDrafts(payload) {
...
@@ -373,7 +376,7 @@ export function getDrafts(payload) {
}
}
export
function
listDraftFilterElementsGroupByType
(
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';
...
@@ -35,6 +35,7 @@ import 'react-contexify/dist/ReactContexify.css';
import
{
getTemplateType
}
from
"../../../../util/axios"
;
import
{
getTemplateType
}
from
"../../../../util/axios"
;
import
{
useGetModalInfoAndAction
}
from
"@/hooks/common"
;
import
{
useGetModalInfoAndAction
}
from
"@/hooks/common"
;
import
AssetFlow
from
"./AssetFlow"
import
AssetFlow
from
"./AssetFlow"
import
{
assetsActionManageService
}
from
"@/services"
;
const
{
Text
}
=
Typography
;
const
{
Text
}
=
Typography
;
const
{
Column
}
=
Table
;
const
{
Column
}
=
Table
;
...
@@ -167,6 +168,10 @@ const AssetTable = (props) => {
...
@@ -167,6 +168,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
);
...
@@ -266,6 +271,8 @@ const AssetTable = (props) => {
...
@@ -266,6 +271,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
([]);
...
@@ -298,11 +305,11 @@ const AssetTable = (props) => {
...
@@ -298,11 +305,11 @@ const AssetTable = (props) => {
},
[
timestamp
])
},
[
timestamp
])
useDebounceEffect
(()
=>
{
useDebounceEffect
(()
=>
{
if
(
reference
!==
AssetRecycleReference
&&
nodeId
)
{
if
(
reference
!==
AssetRecycleReference
&&
(
nodeId
||
nodeId
===
undefined
)
)
{
getFilterElementsGroupThenGetDataAssets
();
getFilterElementsGroupThenGetDataAssets
();
}
}
//eslint-disable-next-line react-hooks/exhaustive-deps
//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
(()
=>
{
useEffect
(()
=>
{
if
(
reference
===
AssetRecycleReference
)
{
if
(
reference
===
AssetRecycleReference
)
{
...
@@ -389,30 +396,21 @@ const AssetTable = (props) => {
...
@@ -389,30 +396,21 @@ const AssetTable = (props) => {
return
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
]
return
[
_addAble
,
_importAble
,
_exportAble
,
_changeDirectoryAble
,
_deleteAble
,
_offlineAble
,
_addTagAble
,
_subscribeAble
]
},
[
permissions
,
selectedRows
])
},
[
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
;
// 直接使用数组作为数据源,添加key
},
[
users
,
assets
,
columns
])
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
menuData
=
React
.
useMemo
(()
=>
{
const
newMenuData
=
[]
const
newMenuData
=
[]
...
@@ -561,14 +559,14 @@ const AssetTable = (props) => {
...
@@ -561,14 +559,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
:
120
,
width
:
150
,
sorter
:
true
,
render
:
(
text
,
record
)
=>
{
render
:
(
text
,
record
)
=>
{
return
(
return
(
<
Tooltip
title=
{
text
||
''
}
>
<
Tooltip
title=
{
text
||
''
}
>
...
@@ -581,7 +579,7 @@ const AssetTable = (props) => {
...
@@ -581,7 +579,7 @@ const AssetTable = (props) => {
};
};
if
(
name
===
'编号'
)
{
if
(
name
===
'编号'
)
{
params
.
width
=
1
5
0
;
params
.
width
=
1
2
0
;
// params.fixed = 'left';
// params.fixed = 'left';
}
else
if
(
name
===
'中文名称'
||
name
===
'岗位中文名'
)
{
}
else
if
(
name
===
'中文名称'
||
name
===
'岗位中文名'
)
{
params
.
width
=
isSzseEnv
?
230
:
160
;
params
.
width
=
isSzseEnv
?
230
:
160
;
...
@@ -629,7 +627,6 @@ const AssetTable = (props) => {
...
@@ -629,7 +627,6 @@ const AssetTable = (props) => {
_columns
.
push
(
params
);
_columns
.
push
(
params
);
})
})
})
setAssets
([]);
setAssets
([]);
...
@@ -654,6 +651,7 @@ const AssetTable = (props) => {
...
@@ -654,6 +651,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
)
};
};
...
@@ -692,16 +690,11 @@ const AssetTable = (props) => {
...
@@ -692,16 +690,11 @@ 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
?.
elementValuesWithoutTypeAttribute
||
[]).
forEach
((
value
)
=>
{
(
elementValue
.
values
||
[]).
forEach
((
value
,
i
)
=>
{
index
++
;
index
++
;
if
(
projectIndex
===
`element
${
index
}
`
)
{
if
(
projectIndex
===
`element
${
index
}
`
)
{
let
metadata
=
{};
let
metadata
=
{};
try
{
try
{
metadata
=
JSON
.
parse
(
value
);
metadata
=
JSON
.
parse
(
value
);
_asset
[
'metadata'
]
=
metadata
;
_asset
[
'metadata'
]
=
metadata
;
_asset
[
`element
${
index
}
`
]
=
metadata
;
_asset
[
`element
${
index
}
`
]
=
metadata
;
...
@@ -713,14 +706,11 @@ const AssetTable = (props) => {
...
@@ -713,14 +706,11 @@ const AssetTable = (props) => {
}
else
{
}
else
{
_asset
[
`element
${
index
}
`
]
=
value
;
_asset
[
`element
${
index
}
`
]
=
value
;
}
}
});
})
})
_assets
.
push
(
_asset
);
_assets
.
push
(
_asset
);
})
})
setAssets
(
_assets
);
setAssets
(
_assets
);
if
(
shouldScrollRef
.
current
)
{
if
(
shouldScrollRef
.
current
)
{
let
scrollId
=
null
;
let
scrollId
=
null
;
if
(
remoteRelationRef
.
current
)
{
if
(
remoteRelationRef
.
current
)
{
...
@@ -820,7 +810,9 @@ const AssetTable = (props) => {
...
@@ -820,7 +810,9 @@ const AssetTable = (props) => {
title
:
'提示'
,
title
:
'提示'
,
content
:
'是否导出所有资产目录?'
,
content
:
'是否导出所有资产目录?'
,
onOk
:
()
=>
{
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 {
} else {
...
@@ -828,6 +820,20 @@ const AssetTable = (props) => {
...
@@ -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 = () => {
const subscriptAsset = () => {
if ((checkedKeys||[]).length === 0) return;
if ((checkedKeys||[]).length === 0) return;
...
@@ -1204,7 +1210,27 @@ const AssetTable = (props) => {
...
@@ -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(
return(
<div className={classes}>
<div className={classes}>
...
@@ -1385,6 +1411,8 @@ const AssetTable = (props) => {
...
@@ -1385,6 +1411,8 @@ const AssetTable = (props) => {
rowKey='id'
rowKey='id'
dataSource={realAssets}
dataSource={realAssets}
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