field tooltip for view details

This commit is contained in:
chenos 2021-03-26 16:11:34 +08:00
parent 8fafdf077d
commit 7786f0ad48
2 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import Field from '@/components/views/Field';
import { Form } from './Form'; import { Form } from './Form';
import { configResponsive, useResponsive } from 'ahooks'; import { configResponsive, useResponsive } from 'ahooks';
import { InfoCircleOutlined } from '@ant-design/icons'; import { InfoCircleOutlined } from '@ant-design/icons';
import scopes from '@/components/views/Form/scopes';
configResponsive({ configResponsive({
small: 0, small: 0,
@ -102,8 +103,11 @@ export function Descriptions(props) {
title={group.title && <span>{group.title} {group.tooltip && <Tooltip title={group.tooltip}><InfoCircleOutlined /></Tooltip>}</span>} title={group.title && <span>{group.title} {group.tooltip && <Tooltip title={group.tooltip}><InfoCircleOutlined /></Tooltip>}</span>}
column={1}> column={1}>
{group.children.map((field: any) => { {group.children.map((field: any) => {
const label = field.tooltip ? (
<><Tooltip title={field.tooltip}><InfoCircleOutlined /></Tooltip>&nbsp;{field.title||field.name}</>
) : (field.title||field.name);
return ( return (
<AntdDescriptions.Item label={field.title||field.name}> <AntdDescriptions.Item label={label}>
<Field data={data} viewType={'descriptions'} schema={field} value={get(data, field.name)}/> <Field data={data} viewType={'descriptions'} schema={field} value={get(data, field.name)}/>
</AntdDescriptions.Item> </AntdDescriptions.Item>
) )

View File

@ -13,6 +13,9 @@
.ant-drawer-footer { .ant-drawer-footer {
text-align: right; text-align: right;
} }
.ant-descriptions-view .ant-descriptions-item-container .ant-descriptions-item-label {
align-items: center;
}
.page-tabs { .page-tabs {
.ant-tabs { .ant-tabs {
margin: -24px -24px 8px; margin: -24px -24px 8px;