Commit d9d316a2 by zhaochengxiang

资产草稿详情

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