Commit d9d316a2 by zhaochengxiang

资产草稿详情

parent 2acef775
...@@ -28,4 +28,5 @@ export const AssetManageReference = 'asset-manage'; ...@@ -28,4 +28,5 @@ export const AssetManageReference = 'asset-manage';
export const AssetBrowseReference = 'asset-browse'; export const AssetBrowseReference = 'asset-browse';
export const ResourceBrowseReference = 'resource-browse'; export const ResourceBrowseReference = 'resource-browse';
export const AssetRecycleReference = 'asset-recycle'; export const AssetRecycleReference = 'asset-recycle';
export const AssetMountReference = 'asset-mount'; export const AssetMountReference = 'asset-mount';
\ No newline at end of file export const AssetDraftReference = 'asset-draft';
\ No newline at end of file
...@@ -8,7 +8,8 @@ import { dispatch } from '../../../model' ...@@ -8,7 +8,8 @@ import { dispatch } from '../../../model'
import Table from '../ResizeableTable' import Table from '../ResizeableTable'
import { isSzseEnv, showMessage } from "../../../util" import { isSzseEnv, showMessage } from "../../../util"
import { AssetItem } from "../AssetManage/Component/AssetTable" import { AssetItem } from "../AssetManage/Component/AssetTable"
import UpdateAsset from "./update" import UpdateAsset from "../AssetManage/Component/AssetDetailDrawer"
import { AssetDraftReference } from "../../../util/constant"
const isAdmin = false const isAdmin = false
const specialCol = ['数据关键用户', '业务数据owner', 'it责任人', '创建人', '更新人'] const specialCol = ['数据关键用户', '业务数据owner', 'it责任人', '创建人', '更新人']
...@@ -31,8 +32,7 @@ const FC = (props) => { ...@@ -31,8 +32,7 @@ const FC = (props) => {
const [row, setRow] = React.useState() const [row, setRow] = React.useState()
const [updateAssetParams, setUpdateAssetParams] = React.useState({ const [updateAssetParams, setUpdateAssetParams] = React.useState({
visible: false, visible: false,
action: undefined, id: undefined,
item: undefined,
}) })
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
...@@ -291,8 +291,7 @@ const FC = (props) => { ...@@ -291,8 +291,7 @@ const FC = (props) => {
const onEditClick = (record) => { const onEditClick = (record) => {
setUpdateAssetParams({ setUpdateAssetParams({
visible: true, visible: true,
action: 'edit', id: record?.id,
item: record
}) })
} }
...@@ -389,8 +388,7 @@ const FC = (props) => { ...@@ -389,8 +388,7 @@ const FC = (props) => {
setRow(record) setRow(record)
setUpdateAssetParams({ setUpdateAssetParams({
visible: true, visible: true,
action: 'detail', id: record?.id,
item: record
}) })
} }
} }
...@@ -420,11 +418,11 @@ const FC = (props) => { ...@@ -420,11 +418,11 @@ const FC = (props) => {
</div> </div>
<UpdateAsset <UpdateAsset
{...updateAssetParams} {...updateAssetParams}
reference={AssetDraftReference}
onCancel={() => { onCancel={() => {
setUpdateAssetParams({ setUpdateAssetParams({
visible: false, visible: false,
action: undefined, id: undefined,
item: undefined,
}) })
}} }}
/> />
......
import React from "react"
import { Drawer } from "antd"
const FC = (props) => {
const { visible, item, action, onCancel } = props
return (
<Drawer
visible={visible}
title='资产目录详情'
width='80%'
placement="right"
closable
destroyOnClose
onClose={() => {
onCancel?.()
}}
>
<Basic action={action} item={item} />
</Drawer>
)
}
export default FC
const Basic = ({ action, item }) => {
return (
<div>
basic
</div>
)
}
\ No newline at end of file
...@@ -10,7 +10,7 @@ import { highlightSearchContentByTerms, showMessage, paginate } from '../../../. ...@@ -10,7 +10,7 @@ import { highlightSearchContentByTerms, showMessage, paginate } from '../../../.
import { AppContext, appId } from '../../../../App'; import { AppContext, appId } from '../../../../App';
import Tag from '../../Tag'; import Tag from '../../Tag';
import Separate from './Separate'; import Separate from './Separate';
import { AnchorId, AnchorDirId, AssetManageReference, AssetRecycleReference } from '../../../../util/constant'; import { AnchorId, AnchorDirId, AssetManageReference, AssetRecycleReference, AssetDraftReference } from '../../../../util/constant';
import IndexCode from './IndexCode'; import IndexCode from './IndexCode';
import Upload from './Upload'; import Upload from './Upload';
import Table from '../../ResizeableTable'; import Table from '../../ResizeableTable';
...@@ -29,7 +29,7 @@ const AssetAction = (props) => { ...@@ -29,7 +29,7 @@ const AssetAction = (props) => {
const { id, dirId, action, terms, onChange, reference, form, onMetadataChange, onElementsChange, readonly = false, permissionId } = props; const { id, dirId, action, terms, onChange, reference, form, onMetadataChange, onElementsChange, readonly = false, permissionId } = props;
const [ currentAction, setCurrentAction ] = useState(action); const [ currentAction, setCurrentAction ] = useState(action);
const [ assetParams, setAssetParams ] = useState({ assets: {}, attributes: [], attributesFoldMap: {} }); const [ assetParams, setAssetParams ] = useState({ assets: {}, attributes: [] });
const [ elements, setElements ] = useState([]); const [ elements, setElements ] = useState([]);
const [currentAttribute, setCurrentAttribute] = useState(); const [currentAttribute, setCurrentAttribute] = useState();
const [ metadataId, setMetadataId ] = useState(''); const [ metadataId, setMetadataId ] = useState('');
...@@ -37,7 +37,7 @@ const AssetAction = (props) => { ...@@ -37,7 +37,7 @@ const AssetAction = (props) => {
const [ confirmLoading, setConfirmLoading ] = useState(false); const [ confirmLoading, setConfirmLoading ] = useState(false);
const [ fullScreen, setFullScreen ] = useState(false); const [ fullScreen, setFullScreen ] = useState(false);
const [ assetPaths, setAssetPaths ] = useState([]); const [ assetPaths, setAssetPaths ] = useState([]);
const { assets, attributes, attributesFoldMap } = assetParams; const { assets, attributes } = assetParams;
const [ assetTagModalVisible, setAssetTagModalVisible ] = useState(false); const [ assetTagModalVisible, setAssetTagModalVisible ] = useState(false);
const [ selectTag, setSelectTag ] = useState({}); const [ selectTag, setSelectTag ] = useState({});
const [ systems, setSystems] = useState([]); const [ systems, setSystems] = useState([]);
...@@ -216,12 +216,14 @@ const AssetAction = (props) => { ...@@ -216,12 +216,14 @@ const AssetAction = (props) => {
} else { } else {
setCurrentAction('detail'); setCurrentAction('detail');
if ((id||'')!=='') { if (id) {
setPagination({...pagination, pageNum: 1}); setPagination({...pagination, pageNum: 1});
getAssetPaths(); getAssetPaths();
checkDataAssetEditable(); if (reference !== AssetDraftReference) {
getAsset(); checkDataAssetEditable();
}
getAsset();
} else { } else {
setMetadataId(''); setMetadataId('');
setAssetParams({...assetParams, ...{assets: {}, attributes: []}}); setAssetParams({...assetParams, ...{assets: {}, attributes: []}});
...@@ -386,13 +388,25 @@ const AssetAction = (props) => { ...@@ -386,13 +388,25 @@ const AssetAction = (props) => {
const getAsset = () => { const getAsset = () => {
setLoading(true); setLoading(true);
let url = 'assetmanage.getDataAssetDetail';
let payload = {
dataAssetId: id,
dirId: dirId,
checkPermission: reference!==AssetManageReference
};
if (reference === AssetDraftReference) {
url = 'assetmanage.getDraftDetail';
payload = {
params: {
draftId: id,
}
};
}
dispatch({ dispatch({
type: 'assetmanage.getDataAssetDetail', type: url,
payload: { payload,
dataAssetId: id,
dirId: dirId,
checkPermission: reference!==AssetManageReference
},
callback: data => { callback: data => {
setLoading(false); setLoading(false);
...@@ -415,21 +429,9 @@ const AssetAction = (props) => { ...@@ -415,21 +429,9 @@ const AssetAction = (props) => {
setMetadataId(data?.metadataId||''); setMetadataId(data?.metadataId||'');
onMetadataChange && onMetadataChange(data?.metadataId||''); onMetadataChange && onMetadataChange(data?.metadataId||'');
const _attributes = []; const _attributes = Array.from(new Set((data?.elements??[]).map(item => item.type)))
(data?.elements||[]).forEach(element => {
if (_attributes.indexOf(element.type) === -1) {
_attributes.push(element.type||'');
}
})
let newAttributesFoldMap = {...attributesFoldMap};
(_attributes||[]).forEach(attribute => {
if (newAttributesFoldMap[attribute]===undefined || newAttributesFoldMap[attribute]===null) {
newAttributesFoldMap[attribute] = true;
}
})
setAssetParams({ assets: data, attributes: _attributes, attributesFoldMap: newAttributesFoldMap }); setAssetParams({ assets: data, attributes: _attributes });
if ((_attributes??[]).length > 0) { if ((_attributes??[]).length > 0) {
setCurrentAttribute(_attributes[0]) setCurrentAttribute(_attributes[0])
} }
......
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