Commit 800c2f26 by zhaochengxiang

回收站

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