Commit 75b1a83e by zhaochengxiang

增加不能编辑的提示

parent 156b720a
......@@ -121,29 +121,55 @@ const ModelTable = (props) => {
key: 'action',
width: 180,
render: (_,record) => {
let disableEdit = false, disableDelete = false, editTip = '', deleteTip = '';
if (!record?.editable&&!record?.permitCheckOut) {
disableEdit = true;
if (record?.state?.id === '2') {
editTip = '待发布的模型不允许编辑';
} else if (record?.state?.id === '4') {
editTip = '已发布模型下存在未发布的模型,不允许再编辑';
}
}
if (!record?.deletable) {
disableDelete = true;
if (record?.state?.id === '2') {
deleteTip = '待发布的模型不允许删除';
} else if (record?.state?.id === '4') {
deleteTip = '已发布的模型不允许删除';
}
}
return (
<div style={{ display: 'flex', alignItems: 'center' }}>
<Button
type='link'
size='small'
disabled={!record?.editable&&!record?.permitCheckOut}
onClick={() => { editItem(record); }}
style={{ padding: 0 }}
>
编辑
</Button>
<Tooltip title={editTip}>
<Button
type='link'
size='small'
disabled={disableEdit}
onClick={() => { editItem(record); }}
style={{ padding: 0 }}
>
编辑
</Button>
</Tooltip>
<div style={{ margin: '0 5px' }}>
<Divider type='vertical' />
</div>
<Button
type='link'
size='small'
disabled={!record?.deletable}
onClick={() => { deleteItem(record); }}
style={{ padding: 0 }}
>
删除
</Button>
<Tooltip title={deleteTip} >
<Button
type='link'
size='small'
disabled={disableDelete}
onClick={() => { deleteItem(record); }}
style={{ padding: 0 }}
>
删除
</Button>
</Tooltip>
<div style={{ margin: '0 5px' }}>
<Divider type='vertical' />
</div>
......
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