Commit 643f0aee by zhaochengxiang

资产关联标准

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