|
@@ -127,10 +127,8 @@ interface IViewListStates {
|
|
|
|
|
|
const { TreeNode, DirectoryTree } = Tree
|
|
const { TreeNode, DirectoryTree } = Tree
|
|
|
|
|
|
-export class ViewList extends React.PureComponent<
|
|
|
|
- IViewListProps,
|
|
|
|
- IViewListStates
|
|
|
|
-> {
|
|
|
|
|
|
+export class ViewList extends React.PureComponent<IViewListProps,
|
|
|
|
+ IViewListStates> {
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
public state: Readonly<IViewListStates> = {
|
|
public state: Readonly<IViewListStates> = {
|
|
screenWidth: document.documentElement.clientWidth,
|
|
screenWidth: document.documentElement.clientWidth,
|
|
@@ -164,7 +162,7 @@ export class ViewList extends React.PureComponent<
|
|
window.addEventListener('resize', this.setScreenWidth, false)
|
|
window.addEventListener('resize', this.setScreenWidth, false)
|
|
}
|
|
}
|
|
|
|
|
|
- private loadViews = async () => {
|
|
|
|
|
|
+ private loadViews = async() => {
|
|
const { projectId } = this.props.match.params
|
|
const { projectId } = this.props.match.params
|
|
if (projectId && this.state.selectedCatalogueKeys.length > 0) {
|
|
if (projectId && this.state.selectedCatalogueKeys.length > 0) {
|
|
const parentId = Number(this.state.selectedCatalogueKeys[0])
|
|
const parentId = Number(this.state.selectedCatalogueKeys[0])
|
|
@@ -172,7 +170,7 @@ export class ViewList extends React.PureComponent<
|
|
this.setState({ tableLoading: true })
|
|
this.setState({ tableLoading: true })
|
|
const data = await request(
|
|
const data = await request(
|
|
api.getViewsByParentId +
|
|
api.getViewsByParentId +
|
|
- `?projectId=${projectId}&parentId=${parentId}`,
|
|
|
|
|
|
+ `?projectId=${projectId}&parentId=${parentId}`,
|
|
{ method: 'get' }
|
|
{ method: 'get' }
|
|
)
|
|
)
|
|
this.setState({
|
|
this.setState({
|
|
@@ -214,10 +212,10 @@ export class ViewList extends React.PureComponent<
|
|
}))
|
|
}))
|
|
|
|
|
|
private getTableColumns = ({
|
|
private getTableColumns = ({
|
|
- viewPermission,
|
|
|
|
- AdminButton,
|
|
|
|
- EditButton
|
|
|
|
- }: ReturnType<typeof ViewList.getViewPermission>) => {
|
|
|
|
|
|
+ viewPermission,
|
|
|
|
+ AdminButton,
|
|
|
|
+ EditButton
|
|
|
|
+ }: ReturnType<typeof ViewList.getViewPermission>) => {
|
|
// const { views } = this.props
|
|
// const { views } = this.props
|
|
const { viewList } = this.state
|
|
const { viewList } = this.state
|
|
const {
|
|
const {
|
|
@@ -234,7 +232,7 @@ export class ViewList extends React.PureComponent<
|
|
dataIndex: 'name',
|
|
dataIndex: 'name',
|
|
filterDropdown: (
|
|
filterDropdown: (
|
|
<SearchFilterDropdown
|
|
<SearchFilterDropdown
|
|
- placeholder="名称"
|
|
|
|
|
|
+ placeholder='名称'
|
|
value={tempFilterViewName}
|
|
value={tempFilterViewName}
|
|
onChange={this.filterViewNameChange}
|
|
onChange={this.filterViewNameChange}
|
|
onSearch={this.searchView}
|
|
onSearch={this.searchView}
|
|
@@ -285,30 +283,30 @@ export class ViewList extends React.PureComponent<
|
|
width: 150,
|
|
width: 150,
|
|
className: utilStyles.textAlignCenter,
|
|
className: utilStyles.textAlignCenter,
|
|
render: (_, record) => (
|
|
render: (_, record) => (
|
|
- <span className="ant-table-action-column">
|
|
|
|
- <Tooltip title="复制">
|
|
|
|
|
|
+ <span className='ant-table-action-column'>
|
|
|
|
+ <Tooltip title='复制'>
|
|
<EditButton
|
|
<EditButton
|
|
- icon="copy"
|
|
|
|
- shape="circle"
|
|
|
|
- type="ghost"
|
|
|
|
|
|
+ icon='copy'
|
|
|
|
+ shape='circle'
|
|
|
|
+ type='ghost'
|
|
onClick={this.copyView(record)}
|
|
onClick={this.copyView(record)}
|
|
/>
|
|
/>
|
|
</Tooltip>
|
|
</Tooltip>
|
|
- <Tooltip title="修改">
|
|
|
|
|
|
+ <Tooltip title='修改'>
|
|
<EditButton
|
|
<EditButton
|
|
- icon="edit"
|
|
|
|
- shape="circle"
|
|
|
|
- type="ghost"
|
|
|
|
|
|
+ icon='edit'
|
|
|
|
+ shape='circle'
|
|
|
|
+ type='ghost'
|
|
onClick={this.editView(record.id)}
|
|
onClick={this.editView(record.id)}
|
|
/>
|
|
/>
|
|
</Tooltip>
|
|
</Tooltip>
|
|
<Popconfirm
|
|
<Popconfirm
|
|
- title="确定删除?"
|
|
|
|
- placement="bottom"
|
|
|
|
|
|
+ title='确定删除?'
|
|
|
|
+ placement='bottom'
|
|
onConfirm={this.deleteView(record.id)}
|
|
onConfirm={this.deleteView(record.id)}
|
|
>
|
|
>
|
|
- <Tooltip title="删除">
|
|
|
|
- <AdminButton icon="delete" shape="circle" type="ghost" />
|
|
|
|
|
|
+ <Tooltip title='删除'>
|
|
|
|
+ <AdminButton icon='delete' shape='circle' type='ghost' />
|
|
</Tooltip>
|
|
</Tooltip>
|
|
</Popconfirm>
|
|
</Popconfirm>
|
|
</span>
|
|
</span>
|
|
@@ -398,7 +396,7 @@ export class ViewList extends React.PureComponent<
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
- private getCatalogues = async () => {
|
|
|
|
|
|
+ private getCatalogues = async() => {
|
|
try {
|
|
try {
|
|
const { projectId } = this.props.match.params
|
|
const { projectId } = this.props.match.params
|
|
|
|
|
|
@@ -419,7 +417,7 @@ export class ViewList extends React.PureComponent<
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private handleSaveCatalogue = async (catalogue: ICatalogue) => {
|
|
|
|
|
|
+ private handleSaveCatalogue = async(catalogue: ICatalogue) => {
|
|
const { projectId } = this.props.match.params
|
|
const { projectId } = this.props.match.params
|
|
if (!projectId) {
|
|
if (!projectId) {
|
|
return
|
|
return
|
|
@@ -431,12 +429,19 @@ export class ViewList extends React.PureComponent<
|
|
if (catalogueFromView) {
|
|
if (catalogueFromView) {
|
|
await request(api.updateCatalogue + `/${catalogueFromView.id}`, {
|
|
await request(api.updateCatalogue + `/${catalogueFromView.id}`, {
|
|
method: 'PUT',
|
|
method: 'PUT',
|
|
- data: { ...catalogue, parentId, projectId }
|
|
|
|
- })
|
|
|
|
|
|
+ data: {
|
|
|
|
+ ...catalogue,
|
|
|
|
+ projectId
|
|
|
|
+ }
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
await request(api.createCatalogue, {
|
|
await request(api.createCatalogue, {
|
|
method: 'post',
|
|
method: 'post',
|
|
- data: { ...catalogue, parentId, projectId }
|
|
|
|
|
|
+ data: {
|
|
|
|
+ ...catalogue,
|
|
|
|
+ parentId: catalogue.parentId === '-1' ? null : catalogue.parentId,
|
|
|
|
+ projectId
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
this.setState({ catalogueModalVisible: false })
|
|
this.setState({ catalogueModalVisible: false })
|
|
@@ -455,7 +460,7 @@ export class ViewList extends React.PureComponent<
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
- private handleDeleteCatalogue = async (c: ICatalogue) => {
|
|
|
|
|
|
+ private handleDeleteCatalogue = async(c: ICatalogue) => {
|
|
try {
|
|
try {
|
|
this.setState({ treeLoading: true })
|
|
this.setState({ treeLoading: true })
|
|
const data = await request(api.deleteCatalogue + `/${c.id}`, {
|
|
const data = await request(api.deleteCatalogue + `/${c.id}`, {
|
|
@@ -463,7 +468,7 @@ export class ViewList extends React.PureComponent<
|
|
})
|
|
})
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
if (data?.header?.code === 200) {
|
|
if (data?.header?.code === 200) {
|
|
- message.error({ content: '删除成功' })
|
|
|
|
|
|
+ message.success({ content: '删除成功' })
|
|
this.getCatalogues()
|
|
this.getCatalogues()
|
|
} else {
|
|
} else {
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
@@ -499,22 +504,22 @@ export class ViewList extends React.PureComponent<
|
|
})
|
|
})
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <Icon type="folder-open" />
|
|
|
|
|
|
+ <Icon type='folder-open' />
|
|
{c.name}
|
|
{c.name}
|
|
</span>
|
|
</span>
|
|
<Dropdown
|
|
<Dropdown
|
|
overlay={() => (
|
|
overlay={() => (
|
|
<Menu>
|
|
<Menu>
|
|
<Menu.Item
|
|
<Menu.Item
|
|
- key="0"
|
|
|
|
|
|
+ key='0'
|
|
onClick={() => this.handleEditCatalogue(c)}
|
|
onClick={() => this.handleEditCatalogue(c)}
|
|
>
|
|
>
|
|
编辑
|
|
编辑
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
- <Menu.Item key="1">
|
|
|
|
|
|
+ <Menu.Item key='1'>
|
|
<Popconfirm
|
|
<Popconfirm
|
|
- title="确定删除?"
|
|
|
|
- placement="bottom"
|
|
|
|
|
|
+ title='确定删除?'
|
|
|
|
+ placement='bottom'
|
|
onConfirm={() => this.handleDeleteCatalogue(c)}
|
|
onConfirm={() => this.handleDeleteCatalogue(c)}
|
|
>
|
|
>
|
|
<a> 删除</a>
|
|
<a> 删除</a>
|
|
@@ -524,7 +529,7 @@ export class ViewList extends React.PureComponent<
|
|
)}
|
|
)}
|
|
trigger={['click']}
|
|
trigger={['click']}
|
|
>
|
|
>
|
|
- <Icon type="more" />
|
|
|
|
|
|
+ <Icon type='more' />
|
|
</Dropdown>
|
|
</Dropdown>
|
|
</div>
|
|
</div>
|
|
<div style={{ marginLeft: 20 }}>
|
|
<div style={{ marginLeft: 20 }}>
|
|
@@ -564,18 +569,18 @@ export class ViewList extends React.PureComponent<
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
<Container>
|
|
<Container>
|
|
- <Helmet title="数据资产" />
|
|
|
|
|
|
+ <Helmet title='数据资产' />
|
|
{!pathname.includes('dataManager') && (
|
|
{!pathname.includes('dataManager') && (
|
|
<ContainerTitle>
|
|
<ContainerTitle>
|
|
<Row>
|
|
<Row>
|
|
<Col span={24} className={utilStyles.shortcut}>
|
|
<Col span={24} className={utilStyles.shortcut}>
|
|
<Breadcrumb className={utilStyles.breadcrumb}>
|
|
<Breadcrumb className={utilStyles.breadcrumb}>
|
|
<Breadcrumb.Item>
|
|
<Breadcrumb.Item>
|
|
- <Link to="">View</Link>
|
|
|
|
|
|
+ <Link to=''>View</Link>
|
|
</Breadcrumb.Item>
|
|
</Breadcrumb.Item>
|
|
</Breadcrumb>
|
|
</Breadcrumb>
|
|
<Link to={`/account/organization/${currentProject.orgId}`}>
|
|
<Link to={`/account/organization/${currentProject.orgId}`}>
|
|
- <i className="iconfont icon-organization" />
|
|
|
|
|
|
+ <i className='iconfont icon-organization' />
|
|
</Link>
|
|
</Link>
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
@@ -585,14 +590,14 @@ export class ViewList extends React.PureComponent<
|
|
<Box>
|
|
<Box>
|
|
<Box.Header>
|
|
<Box.Header>
|
|
<Box.Title>
|
|
<Box.Title>
|
|
- <Icon type="bars" />
|
|
|
|
|
|
+ <Icon type='bars' />
|
|
数据资产列表
|
|
数据资产列表
|
|
</Box.Title>
|
|
</Box.Title>
|
|
<Box.Tools>
|
|
<Box.Tools>
|
|
- <Tooltip placement="bottom" title="新增">
|
|
|
|
|
|
+ <Tooltip placement='bottom' title='新增'>
|
|
<AdminButton
|
|
<AdminButton
|
|
- type="primary"
|
|
|
|
- icon="plus"
|
|
|
|
|
|
+ type='primary'
|
|
|
|
+ icon='plus'
|
|
onClick={this.addView}
|
|
onClick={this.addView}
|
|
/>
|
|
/>
|
|
</Tooltip>
|
|
</Tooltip>
|
|
@@ -609,7 +614,7 @@ export class ViewList extends React.PureComponent<
|
|
this.setState({ catalogueModalVisible: true })
|
|
this.setState({ catalogueModalVisible: true })
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <Icon type="plus" />
|
|
|
|
|
|
+ <Icon type='plus' />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className={styles.treeContent}>
|
|
<div className={styles.treeContent}>
|
|
@@ -621,7 +626,7 @@ export class ViewList extends React.PureComponent<
|
|
<Table
|
|
<Table
|
|
style={{ flex: 1 }}
|
|
style={{ flex: 1 }}
|
|
bordered
|
|
bordered
|
|
- rowKey="id"
|
|
|
|
|
|
+ rowKey='id'
|
|
loading={this.state.tableLoading}
|
|
loading={this.state.tableLoading}
|
|
dataSource={filterViews}
|
|
dataSource={filterViews}
|
|
columns={tableColumns}
|
|
columns={tableColumns}
|
|
@@ -643,6 +648,8 @@ export class ViewList extends React.PureComponent<
|
|
onCancel={this.cancelCopy}
|
|
onCancel={this.cancelCopy}
|
|
/>
|
|
/>
|
|
<CatalogueModal
|
|
<CatalogueModal
|
|
|
|
+ catalogues={this.state.catalogues}
|
|
|
|
+ selectedCatalogueKeys={this.state.selectedCatalogueKeys}
|
|
visible={catalogueModalVisible}
|
|
visible={catalogueModalVisible}
|
|
loading={this.state.saveCatalogueLoading}
|
|
loading={this.state.saveCatalogueLoading}
|
|
fromView={catalogueFromView}
|
|
fromView={catalogueFromView}
|
|
@@ -673,11 +680,9 @@ const mapStateToProps = createStructuredSelector({
|
|
loading: makeSelectLoading()
|
|
loading: makeSelectLoading()
|
|
})
|
|
})
|
|
|
|
|
|
-const withConnect = connect<
|
|
|
|
- IViewListStateProps,
|
|
|
|
|
|
+const withConnect = connect<IViewListStateProps,
|
|
IViewListDispatchProps,
|
|
IViewListDispatchProps,
|
|
- RouteComponentWithParams
|
|
|
|
->(mapStateToProps, mapDispatchToProps)
|
|
|
|
|
|
+ RouteComponentWithParams>(mapStateToProps, mapDispatchToProps)
|
|
const withReducer = injectReducer({ key: 'view', reducer })
|
|
const withReducer = injectReducer({ key: 'view', reducer })
|
|
const withSaga = injectSaga({ key: 'view', saga: sagas })
|
|
const withSaga = injectSaga({ key: 'view', saga: sagas })
|
|
|
|
|