张延森 4 年前
父节点
当前提交
f50a1aea53
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 9
    1
      src/pages/customer/personlist/index.jsx
  2. 5
    0
      src/services/apis.js

+ 9
- 1
src/pages/customer/personlist/index.jsx 查看文件

@@ -2,9 +2,11 @@ import React, { useState, useEffect } from 'react'
2 2
 import { Select, Spin, Table, Button, Form, Input, Divider, Modal,Popconfirm } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetch, apis, fetchList } from '@/utils/request'
5
+import { exportExcel } from '@/utils/utils'
5 6
 import IntegralRecord from '../customerlist/components/integralRecord'
6 7
 
7 8
 const getPersonList = fetchList(apis.person.getPersonList)
9
+const exportPersonList = fetch(apis.person.export)
8 10
 
9 11
 const Condition = Form.create()(props => {
10 12
   const handleSubmit = e => {
@@ -81,6 +83,12 @@ export default props => {
81 83
     })
82 84
   }
83 85
 
86
+  const handleExport = () => {
87
+    exportPersonList({params: queryParams}).then(res => {
88
+      exportExcel(res, '会员列表')
89
+    })
90
+  }
91
+
84 92
   useEffect(() => {
85 93
     setLoading(true)
86 94
     getPersonList(queryParams).then(res => {
@@ -94,7 +102,7 @@ export default props => {
94 102
   return (
95 103
     <div>
96 104
       <Condition onSearch={handleSearch} onReset={handleSearch} />
97
-      <div style={{margin: '24px 0'}}> </div>
105
+      <div style={{margin: '24px 0'}}><Button type="" onClick={handleExport}>导出</Button></div>
98 106
       <Table dataSource={listData} loading={loading} pagination={{...pagination, onChange: handlePageChange}} rowKey="personId">
99 107
         <Table.Column
100 108
           title="头像"

+ 5
- 0
src/services/apis.js 查看文件

@@ -58,6 +58,11 @@ export default {
58 58
       url: `${prefix}/person-list`,
59 59
       method: 'GET',
60 60
       action: 'admin.person.list',
61
+    },
62
+    export: {
63
+      url: `${prefix}/person-list/export`,
64
+      method: 'GET',
65
+      action: 'admin.person.export',
61 66
     }
62 67
   },
63 68
   image: {