Commit 83fec22c by zhaochengxiang

资产项关联元数据

parent a5014adb
...@@ -17,13 +17,15 @@ import DatasourceManage from './view/Manage/DatasourceManage'; ...@@ -17,13 +17,15 @@ import DatasourceManage from './view/Manage/DatasourceManage';
import AssetDetail from './view/Manage/AssetManage/Component/AssetDetail'; import AssetDetail from './view/Manage/AssetManage/Component/AssetDetail';
import ImportAction from './view/Manage/Model/Component/ImportAction'; import ImportAction from './view/Manage/Model/Component/ImportAction';
import EditModel from './view/Manage/Model/Component/EditModel'; import EditModel from './view/Manage/Model/Component/EditModel';
import AssetTree from './view/Manage/AssetManage/Component/AssetTree';
export const AppContext = React.createContext(); export const AppContext = React.createContext();
export class App extends React.Component { export class App extends React.Component {
render() { render() {
const { params } = this.props; const { params, callback, setGlobalState, onGlobalStateChange } = this.props;
let message = '', id = '', terms = []; let message = '', id = '', terms = [];
if (params) { if (params) {
...@@ -54,9 +56,25 @@ export class App extends React.Component { ...@@ -54,9 +56,25 @@ export class App extends React.Component {
); );
} }
if (message === 'showAssetTree') {
return (
<AssetTree
reference='metadata'
readOnly={true}
checkable={true}
onCheck={(values) => {
callback&&callback(values);
}}
{...this.props}
/>
);
}
return ( return (
<AppContext.Provider value={{ <AppContext.Provider value={{
env: params?.env env: params?.env,
setGlobalState,
onGlobalStateChange
}}> }}>
<Router basename={window.__POWERED_BY_QIANKUN__ ? '/data-govern' : '/'}> <Router basename={window.__POWERED_BY_QIANKUN__ ? '/data-govern' : '/'}>
<Switch> <Switch>
......
...@@ -97,4 +97,8 @@ export function* unloadDataAssets(payload) { ...@@ -97,4 +97,8 @@ export function* unloadDataAssets(payload) {
export function* getDataAssetLocation(payload) { export function* getDataAssetLocation(payload) {
return yield call(service.getDataAssetLocation, payload); return yield call(service.getDataAssetLocation, payload);
}
export function* createDataAssetByMetadataIds(payload) {
return yield call(service.createDataAssetByMetadataIds, payload);
} }
\ No newline at end of file
...@@ -64,6 +64,10 @@ export function getDataAssetLocation(payload) { ...@@ -64,6 +64,10 @@ export function getDataAssetLocation(payload) {
return GetJSON("/dataassetmanager/dataAssetApi/locateDataAssetById", payload); return GetJSON("/dataassetmanager/dataAssetApi/locateDataAssetById", payload);
} }
export function createDataAssetByMetadataIds(payload) {
return PostJSON("/dataassetmanager/dataAssetApi/createDataAssetByMetadataIds", payload);
}
export function addOrUpdateDirectory(payload) { export function addOrUpdateDirectory(payload) {
return PostJSON("/dataassetmanager/directoryApi/addOrUpdateDirectory", payload); return PostJSON("/dataassetmanager/directoryApi/addOrUpdateDirectory", payload);
} }
......
...@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Row, Col, Typography } from 'antd'; import { Row, Col, Typography } from 'antd';
import { highlightSearchContentByTerms } from '../../../../util'; import { highlightSearchContentByTerms } from '../../../../util';
import MetadataInfo from './MetadataInfo';
import './AssetItem.less'; import './AssetItem.less';
const AssetItem = (props) => { const AssetItem = (props) => {
...@@ -51,7 +52,10 @@ const AssetItem = (props) => { ...@@ -51,7 +52,10 @@ const AssetItem = (props) => {
return ( return (
<Col className='mb-3' key={_index} md={8}> <Col className='mb-3' key={_index} md={8}>
<Typography.Paragraph title={ `${element.name||''}: ${element.value||''}` } style={{ color: '#464646' }} ellipsis> <Typography.Paragraph title={ `${element.name||''}: ${element.value||''}` } style={{ color: '#464646' }} ellipsis>
{ `${element.name||''}: `}{highlightSearchContentByTerms(element.value||'', terms)} { `${element.name||''}: `}
{
(element.name==='资产项')?<MetadataInfo config={false} value={element.value||''} />:highlightSearchContentByTerms(element.value||'', terms)
}
</Typography.Paragraph> </Typography.Paragraph>
</Col> </Col>
); );
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, Space, Button } from 'antd'; import { Modal, Form, Input, Space, Button } from 'antd';
import { showMessage } from '../../../../util'; import { showMessage } from '../../../../util';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import { AppContext } from '../../../../App';
import MetadataInfo from './MetadataInfo';
import './AssetEdit.less'; import './AssetEdit.less';
...@@ -133,19 +134,34 @@ const AssetEdit = (props) => { ...@@ -133,19 +134,34 @@ const AssetEdit = (props) => {
} }
> >
<Form {...formItemLayout} form={form}> <Form {...formItemLayout} form={form}>
{ (elements||[]).map((element, index) => { <AppContext.Consumer>
return ( {
element.manualMaintain === '是' ? ( value => {
<Form.Item value?.onGlobalStateChange((state, prev) => {
label={element.name} if (state.message === 'data-govern-show-metadata-list-callback-message') {
name={element.name} form?.setFieldsValue({ '资产项': state.data });
key={index} }
> });
<Input />
</Form.Item> return (
) : null <>
) { (elements||[]).map((element, index) => {
})} return (
element.manualMaintain==='是' && (
<Form.Item
label={element.name}
name={element.name}
key={index}
>
{ (element.name==='资产项') ? <MetadataInfo /> : <Input /> }
</Form.Item>
)
)
})}
</>
);
}}
</AppContext.Consumer>
</Form> </Form>
</Modal> </Modal>
); );
......
import React from 'react'; import React from 'react';
import { Row, Col, Typography } from 'antd'; import { Row, Col, Typography } from 'antd';
import MetadataInfo from './MetadataInfo';
import './AssetItem.less'; import './AssetItem.less';
const AssetItem = (props) => { const AssetItem = (props) => {
...@@ -25,7 +26,8 @@ const AssetItem = (props) => { ...@@ -25,7 +26,8 @@ const AssetItem = (props) => {
return ( return (
<Col className='mb-3' key={_index} md={8}> <Col className='mb-3' key={_index} md={8}>
<Typography.Paragraph title={ `${element.name||''}: ${element.value||''}` } style={{ color: '#464646' }} ellipsis> <Typography.Paragraph title={ `${element.name||''}: ${element.value||''}` } style={{ color: '#464646' }} ellipsis>
{ `${element.name||''}: ${element.value||''}` } { `${element.name||''}: `}
{ element.name==='资产项'?<MetadataInfo config={false} value={element.value||''} />:`${element.value||''}` }
</Typography.Paragraph> </Typography.Paragraph>
</Col> </Col>
); );
......
...@@ -13,7 +13,7 @@ import './AssetTree.less'; ...@@ -13,7 +13,7 @@ import './AssetTree.less';
const AssetTree = (props) => { const AssetTree = (props) => {
const { readOnly = false, checkable = false, onSelect, className, onCheck, tableId } = props; const { readOnly = false, checkable = false, onSelect, className, onCheck, tableId, reference='' } = props;
const [ keyword, setKeyword ] = useState(''); const [ keyword, setKeyword ] = useState('');
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
const [ treeData, setTreeData ] = useState([]); const [ treeData, setTreeData ] = useState([]);
...@@ -32,8 +32,8 @@ const AssetTree = (props) => { ...@@ -32,8 +32,8 @@ const AssetTree = (props) => {
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
const timestamp = getQueryParam(AnchorTimestamp, props.location.search); const timestamp = getQueryParam(AnchorTimestamp, props.location?.search);
const id = getQueryParam(AnchorId, props.location.search); const id = getQueryParam(AnchorId, props.location?.search);
useEffect(() => { useEffect(() => {
if ((id||'') !== '') { if ((id||'') !== '') {
...@@ -432,7 +432,8 @@ const AssetTree = (props) => { ...@@ -432,7 +432,8 @@ const AssetTree = (props) => {
}); });
const classes = classNames('asset-tree', className, { const classes = classNames('asset-tree', className, {
'asset-tree-read-only': readOnly 'asset-tree-read-only': readOnly,
'asset-tree-metadata-reference': reference==='metadata'
}); });
return ( return (
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
padding: 0; padding: 0;
} }
.yy-tree-list { .yy-tree{
height: calc(100vh - @header-height - @pm-4 - @pm-3 - 33px + 1px - 20px - 42px) !important; height: calc(100vh - @header-height - @pm-4 - @pm-3 - 33px + 1px - 20px - 42px) !important;
overflow: auto !important; overflow: auto !important;
} }
...@@ -17,8 +17,15 @@ ...@@ -17,8 +17,15 @@
} }
.asset-tree-read-only { .asset-tree-read-only {
.yy-tree-list { .yy-tree {
height: calc(100vh - @header-height - @pm-4 - 20px - 42px) !important;; height: calc(100vh - @header-height - @pm-4 - 20px - 42px) !important;;
overflow: auto !important; overflow: auto !important;
} }
}
.asset-tree-metadata-reference {
.yy-tree {
height: 400px !important;
overflow: auto !important;
}
} }
\ No newline at end of file
import React from 'react';
import { Button } from 'antd';
import { SettingFilled } from '@ant-design/icons';
import { AppContext } from '../../../../App';
const MetadataInfo = ({ value = '', config = true }) => {
const metadata = ((value||'')===''?{}:JSON.parse(value));
return (
<AppContext.Consumer>
{
value => <span>
<a onClick={() => {
value?.setGlobalState({
message: 'data-govern-show-metadata-message',
data: metadata
})
}} style={{ marginRight: 5 }}>{metadata.tableName||''}</a>
{
config && <Button icon={<SettingFilled />} onClick={() => {
value?.setGlobalState({
message: 'data-govern-show-metadata-list-message'
})
}} />
}
</span>
}
</AppContext.Consumer>
);
}
export default MetadataInfo;
\ No newline at end of file
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