Browse Source

(*)表业务元数据展示、配置修改

master
zmh 1 year ago
parent
commit
fe33ef5348
  1. BIN
      web/client/assets/images/favicon.ico
  2. 2
      web/client/src/layout/components/header/index.js
  3. 26
      web/client/src/sections/metadataManagement/actions/businessMetadata.js
  4. 36
      web/client/src/sections/metadataManagement/components/businessDatabaseModal.js
  5. 28
      web/client/src/sections/metadataManagement/containers/businessDatabaseTable.js
  6. 1
      web/client/src/sections/metadataManagement/containers/businessMetadata.js
  7. 12
      web/client/src/sections/metadataManagement/containers/databasesTable.js
  8. 6
      web/client/src/sections/metadataManagement/containers/restapisTable.js
  9. 8
      web/client/src/utils/webapi.js

BIN
web/client/assets/images/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

2
web/client/src/layout/components/header/index.js

@ -39,7 +39,7 @@ const Header = props => {
}
</span>
<div className={styles['header-title']} style={{}}>
<img src='/assets/images/logo.png' style={{ margin: '0 12px 4px 12px', height: 42, borderRadius: 4 }} />政务数据资源中心
<img src='/assets/images/favicon.ico' style={{ margin: '0 12px 4px 12px', height: 42, borderRadius: 4 }} />政务数据资源中心
</div>
</div>
<div id="nav" className={styles['header-nav']}>

26
web/client/src/sections/metadataManagement/actions/businessMetadata.js

