|
@@ -28,14 +28,18 @@ import classnames from 'classnames'
|
|
import { ICatalogue, IViewBase } from 'containers/DataManagerView/types'
|
|
import { ICatalogue, IViewBase } from 'containers/DataManagerView/types'
|
|
import { RouteComponentWithParams } from 'utils/types'
|
|
import { RouteComponentWithParams } from 'utils/types'
|
|
import { withRouter } from 'react-router-dom'
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
+import SubjectModal from 'containers/DataGovernanceQualityAudit/components/SubjectModal'
|
|
|
|
+import { IMetaParam } from 'containers/DataGovernanceQualityAudit/types'
|
|
|
|
|
|
interface IMetadataModalProps extends RouteComponentWithParams {
|
|
interface IMetadataModalProps extends RouteComponentWithParams {
|
|
visible: boolean
|
|
visible: boolean
|
|
|
|
+ selection: IViewBase[]
|
|
onCancel: () => void
|
|
onCancel: () => void
|
|
|
|
+ onSave: (e: IViewBase[]) => void
|
|
}
|
|
}
|
|
|
|
|
|
const MetadataModal = (props: IMetadataModalProps) => {
|
|
const MetadataModal = (props: IMetadataModalProps) => {
|
|
- const { visible, onCancel, match } = props
|
|
|
|
|
|
+ const { visible, onCancel, onSave, match, selection } = props
|
|
|
|
|
|
const [treeLoading, setTreeLoading] = useState(false)
|
|
const [treeLoading, setTreeLoading] = useState(false)
|
|
const [selectedKey, setSelectedKey] = useState<number[]>([])
|
|
const [selectedKey, setSelectedKey] = useState<number[]>([])
|
|
@@ -43,9 +47,9 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
|
|
|
|
const [tableMetadata, setTableMetadata] = useState<IViewBase[]>([])
|
|
const [tableMetadata, setTableMetadata] = useState<IViewBase[]>([])
|
|
const [tableLoading, setTableLoading] = useState(false)
|
|
const [tableLoading, setTableLoading] = useState(false)
|
|
- const [tableRowSelection, setTableRowSelection] = useState([])
|
|
|
|
|
|
+ const [tableRowSelection, setTableRowSelection] = useState<number>()
|
|
|
|
|
|
- const getCatalogues = async () => {
|
|
|
|
|
|
+ const getCatalogues = async() => {
|
|
try {
|
|
try {
|
|
const { projectId } = match.params
|
|
const { projectId } = match.params
|
|
|
|
|
|
@@ -62,7 +66,7 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- const loadViews = async () => {
|
|
|
|
|
|
+ const loadViews = async() => {
|
|
const { projectId } = match.params
|
|
const { projectId } = match.params
|
|
if (projectId && selectedKey.length > 0) {
|
|
if (projectId && selectedKey.length > 0) {
|
|
const parentId = Number(selectedKey[0])
|
|
const parentId = Number(selectedKey[0])
|
|
@@ -80,34 +84,29 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- const tableColumns: Array<ColumnProps<{}>> = [
|
|
|
|
|
|
+ const tableColumns: Array<ColumnProps<IViewBase>> = [
|
|
{
|
|
{
|
|
title: '元数据名称',
|
|
title: '元数据名称',
|
|
- dataIndex: 'dictCode'
|
|
|
|
|
|
+ dataIndex: 'name'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '元数据类型',
|
|
title: '元数据类型',
|
|
- dataIndex: 'dictLabel'
|
|
|
|
|
|
+ dataIndex: ''
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '更新时间',
|
|
title: '更新时间',
|
|
- dataIndex: 'dictValue'
|
|
|
|
|
|
+ dataIndex: ''
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '创建人',
|
|
title: '创建人',
|
|
- dataIndex: 'dictSort'
|
|
|
|
|
|
+ dataIndex: ''
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '是否关联质量',
|
|
title: '是否关联质量',
|
|
- dataIndex: 'isDefault'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '',
|
|
|
|
- render: () => (
|
|
|
|
|
|
+ dataIndex: 'isDefault',
|
|
|
|
+ render: (_, data, idx) => (
|
|
<>
|
|
<>
|
|
- <a>编辑</a>
|
|
|
|
- <Divider type="vertical" />
|
|
|
|
- <a>删除</a>
|
|
|
|
|
|
+ {data?.relationQuality ? <span>是</span> : <span>否</span>}
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
@@ -122,14 +121,12 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
className={classnames(styles.treeNode, {
|
|
className={classnames(styles.treeNode, {
|
|
[styles.treeNodeSelected]: selectedKey.includes(c.id)
|
|
[styles.treeNodeSelected]: selectedKey.includes(c.id)
|
|
})}
|
|
})}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ setSelectedKey([c.id])
|
|
|
|
+ }}
|
|
>
|
|
>
|
|
- <span
|
|
|
|
- className={styles.treeNodeLeft}
|
|
|
|
- onClick={() => {
|
|
|
|
- setSelectedKey([c.id])
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <Icon type="file" />
|
|
|
|
|
|
+ <span className={styles.treeNodeLeft}>
|
|
|
|
+ <Icon type='file' />
|
|
{c.name}
|
|
{c.name}
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
@@ -140,10 +137,19 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
))}
|
|
))}
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
|
|
+ const handleSave = () => {
|
|
|
|
+ const s = tableMetadata?.find((t) => t.id === tableRowSelection)
|
|
|
|
+ onSave([s])
|
|
|
|
+ }
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
getCatalogues()
|
|
getCatalogues()
|
|
}, [])
|
|
}, [])
|
|
|
|
+
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ setTableRowSelection(selection?.map((s) => s.id)?.[0])
|
|
|
|
+ }, [selection])
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
if (selectedKey.length > 0) {
|
|
if (selectedKey.length > 0) {
|
|
loadViews()
|
|
loadViews()
|
|
@@ -152,12 +158,12 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
|
|
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
- title="选择元数据"
|
|
|
|
|
|
+ title='选择元数据'
|
|
visible={visible}
|
|
visible={visible}
|
|
onCancel={onCancel}
|
|
onCancel={onCancel}
|
|
- maskClosable={false}
|
|
|
|
|
|
+ onOk={handleSave}
|
|
destroyOnClose
|
|
destroyOnClose
|
|
- width="80%"
|
|
|
|
|
|
+ width='80%'
|
|
>
|
|
>
|
|
<div className={styles.treeTableContainer}>
|
|
<div className={styles.treeTableContainer}>
|
|
<div className={styles.treeContainer}>
|
|
<div className={styles.treeContainer}>
|
|
@@ -171,20 +177,22 @@ const MetadataModal = (props: IMetadataModalProps) => {
|
|
|
|
|
|
<div style={{ flex: 1 }}>
|
|
<div style={{ flex: 1 }}>
|
|
<div style={{ padding: '0 0 20px' }}>
|
|
<div style={{ padding: '0 0 20px' }}>
|
|
- <Button type="primary" icon="plus">
|
|
|
|
|
|
+ <Button type='primary' icon='plus'>
|
|
查询
|
|
查询
|
|
</Button>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
<Table
|
|
<Table
|
|
rowSelection={{
|
|
rowSelection={{
|
|
- selectedRowKeys: tableRowSelection,
|
|
|
|
|
|
+ type: 'radio',
|
|
|
|
+ selectedRowKeys: [tableRowSelection],
|
|
onChange: (selectedRowKeys) => {
|
|
onChange: (selectedRowKeys) => {
|
|
- setTableRowSelection(selectedRowKeys)
|
|
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ setTableRowSelection((c) => selectedRowKeys[0])
|
|
}
|
|
}
|
|
}}
|
|
}}
|
|
style={{ flex: 1 }}
|
|
style={{ flex: 1 }}
|
|
bordered
|
|
bordered
|
|
- rowKey="id"
|
|
|
|
|
|
+ rowKey='id'
|
|
loading={tableLoading}
|
|
loading={tableLoading}
|
|
dataSource={tableMetadata}
|
|
dataSource={tableMetadata}
|
|
columns={tableColumns}
|
|
columns={tableColumns}
|