Commit 53cf45a4 by zhaochengxiang

bug fix

parent 9f33ce11
...@@ -31,7 +31,6 @@ const AssetAction = (props) => { ...@@ -31,7 +31,6 @@ const AssetAction = (props) => {
const [ currentAction, setCurrentAction ] = useState(action); const [ currentAction, setCurrentAction ] = useState(action);
const [ assetParams, setAssetParams ] = useState({ assets: {}, attributes: [], attributesFoldMap: {} }); const [ assetParams, setAssetParams ] = useState({ assets: {}, attributes: [], attributesFoldMap: {} });
const [ elements, setElements ] = useState([]); const [ elements, setElements ] = useState([]);
const [ wholeElements, setWholeElements ] = useState([]);
const [currentAttribute, setCurrentAttribute] = useState(); const [currentAttribute, setCurrentAttribute] = useState();
const [ metadataId, setMetadataId ] = useState(''); const [ metadataId, setMetadataId ] = useState('');
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
...@@ -213,12 +212,11 @@ const AssetAction = (props) => { ...@@ -213,12 +212,11 @@ const AssetAction = (props) => {
getTreeData(); getTreeData();
getDepartments(); getDepartments();
if (action === 'add') { if (action === 'add') {
// getElements();
} else { } else {
setCurrentAction('detail'); setCurrentAction('detail');
if ((id||'')!=='') { if ((id||'')!=='') {
setPagination({...pagination, pageNum: 1}); setPagination({...pagination, pageNum: 1});
getElements();
getAssetPaths(); getAssetPaths();
getResourceRelations(); getResourceRelations();
checkDataAssetEditable(); checkDataAssetEditable();
...@@ -228,7 +226,6 @@ const AssetAction = (props) => { ...@@ -228,7 +226,6 @@ const AssetAction = (props) => {
setMetadataId(''); setMetadataId('');
setAssetParams({...assetParams, ...{assets: {}, attributes: []}}); setAssetParams({...assetParams, ...{assets: {}, attributes: []}});
setCurrentAttribute(); setCurrentAttribute();
getElements();
} }
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
...@@ -385,20 +382,6 @@ const AssetAction = (props) => { ...@@ -385,20 +382,6 @@ const AssetAction = (props) => {
}); });
} }
const getElements = ( cb = null ) => {
dispatch({
type: (currentAction==='add')?'assetmanage.listElementsAndFillValue':'assetmanage.listElements',
payload: (currentAction==='add')?{
params: {
dirId
}
}:undefined,
callback: data => {
setWholeElements(data||[]);
}
})
}
const getUserElements = () => { const getUserElements = () => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -597,7 +580,7 @@ const AssetAction = (props) => { ...@@ -597,7 +580,7 @@ const AssetAction = (props) => {
if (item.resourceType==='innerSource'||item.resourceType==='outerSource') { if (item.resourceType==='innerSource'||item.resourceType==='outerSource') {
window.open(`/center-home/menu/asset-resource-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&timestamp=${timestamp}`); window.open(`/center-home/menu/asset-resource-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&timestamp=${timestamp}`);
} else if (item.resourceType==='dataAsset') { } else if (item.resourceType==='dataAsset') {
window.open(`/center-home/menu/asset-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&templateType=${LocalStorage.get(`templateType-${appId}`)}&timestamp=${timestamp}`); window.open(`/center-home/menu/asset-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&templateType=${assets?.templateType}&timestamp=${timestamp}`);
} else { } else {
showMessage('warn', '资产目录类型不是资源也不是资产!'); showMessage('warn', '资产目录类型不是资源也不是资产!');
} }
...@@ -946,6 +929,10 @@ const AssetAction = (props) => { ...@@ -946,6 +929,10 @@ const AssetAction = (props) => {
</Space> </Space>
</div> </div>
} }
<Spin
spinning={loading}
>
{ {
(action!=='add' && (id||'')!=='') && <div> (action!=='add' && (id||'')!=='') && <div>
<div className='pl-common py-compact-common'> <div className='pl-common py-compact-common'>
...@@ -1000,9 +987,7 @@ const AssetAction = (props) => { ...@@ -1000,9 +987,7 @@ const AssetAction = (props) => {
overflow: 'auto', overflow: 'auto',
}} }}
> */} > */}
<Spin
spinning={loading}
>
<Form form={form} onValuesChange={onValuesChange}> <Form form={form} onValuesChange={onValuesChange}>
<Radio.Group buttonStyle='solid' className='mb-3' value={currentAttribute} onChange={(e) => { <Radio.Group buttonStyle='solid' className='mb-3' value={currentAttribute} onChange={(e) => {
setCurrentAttribute(e.target.value) setCurrentAttribute(e.target.value)
...@@ -1018,15 +1003,9 @@ const AssetAction = (props) => { ...@@ -1018,15 +1003,9 @@ const AssetAction = (props) => {
return <div key={index} style={{ display: (attribute===currentAttribute)?'':'none' }}> return <div key={index} style={{ display: (attribute===currentAttribute)?'':'none' }}>
<Descriptions column={1} bordered> <Descriptions column={1} bordered>
{ {
wholeElements?.length>0 && elements?.map((element, index) => { elements?.map((element, index) => {
if (element.type!==attribute || element.name === '资产项') return null; if (element.type!==attribute || element.name === '资产项') return null;
let interpretation = null;
const filterElements = wholeElements?.filter(_element => _element.id === element.id);
if (filterElements.length>0) {
interpretation = filterElements[0].interpretation;
}
return ( return (
<Descriptions.Item <Descriptions.Item
key={index} key={index}
...@@ -1054,8 +1033,8 @@ const AssetAction = (props) => { ...@@ -1054,8 +1033,8 @@ const AssetAction = (props) => {
</Form.Item> </Form.Item>
</Col> </Col>
{ {
interpretation && <Col span={2}> element.interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}> <Tooltip placement="left" title={element.interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} /> <QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip> </Tooltip>
</Col> </Col>
...@@ -1067,8 +1046,8 @@ const AssetAction = (props) => { ...@@ -1067,8 +1046,8 @@ const AssetAction = (props) => {
{ elementDetailComponent(element) } { elementDetailComponent(element) }
</Col> </Col>
{ {
interpretation && <Col span={2}> element.interpretation && <Col span={2}>
<Tooltip placement="left" title={interpretation}> <Tooltip placement="left" title={element.interpretation}>
<QuestionCircleOutlined style={{ fontSize: 16 }} /> <QuestionCircleOutlined style={{ fontSize: 16 }} />
</Tooltip> </Tooltip>
</Col> </Col>
......
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