Commit 643f0aee by zhaochengxiang

资产关联标准

parent eccd7dcd
...@@ -51,6 +51,7 @@ const AssetAction = (props) => { ...@@ -51,6 +51,7 @@ const AssetAction = (props) => {
const [loadingMetadataColumnList, setLoadingMetadataColumnList] = useState(false); const [loadingMetadataColumnList, setLoadingMetadataColumnList] = useState(false);
const [metadataColumnList, setMetadataColumnList] = useState(undefined); const [metadataColumnList, setMetadataColumnList] = useState(undefined);
const [selectStandardParam, setSelectStandardParam] = useState({ visible: false, id: undefined }); const [selectStandardParam, setSelectStandardParam] = useState({ visible: false, id: undefined });
const [standardList, setStandardList] = useState(undefined);
const app = useContext(AppContext); const app = useContext(AppContext);
const uploadRef = useRef(undefined); const uploadRef = useRef(undefined);
...@@ -110,22 +111,36 @@ const AssetAction = (props) => { ...@@ -110,22 +111,36 @@ const AssetAction = (props) => {
title: '引用标准', title: '引用标准',
dataIndex: 'standard', dataIndex: 'standard',
ellipsis: true, ellipsis: true,
render: (_, record) => {
return <AppContext.Consumer>
{
appValue => <a onClick={() => {
appValue?.setGlobalState && appValue?.setGlobalState({
message: 'data-govern-show-index-detail-message',
data: { id: record.standard?.standardId }
})
}}>
<span>{record.standard?.standardName}</span>
</a>
}
</AppContext.Consumer>
}
}, },
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
width: 80, width: 80,
render: (_, record) => { render: (_, record) => {
return <Button return (reference===AssetManageReference||canEdit) ? <Button
type='link' type='link'
size='small' size='small'
onClick={() => { onClick={() => {
// setSelectStandardParam({ visible: true, id: record._id }); setSelectStandardParam({ visible: true, id: record._id });
}} }}
style={{ padding: 0 }} style={{ padding: 0 }}
> >
关联标准 关联标准
</Button> </Button> : null;
} }
} }
]; ];
...@@ -162,6 +177,22 @@ const AssetAction = (props) => { ...@@ -162,6 +177,22 @@ const AssetAction = (props) => {
return []; return [];
}, [currentDomainGroup, treeDataMap]) }, [currentDomainGroup, treeDataMap])
const tableData = useMemo(() => {
if (metadataColumnList && standardList) {
const newMetadataColumnList = [...metadataColumnList];
newMetadataColumnList.forEach(item => {
const index = standardList?.findIndex(_item => _item.metadataId === item._id);
if (index !== -1) {
item.standard = standardList[index];
}
});
return newMetadataColumnList;
}
return [];
}, [metadataColumnList, standardList])
const getAssetPaths = () => { const getAssetPaths = () => {
dispatch({ dispatch({
type: 'assetmanage.getAssetPaths', type: 'assetmanage.getAssetPaths',
...@@ -378,7 +409,7 @@ const AssetAction = (props) => { ...@@ -378,7 +409,7 @@ const AssetAction = (props) => {
try { try {
setMetadata(JSON.parse(metadataValue)); setMetadata(JSON.parse(metadataValue));
getMetadataAttributes(); getMetadataAttributes();
// getMetadataStandardList(); getMetadataStandardList();
} catch(error) { } catch(error) {
} }
...@@ -470,9 +501,13 @@ const AssetAction = (props) => { ...@@ -470,9 +501,13 @@ const AssetAction = (props) => {
data: { data: {
parentMetadataId: prevMetadata.metadataTableId parentMetadataId: prevMetadata.metadataTableId
}, },
params: {
page: 1,
size: 999999
}
}, },
callback: data => { callback: data => {
setStandardList(data?.content);
}, },
}); });
} }
...@@ -933,7 +968,7 @@ const AssetAction = (props) => { ...@@ -933,7 +968,7 @@ const AssetAction = (props) => {
loading={loadingMetadataColumnList} loading={loadingMetadataColumnList}
columns={columns} columns={columns}
rowKey='_id' rowKey='_id'
dataSource={metadataColumnList||[]} dataSource={tableData||[]}
pagination={{ pagination={{
position: ['bottomLeft'], position: ['bottomLeft'],
size: 'small', size: 'small',
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import AssetAction from './AssetAction'; import AssetDetail from './AssetDetail';
import { getQueryParam } from '../../../../util'; import { getQueryParam } from '../../../../util';
import './AssetDetailPage.less'; import './AssetDetailPage.less';
import { AssetBrowseReference } from "../../../../util/constant";
const AssetDetailPage = (props)=>{ const AssetDetailPage = (props)=>{
...@@ -28,7 +27,7 @@ const AssetDetailPage = (props)=>{ ...@@ -28,7 +27,7 @@ const AssetDetailPage = (props)=>{
</div> </div>
<div className='detail-container'> <div className='detail-container'>
<div className='detail-container-card'> <div className='detail-container-card'>
<AssetAction reference={AssetBrowseReference} id={id} action='detail' dirId={dirId} readonly={true} /> <AssetDetail id={id} dirId={dirId} />
</div> </div>
</div> </div>
</div> </div>
......
...@@ -72,7 +72,12 @@ const FC = (props) => { ...@@ -72,7 +72,12 @@ const FC = (props) => {
parentClass: 'Catalog' parentClass: 'Catalog'
}, },
callback: data => { callback: data => {
setTreeData(data); const filterData = data?.filter(item => item.name !== '草稿');
if (filterData && filterData.length > 0) {
setCurrentTreeId(filterData[0]._id);
}
setTreeData(filterData);
} }
}); });
} }
...@@ -146,15 +151,19 @@ const FC = (props) => { ...@@ -146,15 +151,19 @@ const FC = (props) => {
bodyStyle={{ padding: '24px', height: '70vh', overflow: 'auto' }} bodyStyle={{ padding: '24px', height: '70vh', overflow: 'auto' }}
> >
<Row> <Row>
<Col span={8}> <Col span={6}>
<Tree <Tree
showLine={true} showLine={true}
showIcon={false} showIcon={false}
treeData={loop(treeData)} treeData={loop(treeData)}
onSelect={onTreeSelect} onSelect={onTreeSelect}
selectedKeys={currentTreeId ? [currentTreeId]: undefined}
/> />
</Col> </Col>
<Col span={16}> <Col span={1}>
<div style={{ width: 1, height: 'calc(70vh - 48px)', backgroundColor: '#f0f0f0' }} ></div>
</Col>
<Col span={17}>
<Table <Table
columns={columns} columns={columns}
dataSource={tableData||[]} dataSource={tableData||[]}
......
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