|
@@ -0,0 +1,223 @@
|
|
1
|
+import React, { Component, useState, useEffect } from 'react';
|
|
2
|
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions } from 'antd';
|
|
3
|
+import moment from 'moment';
|
|
4
|
+import style from './compenents/style.less';
|
|
5
|
+import request from '../../../utils/request';
|
|
6
|
+import apis from '../../../services/apis';
|
|
7
|
+import router from 'umi/router';
|
|
8
|
+import AuthButton from '@/components/AuthButton';
|
|
9
|
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
|
|
10
|
+import WxDictSelect from '@/components/SelectButton/WxDictSelect';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+const { RangePicker } = DatePicker;
|
|
14
|
+const { Option } = Select
|
|
15
|
+
|
|
16
|
+const formItemLayout = {
|
|
17
|
+ labelCol: { span: 10},
|
|
18
|
+ wrapperCol: { span: 14 },
|
|
19
|
+ };
|
|
20
|
+
|
|
21
|
+let daterange = []
|
|
22
|
+let tableTitle = ['类型']
|
|
23
|
+
|
|
24
|
+let columns = [
|
|
25
|
+ {
|
|
26
|
+ title: '姓名',
|
|
27
|
+ dataIndex: 'nickName',
|
|
28
|
+ key: 'nickName',
|
|
29
|
+ },
|
|
30
|
+ {
|
|
31
|
+ title: '电话',
|
|
32
|
+ dataIndex: 'phone',
|
|
33
|
+ key: 'phone',
|
|
34
|
+ },
|
|
35
|
+ {
|
|
36
|
+ title: '性别',
|
|
37
|
+ dataIndex: 'gender',
|
|
38
|
+ key: 'gender',
|
|
39
|
+ },
|
|
40
|
+ {
|
|
41
|
+ title: '归属地',
|
|
42
|
+ dataIndex: 'province',
|
|
43
|
+ key: 'province',
|
|
44
|
+ },
|
|
45
|
+ {
|
|
46
|
+ title: '来源渠道',
|
|
47
|
+ dataIndex: 'personFrom',
|
|
48
|
+ key: 'personFrom',
|
|
49
|
+ },
|
|
50
|
+ {
|
|
51
|
+ title: '置业顾问',
|
|
52
|
+ dataIndex: 'realtyConsultant',
|
|
53
|
+ key: 'realtyConsultant',
|
|
54
|
+ },
|
|
55
|
+ {
|
|
56
|
+ title: '置业顾问电话',
|
|
57
|
+ dataIndex: 'realtyConsultantPhone',
|
|
58
|
+ key: 'realtyConsultantPhone',
|
|
59
|
+ },
|
|
60
|
+ {
|
|
61
|
+ title: '分享者',
|
|
62
|
+ dataIndex: 'sharePersonName',
|
|
63
|
+ key: 'sharePersonName',
|
|
64
|
+ },
|
|
65
|
+ {
|
|
66
|
+ title: '分享者电话',
|
|
67
|
+ dataIndex: 'sharePersonPhone',
|
|
68
|
+ key: 'sharePersonPhone',
|
|
69
|
+ },
|
|
70
|
+ {
|
|
71
|
+ title: '访问次数',
|
|
72
|
+ dataIndex: 'visitNum',
|
|
73
|
+ key: 'visitNum',
|
|
74
|
+ },
|
|
75
|
+]
|
|
76
|
+
|
|
77
|
+class SharePersonNum extends React.Component {
|
|
78
|
+
|
|
79
|
+ constructor(props) {
|
|
80
|
+ super(props)
|
|
81
|
+ let startDate;
|
|
82
|
+ let endDate;
|
|
83
|
+ if (props.location.query.queryDate){
|
|
84
|
+ startDate = moment(props.location.query.queryDate).hours(0).minutes(0).seconds(0).milliseconds(0).toDate();
|
|
85
|
+ endDate = moment(props.location.query.queryDate).hours(23).minutes(59).seconds(59).milliseconds(999).toDate();
|
|
86
|
+ }else{
|
|
87
|
+ startDate = moment(props.location.query.startDate).hours(0).minutes(0).seconds(0).milliseconds(0).toDate();
|
|
88
|
+ endDate = moment(props.location.query.endDate).hours(23).minutes(59).seconds(59).milliseconds(999).toDate();
|
|
89
|
+ }
|
|
90
|
+ console.log(startDate)
|
|
91
|
+ this.state = {
|
|
92
|
+ formData: {
|
|
93
|
+ personFrom: '',
|
|
94
|
+ pageNum:'',
|
|
95
|
+ pageSize:'',
|
|
96
|
+ startDate: startDate,
|
|
97
|
+ endDate: endDate,
|
|
98
|
+ province:'',
|
|
99
|
+ realtyConsultant:'',
|
|
100
|
+ realtyConsultantPhone:'',
|
|
101
|
+ activityId: props.location.query.activityId,
|
|
102
|
+ activityType:props.location.query.activityType
|
|
103
|
+ },
|
|
104
|
+ personData: [],
|
|
105
|
+ dataSoures: [],
|
|
106
|
+ tableData: [],
|
|
107
|
+ userType: 'all',
|
|
108
|
+ buildingId: [],
|
|
109
|
+ targetType: []
|
|
110
|
+ }
|
|
111
|
+ }
|
|
112
|
+
|
|
113
|
+ componentDidMount() {
|
|
114
|
+ this.getTableList()
|
|
115
|
+ }
|
|
116
|
+
|
|
117
|
+ getTableList () {
|
|
118
|
+ const { formData } = this.state
|
|
119
|
+ console.log(formData)
|
|
120
|
+ request({ ...apis.activityDataStatis.activityVisitPersonNum, params: formData }).then(data => {
|
|
121
|
+ console.log(data)
|
|
122
|
+ this.setState({ tableData: data.records, total: data.total})
|
|
123
|
+ }).catch()
|
|
124
|
+ }
|
|
125
|
+
|
|
126
|
+ handleSubmit = (e, props) => {
|
|
127
|
+ let startDate = null
|
|
128
|
+ let endDate = null
|
|
129
|
+ const province = this.props.form.getFieldValue("province");
|
|
130
|
+ const personFrom = this.props.form.getFieldValue("personFrom");
|
|
131
|
+ const realtyConsultant = this.props.form.getFieldValue("realtyConsultant");
|
|
132
|
+ const realtyConsultantPhone = this.props.form.getFieldValue("realtyConsultantPhone");
|
|
133
|
+
|
|
134
|
+ const { formData } = this.state
|
|
135
|
+ this.setState({
|
|
136
|
+ formData: {
|
|
137
|
+ ...formData,
|
|
138
|
+ personFrom: personFrom,
|
|
139
|
+ province: province,
|
|
140
|
+ realtyConsultant: realtyConsultant,
|
|
141
|
+ realtyConsultantPhone: realtyConsultantPhone
|
|
142
|
+ }
|
|
143
|
+ }, this.getTableList)
|
|
144
|
+ }
|
|
145
|
+
|
|
146
|
+ //重置搜索
|
|
147
|
+ handleReset = e => {
|
|
148
|
+ this.props.form.resetFields()
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ exportActivityStats = () => {
|
|
152
|
+ const { formData } = this.state
|
|
153
|
+ request({ ...apis.activityDataStatis.activityVisitPersonNumExport, params: formData }).then(data => {
|
|
154
|
+ if (!data) {
|
|
155
|
+ return
|
|
156
|
+ }
|
|
157
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
158
|
+ const link = document.createElement('a')
|
|
159
|
+ link.style.display = 'none'
|
|
160
|
+ link.href = url
|
|
161
|
+ link.setAttribute('download', '访问统计.xlsx')
|
|
162
|
+ document.body.append(link)
|
|
163
|
+ link.click()
|
|
164
|
+ }).catch()
|
|
165
|
+ }
|
|
166
|
+
|
|
167
|
+ //排序
|
|
168
|
+ handleTableChange = (pagination, filters, sorter) => {
|
|
169
|
+ console.log(pagination, filters, sorter)
|
|
170
|
+ const { formData } = this.state
|
|
171
|
+ this.setState({
|
|
172
|
+ formData: {
|
|
173
|
+ ...formData,
|
|
174
|
+ personFrom: formData.personFrom,
|
|
175
|
+ pageNum: pagination.current,
|
|
176
|
+ pageSize: pagination.pageSize
|
|
177
|
+ }
|
|
178
|
+ }, this.getTableList)
|
|
179
|
+ };
|
|
180
|
+
|
|
181
|
+ render() {
|
|
182
|
+ const { radioVal } = this.state
|
|
183
|
+ const { getFieldDecorator } = this.props.form;
|
|
184
|
+
|
|
185
|
+ return (
|
|
186
|
+ <>
|
|
187
|
+ <Form layout="inline" onSubmit={e => this.handleSubmit(e, this.props)}>
|
|
188
|
+ <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
|
|
189
|
+ {getFieldDecorator('personFrom')(
|
|
190
|
+ <WxDictSelect />,
|
|
191
|
+ )}
|
|
192
|
+ </Form.Item>
|
|
193
|
+ <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
|
|
194
|
+ {getFieldDecorator('province')(<Input placeholder="请输入归属地"/>)}
|
|
195
|
+ </Form.Item>
|
|
196
|
+ <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
|
|
197
|
+ {getFieldDecorator('realtyConsultant')(<Input placeholder="置业顾问"/>)}
|
|
198
|
+ </Form.Item>
|
|
199
|
+ <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
|
|
200
|
+ {getFieldDecorator('realtyConsultantPhone')(<Input placeholder="置业顾问电话"/>)}
|
|
201
|
+ </Form.Item>
|
|
202
|
+ <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
|
|
203
|
+ <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
|
|
204
|
+ 查询
|
|
205
|
+ </Button>
|
|
206
|
+ <Button onClick={e => this.handleReset()} style={{ marginLeft: '30px' }}>重置</Button>
|
|
207
|
+ </Form.Item>
|
|
208
|
+ </Form>
|
|
209
|
+ <div>
|
|
210
|
+ <AuthButton name="admin.customer.import" noRight={null}>
|
|
211
|
+ <Button type="primary" style={{ float: 'right', margin: '20px 0', zIndex: 1 }} onClick={this.exportActivityStats}>
|
|
212
|
+ 导出
|
|
213
|
+ </Button>
|
|
214
|
+ </AuthButton>
|
|
215
|
+ <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total}} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
|
|
216
|
+ </div>
|
|
217
|
+ </>
|
|
218
|
+ )
|
|
219
|
+
|
|
220
|
+ }
|
|
221
|
+}
|
|
222
|
+const WrappedTypeForm = Form.create()(SharePersonNum);
|
|
223
|
+export default WrappedTypeForm
|