Commit 800c2f26 by zhaochengxiang

回收站

parent 8f946bf6
......@@ -86,6 +86,10 @@ const AssetTable = (props) =>{
})
}
const onRecycleClick =() => {
window.open('/center-home/view/asset-recycle');
}
const addAsset =()=>{
setAssetEditAction('add');
setAssetEditVisible(true);
......@@ -227,7 +231,7 @@ const AssetTable = (props) =>{
headStyle={{ padding: 10 }}
title={
<div className='d-flex'>
<Button style={{ marginLeft: 'auto' }} type="primary" >资产回收站</Button>
<Button style={{ marginLeft: 'auto' }} type="primary"onClick={onRecycleClick} >资产回收站</Button>
</div>
}
>
......
import React, { useEffect, useState } from 'react';
import {Card, Spin, Button, Tooltip, Tree, Input, Dropdown, Menu, Space, Modal} from 'antd';
import { PlusOutlined, ImportOutlined,EditOutlined,DeleteOutlined,ExportOutlined,SyncOutlined } from '@ant-design/icons';
import classNames from 'classnames'
import { dispatch } from '../../../../model';
import ImportDirectory from './ImportDirectory';
......@@ -10,7 +11,7 @@ import './AssetTree.less';
const AssetTree = (props) => {
const { readOnly = false, onSelect } = props;
const { readOnly = false, onSelect, className, ...restProps } = props;
const [ keyword, setKeyword ] = useState('');
const [ loading, setLoading ] = useState(false);
const [ treeData, setTreeData ] = useState([]);
......@@ -222,9 +223,13 @@ const AssetTree = (props) => {
};
});
const classes = classNames('asset-tree', className, {
'asset-tree-read': readOnly
});
return (
<Card
className={"asset-tree"}
className={classes}
title={ readOnly ? null : (
<Space>
<Tooltip title="新增目录">
......@@ -253,6 +258,7 @@ const AssetTree = (props) => {
bodyStyle={{ padding:10 }}
headStyle={{ padding:10 }}
style={{ width: '100%' }}
{...restProps}
>
<Spin spinning={loading}>
<Input
......
......@@ -13,3 +13,10 @@
color: #f50;
}
}
.asset-tree-read {
.yy-tree-list {
height: 400px !important;
overflow: auto !important;
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import { showMessage } from '../../../../util';
const AssetMount = (props) => {
const { onCancel,visible, item } = props;
const { onCancel, visible, id } = props;
const [ nodeId, setNodeId ] = useState(null);
const [ confirmLoading, setConfirmLoading ] = useState(false);
......@@ -24,7 +24,7 @@ const AssetMount = (props) => {
params: {
dirId: nodeId,
},
data: [ item.id||'' ]
data: [ id||'' ]
},
callback: data => {
setConfirmLoading(false);
......@@ -41,7 +41,7 @@ const AssetMount = (props) => {
<Modal
title='挂载详情'
visible={ visible }
width={ 500 }
width={ 400 }
confirmLoading={ confirmLoading }
onCancel={()=>{ onCancel && onCancel()}}
onOk={ onOk }
......
......@@ -15,7 +15,7 @@ const AssetRecycle = (props) => {
const [ assets, setAssets ] = useState([]);
const [ total, setTotal ] = useState(0);
const [ pagination, setPagination ] = useState( { pageNum: 1, pageSize: 20 } );
const [ currentAsset, setCurrentAsset ] = useState(null);
const [ currentAssetId, setCurrentAssetId ] = useState('');
const [ assetDetailVisible, setAssetDetailVisible ] = useState(false);
const [ assetMountVisible, setAssetMountVisible ] = useState(false);
......@@ -47,9 +47,6 @@ const AssetRecycle = (props) => {
dataIndex: 'name',
},
{
title: '说明'
},
{
title: '操作',
key: 'action',
width: 120,
......@@ -80,7 +77,7 @@ const AssetRecycle = (props) => {
pageSize
},
callback: data => {
setAssets(data.data||[]);
convertAssets(data.data||[]);
setTotal(data.total);
setLoading(false);
},
......@@ -90,13 +87,28 @@ const AssetRecycle = (props) => {
})
}
const convertAssets = data => {
(data||[]).forEach(item => {
(item.elements||[]).forEach(element => {
if (element.name === '中文名称') {
item.cnName = element.value;
}
if (element.name === '英文名称') {
item.name = element.value;
}
})
})
setAssets(data||[]);
}
const detailItem = (record) => {
setCurrentAsset(record);
setCurrentAssetId(record.id);
setAssetDetailVisible(true);
}
const mountItem = (record) => {
setCurrentAsset(record);
setCurrentAssetId(record.id);
setAssetMountVisible(true);
}
......@@ -156,12 +168,12 @@ const AssetRecycle = (props) => {
/>
<AssetDetail
visible={ assetDetailVisible }
item={ currentAsset }
id={ currentAssetId }
onCancel={ onAssetDetailCancel }
/>
<AssetMount
visible={ assetMountVisible }
item={ currentAsset }
id={ currentAssetId }
onCancel={ onAssetMountCancel }
/>
{contextHolder}
......
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