Commit 299abef3 by zhaochengxiang

资产右键功能调整

parent cc6f5f04
...@@ -164,17 +164,38 @@ const AssetTable = (props) => { ...@@ -164,17 +164,38 @@ const AssetTable = (props) => {
const app = useContext(AppContext) const app = useContext(AppContext)
const actionCol = {
title: '操作',
dataIndex: 'action',
width: 60,
fixed: 'right',
filter: false,
render: (_, record) => {
return (
<React.Fragment>
{
(reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && <a onClick={(e) => {
e.stopPropagation();
handleItemClick('authorization', record);
}}>授权</a>
}
</React.Fragment>
)
}
}
useEffect(() => { useEffect(() => {
if (TableWidth>0 && columns.length>0) { if (TableWidth>0 && columns.length>0) {
const currentWidth = (columns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 32.0; const newColumns = [...columns, actionCol];
const currentWidth = (newColumns.reduce((preVal, col) => (col.width?col.width:0) + preVal, 0)) + 32.0;
if (currentWidth < TableWidth) { if (currentWidth < TableWidth) {
columns.forEach(column => { newColumns.forEach(column => {
column.width = (TableWidth - 32.0)/columns.length; column.width = (TableWidth - 32.0)/newColumns.length;
}) })
} }
setRealColumns([...columns, <Column key='auto' />]); setRealColumns([...newColumns, <Column key='auto' />]);
} else { } else {
setRealColumns([]); setRealColumns([]);
} }
...@@ -791,7 +812,7 @@ const AssetTable = (props) => { ...@@ -791,7 +812,7 @@ const AssetTable = (props) => {
}) })
} }
const handleItemClick = ({ id, event, props }) => { const handleItemClick = (id, record) => {
if (id === 'uncombed') { if (id === 'uncombed') {
modal.confirm({ modal.confirm({
title: '提示', title: '提示',
...@@ -801,7 +822,7 @@ const AssetTable = (props) => { ...@@ -801,7 +822,7 @@ const AssetTable = (props) => {
type: 'assetmanage.updateResourceState', type: 'assetmanage.updateResourceState',
payload: { payload: {
params: { params: {
dataAssetId: contextMenuItem.id, dataAssetId: record.id,
resourceState: 'uncombed' resourceState: 'uncombed'
} }
}, },
...@@ -825,7 +846,7 @@ const AssetTable = (props) => { ...@@ -825,7 +846,7 @@ const AssetTable = (props) => {
type: 'assetmanage.updateResourceState', type: 'assetmanage.updateResourceState',
payload: { payload: {
params: { params: {
dataAssetId: contextMenuItem.id, dataAssetId: record.id,
resourceState: 'notRelatedAsset' resourceState: 'notRelatedAsset'
} }
}, },
...@@ -841,10 +862,10 @@ const AssetTable = (props) => { ...@@ -841,10 +862,10 @@ const AssetTable = (props) => {
} }
}); });
} else if (id === 'authorization') { } else if (id === 'authorization') {
if (contextMenuItem?.metadata?.metadataTableId) { if (record.metadata?.metadataTableId) {
app?.setGlobalState && app?.setGlobalState({ app?.setGlobalState && app?.setGlobalState({
message: 'data-govern-assets-admit', message: 'data-govern-assets-admit',
data: contextMenuItem data: record
}) })
} else { } else {
showMessage("warn","该资产没有关联元数据信息"); showMessage("warn","该资产没有关联元数据信息");
...@@ -855,12 +876,12 @@ const AssetTable = (props) => { ...@@ -855,12 +876,12 @@ const AssetTable = (props) => {
const moreMenu = ( const moreMenu = (
<Menu> <Menu>
{ {
(reference===AssetManageReference) && // (reference===AssetManageReference) &&
<Menu.Item disabled={(checkedKeys||[]).length===0}> // <Menu.Item disabled={(checkedKeys||[]).length===0}>
<div className='text-center' onClick={onStartFlowClick}> // <div className='text-center' onClick={onStartFlowClick}>
申请 // 申请
</div> // </div>
</Menu.Item> // </Menu.Item>
} }
{ {
(reference!==AssetRecycleReference) && (reference!==AssetRecycleReference) &&
...@@ -945,10 +966,10 @@ const AssetTable = (props) => { ...@@ -945,10 +966,10 @@ const AssetTable = (props) => {
} }
{ {
(reference===AssetBrowseReference||reference===ResourceBrowseReference) && // (reference===AssetBrowseReference||reference===ResourceBrowseReference) &&
<Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}> // <Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
<Button onClick={onStartFlowClick} disabled={(checkedKeys||[]).length===0} >申请</Button> // <Button onClick={onStartFlowClick} disabled={(checkedKeys||[]).length===0} >申请</Button>
</Tooltip> // </Tooltip>
} }
{ {
...@@ -956,10 +977,10 @@ const AssetTable = (props) => { ...@@ -956,10 +977,10 @@ const AssetTable = (props) => {
<Button>其他操作</Button> <Button>其他操作</Button>
</Dropdown> : <React.Fragment> </Dropdown> : <React.Fragment>
{ {
(reference===AssetManageReference) && // (reference===AssetManageReference) &&
<Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}> // <Tooltip title={(checkedKeys||[]).length===0?'请先选择资产':''}>
<Button onClick={onStartFlowClick} disabled={(checkedKeys||[]).length===0} >申请</Button> // <Button onClick={onStartFlowClick} disabled={(checkedKeys||[]).length===0} >申请</Button>
</Tooltip> // </Tooltip>
} }
{ {
...@@ -1043,18 +1064,18 @@ const AssetTable = (props) => { ...@@ -1043,18 +1064,18 @@ const AssetTable = (props) => {
setAssetDetailDrawerVisible(true); setAssetDetailDrawerVisible(true);
}, },
onContextMenu: event => { onContextMenu: event => {
if ((reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && (record.resourceState==='uncombed'||record.resourceState==='notRelatedAsset')) { // if ((reference===AssetManageReference||(reference===AssetBrowseReference&&record.hasPermission)) && (record.resourceState==='uncombed'||record.resourceState==='notRelatedAsset')) {
setContextMenuItem(record); // setContextMenuItem(record);
displayMenu(event); // displayMenu(event);
} // }
}, },
} }
}} }}
rowClassName={(record, index) => { rowClassName={(record, index) => {
let classNames = []; let classNames = [];
if (reference===AssetManageReference && (record.resourceState==='uncombed'||record.resourceState==='notRelatedAsset')) { // if (reference===AssetManageReference && (record.resourceState==='uncombed'||record.resourceState==='notRelatedAsset')) {
classNames.push('cursor-contextmenu'); // classNames.push('cursor-contextmenu');
} // }
if (record?.id===anchorId || record?.id===selectItem?.id) { if (record?.id===anchorId || record?.id===selectItem?.id) {
classNames.push('yy-table-select-row'); classNames.push('yy-table-select-row');
......
...@@ -177,6 +177,15 @@ const ModelTable = (props) => { ...@@ -177,6 +177,15 @@ const ModelTable = (props) => {
}, },
width: 60, width: 60,
ellipsis: true, ellipsis: true,
filter: false,
}
const editorCol = {
title: '管理人',
dataIndex: 'editor',
width: 100,
ellipsis: true,
filter: false,
} }
const actionCol = { const actionCol = {
...@@ -184,6 +193,7 @@ const ModelTable = (props) => { ...@@ -184,6 +193,7 @@ const ModelTable = (props) => {
dataIndex: 'action', dataIndex: 'action',
width: 240, width: 240,
fixed: 'right', fixed: 'right',
filter: false,
render: (_, record) => { render: (_, record) => {
const authActionTitles = []; const authActionTitles = [];
if ((getDataModelerRole(user)!==DataModelerRoleReader) && view!=='grant' && !isOnlyEnding && (record.editable||record.permitCheckOut)) { if ((getDataModelerRole(user)!==DataModelerRoleReader) && view!=='grant' && !isOnlyEnding && (record.editable||record.permitCheckOut)) {
...@@ -517,13 +527,13 @@ const ModelTable = (props) => { ...@@ -517,13 +527,13 @@ const ModelTable = (props) => {
}); });
if (!modelId) { if (!modelId) {
newCols = [indexCol, ...newCols, actionCol]; newCols = [indexCol, ...newCols, editorCol, actionCol];
} else { } else {
newCols = [...newCols, actionCol]; newCols = [...newCols, editorCol, actionCol];
} }
if ((visibleColNames||[]).length > 0) { if ((visibleColNames||[]).length > 0) {
newCols = newCols.filter(col => visibleColNames.indexOf(col.title)!==-1 || col.title==='序号' || col.title==='操作'); newCols = newCols.filter(col => visibleColNames.indexOf(col.title)!==-1 || col.filter===false);
if (newCols.length > 2) { if (newCols.length > 2) {
newCols[newCols.length-2].width = null; newCols[newCols.length-2].width = null;
......
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