Commit 13fcdac8 authored by lxd's avatar lxd

feat:问题修复

parent 082771f5
...@@ -6,6 +6,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'; ...@@ -6,6 +6,7 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import { format } from 'date-fns'; import { format } from 'date-fns';
import moment from 'moment';
import ToExamineModal from './ToExamine'; import ToExamineModal from './ToExamine';
import { columns, toolBarRender } from './data'; import { columns, toolBarRender } from './data';
import { import {
...@@ -94,16 +95,28 @@ const PaymentMange = () => { ...@@ -94,16 +95,28 @@ const PaymentMange = () => {
} }
setToExamineModalVisibel(false); setToExamineModalVisibel(false);
}; };
const checkedTime = ({ dateTimeRange }) => {
const startTimeStr = moment(dateTimeRange?.[0]).format('YYYY-MM-DD');
const endTimeStr = moment(dateTimeRange?.[1]).format('YYYY-MM-DD');
const diffTime = moment(endTimeStr).valueOf() - moment(startTimeStr).valueOf();
const maxTime = 62 * 3600 * 24 * 1000;
if (!dateTimeRange?.[0]) {
notification.error({ message: '付款单开始时间不能为空' });
return false;
}
if (diffTime > maxTime) {
notification.error({ message: '只允许下载2个月的数据' });
return false;
}
return true;
};
const onExport = async () => { const onExport = async () => {
const params = formRef.current.getFieldsValue(); const params = formRef.current.getFieldsValue();
setloading(true); setloading(true);
if (params?.dateTimeRange?.[0]) { if (checkedTime(params)) {
const data = await selfPaymentExport(params); const data = await selfPaymentExport(params);
const blob = new Blob([data]); const blob = new Blob([data]);
saveAs(blob, `付款单导出数据-${format(new Date(), 'yyyyMMddHHmmss')}.xlsx`); saveAs(blob, `付款单导出数据-${format(new Date(), 'yyyyMMddHHmmss')}.xlsx`);
} else {
notification.error({ message: '付款单开始时间不能为空' });
} }
setloading(false); setloading(false);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment