Commit bd5f9eae by zhaochengxiang

数据类型配置列表

parent 0fe534e7
import React from "react" import React from "react"
import { Tooltip, Typography, Button } from 'antd'
import { dispatch } from '../../../model'
import Table from '../../../util/Component/Table'
import '../AssetTask/index.less'
const FC = (props) => { const FC = (props) => {
const [loading, setLoading] = React.useState(false)
const [data, setData] = React.useState()
const cols = [
{
title: '序号',
dataIndex: 'index',
width:60,
render:(_, __, index)=> (index+1)
},
{
title: '标准数据类型',
dataIndex: 'standardType',
render:(_, record)=> record.standardType?.name
},
{
title: '使用条件',
dataIndex: 'range',
render: (_, record) => {
let text = ''
if (record.lengthSelected
&& (
(record.lengthMinValue!==null&&record.lengthMinValue!==undefined)
|| (record.lengthMaxValue!==null&&record.lengthMaxValue!==undefined)
)
) {
text = '长度: '
if (record.lengthMinValue!==null && record.lengthMinValue!==undefined) {
text = `${text} 大于${record.lengthMinValue}`
}
if (record.lengthMaxValue!==null && record.lengthMaxValue!==undefined) {
text = `${text} 小于${record.lengthMaxValue}`
}
}
if (record.precisionSelected
&& (
(record.precisionMinValue!==null&&record.precisionMinValue!==undefined)
|| (record.precisionMaxValue!==null&&record.precisionMaxValue!==undefined)
)
) {
text = text?`${text}; `:''
text = `${text}精度: `
if (record.precisionMinValue!==null && record.precisionMinValue!==undefined) {
text = `${text} 大于${record.precisionMinValue}`
}
if (record.precisionMaxValue!==null && record.precisionMaxValue!==undefined) {
text = `${text} 小于${record.precisionMaxValue}`
}
}
return (
<Tooltip title={text}>
<Typography.Text ellipsis={true}>
{text}
</Typography.Text>
</Tooltip>
)
}
},
{
title: '数据库',
dataIndex: 'dbType',
},
{
title: '推荐类型',
dataIndex: 'columnTypeSelectedList',
render: (_, record) => (
<Tooltip title={(record.columnTypeSelectedList??[]).toString()}>
<Typography.Text ellipsis={true}>
{(record.columnTypeSelectedList??[]).toString()}
</Typography.Text>
</Tooltip>
),
},
]
React.useEffect(() => {
getDataTypeConfigs()
}, [])
const getDataTypeConfigs = () => {
setLoading(true)
dispatch({
type: 'datamodel.getDataTypeConfigs',
callback: data => {
setLoading(false)
setData(data)
},
error: () => {
setLoading(false)
}
})
}
const onAddClick = () => {
}
const onRightMenuItemClick = (key, record) => {
if (key === '编辑') {
}
if (key === '删除') {
}
}
return ( return (
<div> <div className='task-manage'>
data type config <div className='header px-3'>
<Button onClick={onAddClick}>新增</Button>
</div>
<div className='px-3 pt-3'>
<Table
loading={loading}
maxHeight='calc(100vh - 242px)'
columns={cols??[]}
dataSource={data??[]}
pagination={false}
shouldRowContextMenu={(record) => {
return true
}}
menuData={['编辑', '删除']}
menuPermissions={['编辑', '删除']}
onMenuItemClick={onRightMenuItemClick}
/>
</div>
</div> </div>
) )
} }
......
...@@ -270,7 +270,7 @@ const FC = (props) => { ...@@ -270,7 +270,7 @@ const FC = (props) => {
<div className='px-3 pt-3'> <div className='px-3 pt-3'>
<Table <Table
loading={loading} loading={loading}
maxHeight='calc(100vh - 285px - 46px)' maxHeight='calc(100vh - 285px)'
columns={cols??[]} columns={cols??[]}
dataSource={data??[]} dataSource={data??[]}
pageNum={args.page} pageSize={args.size} total={total ?? 0} pageNum={args.page} pageSize={args.size} total={total ?? 0}
......
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