Commit e4a71920 by zhaochengxiang

资产问题

parent 32b81feb
...@@ -116,7 +116,7 @@ const AssetTable = (props) => { ...@@ -116,7 +116,7 @@ const AssetTable = (props) => {
const timestamp = getQueryParam(AnchorTimestamp, props.location.search); const timestamp = getQueryParam(AnchorTimestamp, props.location.search);
const shouldScrollRef = useRef(false); const shouldScrollRef = useRef(false);
const [ metadataIndex, setMetadataIndex ] = useState(''); const metadataIndexRef = useRef('');
useEffect(() => { useEffect(() => {
if ((nodeId||'') !== '' ) { if ((nodeId||'') !== '' ) {
...@@ -204,8 +204,7 @@ const AssetTable = (props) => { ...@@ -204,8 +204,7 @@ const AssetTable = (props) => {
(data||[]).forEach(group => { (data||[]).forEach(group => {
(group.names||[]).forEach((name, i) => { (group.names||[]).forEach((name, i) => {
index += (i+1); index++;
const params = { const params = {
title: name, title: name,
dataIndex: `element${index}`, dataIndex: `element${index}`,
...@@ -261,7 +260,6 @@ const AssetTable = (props) => { ...@@ -261,7 +260,6 @@ const AssetTable = (props) => {
} }
_metadataIndex = `element${index}`; _metadataIndex = `element${index}`;
setMetadataIndex(_metadataIndex);
} }
_columns.push(params); _columns.push(params);
...@@ -271,6 +269,8 @@ const AssetTable = (props) => { ...@@ -271,6 +269,8 @@ const AssetTable = (props) => {
setAssets([]); setAssets([]);
setColumns([..._columns, actionColumn]); setColumns([..._columns, actionColumn]);
metadataIndexRef.current = _metadataIndex;
getDataAssets(_metadataIndex); getDataAssets(_metadataIndex);
}, },
...@@ -280,7 +280,7 @@ const AssetTable = (props) => { ...@@ -280,7 +280,7 @@ const AssetTable = (props) => {
}) })
} }
const getDataAssets = (projectIndex = metadataIndex) => { const getDataAssets = (projectIndex = metadataIndexRef.current) => {
setLoading(true); setLoading(true);
dispatchLatestHomepage({ dispatchLatestHomepage({
type: (nodeType==='RecycleBin')?'assetmanage.listRecycleBinDataAssetsByPage':'assetmanage.listDataAssetsByPage', type: (nodeType==='RecycleBin')?'assetmanage.listRecycleBinDataAssetsByPage':'assetmanage.listDataAssetsByPage',
...@@ -299,11 +299,13 @@ const AssetTable = (props) => { ...@@ -299,11 +299,13 @@ const AssetTable = (props) => {
(asset.elementValues||[]).forEach((elementValue) => { (asset.elementValues||[]).forEach((elementValue) => {
(elementValue.values||[]).forEach((value, i) => { (elementValue.values||[]).forEach((value, i) => {
index += (i+1);
index++;
if (projectIndex === `element${index}`) { if (projectIndex === `element${index}`) {
let metadata = {}; let metadata = {};
try { try {
metadata = JSON.parse(value); metadata = JSON.parse(value);
_asset['metadata'] = metadata; _asset['metadata'] = metadata;
_asset[`element${index}`] = metadata; _asset[`element${index}`] = metadata;
...@@ -382,7 +384,7 @@ const AssetTable = (props) => { ...@@ -382,7 +384,7 @@ const AssetTable = (props) => {
type: (nodeType!=='RecycleBin')?'assetmanage.unloadDataAssets':'assetmanage.deleteDataAssets', type: (nodeType!=='RecycleBin')?'assetmanage.unloadDataAssets':'assetmanage.deleteDataAssets',
payload, payload,
callback: () => { callback: () => {
showMessage("success","删除成功") showMessage("success","删除成功");
getDataAssets(); getDataAssets();
const index = selectedKeys.findIndex((key) => key === item.id); const index = selectedKeys.findIndex((key) => key === item.id);
if (index !== -1) { if (index !== -1) {
......
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