ソースを参照

客户 导出数据

魏熙美 5 年 前
コミット
4113626e8a

+ 27
- 1
src/pages/customer/customerlist/index.jsx ファイルの表示

@@ -24,7 +24,7 @@ const { Meta } = Card;
24 24
  * @returns
25 25
  */
26 26
 function body(props) {
27
-  const { getFieldDecorator } = props.form
27
+  const { getFieldDecorator, getFieldsValue } = props.form
28 28
 
29 29
   // eslint-disable-next-line react-hooks/rules-of-hooks
30 30
   const [dataSource, setDataSource] = useState({ records: [] })
@@ -145,6 +145,29 @@ function body(props) {
145 145
     });
146 146
   }
147 147
 
148
+  function exportCustomer () {
149
+    const fieldsValue = getFieldsValue()
150
+    request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
151
+      .then(response => {
152
+        download(response)
153
+      }).catch(error => {
154
+
155
+      })
156
+  }
157
+
158
+  function download (data) {
159
+    if (!data) {
160
+      return
161
+    }
162
+    const url = window.URL.createObjectURL(new Blob([data]))
163
+    const link = document.createElement('a')
164
+    link.style.display = 'none'
165
+    link.href = url
166
+    link.setAttribute('download', '客户列表.xlsx')
167
+    document.body.append(link)
168
+    link.click()
169
+  }
170
+
148 171
   const columns = [
149 172
     {
150 173
       title: '头像',
@@ -289,6 +312,9 @@ function body(props) {
289 312
             </Button>
290 313
         </Form.Item>
291 314
       </Form>
315
+      <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
316
+        导出
317
+      </Button>
292 318
 
293 319
       <div style={{ margin: '20px 0'}}>
294 320
         <AuthButton name="admin.customer.recommend.get" noRight={null}>

+ 2
- 2
src/pages/customer/independentList/index.jsx ファイルの表示

@@ -442,10 +442,10 @@ function body (props) {
442 442
           </Button>
443 443
           <Button style={{ marginLeft: 8 }} onClick={handleReset}>
444 444
             重置
445
-            </Button>
445
+          </Button>
446 446
         </Form.Item>
447 447
       </Form>
448
-      <Button type="primary" onClick={() => exportIndependen()} style={{ float: 'right', margin: '20px 0' }}>
448
+      <Button type="primary" onClick={() => exportIndependen()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
449 449
         导出
450 450
       </Button>
451 451
       <Table rowKey="independentIndex" dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />

+ 3
- 2
src/pages/customer/recommendCustomer/index.jsx ファイルの表示

@@ -147,7 +147,7 @@ function body(props) {
147 147
       title: '推荐人',
148 148
       dataIndex: 'consultantName',
149 149
       key: 'consultantName',
150
-      render: (_, record) => <><span>{ record.recommendName + " " + record.recommendTel }</span></>,
150
+      render: (_, record) => <><span>{ (record.recommendName !== null ? record.recommendName : '') + " " + (record.recommendTel !== null ? record.recommendTel : '') }</span></>,
151 151
     },
152 152
     {
153 153
       title: '推荐时间',
@@ -224,7 +224,8 @@ function body(props) {
224 224
             </Button>
225 225
         </Form.Item>
226 226
       </Form>
227
-      <Button type="primary" onClick={() => exportRecommendCustomer()} style={{float:'right',margin:'20px 0'}}>
227
+      {/* style={{float:'right',margin:'20px 0'}} */}
228
+      <Button type="primary" onClick={() => exportRecommendCustomer()}>
228 229
         导出
229 230
       </Button>
230 231
       <Table rowKey="recommendCustomer" dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />

+ 1
- 1
src/pages/customer/report/index.jsx ファイルの表示

@@ -197,7 +197,7 @@ function body(props) {
197 197
         <div >
198 198
         </div>
199 199
       </Form>
200
-      <Button type="primary" onClick={() => exportReport()} style={{ float: 'right', margin: '20px 0' }}>
200
+      <Button type="primary" onClick={() => exportReport()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
201 201
         导出
202 202
       </Button>
203 203
       <Table rowKey="report" style={{ marginTop: '40px' }} dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />

+ 5
- 0
src/services/apis.js ファイルの表示

@@ -266,6 +266,11 @@ export default {
266 266
       url: `${prefix}/customer/recommend/agents/export`,
267 267
       action: 'admin.customer.recommend.agents.export.get',
268 268
     },
269
+    customerRecommendExport: { // 导出数据(客户列表)
270
+      method: 'GET',
271
+      url: `${prefix}/customer/recommend/export`,
272
+      action: 'admin.customer.recommend.export.get',
273
+    },
269 274
   },
270 275
   indexEcharts: {
271 276
     list:{