|
|
@ -1,11 +1,41 @@ |
|
|
|
import React, { useEffect, useState } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Select, Input, Button, RadioGroup, Radio, Tooltip } from '@douyinfe/semi-ui'; |
|
|
|
import { IconSearch } from '@douyinfe/semi-icons'; |
|
|
|
import { Select, Input, Spin, Table, Button } from '@douyinfe/semi-ui'; |
|
|
|
import { RESERVEITEM_TYPE } from '../constants'; |
|
|
|
import '../style.less' |
|
|
|
import moment from 'moment' |
|
|
|
|
|
|
|
const ReserveItemsLostStatistics = (props) => { |
|
|
|
const { dispatch, actions, isRequesting, reserveItemReport } = props; |
|
|
|
const [downloadUrl, setDownloadUrl] = useState(null); |
|
|
|
const [downloadKey, setDownloadKey] = useState(null); |
|
|
|
useEffect(() => { |
|
|
|
dispatch(actions.businessManagement.getReserveItemReport(RESERVEITEM_TYPE.lostStatistic)); |
|
|
|
}, []); |
|
|
|
|
|
|
|
const exportReport = (url) => { |
|
|
|
setDownloadUrl(`/_file-server${url}`); |
|
|
|
setDownloadKey(Math.random()); |
|
|
|
} |
|
|
|
const columns = [ |
|
|
|
{ |
|
|
|
title: '序号', |
|
|
|
dataIndex: 'name', |
|
|
|
render: (text, record, index) => index + 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '时间', |
|
|
|
dataIndex: 'date', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '名称', |
|
|
|
dataIndex: 'path', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'action', |
|
|
|
render: (text, record, indexe) => (<Button theme='solid' type='secondary' onClick={() => exportReport(record.path)} > 导出</Button >) |
|
|
|
}, |
|
|
|
]; |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
@ -26,12 +56,17 @@ const ReserveItemsLostStatistics = (props) => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div style={{ borderBottom: '1px solid #F2F3F5', marginLeft: '-20px', marginBottom: 16 }}></div> |
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 22 }}> |
|
|
|
<div style={{ display: 'flex', }}> |
|
|
|
<div style={{ color: '#646566', fontSize: 14 }}> |
|
|
|
当前显示 |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{ |
|
|
|
downloadUrl ? <iframe key={downloadKey} src={downloadUrl} style={{ display: 'none' }} /> : '' |
|
|
|
} |
|
|
|
<div style={{ marginBottom: 22 }}> |
|
|
|
<Spin spinning={isRequesting}> |
|
|
|
<Table |
|
|
|
rowKey={"id"} |
|
|
|
columns={columns} |
|
|
|
dataSource={reserveItemReport} |
|
|
|
/> |
|
|
|
</Spin> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -41,10 +76,12 @@ const ReserveItemsLostStatistics = (props) => { |
|
|
|
|
|
|
|
|
|
|
|
function mapStateToProps(state) { |
|
|
|
const { auth, global } = state; |
|
|
|
const { auth, global, reserveItemReport } = state; |
|
|
|
return { |
|
|
|
user: auth.user, |
|
|
|
actions: global.actions, |
|
|
|
reserveItemReport: reserveItemReport.data || [], |
|
|
|
isRequesting: reserveItemReport.isRequesting |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|