import React from 'react'; import { Table, Drawer, Button, Pagination } from 'kts-xui'; import { KtsForm, AdvancedSearch } from 'kts-components'; import { taskStatusEnum, findLabel } from '../../../CommonComponents/FiledsEnum'; import agent from '../../../Server'; interface IProps { onClose: () => void; importInvoice: (list) => void; taskUuid: string; } export default class SellerImport extends React.Component { columns = [ { title: '任务单号', dataIndex: 'taskNo', ellipsis: true, width: 160, }, { title: '采集方', dataIndex: 'verifiedParty', ellipsis: true, width: 200, }, { title: '任务状态', width: 110, dataIndex: 'status', render: text => { return findLabel(text, taskStatusEnum) } }, { title: '关联单据', dataIndex: 'originalDocList', width: 120, ellipsis: true, render: (text) => { if (text && text.length > 0) { let originalDocuments = text.reduce((acc, obj) => { acc.push(obj.originalDocument); return acc; }, []) let str = originalDocuments.join('/'); return str } } }, { title: '创建人', dataIndex: 'creator', width: 100, ellipsis: true, }, { title: '备注', width: 140, dataIndex: 'remark', ellipsis: true, }, ]; constructor(props) { super(props); this.state = { selectedRowKeys: [], pageMeta: { pageNum: 1, pageSize: 10, pages: 0, total: 0, }, list: [ ], } } onSubmitSchema = (value) => { console.log(value); } componentDidMount() { const params = { pageNum: 1, pageSize: 10 }; this.getData(params); } getData = async (params) => { params = { ...params, taskUuid: this.props.taskUuid } const res: any = await agent.post('/collector/task/getRelationTask', params, this); if (res.er) { return; } else if (res.res) { this.setState({ // pageMeta: res.res.pageMeta, list: res.res }); } } /** * 导入发票 */ onImport = () => { const { selectedRowKeys } = this.state; this.props.importInvoice(selectedRowKeys); } 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 = {}) => { this.setState({ params: data, }); const params = { ...data, ...this.state.pageMeta, pageNum: 1, pageSize: 10 }; this.getData(params); } topExpand = () => { return ( ); } onClose = () => { this.props.onClose(); } render() { const dataSource = this.state.list; const { selectedRowKeys } = this.state; const rowSelection = { onChange: (selectedRowKeys) => { this.setState({ selectedRowKeys }); }, getCheckboxProps: (record: any) => ({ disabled: record.status!==3, }), selectedRowKeys } return ( } > {/*
{this.topExpand()}
*/}
{/* `第 ${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} /> */}
); } }