import * as React from 'react'; import { AutoTableContainer, Table, Pagination, Tag, Drawer } from 'kts-xui'; import { AdvancedSearch, KtsForm } from 'kts-components'; import moment from 'moment'; import { columnEnum } from '../CommonComponents/ColumnEnum'; import { findLabel, invoiceTypeEnum, nationStatusEnum, collectionModeEnum, handleStatusEnum } from '../CommonComponents/FiledsEnum'; import { ExclamationCircleOutlined } from '@ant-design/icons'; import agent from '../Server'; import { Tooltip } from 'kts-components-antd-x4'; /** Props接口 */ interface IProps { onClose: () => void; } class UIComponents extends React.Component { columns = [ { title: '采集状态', dataIndex: 'handleStatus', align: 'center', width: 100, render: (text, record) => { if (text === 1) { return {findLabel(text, handleStatusEnum)} } else { return } } }, { title: '发票类型', width: 120, align: 'center', dataIndex: 'invoiceType', render: (text, record) => { if (text) { return {findLabel(text, invoiceTypeEnum)} } } }, { title: '国税状态', dataIndex: columnEnum['国税状态'], align: 'center', width: 120, render: (text) => { if (text === 1) { return {findLabel(text, nationStatusEnum)} } else { return {findLabel(text, nationStatusEnum)} } } }, { title: '销售方', dataIndex: columnEnum['销售方'], width: 160, ellipsis: true, }, { title: '购买方', dataIndex: columnEnum['采购方'], width: 160, ellipsis: true, }, { title: '发票号码', width: 190, dataIndex: 'invoiceNo', }, { title: '发票代码', width: 140, dataIndex: 'invoiceCode', }, { title: '开票日期', width: 130, dataIndex: 'invoiceDate', render: (text) => { return text && moment(text).format('YYYY-MM-DD'); } }, { title: '采集方式', width: 130, dataIndex: columnEnum['采集方式'], render: (text, record) => { if (text) { return {findLabel(text, collectionModeEnum)} } } }, { title: '采集时间', width: 160, dataIndex: columnEnum['采集时间'], ellipsis: true, render: text => { return text && moment(text).format('YYYY-MM-DD HH:mm') } }, { title: '采集人', width: 130, dataIndex: columnEnum['采集人'], }, ]; constructor(props) { super(props); this.state = { pageMeta: null, list: [ ], params: {}, showModal: false, selectedRowKeys: [], denyList: [], invoiceUuid: '' }; } erifyRecords = id => { this.setState({ invoiceUuid: id }) } closeVerify = () => { this.setState({ invoiceUuid: '' }) } topExpand = () => { return ( ); } componentDidMount() { const params = { pageNum: 1, pageSize: 10, ...this.state.params, }; this.getData(params); } 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); } onSearch = (data = {}) => { console.log(data); this.setState({ params: data, }); const params = { ...data, ...this.state.pageMeta, pageNum: 1 }; this.getData(params); } getData = async (params?) => { params = { ...params, minInvoiceDate: params['minInvoiceDate'] && moment(params['minInvoiceDate']).format('YYYY-MM-DD 00:00:00'), maxInvoiceDate: params['maxInvoiceDate'] && moment(params['maxInvoiceDate']).format('YYYY-MM-DD 23:59:59'), minCreateTime: params['minCreateTime'] && moment(params['minCreateTime']).format('YYYY-MM-DD 00:00:00'), maxCreateTime: params['maxCreateTime'] && moment(params['maxCreateTime']).format('YYYY-MM-DD 23:59:59'), } const res: any = await agent.post('/collector/record/page', params, this); if (res.err) { return; } else { this.setState({ pageMeta: res.res.pageMeta, list: res.res.items }); } } onCaijiRefresh = () => { this.onRefresh(); } onClose = () => { this.props.onClose(); } render() { const dataSource = this.state.list; const { pageMeta, selectedRowKeys, invoiceUuid } = this.state; const rowSelection = { onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRowKeys }); }, getCheckboxProps: (record) => ({ disabled: record.effectiveStatus !== 1 }), } return (
{this.topExpand()}
{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} />} ); } } export default UIComponents