import * as React from 'react'; import { Menu } from 'kts-components-antd-x4'; import { WrapperDrop } from 'kts-components'; import InvoiceImport from '../CommonComponents/InvoiceImport'; import agent from '../Server'; import { DigitalAssetVerification } from '../..'; /** Props接口 */ interface IProps { onSuccess?: () => void; taskUuid?: string; value?: string; } //发票采集功能 export default class UIComponents extends React.Component { constructor(props) { super(props); this.state = { menuKey: '', visible: false, taskUuid: this.props.taskUuid, }; } componentDidMount() { if (this.props.value) { this.handleMenuClick({ key: this.props.value }) } } handleMenuClick = e => { this.setState({ visible: true, menuKey: e.key }); }; render() { const menu = ( 扫码枪 Excel上传 手工录入 ); return (
{this.props.children}
); } onClose = () => { this.setState({ visible: false, }); } onSuccess = (list: any[]) => { console.log(list); } onRefresh = () => { this.props.onSuccess && this.props.onSuccess(); } uploadInvoice = async (values) => { values = { ...values, collectionMode: 1, // taskUuid: this.props.taskUuid } const res: any = await agent.post('/collector/asset/collect', values, this); return res; } uploadInvoiceByExcel = async (values) => { const res: any = await DigitalAssetVerification.server .post(`${DigitalAssetVerification.prefix_path}/collector/asset/uploadInvoice`) .reqFs(DigitalAssetVerification.server.reqFs.filter(v => v !== DigitalAssetVerification.serviceTools.addContentType)) // .field('taskUuid', this.props.taskUuid) .field('fileName', values.name) .attach('file', values, values.name).end(this); return res; } uploadInvoiceByScan = async (values) => { values = { ...values, collectionMode: 2, // taskUuid: this.props.taskUuid } const res: any = await agent.post('/collector/asset/collect', values, this); return res; } private renderCollect = () => { const { menuKey, visible } = this.state; const urlData = { url: this.uploadInvoiceByExcel, key4: this.uploadInvoice, scankey4: this.uploadInvoiceByScan, downloadurl: '/invoiceexcel.xls', } if (menuKey && visible) { switch (menuKey) { // case 'seller': // return ; // case 'buyer': // return ; default: return ; } } return <>; } }