import * as React from 'react'; import { message, Button, Table, Drawer } from 'kts-xui'; import { Pagination, Tag, Tooltip } from 'kts-components-antd-x4'; import { AdvancedSearch, KtsForm } from 'kts-components'; import agent from '../../../Server'; import moment from 'moment'; import { WarningOutlined, InfoCircleOutlined } from '@ant-design/icons'; import { invoiceTypeEnum, nationStatusEnum, handleStatusEnum, findLabel, collectionModeEnum } from '../../../CommonComponents/FiledsEnum' /** Props接口 */ interface IProps { onSuccess: () => void; taskUuid: string; status: number; } export default class UIComponents extends React.Component { columns = [ { title: '发票类型', dataIndex: 'invoiceType', key: 'invoiceType', align: 'center', width: 120, render: (text, record) => { if (text) { return {findLabel(text, invoiceTypeEnum)} {record.errorMsg && } } else { if (record.errorMsg) { return } } } }, { title: '采集状态', dataIndex: 'handleStatus', key: 'handleStatus', align:'center', width: 100, render: (text,record) => { if (text !== 1) { return {findLabel(text, handleStatusEnum)} } else if (!text) { return '-'; } else { return findLabel(text, handleStatusEnum) } } }, { title: '国税状态', dataIndex: 'nationStatus', key: 'nationStatus', align:'center', width: 100, render: text => { return {findLabel(text, nationStatusEnum)} } }, { title: '销售方', dataIndex: 'salerName', key: 'salerName', width: 190, ellipsis: true, }, { title: '购买方', dataIndex: 'buyerName', key: 'buyerName', width: 190, ellipsis: true, }, { title: '发票号码', dataIndex: 'invoiceNo', key: 'invoiceNo', width: 190, }, { title: '发票代码', dataIndex: 'invoiceCode', key: 'invoiceCode', width: 140, }, { title: '开票日期', dataIndex: 'invoiceDate', key: 'invoiceDate', width: 140, render: text => moment(text).format('YYYY-MM-DD') }, { title: '采集方式', dataIndex: 'collectionMode', key: 'collectionMode', width: 100, render: text => { return {findLabel(text, collectionModeEnum)} } }, { title: '采集时间', dataIndex: 'createTime', key: 'createTime', width: 180, ellipsis: true, render: text => moment(text).format('YYYY-MM-DD HH:mm:ss') }, { title: '采集人', dataIndex: 'collectMan', key: 'collectMan', width: 100, ellipsis: true, }, ]; constructor(props: IProps) { super(props); this.state = { list: [], menuKey: '', pageMeta: null, params: {}, visible: false, taskUuid: this.props.taskUuid, }; } componentDidMount() { const params = { ...this.state.params, ...this.state.pageMeta, }; this.getData(params); } onReChech = async (key: string) => { const res: any = await agent.get('/web/verifiedTask/reCheckCollectInvoice', { recordUuid: key, taskUuid: this.state.taskUuid }, this); if (res.err) { return; } else { message.success('操作成功'); this.onRefresh(); } } getData = async (params) => { params = { ...params, taskUuid: this.state.taskUuid } const res: any = await agent.post('/collector/record/page', params, this); if (res.er) { return; } else if (res.res) { this.setState({ pageMeta: res.res.pageMeta, list: res.res.items }); } } onClose = () => { this.props.onSuccess(); } onSuccess = (list: any[]) => { console.log(list); } refreshInvoice = () => { } handleMenuClick = e => { this.setState({ visible: true, menuKey: e.key }); }; onSearch = (data = {}) => { data={ ...data, minCreateTime:data['minCreateTime']&&moment(data['minCreateTime']).format('YYYY-MM-DD 00:00:00'), maxCreateTime:data['maxCreateTime']&&moment(data['maxCreateTime']).format('YYYY-MM-DD 23:59:59'), } this.setState({ params: data, }); const params = { ...data, ...this.state.pageMeta, pageNum: 1, }; this.getData(params); } radioChange = (e) => { this.props.changeView!(e.target.value); } onPageChange = (pageNum, pageSize) => { this.setState({ pageMeta: { ...this.state.pageMeta, pageNum, pageSize } }, () => { this.onRefresh(); }); } onRefresh = () => { const params = { ...this.state.params, ...this.state.pageMeta, }; this.getData(params); } onCaijiRefresh = () => { this.onRefresh(); this.props.onSuccess!(); } topExpand = () => { return ( // 发票信息 // 采集记录 // } > ); } render() { const { list, pageMeta } = this.state; const dataSource = list && list.map((item, index) => { return { ...item, index }; }); return (
{this.topExpand()}
{/*
{(status === 1 || status === 2) && }
*/}
{/* , // , ]} /> */} {pageMeta && `第 ${range[0]}-${range[1]} 条, 共有 ${total} 条`} style={{ padding: '16px 0', flex: 'none', background: 'white', textAlign: 'center' }} total={pageMeta.total} pageSize={pageMeta.pageSize} current={pageMeta.pageNum} showSizeChanger={true} />} ); } }