Commit e4a71920 by zhaochengxiang

资产问题

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