|
@@ -1,10 +1,11 @@
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
|
-import { Button, Card, Form, Input, Space, Table } from 'antd';
|
|
|
-import { ReloadOutlined, SearchOutlined } from '@ant-design/icons';
|
|
|
+import { Button, Card, Form, Input, message, Space, Table } from 'antd';
|
|
|
+import { ReloadOutlined, SearchOutlined, DownloadOutlined } from '@ant-design/icons';
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
|
import { queryAfterSalesSupport } from '@/services/afterSales/afterSalesSupport';
|
|
|
import moment from 'moment';
|
|
|
+import { queryExport } from '@/services/afterSales/afterSalesSupport';
|
|
|
|
|
|
interface DataType {
|
|
|
name: string;
|
|
@@ -86,6 +87,25 @@ const AfterSalesSupport: React.FC = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ // 导出
|
|
|
+ const onExport = () => {
|
|
|
+ form.validateFields().then((data) => {
|
|
|
+ queryExport(data)
|
|
|
+ .then((res: any) => {
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.style.display = 'none';
|
|
|
+ link.href = window.URL.createObjectURL(new Blob([res]));
|
|
|
+ link.setAttribute('download', '售后支持列表.xlsx');
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ message.error('导出失败');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
const columns: ColumnsType<DataType> = [
|
|
|
{
|
|
|
title: '序号',
|
|
@@ -185,6 +205,10 @@ const AfterSalesSupport: React.FC = () => {
|
|
|
<ReloadOutlined />
|
|
|
重置
|
|
|
</Button>
|
|
|
+ <Button type="dashed" onClick={onExport}>
|
|
|
+ <DownloadOutlined />
|
|
|
+ 导出
|
|
|
+ </Button>
|
|
|
</Space>
|
|
|
</Form.Item>
|
|
|
</Form>
|