Commit e6f49a4f by zhaochengxiang

修改资产项问题

parent 827ee000
...@@ -277,9 +277,19 @@ const AssetTable = (props) => { ...@@ -277,9 +277,19 @@ const AssetTable = (props) => {
} }
} }
const onAssetCheckboxChange = (value) => { const onAssetCheckboxChange = (e) => {
setSelectedKeys(value||[]);
setCheckAllValue((value||[].length!==0) && (value||[]).length===(assets||[]).length); let newSelectedKeys = [...selectedKeys];
if (e.target.checked) {
newSelectedKeys = [...newSelectedKeys, e.target.value];
} else {
const index = newSelectedKeys.findIndex((key) => key === e.target.value);
newSelectedKeys.splice(index, 1);
}
setSelectedKeys(newSelectedKeys||[]);
setCheckAllValue((newSelectedKeys||[].length!==0) && (newSelectedKeys||[]).length===(assets||[]).length);
} }
const deleteAssets = () => { const deleteAssets = () => {
...@@ -423,7 +433,6 @@ const AssetTable = (props) => { ...@@ -423,7 +433,6 @@ const AssetTable = (props) => {
<> <>
<Checkbox.Group <Checkbox.Group
style={{ width: '100%' }} style={{ width: '100%' }}
onChange={ onAssetCheckboxChange }
value={ selectedKeys } value={ selectedKeys }
> >
<AutoSizer> <AutoSizer>
...@@ -456,7 +465,7 @@ const AssetTable = (props) => { ...@@ -456,7 +465,7 @@ const AssetTable = (props) => {
<> <>
<div className='d-flex mt-3 mb-1' style={{ alignItems: 'center' }}> <div className='d-flex mt-3 mb-1' style={{ alignItems: 'center' }}>
<div className='textOverflow' style={{ flex: 1 }}> <div className='textOverflow' style={{ flex: 1 }}>
<Checkbox value={item.id}></Checkbox> <Checkbox value={item.id} onChange={onAssetCheckboxChange}></Checkbox>
<span title={assetNames[index]||''} style={{ marginLeft:8, fontSize: 18, fontWeight: 'bold' }}>{assetNames[index]||''}</span> <span title={assetNames[index]||''} style={{ marginLeft:8, fontSize: 18, fontWeight: 'bold' }}>{assetNames[index]||''}</span>
</div> </div>
<Space className='m-3' style={{ marginLeft: 'auto' }} size='small'> <Space className='m-3' style={{ marginLeft: 'auto' }} size='small'>
......
...@@ -10,24 +10,26 @@ const MetadataInfo = ({ value = '', config = true }) => { ...@@ -10,24 +10,26 @@ const MetadataInfo = ({ value = '', config = true }) => {
try { try {
metadata = JSON.parse(value); metadata = JSON.parse(value);
} catch(error) { } catch(error) {
metadata = value;
} }
return ( return (
<AppContext.Consumer> <AppContext.Consumer>
{ {
value => <span> value => <span>
<a onClick={() => { {
(typeof metadata==='string') ? <span style={{ marginRight: 5 }}>{metadata||''}</span> : <a onClick={() => {
value?.setGlobalState({ value?.setGlobalState({
message: 'data-govern-show-metadata-message', message: 'data-govern-show-metadata-message',
data: metadata data: metadata
}) })
}} style={{ marginRight: 5 }}>{metadata?.tableName||''}</a> }} style={{ marginRight: 5 }}>{metadata?.tableName||''}</a>
}
{ {
config && <Button icon={<SettingFilled />} onClick={() => { config && <Button icon={<SettingFilled />} onClick={() => {
value?.setGlobalState && value?.setGlobalState({ value?.setGlobalState && value?.setGlobalState({
message: 'data-govern-show-metadata-list-message', message: 'data-govern-show-metadata-list-message',
data: metadata data: (typeof metadata==='string') ? {} : metadata
}) })
}} /> }} />
} }
......
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