Commit 0d6fb11e by zhaochengxiang

模型简介样式修改

parent 789ff5fd
import React, { useState, useEffect, useRef } from "react"; import React, { useState, useEffect, useRef } from "react";
import { Tooltip, Modal, Pagination, Table, Descriptions } from 'antd'; import { Tooltip, Modal, Pagination, Table, Descriptions, Popover } from 'antd';
import { DownOutlined, UpOutlined } from '@ant-design/icons'; import { DownOutlined, UpOutlined } from '@ant-design/icons';
import SmoothScroll from 'smooth-scroll'; import SmoothScroll from 'smooth-scroll';
import classnames from 'classnames'; import classnames from 'classnames';
...@@ -19,43 +19,61 @@ const ModelNameColumn = (props) => { ...@@ -19,43 +19,61 @@ const ModelNameColumn = (props) => {
const { text, record, detailItem } = props; const { text, record, detailItem } = props;
const [ data, setData ] = useState(record); const [ data, setData ] = useState(record);
const cols = [
{
title: '序号',
dataIndex: 'key',
render: (text, record, index) => {
return (index+1).toString();
},
width: 60,
ellipsis: true,
},
{
title: '字段中文名称',
width: 160,
dataIndex: 'cnName',
editable: true,
ellipsis: true,
},
{
title: '字段英文名称',
width: 160,
dataIndex: 'name',
editable: true,
ellipsis: true,
},
];
let _textComponent = <span>{text}</span>; let _textComponent = <span>{text}</span>;
if (data.digest) { if (data.digest) {
_textComponent = <Descriptions className='model-table-descritpion' column={1} size='small'> _textComponent = <div style={{ width: 400, maxHeight: 600, overflow: 'auto' }}>
<Descriptions.Item label='模型名称'> <Descriptions className='model-digest-descritpion' column={2} size='small'>
{ data.digest.name||'' } <Descriptions.Item label='模型名称'>
</Descriptions.Item> { data.digest.name||'' }
<Descriptions.Item label='中文名称'> </Descriptions.Item>
{ data.digest.cnName||'' } <Descriptions.Item label='中文名称'>
</Descriptions.Item> { data.digest.cnName||'' }
<Descriptions.Item label='描述'> </Descriptions.Item>
{ data.digest.remark||'' } <Descriptions.Item label='描述'>
</Descriptions.Item> { data.digest.remark||'' }
<Descriptions.Item label='字段'> </Descriptions.Item>
{ </Descriptions>
(data.digest.attributeDigests||[]).map((item, index) => { <Table
if (index > 9) return null; className='mt-2'
return ( dataSource={data.digest.attributeDigests||[]}
<React.Fragment key={index}> columns={cols}
{ (index > 0) && <br /> } loading={false}
{`${item.name||''} ${item.cnName||''}`} pagination={false}
</React.Fragment> size='small'
) />
}) </div>
}
{
(data.digest.attributeDigests||[]).length>10 && <React.Fragment>
<br />
...
</React.Fragment>
}
</Descriptions.Item>
</Descriptions>
} }
return ( return (
<Tooltip <Popover
title={_textComponent} content={_textComponent}
overlayClassName='model-digest-popover'
onVisibleChange={(visible) => { onVisibleChange={(visible) => {
if (visible && !record.digest) { if (visible && !record.digest) {
dispatch({ dispatch({
...@@ -74,7 +92,7 @@ const ModelNameColumn = (props) => { ...@@ -74,7 +92,7 @@ const ModelNameColumn = (props) => {
<a onClick={()=>{detailItem(record);}}> <a onClick={()=>{detailItem(record);}}>
{text||''} {text||''}
</a> </a>
</Tooltip> </Popover>
); );
} }
...@@ -623,7 +641,7 @@ const ModelTable = (props) => { ...@@ -623,7 +641,7 @@ const ModelTable = (props) => {
onResize={({ width }) => { onResize={({ width }) => {
if (tableWidth !== width) { if (tableWidth !== width) {
setTableWidth(width); setTableWidth(width);
let newColumns = [...cols]; let newColumns = [...cols];
if ((modelId||'') !== '') { if ((modelId||'') !== '') {
......
...@@ -30,14 +30,20 @@ ...@@ -30,14 +30,20 @@
} }
} }
.model-table-descritpion { .model-digest-descritpion {
.yy-descriptions-row > td { .yy-descriptions-row > td {
padding-bottom: 0px !important; padding-bottom: 0px !important;
} }
}
.yy-descriptions-item-label, .yy-descriptions-item-content { .model-digest-popover {
color: #fff !important; .yy-popover-inner-content {
padding: 8px !important;
} }
.yy-table-thead > tr > th, .yy-table-tbody > tr > td {
font-size: 13px !important;
}
} }
.excel-copy-descritpion { .excel-copy-descritpion {
......
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