张延森 il y a 4 ans
Parent
révision
f50a1aea53
2 fichiers modifiés avec 14 ajouts et 1 suppressions
  1. 9
    1
      src/pages/customer/personlist/index.jsx
  2. 5
    0
      src/services/apis.js

+ 9
- 1
src/pages/customer/personlist/index.jsx Voir le fichier

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

+ 5
- 0
src/services/apis.js Voir le fichier

58
       url: `${prefix}/person-list`,
58
       url: `${prefix}/person-list`,
59
       method: 'GET',
59
       method: 'GET',
60
       action: 'admin.person.list',
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
   image: {
68
   image: {