|  |  | @ -1,6 +1,6 @@ | 
			
		
	
		
			
				
					|  |  |  | import React, { useEffect, useState } from 'react'; | 
			
		
	
		
			
				
					|  |  |  | import { connect } from 'react-redux'; | 
			
		
	
		
			
				
					|  |  |  | import { Spin, Table, Popconfirm, Button, Input } from 'antd'; | 
			
		
	
		
			
				
					|  |  |  | import { Spin, Table, Popconfirm, Button, Input, Row, Col } from 'antd'; | 
			
		
	
		
			
				
					|  |  |  | import { ButtonGroup } from '$components'; | 
			
		
	
		
			
				
					|  |  |  | import moment from 'moment'; | 
			
		
	
		
			
				
					|  |  |  | import FileSaver from 'file-saver'; | 
			
		
	
	
		
			
				
					|  |  | @ -173,13 +173,18 @@ const DatabaseTable = (props) => { | 
			
		
	
		
			
				
					|  |  |  |                     ra.applyBy == user.id && ra.resourceName === record.name); | 
			
		
	
		
			
				
					|  |  |  |                 return <ButtonGroup> | 
			
		
	
		
			
				
					|  |  |  |                     <a onClick={() => onView(record)}>查看</a> | 
			
		
	
		
			
				
					|  |  |  |                     <a style={{ marginLeft: 10 }} onClick={() => onEdit(record)}>编辑</a> | 
			
		
	
		
			
				
					|  |  |  |                     <Popconfirm | 
			
		
	
		
			
				
					|  |  |  |                         title="是否确认删除该元数据?" | 
			
		
	
		
			
				
					|  |  |  |                         onConfirm={() => confirmDelete(record.id)} | 
			
		
	
		
			
				
					|  |  |  |                     > <a style={{ marginLeft: 10 }}>删除</a></Popconfirm> | 
			
		
	
		
			
				
					|  |  |  |                     {record.type === '表' ? <a style={{ marginLeft: 10 }} onClick={() => marking(record.id)}>打标</a> : null} | 
			
		
	
		
			
				
					|  |  |  |                     {user.role == '系统管理员' ? '' : record.type === '表' ? resourceApplicationsRecords.length === 0 ? | 
			
		
	
		
			
				
					|  |  |  |                     {user.role == '数据消费者' ? null : | 
			
		
	
		
			
				
					|  |  |  |                         <> | 
			
		
	
		
			
				
					|  |  |  |                             <a style={{ marginLeft: 10 }} onClick={() => onEdit(record)}>编辑</a> | 
			
		
	
		
			
				
					|  |  |  |                             <Popconfirm | 
			
		
	
		
			
				
					|  |  |  |                                 title="是否确认删除该元数据?" | 
			
		
	
		
			
				
					|  |  |  |                                 onConfirm={() => confirmDelete(record.id)} | 
			
		
	
		
			
				
					|  |  |  |                             > <a style={{ marginLeft: 10 }}>删除</a></Popconfirm> | 
			
		
	
		
			
				
					|  |  |  |                             {record.type === '表' ? <a style={{ marginLeft: 10 }} onClick={() => marking(record.id)}>打标</a> : null} | 
			
		
	
		
			
				
					|  |  |  |                         </> | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |                     {user.role !== '数据消费者' ? null : record.type === '表' ? resourceApplicationsRecords.length === 0 ? | 
			
		
	
		
			
				
					|  |  |  |                         <a style={{ marginLeft: 10 }} onClick={() => applyResources(record)}>申请资源</a> : | 
			
		
	
		
			
				
					|  |  |  |                         <span style={{ marginLeft: 10, color: "#c0c0c0" }} title='已存在资源申请'>申请资源</span> : null} | 
			
		
	
		
			
				
					|  |  |  |                 </ButtonGroup> | 
			
		
	
	
		
			
				
					|  |  | @ -252,27 +257,33 @@ const DatabaseTable = (props) => { | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     return <Spin spinning={isRequesting}> | 
			
		
	
		
			
				
					|  |  |  |         <div style={{ marginBottom: 16 }}> | 
			
		
	
		
			
				
					|  |  |  |             <Button type='primary' onClick={() => { | 
			
		
	
		
			
				
					|  |  |  |                 dispatch(metadataManagement.getMetadataModels({ modelTypes: ModelTypes.join(',') })).then(res => { | 
			
		
	
		
			
				
					|  |  |  |                     if (res.success) { | 
			
		
	
		
			
				
					|  |  |  |                         setEditData({ add: true, title: '新建库表元数据', record: { path: '/' + resourceCatalogPath.join('/'), type: '目录' } }); | 
			
		
	
		
			
				
					|  |  |  |                         setModalVisible(true); | 
			
		
	
		
			
				
					|  |  |  |         <Row style={{ marginBottom: 16 }}> | 
			
		
	
		
			
				
					|  |  |  |             <Col span={12}> | 
			
		
	
		
			
				
					|  |  |  |                 {user.role == '数据消费者' ? null : <> | 
			
		
	
		
			
				
					|  |  |  |                     <Button type='primary' onClick={() => { | 
			
		
	
		
			
				
					|  |  |  |                         dispatch(metadataManagement.getMetadataModels({ modelTypes: ModelTypes.join(',') })).then(res => { | 
			
		
	
		
			
				
					|  |  |  |                             if (res.success) { | 
			
		
	
		
			
				
					|  |  |  |                                 setEditData({ add: true, title: '新建库表元数据', record: { path: '/' + resourceCatalogPath.join('/'), type: '目录' } }); | 
			
		
	
		
			
				
					|  |  |  |                                 setModalVisible(true); | 
			
		
	
		
			
				
					|  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |                         }) | 
			
		
	
		
			
				
					|  |  |  |                     }}>新建</Button> | 
			
		
	
		
			
				
					|  |  |  |                     { | 
			
		
	
		
			
				
					|  |  |  |                         tableDataCount == 0 ? <Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }} onClick={() => handleExport()}>导出</Button> : | 
			
		
	
		
			
				
					|  |  |  |                             selectedRowKeys && selectedRowKeys.length ? | 
			
		
	
		
			
				
					|  |  |  |                                 <Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }} onClick={() => handleExport()}>导出</Button> | 
			
		
	
		
			
				
					|  |  |  |                                 : <Popconfirm title={'是否导出全部?'} onConfirm={() => handleExport(true)} okText="确定" cancelText="取消"> | 
			
		
	
		
			
				
					|  |  |  |                                     <Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }}> 导出</Button> | 
			
		
	
		
			
				
					|  |  |  |                                 </Popconfirm> | 
			
		
	
		
			
				
					|  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |                 }) | 
			
		
	
		
			
				
					|  |  |  |             }}>新建</Button> | 
			
		
	
		
			
				
					|  |  |  |             { | 
			
		
	
		
			
				
					|  |  |  |                 tableDataCount == 0 ? <Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }} onClick={() => handleExport()}>导出</Button> : | 
			
		
	
		
			
				
					|  |  |  |                     selectedRowKeys && selectedRowKeys.length ? | 
			
		
	
		
			
				
					|  |  |  |                         <Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }} onClick={() => handleExport()}>导出</Button> | 
			
		
	
		
			
				
					|  |  |  |                         : <Popconfirm title={'是否导出全部?'} onConfirm={() => handleExport(true)} okText="确定" cancelText="取消"> | 
			
		
	
		
			
				
					|  |  |  |                             <Button disabled={tableDataCount == 0} style={{ marginLeft: 16 }}> 导出</Button> | 
			
		
	
		
			
				
					|  |  |  |                         </Popconfirm> | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             <Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>查询</Button> | 
			
		
	
		
			
				
					|  |  |  |             <Input style={{ width: 220, float: 'right' }} placeholder="名称/代码/类型" | 
			
		
	
		
			
				
					|  |  |  |                 allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} /> | 
			
		
	
		
			
				
					|  |  |  |         </div > | 
			
		
	
		
			
				
					|  |  |  |                 </>} | 
			
		
	
		
			
				
					|  |  |  |             </Col> | 
			
		
	
		
			
				
					|  |  |  |             <Col span={12} style={{ display: 'flex', justifyContent: 'flex-end' }}> | 
			
		
	
		
			
				
					|  |  |  |                 <Input style={{ width: 220 }} placeholder="名称/代码/类型" | 
			
		
	
		
			
				
					|  |  |  |                     allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} /> | 
			
		
	
		
			
				
					|  |  |  |                 <Button type='primary' style={{ marginLeft: 16 }} onClick={onSearch}>查询</Button> | 
			
		
	
		
			
				
					|  |  |  |             </Col> | 
			
		
	
		
			
				
					|  |  |  |         </Row > | 
			
		
	
		
			
				
					|  |  |  |         <Table | 
			
		
	
		
			
				
					|  |  |  |             scroll={{ y: clientHeight - 320 }} | 
			
		
	
		
			
				
					|  |  |  |             rowKey='id' | 
			
		
	
	
		
			
				
					|  |  | 
 |