fix:Rock Token列表ID合并与列宽优化
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
ExclamationCircleOutlined,
|
||||
MessageOutlined,
|
||||
StopOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import type { RockTokenItem } from '../../api'
|
||||
@@ -16,9 +17,16 @@ export interface TokenRemarkCellProps {
|
||||
record: RockTokenItem
|
||||
onUpdateRemark: (id: number, remark: string, status?: string) => void
|
||||
onMarkAbnormal: (id: number, remark?: string) => void
|
||||
// 紧凑模式:表格里只渲染一个图标按钮,备注内容通过悬浮提示和弹层查看
|
||||
compact?: boolean
|
||||
}
|
||||
|
||||
export function TokenRemarkCell({ record, onUpdateRemark, onMarkAbnormal }: TokenRemarkCellProps) {
|
||||
export function TokenRemarkCell({
|
||||
record,
|
||||
onUpdateRemark,
|
||||
onMarkAbnormal,
|
||||
compact,
|
||||
}: TokenRemarkCellProps) {
|
||||
const [open, setOpen] = useState(false)
|
||||
const [inputValue, setInputValue] = useState(record.remark || '')
|
||||
|
||||
@@ -165,6 +173,31 @@ export function TokenRemarkCell({ record, onUpdateRemark, onMarkAbnormal }: Toke
|
||||
const isAbnormalOrReported =
|
||||
record.status === 'abnormal' || (record.remark && record.remark.includes('上报'))
|
||||
|
||||
if (compact) {
|
||||
const hasRemark = Boolean(record.remark)
|
||||
return (
|
||||
<Popover
|
||||
content={content}
|
||||
trigger="click"
|
||||
open={open}
|
||||
onOpenChange={(v) => {
|
||||
setOpen(v)
|
||||
if (v) setInputValue(record.remark || '')
|
||||
}}
|
||||
placement="bottomLeft"
|
||||
>
|
||||
<Button
|
||||
size="small"
|
||||
type={hasRemark ? 'primary' : 'text'}
|
||||
danger={hasRemark && Boolean(isAbnormalOrReported)}
|
||||
icon={hasRemark ? <MessageOutlined /> : <EditOutlined />}
|
||||
title={hasRemark ? `备注:${record.remark}(点击修改)` : '添加备注'}
|
||||
style={{ width: 26, height: 26, padding: 0, fontSize: 12 }}
|
||||
/>
|
||||
</Popover>
|
||||
)
|
||||
}
|
||||
|
||||
if (!record.remark) {
|
||||
return (
|
||||
<Popover
|
||||
|
||||
Reference in New Issue
Block a user