import * as React from 'react'; import { PageHeaderFoot, Button, AutoTableContainer, Table, Pagination } from 'kts-xui'; import { AdvancedSearch, KtsForm } from 'kts-components'; import MercyModal from './UI.MercyModal'; import moment from 'moment'; import { columnEnum } from '../CommonComponents/ColumnEnum'; import { withRouter, RouteChildrenProps } from 'react-router-dom'; import agent from '../Server'; import { DigitalAssetVerification } from '../..'; import HistoryModal from './UI.HistoryModal'; import { findLabel, proveStatusEnum, invoiceTypeEnum, effectiveStatusEnum, submitStatusEnum, appealStatusEnum, taskTypeEnum } from '../CommonComponents/FiledsEnum'; import { Select, Space, Tag, Tooltip } from 'kts-components-antd-x4'; import VerifyList from '../CommonComponents/VerifiedList' /** Props接口 */ interface IProps { } class UIComponents extends React.Component { columns = [ { title: '商品id', dataIndex: 'goodsUuid', width: 250, }, { title: '核验方', dataIndex: 'verifierName', width: 200, ellipsis: true, }, { title: '销售方', width: 170, dataIndex: 'salerName', ellipsis: true, }, { title: '采购方', width: 170, dataIndex: 'buyerName', ellipsis: true, }, { dataIndex:'buyerTaxNo', type: 'string', width: 170, title: '采购方纳税人识别号', ellipsis: true, }, { title: '业务有效性', width: 120, align: 'center', dataIndex: columnEnum['有效性状态'], render: (text, record) => { if (text === 2) { return {findLabel(text, effectiveStatusEnum)} } else { return {findLabel(text, effectiveStatusEnum)} } } }, { title: '证明结果', width: 100, align: 'center', dataIndex: columnEnum['证明标识'], render: (text, record) => { if (text === 2 || text === 4) { return {findLabel(text, proveStatusEnum)} } else if (text === 1) { return {findLabel(text, proveStatusEnum)} } else { return findLabel(text, proveStatusEnum) } } }, { title: '提交状态', width: 100, align: 'center', dataIndex: columnEnum['提交状态'], render: (text, record) => { if (text === 4 || text === 5) { return {findLabel(text, submitStatusEnum)} } else { return {findLabel(text, submitStatusEnum)} } } }, { title: '商品名称', dataIndex: 'goodsName', width: 160, ellipsis: true, }, { title: '规格型号', width: 160, ellipsis: true, dataIndex: 'specificationModel', render: (text) => { return {text} } }, { title: '数量', width: 70, ellipsis: true, dataIndex: 'quantity', }, { title: '单位', width: 70, ellipsis: true, dataIndex: 'unit', }, { title: '发票类型', width: 120, dataIndex: 'invoiceType', render: (text, record) => { if (text) { return {findLabel(text, invoiceTypeEnum)} } } }, { title: '发票代码', width: 140, dataIndex: 'invoiceCode', }, { title: '发票号码', width: 190, dataIndex: 'invoiceNo', }, { title: '开票日期', width: 120, dataIndex: 'invoiceDate', render: text => { return text && moment(text).format('YYYY-MM-DD') } }, { title: '申诉状态', width: 100, dataIndex: 'appealStatus', render: (text, record) => { if (text === 1) { return {findLabel(text, appealStatusEnum)} } else if (text === 3) { return {findLabel(text, appealStatusEnum)} } else { return findLabel(text, appealStatusEnum) } } }, { title: '采集时间', width: 160, ellipsis: true, dataIndex: 'createTime', render: text => { return text && moment(text).format('YYYY-MM-DD HH:mm') } }, { title: '采集人', width: 100, ellipsis: true, dataIndex: 'collectMan', }, { title: '提交时间', width: 160, ellipsis: true, dataIndex: 'submitTime', render: text => { return text && moment(text).format('YYYY-MM-DD HH:mm') } }, { title: '提交用途', width: 150, ellipsis: true, dataIndex:'submitPurpose', },{ title: '提交人', width: 100, ellipsis: true, dataIndex: 'submitter', }, { title: '任务单号', dataIndex: columnEnum['任务单号'], width: 160, ellipsis: true, }, { title: '关联单据', width: 120, dataIndex: 'goodsDocRelationList', ellipsis: true, render: (text, record) => { if (record.goodsDocRelationList?.length > 0) { let originalDocuments = record.goodsDocRelationList.reduce((acc, obj) => { acc.push(obj.originalDocument); return acc; }, []) let str = originalDocuments.join('/'); return str } } }, { title: '操作', dataIndex: 'id', width: 180, fixed: 'right', render: (text, record) => { //无效商品 证明结果正常 return {record.canAppeal === 1 && { this.onMercy([record]); }}>申诉} {record.appealStatus !== null && { this.onMercyList(record) }}>申诉记录} {record.submitStatus === 3 && { this.onVerifyList(record.goodsUuid) }}>处理记录} } }, ]; constructor(props) { super(props); this.state = { pageMeta: null, list: [ ], params: {}, selectedRowKeys: [], selectedRows: [], denyList: [], mercyId: null, validMode: '', goodsUuid: '', }; } onVerifyList = id => { this.setState({ goodsUuid: id, }) } closeVerify = () => { this.setState({ goodsUuid: '', }) } changeValid = value => { this.setState({ validMode: value }, () => { const { params } = this.state this.onSearch({ ...params, validMode: value }) }); } topExpand = () => { const { validMode } = this.state return ( 全部 有效商品 无效商品 } > option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 } } }, }} > ); } /** * 申诉 * @param record */ onMercy = (record: any[]) => { this.setState({ denyList: record, }) } onMercyList = (record) => { this.setState({ mercyId: record }) } onCloseMercyList = () => { this.setState({ mercyId: null }) } componentDidMount() { const params = { pageNum: 1, pageSize: 10 }; 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, effectiveStatus: this.state.validMode, }; this.getData(params); } onSearch = (data = {}) => { this.setState({ params: data, }); const params = { ...data, ...this.state.pageMeta, effectiveStatus: this.state.validMode, pageNum: 1 }; this.getData(params); } getData = async (params?) => { params = { ...params, 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'), minSubmitTime: params['minSubmitTime'] && moment(params['minSubmitTime']).format('YYYY-MM-DD 00:00:00'), maxSubmitTime: params['maxSubmitTime'] && moment(params['maxSubmitTime']).format('YYYY-MM-DD 23:59:59'), 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'), } const res: any = await agent.post('/asset/submit/submitGoodsPage', params, this); if (res.err) { return; } else { if (res.res) { this.setState({ pageMeta: res.res.pageMeta, list: res.res.items }); } } } onDeny = () => { this.setState({ denyList: [...this.state.selectedRows] }) } /** * 导出 带筛选条件导出 */ onExport = async () => { const { params } = this.state; const data = { ...params, effectiveStatus: this.state.validMode, 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'), minSubmitTime: params['minSubmitTime'] && moment(params['minSubmitTime']).format('YYYY-MM-DD 00:00:00'), maxSubmitTime: params['maxSubmitTime'] && moment(params['maxSubmitTime']).format('YYYY-MM-DD 23:59:59'), 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'), }; const res: any = await DigitalAssetVerification.server.post(`${DigitalAssetVerification.prefix_path}/asset/submit/exportSubmitGoods`, data).reqFs(DigitalAssetVerification.server.reqFs.filter(v => v !== DigitalAssetVerification.serviceTools.addContentType)).resFs([]).responseType('blob').end(null);; if (res.err) { return; } else { const blob = res.res.body; let url = URL.createObjectURL(blob); let link = document.createElement('a'); link.style.display = 'none'; link.href = url; link.setAttribute('download', `资产采集商品明细-${moment(new Date()).format('YYYYMMDDHHmmss')}.xls`); link.click(); // link = null; } } closeModal = () => { this.setState({ denyList: [] }) } successModal = () => { this.onRefresh(); this.closeModal(); this.setState({ selectedRowKeys: [], selectedRows: [], }) } render() { const dataSource = this.state.list; const { pageMeta, selectedRows, mercyId, goodsUuid, selectedRowKeys } = this.state; const rowSelection = { selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRowKeys, selectedRows }); }, getCheckboxProps: (record) => ({ disabled: record.canAppeal !== 1 }), } return (
导出, , ]} >
{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} />} { this.state.denyList.length > 0 && } { mercyId && } {goodsUuid && } ); } } export default withRouter(UIComponents as any)