Commit d34128da by zhaochengxiang

bug fix

parent 3c05c301
......@@ -66,6 +66,7 @@ const AssetAction = (props) => {
const [modal, contextHolder] = Modal.useModal();
const [permissions, setPermissions] = useState(undefined);
const [keyword, setKeyword] = useState('');
const [standardList, setStandardList] = useState(undefined);
const app = useContext(AppContext);
const uploadRef = useRef(undefined);
......@@ -115,19 +116,6 @@ const AssetAction = (props) => {
// }
// },
{
title: '业务规则',
dataIndex: 'businessRules',
width: 240,
ellipsis: true,
render: (text, _) => highlightSearchContentByTerms(text||'', terms)
},
{
title: '计量单位',
dataIndex: 'unitOfMeasurement',
ellipsis: true,
render: (text, _) => highlightSearchContentByTerms(text||'', terms)
},
{
title: '备注信息',
dataIndex: 'remarks',
ellipsis: true,
......@@ -146,25 +134,25 @@ const AssetAction = (props) => {
width: 60,
ellipsis: true,
},
// {
// 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: '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>
}
},
];
useEffect(() => {
......@@ -222,21 +210,30 @@ const AssetAction = (props) => {
}, [currentDomainGroup, currentBussinessDomain, treeDataMap])
const tableData = useMemo(() => {
if (metadataColumnList) {
const newMetadataColumnList = metadataColumnList.filter(item => {
if (metadataColumnList && standardList) {
const newMetadataColumnList = [];
metadataColumnList.filter(item => {
return (
!keyword
|| (item.name??'').indexOf(keyword)!==-1
|| (item.cnName??'').indexOf(keyword)!==-1
|| (item.businessRules??'').indexOf(keyword)!==-1
)
}).forEach(item => {
const index = standardList?.findIndex(_item => _item.metadataId === item._id);
let newItem = {...item};
if (index !== -1) {
newItem.standard = standardList[index];
}
newMetadataColumnList.push(newItem);
});
return paginate(newMetadataColumnList, pageNum, pageSize);
}
return [];
}, [metadataColumnList, pagination, keyword])
}, [metadataColumnList, standardList, pagination, keyword])
const getPermission = () => {
// dispatch({
......@@ -396,6 +393,7 @@ const AssetAction = (props) => {
try {
setMetadata(JSON.parse(metadataValue));
getMetadataAttributes();
getMetadataStandardList();
} catch(error) {
}
......@@ -821,6 +819,30 @@ const AssetAction = (props) => {
// }
// }
const getMetadataStandardList = () => {
setMetadata(prevMetadata => {
if (prevMetadata.metadataTableId) {
dispatch({
type: 'assetmanage.getMetadataStandardList',
payload: {
data: {
parentMetadataId: prevMetadata?.metadataTableId
},
params: {
page: 1,
size: 999999
}
},
callback: data => {
setStandardList(data?.content);
},
});
}
return prevMetadata;
})
}
const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('主题域分组')) {
setCurrentDomainGroup(changedValues['主题域分组']);
......@@ -1065,7 +1087,7 @@ const AssetAction = (props) => {
</Button>
</Dropdown> */}
<Input size="middle"
placeholder="搜索中英文名称/业务规则"
placeholder="搜索中英文名称"
value={keyword}
bordered={true} allowClear
style={{ width: 200 }}
......@@ -1093,7 +1115,7 @@ const AssetAction = (props) => {
pagination={{
position: ['bottomLeft'],
size: 'small',
total: (tableData||[]).length,
total: (metadataColumnList||[]).length,
showTotal: (total) => `${total}`,
showSizeChanger: true,
current: pageNum,
......
......@@ -80,7 +80,13 @@ const AssetItem = (props) => {
</div>}
>
<Text ellipsis={true}>
{content||''}
{
(typeof metadata==='string') ? (content||'') : <a onClick={() => {
}}>
{ metadata?.tableEnName??metadata?.tableCnName }
</a>
}
</Text>
</Tooltip>
);
......
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