Commit ceec2e3c by zhaochengxiang

历史版本

parent 6322bf75
......@@ -36,6 +36,10 @@ const { Text } = Typography;
const { Search } = Input;
const { Column } = Table;
const operationMap = {
historyVersion: '历史版本',
}
//资产项
export const AssetItem = (props) => {
const { metadata, terms } = props;
......@@ -218,8 +222,12 @@ const AssetTable = (props) => {
{
(reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && <a onClick={(e) => {
e.stopPropagation();
handleItemClick('authorization', record);
}}>授权</a>
if (record.metadata?.metadataTableId) {
app?.setGlobalState && app?.setGlobalState({
message: 'data-govern-assets-admit',
data: record
})
}}}>授权</a>
}
{
// (reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && <a onClick={(e) => {
......@@ -402,6 +410,16 @@ const AssetTable = (props) => {
return newAssets;
}, [users, assets, columns])
const menuData = React.useMemo(() => {
const newMenuData = []
for (const key of contextMenuItem?.allowButtons??[]) {
if (operationMap[key]) {
newMenuData.push(operationMap[key])
}
}
return newMenuData
}, [contextMenuItem])
const storageChange = (e) => {
if (e.key === 'assetRelationOnClickEvent') {
remoteRelationRef.current = e.relation;
......@@ -1009,7 +1027,7 @@ const AssetTable = (props) => {
const handleItemClick = ({ event, props, data, triggerEvent }) => {
const key = event.currentTarget.id;
if (key === 'history') {
if (key === '历史版本') {
setHistoryAndVersionParams({
visible: true,
id: contextMenuItem?.id
......@@ -1258,8 +1276,19 @@ const AssetTable = (props) => {
},
onContextMenu: event => {
if (reference===AssetManageReference) {
setContextMenuItem(record);
displayMenu(event);
let allowContextMenu = false
for (const key of (record.allowButtons??[])) {
if (operationMap[key]) {
allowContextMenu = true
break
}
}
if (allowContextMenu) {
setContextMenuItem(record);
displayMenu(event);
}
}
},
}
......@@ -1277,7 +1306,8 @@ const AssetTable = (props) => {
return classNames.join(' ');
}}
loading={loading}
columns={reference===AssetManageReference?[indexCol, ...columns, tagCol, actionCol]:[indexCol, ...columns, actionCol]}
columns={reference===AssetManageReference?[indexCol, ...columns, tagCol]:[indexCol, ...columns]}
// columns={reference===AssetManageReference?[indexCol, ...columns, tagCol, actionCol]:[indexCol, ...columns, actionCol]}
rowKey='id'
dataSource={realAssets}
pagination={false}
......@@ -1406,9 +1436,13 @@ const AssetTable = (props) => {
/>
<RcMenu id={MENU_ID}>
<RcItem id="history" onClick={handleItemClick}>
历史版本
</RcItem>
{
menuData?.map(item => (
<RcItem id={item} onClick={handleItemClick}>
{item}
</RcItem>
))
}
</RcMenu>
{contextHolder}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment