Commit d34128da by zhaochengxiang

bug fix

parent 3c05c301
...@@ -66,6 +66,7 @@ const AssetAction = (props) => { ...@@ -66,6 +66,7 @@ const AssetAction = (props) => {
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
const [permissions, setPermissions] = useState(undefined); const [permissions, setPermissions] = useState(undefined);
const [keyword, setKeyword] = useState(''); const [keyword, setKeyword] = useState('');
const [standardList, setStandardList] = useState(undefined);
const app = useContext(AppContext); const app = useContext(AppContext);
const uploadRef = useRef(undefined); const uploadRef = useRef(undefined);
...@@ -115,19 +116,6 @@ const AssetAction = (props) => { ...@@ -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: '备注信息', title: '备注信息',
dataIndex: 'remarks', dataIndex: 'remarks',
ellipsis: true, ellipsis: true,
...@@ -146,25 +134,25 @@ const AssetAction = (props) => { ...@@ -146,25 +134,25 @@ const AssetAction = (props) => {
width: 60, width: 60,
ellipsis: true, ellipsis: true,
}, },
// { {
// title: '引用标准', title: '关联标准',
// dataIndex: 'standard', dataIndex: 'standard',
// ellipsis: true, ellipsis: true,
// render: (_, record) => { render: (_, record) => {
// return <AppContext.Consumer> return <AppContext.Consumer>
// { {
// appValue => <a onClick={() => { appValue => <a onClick={() => {
// appValue?.setGlobalState && appValue?.setGlobalState({ appValue?.setGlobalState && appValue?.setGlobalState({
// message: 'data-govern-show-index-detail-message', message: 'data-govern-show-index-detail-message',
// data: { id: record.standard?.standardId } data: { id: record.standard?.standardId }
// }) })
// }}> }}>
// <span>{record.standard?.standardName}</span> <span>{record.standard?.standardName}</span>
// </a> </a>
// } }
// </AppContext.Consumer> </AppContext.Consumer>
// } }
// }, },
]; ];
useEffect(() => { useEffect(() => {
...@@ -222,21 +210,30 @@ const AssetAction = (props) => { ...@@ -222,21 +210,30 @@ const AssetAction = (props) => {
}, [currentDomainGroup, currentBussinessDomain, treeDataMap]) }, [currentDomainGroup, currentBussinessDomain, treeDataMap])
const tableData = useMemo(() => { const tableData = useMemo(() => {
if (metadataColumnList) { if (metadataColumnList && standardList) {
const newMetadataColumnList = metadataColumnList.filter(item => { const newMetadataColumnList = [];
metadataColumnList.filter(item => {
return ( return (
!keyword !keyword
|| (item.name??'').indexOf(keyword)!==-1 || (item.name??'').indexOf(keyword)!==-1
|| (item.cnName??'').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 paginate(newMetadataColumnList, pageNum, pageSize);
} }
return []; return [];
}, [metadataColumnList, pagination, keyword]) }, [metadataColumnList, standardList, pagination, keyword])
const getPermission = () => { const getPermission = () => {
// dispatch({ // dispatch({
...@@ -396,6 +393,7 @@ const AssetAction = (props) => { ...@@ -396,6 +393,7 @@ const AssetAction = (props) => {
try { try {
setMetadata(JSON.parse(metadataValue)); setMetadata(JSON.parse(metadataValue));
getMetadataAttributes(); getMetadataAttributes();
getMetadataStandardList();
} catch(error) { } catch(error) {
} }
...@@ -821,6 +819,30 @@ const AssetAction = (props) => { ...@@ -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) => { const onValuesChange = (changedValues, allValues) => {
if (changedValues.hasOwnProperty('主题域分组')) { if (changedValues.hasOwnProperty('主题域分组')) {
setCurrentDomainGroup(changedValues['主题域分组']); setCurrentDomainGroup(changedValues['主题域分组']);
...@@ -1065,7 +1087,7 @@ const AssetAction = (props) => { ...@@ -1065,7 +1087,7 @@ const AssetAction = (props) => {
</Button> </Button>
</Dropdown> */} </Dropdown> */}
<Input size="middle" <Input size="middle"
placeholder="搜索中英文名称/业务规则" placeholder="搜索中英文名称"
value={keyword} value={keyword}
bordered={true} allowClear bordered={true} allowClear
style={{ width: 200 }} style={{ width: 200 }}
...@@ -1093,7 +1115,7 @@ const AssetAction = (props) => { ...@@ -1093,7 +1115,7 @@ const AssetAction = (props) => {
pagination={{ pagination={{
position: ['bottomLeft'], position: ['bottomLeft'],
size: 'small', size: 'small',
total: (tableData||[]).length, total: (metadataColumnList||[]).length,
showTotal: (total) => `${total}`, showTotal: (total) => `${total}`,
showSizeChanger: true, showSizeChanger: true,
current: pageNum, current: pageNum,
......
...@@ -80,7 +80,13 @@ const AssetItem = (props) => { ...@@ -80,7 +80,13 @@ const AssetItem = (props) => {
</div>} </div>}
> >
<Text ellipsis={true}> <Text ellipsis={true}>
{content||''} {
(typeof metadata==='string') ? (content||'') : <a onClick={() => {
}}>
{ metadata?.tableEnName??metadata?.tableCnName }
</a>
}
</Text> </Text>
</Tooltip> </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