Commit 61ea7163 by zhaochengxiang

去掉多余的代码

parent 01bba12d
......@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
import { Form, Spin, Input, Descriptions, Space, Button, Tooltip, Select } from 'antd';
import { DownOutlined, UpOutlined } from '@ant-design/icons';
import MetadataInfo from './MetadataInfo';
import { dispatch } from '../../../../model';
import { highlightSearchContentByTerms, showMessage, getAssetRange, checkMenuAdmit, getAssetType } from '../../../../util';
import { AppContext } from '../../../../App';
......@@ -15,7 +14,6 @@ import ResourceItem from '../../AssetResourceManage/resource-item';
import { CancelSvg, EditSvg, SaveSvg, FullScreenSvg, CancelFullScreenSvg } from './AssetSvg';
import { Subject } from 'rxjs';
import { element } from 'prop-types';
export const AssetActionSubject = new Subject();
......
import React, { useEffect, useMemo, useState } from "react";
import { Spin, Descriptions, Divider } from "antd";
import MetadataInfo from './MetadataInfo';
import { getAssetRange, highlightSearchContentByTerms } from '../../../../util';
import { dispatch } from '../../../../model';
import { ElementItem } from "./AssetAction";
import { AssetManageReference } from "../../../../util/constant";
const AssetDetail = (props)=>{
......@@ -143,9 +144,7 @@ const AssetDetail = (props)=>{
(_currentValues||[]).map((item, index) => {
return (
<Descriptions.Item label={item.name||''} key={index}>
{
item.name==='资产项' ? <MetadataInfo config={false} value={item.value||''} terms={terms} /> : <span>{highlightSearchContentByTerms(item.value||'', terms)}</span>
}
<ElementItem type={AssetManageReference} element={item} value={item.value} terms={terms} />
</Descriptions.Item>
);
})
......
import React from 'react';
import { Row, Col, Typography } from 'antd';
import MetadataInfo from './MetadataInfo';
import './AssetItem.less';
const AssetItem = (props) => {
const { data } = props;
return (
<div className='asset-item'>
{
(data.elementsGroup||[]).map((elementGroup, index) => {
const _type = elementGroup.type||'';
return (
<div key={index}>
<div className='flex' style={{ alignItems: 'center', padding: '15px 0' }}>
<div style={{ width: 3, height: 14, backgroundColor: '#0069AC', marginRight: 5 }} />
<span style={{ fontWeight: 'bold', color: '#464646' }}>{_type||''}</span>
</div>
<Row>
{
elementGroup && elementGroup.elements && elementGroup.elements.map((element, _index) => {
return (
<Col className='mb-3' key={_index} md={8}>
<Typography.Paragraph title={ `${element.name||''}: ${element.value||''}` } style={{ color: '#464646' }} ellipsis>
{ `${element.name||''}: `}
{ element.name==='资产项'?<MetadataInfo config={false} value={element.value||''} />:`${element.value||''}` }
</Typography.Paragraph>
</Col>
);
})
}
</Row>
<div style={{ width: '100%', height: 2, backgroundColor: '#ededed' }} />
</div>
)
})
}
</div>
);
}
export default AssetItem;
\ No newline at end of file
.asset-item {
margin: 0px 0px 0px 30px;
.yy-divider-horizontal {
margin: 0 !important;
}
}
\ No newline at end of file
import React from 'react'
import { Button, Tooltip } from 'antd'
import { SettingFilled } from '@ant-design/icons'
import { highlightSearchContentByTerms, IsArr } from '../../../../util'
import { AppContext } from '../../../../App'
import { MetadataColumnTooltipTitle } from '../../AssetResourceManage/table'
import { AssetManageReference, ResourceManageReference } from '../../../../util/constant'
const MetadataInfo = ({ value = '', reference = AssetManageReference, config = true, terms = [] }) => {
const app = React.useContext(AppContext)
const decodeData = React.useMemo(() => {
if (value) {
try {
return JSON.parse(value)
} catch(error) {
return value
}
}
return []
}, [value])
return (
<React.Fragment>
{
reference === ResourceManageReference ? <ResourceItem data={decodeData} config={config} terms={terms} /> : <AssetItem data={decodeData} config={config} terms={terms} />
}
</React.Fragment>
)
}
export default MetadataInfo
const ResourceItem = ({ data, config, terms }) => {
const app = React.useContext(AppContext)
return (
<div className='flex' style={{ alignItems: 'center' }}>
{
(typeof data === 'string') ? <span style={{ marginRight: 5 }}>
{highlightSearchContentByTerms(data, terms)}
</span> : ((IsArr(data)&&data.length>0) ? <span>
<Tooltip
overlayClassName='tooltip-common'
title={<MetadataColumnTooltipTitle data={data} />}
>
<a onClick={() => {
app?.setGlobalState?.({
message: 'data-govern-show-metadata-message',
data: data[0]
})
}}
style={{ marginRight: 5 }}
>
{highlightSearchContentByTerms(data[0].enName, terms)}
</a>
</Tooltip>
</span> : null)
}
{
config && <Button type='text' icon={<SettingFilled />} onClick={() => {
app?.setGlobalState?.({
message: 'data-govern-show-metadata-list-message',
data: (typeof data==='string') ? {} : data[0]
})
}} />
}
</div>
)
}
const AssetItem = ({ data, config, terms }) => {
const app = React.useContext(AppContext)
return (
<div className='flex' style={{ alignItems: 'center' }}>
{
(typeof data === 'string') ? <span style={{ marginRight: 5 }}>
{highlightSearchContentByTerms(data, terms)}
</span> : (IsArr(data) ? <div className='flex' style={{ flexDirection: 'column', lineHeight: '32px' }}>
{
(data??[]).map((item, index) => <span key={index}>
<Tooltip
overlayClassName='tooltip-common'
title={<MetadataColumnTooltipTitle data={[item]} />}
>
<a onClick={() => {
app?.setGlobalState?.({
message: 'data-govern-show-metadata-message',
data: item
})
}}
style={{ marginRight: 5, marginTop: config?5:0 }}
>
{highlightSearchContentByTerms(item.enName, terms)}
</a>
</Tooltip>
</span>
)
}
</div> : null)
}
</div>
)
}
\ No newline at end of file
......@@ -7,7 +7,6 @@ import produce from 'immer'
import { AssetManageReference, ResourceManageReference } from '../../../util/constant'
import { getAssetRange, getAssetType, inputWidth, isSzseEnv } from '../../../util'
import { AppContext } from '../../../App'
import MetadataInfo from '../AssetManage/Component/MetadataInfo'
import { defaultPage, usePage } from '../../../util/hooks/page'
import Table from '../../../util/Component/Table'
import AssetItem from '../AssetManage/asset-item'
......
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