@ -3,49 +3,49 @@
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getBusinessMetadata(params) {
export function getBusinessMetadataDatabases(params) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: params,
actionType: 'GET_BUSINESS_METADATA_LIST',
url: ApiTable.getBusinessMetadata,
actionType: 'GET_BUSINESS_METADATA_DATABASES_LIST',
url: ApiTable.getBusinessMetadataDatabases,
msg: { error: '获取业务元数据列表失败' },
reducer: { name: 'metadataDatabases' }
reducer: { name: 'businessMetadataDatabases' }
});
}
export function postBusinessMetadata(data) {
export function postBusinessMetadataDatabases(data) {
return dispatch => basicAction({
type: 'post',
data: data,
dispatch: dispatch,
actionType: 'POST_BUSINESS_METADATA',
url: ApiTable.postBusinessMetadata,
actionType: 'POST_BUSINESS_METADATA_DATABASES',
url: ApiTable.postBusinessMetadataDatabases,
msg: { option: '新建业务元数据' },
reducer: {}
});
}
export function putBusinessMetadata(id, data) {
export function putBusinessMetadataDatabases(id, data) {
return dispatch => basicAction({
type: 'put',
data: data,
dispatch,
actionType: 'PUT_BUSINESS_METADATA',
url: ApiTable.putBusinessMetadata.replace('{id}', id),
actionType: 'PUT_BUSINESS_METADATA_DATABASES',
url: ApiTable.putBusinessMetadataDatabases.replace('{id}', id),
msg: {
option: '修改业务元数据',
}
});
}
export function delBusinessMetadata(id) {
export function delBusinessMetadataDatabases(id) {
return dispatch => basicAction({
type: 'del',
dispatch,
actionType: 'DELETE_BUSINESS_METADATA',
url: ApiTable.delBusinessMetadata.replace('{id}', id),
actionType: 'DELETE_BUSINESS_METADATA_DATABASES',
url: ApiTable.delBusinessMetadataDatabases.replace('{id}', id),
msg: {
option: '删除业务元数据',
}

36
web/client/src/sections/metadataManagement/components/businessDatabaseModal.js

@ -19,24 +19,39 @@ const BusinessDatabaseModal = (props) => {
return Promise.resolve();
}
const renderBasicInfo = (databasesRecord) => {
let path = '/' + resourceCatalogPath.join('/');
return <div>
<Row><Col span={12}>
<div style={{ color: '#3BB19C', fontSize: 18 }}>基本信息</div>
<div style={{ lineHeight: '35px', marginLeft: 32 }}>
<div> 元数据名称<span style={{ color: '#7F7F7F' }}>{databasesRecord.name}</span></div>
<div> 元数据代码<span style={{ color: '#7F7F7F' }}>{databasesRecord.code}</span></div>
<div> 元数据类型<span style={{ color: '#7F7F7F' }}>{databasesRecord.type}</span></div>
<div> 上下文路径<span style={{ color: '#7F7F7F' }}>{'/' + resourceCatalogPath.join('/')}</span></div>
<div> 元数据详情<span style={{ color: '#7F7F7F' }}>{databasesRecord.description}</span></div>
{[{ name: '元数据名称:', key: 'name' },
{ name: '元数据代码:', key: 'code' },
{ name: '元数据类型:', key: 'type' },
{ name: '上下文路径:', key: 'path' },
{ name: '元数据详情:', key: 'description' }].map(item => {
if (item.key != 'path')
return <div>{item.name}<span style={{ color: '#7F7F7F' }} title={databasesRecord[item.key]}>{
databasesRecord[item.key] && databasesRecord[item.key].length > (item.key === 'description' ? 40 : 15) ?
databasesRecord[item.key].substring(0, (item.key === 'description' ? 40 : 15)) + '...' : databasesRecord[item.key]}</span></div>
else
return <div>{item.name}<span style={{ color: '#7F7F7F' }} title={path} >{path && path.length > 15 ?
path.substring(0, 15) + '...' : path}</span></div>
})}
</div>
</Col>
<Col span={12}>
<div style={{ color: '#3BB19C', fontSize: 18 }}>属性</div>
<div style={{ lineHeight: '35px', marginLeft: 32 }}>
{metadataModels && metadataModels.filter(mm => mm.modelType === '表').map(mm =>
<div title={mm.attributeName}> {mm.attributeName.length > 10 ? mm.attributeName.substring(0, 10) + '...' :
{metadataModels && metadataModels.filter(mm => mm.modelType === '表').map(mm => {
let str = ''
if (databasesRecord.attributesParam && databasesRecord.attributesParam[mm.attributeCode]) {
str = databasesRecord.attributesParam[mm.attributeCode];
}
return <div title={mm.attributeName}> {mm.attributeName.length > 6 ? mm.attributeName.substring(0, 6) + '...' :
mm.attributeName}
<span style={{ color: '#7F7F7F' }}>{databasesRecord.attributesParam && databasesRecord.attributesParam[mm.attributeCode] || ""}</span></div>)}
<span style={{ color: '#7F7F7F' }} title={str}>{str && str.length > 15 ? str.substring(0, 15) + '...' : str}</span></div>
})
}
</div>
</Col>
</Row>
@ -48,10 +63,11 @@ const BusinessDatabaseModal = (props) => {
okText='确定' width={800}
onOk={() => handleOk(null)}
onCancel={onCancel}>
{editData.record.businessMetadataDatabases.length ?
{editData.record && editData.record.businessMetadataDatabases.length ?
renderBasicInfo(editData.record) : null
}
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} initialValues={editData.record.businessMetadataDatabases || {}}>
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} initialValues={editData.record && editData.record.businessMetadataDatabases.length &&
editData.record.businessMetadataDatabases[0] || {}}>
{[{ name: '信息资源名称', key: 'resourceName' },
{ name: '信息资源摘要', key: 'resourceAbstract' },
{ name: '信息资源提供方', key: 'resourceProvider' },

28
web/client/src/sections/metadataManagement/containers/businessDatabaseTable.js

@ -5,7 +5,7 @@ import moment from 'moment';
import FileSaver from 'file-saver';
import BusinessDatabaseModal from '../components/businessDatabaseModal';
const BusinessDatabaseTable = (props) => {
const { user, dispatch, actions, clientHeight, resourceCatalogId, resourceCatalogKey,
const { user, dispatch, actions, clientHeight, resourceCatalogId,
resourceCatalogPath, isRequesting, metadataModels } = props;
const { metadataManagement } = actions;
const SortValues = { 'ascend': 'asc', 'descend': 'desc' };
@ -22,11 +22,11 @@ const BusinessDatabaseTable = (props) => {
useEffect(() => {
setUpdateAtSort('descend');
initData({ limit, offset: currentPage - 1, orderDirection: SortValues[updateAtSort] });
onSearch('descend');
}, [resourceCatalogId]);
const initData = (query = {}) => {
dispatch(metadataManagement.getBusinessMetadata({ catalog: resourceCatalogId, keywords, orderBy: 'updateAt', ...query })).then(res => {
dispatch(metadataManagement.getBusinessMetadataDatabases({ catalog: resourceCatalogId, keywords, orderBy: 'updateAt', ...query })).then(res => {
if (res.success) {
setTableData(res.payload.data.rows);
setTableDataCount(res.payload.data.count);
@ -39,13 +39,13 @@ const BusinessDatabaseTable = (props) => {
if (!add)
setEditData({ title: '查看业务元数据', record: { path: '/' + resourceCatalogPath.join('/'), ...record, ...record.attributesParam } });
else
setEditData({ add: true, title: '新建业务元数据', record: { path: '/' + resourceCatalogPath.join('/'), ...record, ...record.attributesParam } });
setEditData({ add: true, title: '新建业务元数据', record: { ...record } });
setModalVisible(true);
}
})
}
const confirmDelete = (id) => {
dispatch(metadataManagement.delBusinessMetadata(id)).then(res => {
dispatch(metadataManagement.delBusinessMetadataDatabases(id)).then(res => {
if (res.success) {
onSearch(); setModalVisible(false);
}
@ -211,18 +211,18 @@ const BusinessDatabaseTable = (props) => {
}
}];
const onSearch = () => {
const onSearch = (sort) => {
setSelectedRowKeys([]);
setSelectedRows([]);
setCurrentPage(1);
initData({ limit, offset: 0, orderDirection: SortValues[updateAtSort] });
initData({ limit, offset: 0, orderDirection: SortValues[sort || updateAtSort] });
}
const handleExport = (isAll = false) => {
let tableHeader = `<tr>`;
columns.filter(c => c.dataIndex != 'action').map(c => { tableHeader += `<th><div>${c.title}</div></th>`; });
tableHeader += '</tr>';
if (isAll) {
dispatch(metadataManagement.getBusinessMetadata({ catalog: resourceCatalogId })).then(res => {
dispatch(metadataManagement.getBusinessMetadataDatabases({ catalog: resourceCatalogId })).then(res => {
if (res.success) {
handleExportTable(tableHeader, res.payload.data.rows);
}
@ -270,12 +270,14 @@ const BusinessDatabaseTable = (props) => {
let obj = {}
if (editData.add) {
obj = { createBy: user.id, metadataDatabaseId: editData.record.id, ...values }
dispatch(metadataManagement.postBusinessMetadata(obj)).then(() => {
onSearch(); setModalVisible(false);
dispatch(metadataManagement.postBusinessMetadataDatabases(obj)).then(res => {
if (res.success) {
onSearch(); setModalVisible(false);
}
});
} else {
obj = { ...values }
dispatch(metadataManagement.putBusinessMetadata(editData.record.businessMetadataDatabases[0].id, obj)).then(res => {
dispatch(metadataManagement.putBusinessMetadataDatabases(editData.record.businessMetadataDatabases[0].id, obj)).then(res => {
if (res.success) {
onSearch(); setModalVisible(false);
}
@ -332,12 +334,12 @@ const BusinessDatabaseTable = (props) => {
</Spin >
}
function mapStateToProps(state) {
const { global, auth, metadataDatabases, metadataModels } = state;
const { global, auth, businessMetadataDatabases, metadataModels } = state;
return {
user: auth.user,
actions: global.actions,
clientHeight: global.clientHeight,
isRequesting: metadataDatabases.isRequesting || metadataModels.isRequesting,
isRequesting: businessMetadataDatabases.isRequesting || metadataModels.isRequesting,
metadataModels: metadataModels.data
};
}

1
web/client/src/sections/metadataManagement/containers/businessMetadata.js

@ -12,7 +12,6 @@ const BusinessMetadata = (props) => {
const [resourceCatalogData, setResourceCatalogData] = useState([]);
const [selectedKeys, setSelectedKeys] = useState([]);
const [expandedKeys, setExpandedKeys] = useState([]);
const [modalVisible, setModalVisible] = useState(false);
const [resourceCatalogId, setResourceCatalogId] = useState('');
const [resourceCatalogKey, setResourceCatalogKey] = useState('');
const [resourceCatalogPath, setResourceCatalogPath] = useState([]);

12
web/client/src/sections/metadataManagement/containers/databasesTable.js

@ -32,7 +32,7 @@ const DatabaseTable = (props) => {
useEffect(() => {
dispatch(metadataManagement.getTagList());
setCreateAtSort('descend');
initData({ limit, offset: currentPage - 1, orderDirection: SortValues[createAtSort] });
onSearch('descend');
}, [resourceCatalogId]);
const initData = (query = {}) => {
@ -186,11 +186,11 @@ const DatabaseTable = (props) => {
}
}];
const onSearch = () => {
const onSearch = (sort) => {
setSelectedRowKeys([]);
setSelectedRows([]);
setCurrentPage(1);
initData({ limit, offset: 0, orderDirection: SortValues[createAtSort] });
initData({ limit, offset: 0, orderDirection: SortValues[sort || createAtSort] });
}
const handleExport = (isAll = false) => {
let tableHeader = `<tr>`;
@ -237,8 +237,10 @@ const DatabaseTable = (props) => {
let obj = {}
if (editData.add) {
obj = { createBy: user.id, catalog: resourceCatalogId, catalogKey: resourceCatalogKey, ...values }
dispatch(metadataManagement.postMetadataDatabases(obj)).then(() => {
onSearch(); setModalVisible(false);
dispatch(metadataManagement.postMetadataDatabases(obj)).then(res => {
if (res.success) {
onSearch(); setModalVisible(false);
}
});
} else {
obj = { catalog: resourceCatalogId, catalogKey: resourceCatalogKey, ...values }

6
web/client/src/sections/metadataManagement/containers/restapisTable.js

@ -165,8 +165,10 @@ const RestapisTable = (props) => {
let obj = {}
if (editData.add) {
obj = { createBy: user.id, catalog: resourceCatalogId, catalogKey: resourceCatalogKey, ...values }
dispatch(metadataManagement.postMetadataRestapis(obj)).then(() => {
onSearch(); setModalVisible(false);
dispatch(metadataManagement.postMetadataRestapis(obj)).then(res => {
if (res.success) {
onSearch(); setModalVisible(false);
}
});
} else {
obj = { catalog: resourceCatalogId, catalogKey: resourceCatalogKey, ...values }

8
web/client/src/utils/webapi.js

@ -46,10 +46,10 @@ export const ApiTable = {
delMetadataRestapis: 'metadata/restapis/{id}',
//业务元数据管理
getBusinessMetadata: 'business/metadata',
postBusinessMetadata: 'business/metadata',
putBusinessMetadata: 'business/metadata/{id}',
delBusinessMetadata: 'business/metadata/{id}',
getBusinessMetadataDatabases: 'business/metadata/databases',
postBusinessMetadataDatabases: 'business/metadata/databases',
putBusinessMetadataDatabases: 'business/metadata/databases/{id}',
delBusinessMetadataDatabases: 'business/metadata/databases/{id}',
//元数据采集-数据源管理
pgCheckConnect: 'adapter/check/connect',

Loading…
Cancel
Save