zlisen пре 3 година
родитељ
комит
d72f891e6c

+ 50
- 19
config/routes.js Прегледај датотеку

@@ -378,7 +378,7 @@ export default [
378 378
               //   hideInMenu: true,
379 379
               //   component: './channel/InviteClients',
380 380
               // },
381
-               {
381
+              {
382 382
                 path: '/channel/independentList',
383 383
                 name: '经纪人',
384 384
                 component: './channel/independentList/index',
@@ -540,10 +540,9 @@ export default [
540 540
                 component: './carouselFigure/editAdvertising',
541 541
                 menuCode: '/carouselFigure/editAdvertising',
542 542
               },
543
-             
544 543
             ],
545 544
           },
546
-         
545
+
547 546
           {
548 547
             path: '/system',
549 548
             name: '系统管理',
@@ -607,52 +606,84 @@ export default [
607 606
             path: '/statistics',
608 607
             name: '数据统计',
609 608
             component: '../layouts/BlankLayout',
610
-            menuCode: '/statistics',
609
+            menuCode: '/building',
611 610
             // hideInMenu: true,
612 611
             routes: [
613 612
               {
614 613
                 path: '/statistics/dataReport',
615 614
                 name: '数据报表',
616 615
                 component: './statistics/dataReport',
617
-                menuCode: '/statistics/dataReport',
616
+                menuCode: '/building/list',
618 617
               },
619 618
               {
620 619
                 path: '/statistics/dataReport/newAdd',
621 620
                 name: '新增用户',
622 621
                 hideInMenu: true,
623 622
                 component: './statistics/dataReport/newAdd',
624
-                menuCode: '/statistics/dataReport',
623
+                menuCode: '/building/list',
625 624
               },
626 625
               {
627 626
                 path: '/statistics/activity',
628 627
                 name: '活动统计',
629 628
                 component: './statistics/activity',
630
-                menuCode: '/statistics/activity',
629
+                menuCode: '/building/list',
630
+              },
631
+              {
632
+                path: '/statistics/activity/sharePersonNum',
633
+                name: '分享人数',
634
+                hideInMenu: true,
635
+                component: './statistics/activity/sharePersonNum',
636
+                menuCode: '/building/list',
637
+              },
638
+              {
639
+                path: '/statistics/activity/shareNum',
640
+                name: '分享次数',
641
+                hideInMenu: true,
642
+                component: './statistics/activity/shareNum',
643
+                menuCode: '/building/list',
644
+              },
645
+              {
646
+                path: '/statistics/activity/visitPersonNum',
647
+                name: '访问人数',
648
+                hideInMenu: true,
649
+                component: './statistics/activity/visitPersonNum',
650
+                menuCode: '/building/list',
651
+              },
652
+              {
653
+                path: '/statistics/activity/visitNum',
654
+                name: '访问次数',
655
+                hideInMenu: true,
656
+                component: './statistics/activity/visitNum',
657
+                menuCode: '/building/list',
658
+              },
659
+              {
660
+                path: '/statistics/activity/addRegistNum',
661
+                name: '新增注册用户',
662
+                hideInMenu: true,
663
+                component: './statistics/activity/addRegistNum',
664
+                menuCode: '/building/list',
631 665
               },
632
-              // {
633
-              //   path: '/statistics/activity/sharePersonNum',
634
-              //   name: '活动统计',
635
-              //   component: './statistics/activity/sharePersonNum',
636
-              //   menuCode: '/statistics/activity',
637
-              // },
638
-
639 666
               
640
-
641
-
642 667
               {
643 668
                 path: '/statistics/building',
644 669
                 name: '项目统计',
645 670
                 component: './statistics/building',
646
-                menuCode: '/statistics/activity',
671
+                menuCode: '/building/list',
672
+              },
673
+              {
674
+                path: '/statistics/building/detail',
675
+                name: '项目统计',
676
+                hideInMenu: true,
677
+                component: './statistics/building/detail',
678
+                menuCode: '/building/list',
647 679
               },
648 680
 
649 681
               {
650 682
                 path: '/statistics/consultant',
651 683
                 name: 'KPI',
652 684
                 component: './statistics/consultant',
653
-                menuCode: '/statistics/activity',
685
+                menuCode: '/building/list',
654 686
               },
655
-              
656 687
             ],
657 688
           },
658 689
           {

+ 3
- 4
src/pages/statistics/activity/activityOverview/index.jsx Прегледај датотеку

@@ -77,10 +77,9 @@ const activityOverView = props => {
77 77
         <Form.Item>
78 78
           {getFieldDecorator('targetType')(
79 79
             <Select placeholder="活动类型" allowClear style={{ width: 150, marginLeft: '20px' }}>
80
-              <Option value="activity">报名活动</Option>
81
-              <Option value="help">助力活动</Option>
82
-              <Option value="group">拼团活动</Option>
83
-              <Option value="h5">H5活动</Option>
80
+              <Option value="dymic">报名</Option>
81
+              <Option value="look">带看</Option>
82
+              <Option value="house">团房</Option>
84 83
               <Option value="live">直播</Option>
85 84
             </Select>,
86 85
           )}

+ 332
- 0
src/pages/statistics/activity/addRegistNum.jsx Прегледај датотеку

@@ -0,0 +1,332 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import {
3
+  Form,
4
+  Icon,
5
+  Input,
6
+  Button,
7
+  DatePicker,
8
+  Select,
9
+  Card,
10
+  Row,
11
+  Col,
12
+  Pagination,
13
+  Alert,
14
+  Table,
15
+  Avatar,
16
+  Radio,
17
+  Modal,
18
+  Descriptions,
19
+} from 'antd';
20
+import moment from 'moment';
21
+import request from '../../../utils/request';
22
+import apis from '../../../services/apis';
23
+import router from 'umi/router';
24
+import AuthButton from '@/components/AuthButton';
25
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
26
+import WxDictSelect from '@/components/SelectButton/WxDictSelect';
27
+import Prompt from 'umi/prompt';
28
+
29
+const { RangePicker } = DatePicker;
30
+const { Option } = Select;
31
+
32
+const formItemLayout = {
33
+  labelCol: { span: 10 },
34
+  wrapperCol: { span: 14 },
35
+};
36
+
37
+let daterange = [];
38
+let tableTitle = ['类型'];
39
+
40
+let columns = [
41
+  {
42
+    title: '姓名',
43
+    dataIndex: 'nickName',
44
+    key: 'nickName',
45
+  },
46
+  {
47
+    title: '电话',
48
+    dataIndex: 'phone',
49
+    key: 'phone',
50
+  },
51
+  {
52
+    title: '性别',
53
+    dataIndex: 'gender',
54
+    key: 'gender',
55
+  },
56
+  {
57
+    title: '归属地',
58
+    dataIndex: 'province',
59
+    key: 'province',
60
+  },
61
+  {
62
+    title: '来源渠道',
63
+    dataIndex: 'personFrom',
64
+    key: 'personFrom',
65
+  },
66
+  {
67
+    title: '置业顾问',
68
+    dataIndex: 'realtyConsultant',
69
+    key: 'realtyConsultant',
70
+  },
71
+  {
72
+    title: '置业顾问电话',
73
+    dataIndex: 'realtyConsultantPhone',
74
+    key: 'realtyConsultantPhone',
75
+  },
76
+  {
77
+    title: '分享者',
78
+    dataIndex: 'sharePersonName',
79
+    key: 'sharePersonName',
80
+  },
81
+  {
82
+    title: '分享者电话',
83
+    dataIndex: 'sharePersonPhone',
84
+    key: 'sharePersonPhone',
85
+  },
86
+];
87
+
88
+class SharePersonNum extends React.Component {
89
+  constructor(props) {
90
+    super(props);
91
+    let startDate;
92
+    let endDate;
93
+    if (props.location.query.queryDate) {
94
+      startDate =
95
+        moment(props.location.query.queryDate)
96
+          .hours(0)
97
+          .minutes(0)
98
+          .seconds(0)
99
+          .milliseconds(0)
100
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
101
+      endDate =
102
+        moment(props.location.query.queryDate)
103
+          .hours(23)
104
+          .minutes(59)
105
+          .seconds(59)
106
+          .milliseconds(999)
107
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
108
+    } else {
109
+      startDate =
110
+        moment(props.location.query.startDate)
111
+          .hours(0)
112
+          .minutes(0)
113
+          .seconds(0)
114
+          .milliseconds(0)
115
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
116
+      endDate =
117
+        moment(props.location.query.endDate)
118
+          .hours(23)
119
+          .minutes(59)
120
+          .seconds(59)
121
+          .milliseconds(999)
122
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
123
+    }
124
+    console.log(startDate);
125
+    this.state = {
126
+      formData: {
127
+        personFrom: '',
128
+        province: '',
129
+        pageNum: '',
130
+        pageSize: '',
131
+        startDate: startDate,
132
+        endDate: endDate,
133
+        activityId: props.location.query.activityId,
134
+        activityType: props.location.query.activityType,
135
+        buildingId: props.location.query.buildingId,
136
+      },
137
+      personData: [],
138
+      dataSoures: [],
139
+      tableData: [],
140
+      userType: 'all',
141
+      activityName: props.location.query.activityName,
142
+    };
143
+  }
144
+
145
+  componentDidMount() {
146
+    this.getTableList();
147
+  }
148
+
149
+  getTableList() {
150
+    const { formData } = this.state;
151
+    console.log(formData);
152
+    request({ ...apis.activityDataStatis.activityAddRegist, params: formData })
153
+      .then(data => {
154
+        console.log(data);
155
+        this.setState({ tableData: data.records, total: data.total });
156
+      })
157
+      .catch();
158
+  }
159
+
160
+  handleSubmit = (e, props) => {
161
+    let startDate = null;
162
+    let endDate = null;
163
+    const personFrom = this.props.form.getFieldValue('personFrom');
164
+    const province = this.props.form.getFieldValue('province');
165
+    const { formData } = this.state;
166
+    this.setState(
167
+      {
168
+        formData: {
169
+          ...formData,
170
+          personFrom: personFrom,
171
+          province: province,
172
+          pageNum: 1,
173
+          pageSize: 999,
174
+        },
175
+      },
176
+      this.getTableList,
177
+    );
178
+  };
179
+
180
+  //重置搜索
181
+  handleReset = e => {
182
+    this.props.form.resetFields();
183
+    let startDate;
184
+    let endDate;
185
+    if (this.props.location.query.queryDate) {
186
+      startDate =
187
+        moment(this.props.location.query.queryDate)
188
+          .hours(0)
189
+          .minutes(0)
190
+          .seconds(0)
191
+          .milliseconds(0)
192
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
193
+      endDate =
194
+        moment(this.props.location.query.queryDate)
195
+          .hours(23)
196
+          .minutes(59)
197
+          .seconds(59)
198
+          .milliseconds(999)
199
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
200
+    } else {
201
+      startDate =
202
+        moment(this.props.location.query.startDate)
203
+          .hours(0)
204
+          .minutes(0)
205
+          .seconds(0)
206
+          .milliseconds(0)
207
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
208
+      endDate =
209
+        moment(this.props.location.query.endDate)
210
+          .hours(23)
211
+          .minutes(59)
212
+          .seconds(59)
213
+          .milliseconds(999)
214
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
215
+    }
216
+    this.setState(
217
+      {
218
+        formData: {
219
+          personFrom: '',
220
+          province: '',
221
+          pageNum: '',
222
+          pageSize: '',
223
+          startDate: startDate,
224
+          endDate: endDate,
225
+          activityId: this.props.location.query.activityId,
226
+          activityType: this.props.location.query.activityType,
227
+          buildingId: this.props.location.query.buildingId,
228
+        },
229
+        personData: [],
230
+        dataSoures: [],
231
+        tableData: [],
232
+        userType: 'all',
233
+        activityName: this.props.location.query.activityName,
234
+      },
235
+      this.getTableList,
236
+    );
237
+  };
238
+
239
+  goback = () => {
240
+    router.go(-1);
241
+  };
242
+
243
+  exportActivityStats = () => {
244
+    const { formData } = this.state;
245
+    request({ ...apis.activityDataStatis.activityAddRegistNumExport, params: formData })
246
+      .then(data => {
247
+        if (!data) {
248
+          return;
249
+        }
250
+        const url = window.URL.createObjectURL(new Blob([data]));
251
+        const link = document.createElement('a');
252
+        link.style.display = 'none';
253
+        link.href = url;
254
+        link.setAttribute('download', '分享统计.xlsx');
255
+        document.body.append(link);
256
+        link.click();
257
+      })
258
+      .catch();
259
+  };
260
+
261
+  //排序
262
+  handleTableChange = (pagination, filters, sorter) => {
263
+    console.log(pagination, filters, sorter);
264
+    const { formData } = this.state;
265
+    this.setState(
266
+      {
267
+        formData: {
268
+          ...formData,
269
+          personFrom: formData.personFrom,
270
+          pageNum: pagination.current,
271
+          pageSize: pagination.pageSize,
272
+        },
273
+      },
274
+      this.getTableList,
275
+    );
276
+  };
277
+
278
+  render() {
279
+    const { radioVal } = this.state;
280
+    const { getFieldDecorator } = this.props.form;
281
+
282
+    return (
283
+      <Card>
284
+        <div align="right" style={{ marginBottom: '16px' }}>
285
+          <Button onClick={this.goback}>返回</Button>
286
+        </div>
287
+        {this.state.activityName && (
288
+          <div>
289
+            <span style={{ marginLeft: '20px' }}>分享内容:{this.state.activityName}</span>
290
+          </div>
291
+        )}
292
+        <Form layout="inline" onSubmit={e => this.handleSubmit(e, this.props)}>
293
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
294
+            {getFieldDecorator('province')(<Input placeholder="请输入归属地" />)}
295
+          </Form.Item>
296
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
297
+            {getFieldDecorator('personFrom')(<WxDictSelect />)}
298
+          </Form.Item>
299
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
300
+            <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
301
+              搜索
302
+            </Button>
303
+            <Button onClick={e => this.handleReset()} style={{ marginLeft: '30px' }}>
304
+              重置
305
+            </Button>
306
+          </Form.Item>
307
+        </Form>
308
+        <div>
309
+          <AuthButton name="admin.statistical.activity.export" noRight={null}>
310
+            <Button
311
+              type="primary"
312
+              style={{ float: 'right', margin: '20px 0', zIndex: 1 }}
313
+              onClick={this.exportActivityStats}
314
+            >
315
+              导出
316
+            </Button>
317
+          </AuthButton>
318
+          <Table
319
+            style={{ marginTop: '20px' }}
320
+            dataSource={this.state.tableData}
321
+            columns={columns}
322
+            pagination={{ total: this.state.total }}
323
+            onChange={this.handleTableChange}
324
+            scroll={{ y: 500 }}
325
+          ></Table>
326
+        </div>
327
+      </Card>
328
+    );
329
+  }
330
+}
331
+const WrappedTypeForm = Form.create()(SharePersonNum);
332
+export default WrappedTypeForm;

+ 119
- 72
src/pages/statistics/activity/compents/OverviewDeatil.jsx Прегледај датотеку

@@ -7,84 +7,131 @@ import apis from '../../../../services/apis';
7 7
 import moment from 'moment';
8 8
 import router from 'umi/router';
9 9
 
10
-
11 10
 const NewUsers = props => {
12 11
   const { params } = props;
13 12
   const [data, setData] = useState({ records: [] });
14 13
 
15
-  
16
-const toSharePersonNum = rowData => () => {
17
-  console.log(rowData, 'rowData')
18
-  if(rowData) {
19
-    router.push({
20
-    pathname: '/statistical/activity/byDate/sharePersonNum',
21
-    query: {
22
-      queryDate: rowData.date,
23
-      buildingId: params.buildingId||undefined, 
24
-      activityType: params.activityType||undefined
25
-    },
26
-  });
27
-    return
28
-  }
29
-}
14
+  const toSharePersonNum = rowData => () => {
15
+    if (rowData) {
16
+      router.push({
17
+        pathname: '/statistics/activity/sharePersonNum',
18
+        query: {
19
+          queryDate: rowData.date,
20
+          buildingId: params.buildingId || undefined,
21
+          activityType: params.activityType || undefined,
22
+        },
23
+      });
24
+      return;
25
+    }
26
+  };
30 27
 
31
-const columns = [
32
-  {
33
-    title: '日期',
34
-    dataIndex: 'date',
35
-    key: 'date',
36
-  },
37
-  {
38
-    title: '分享人数',
39
-    dataIndex: 'sharePersonNum',
40
-    key: 'sharePersonNum',
41
-    sorter: true,
42
-    render: (text, record) => (
43
-      <Navigate onClick={toSharePersonNum(record)}>{record.sharePersonNum}</Navigate>
44
-    ),
45
-  },
46
-  {
47
-    title: '分享次数',
48
-    dataIndex: 'shareNum',
49
-    key: 'shareNum',
50
-    sorter: true,
51
-    // render: (text, record) => (
52
-    //   <Navigate onClick={toShareNum(record)}>{record.shareNum}</Navigate>
53
-    //   // <a style={{ color: '#66B3FF' }} onClick={toShareNum(record)}><span>{record.shareNum}</span></a>
54
-    // ),
55
-  },
28
+  const toShareNum = rowData => () => {
29
+    if (rowData) {
30
+      router.push({
31
+        pathname: '/statistics/activity/shareNum',
32
+        query: {
33
+          queryDate: rowData.date,
34
+          buildingId: params.buildingId || undefined,
35
+          activityType: params.activityType || undefined,
36
+        },
37
+      });
38
+      return;
39
+    }
40
+  };
56 41
 
57
-  {
58
-    title: '访问人数',
59
-    dataIndex: 'visitPersonNum',
60
-    key: 'visitPersonNum',
61
-    sorter: true,
62
-    // render: (text, record) => (
63
-    //   <Navigate onClick={toAddVisitPersonNum(record)}>{record.visitPersonNum}</Navigate>
64
-    //   // <a style={{ color: '#66B3FF' }} onClick={toAddVisitPersonNum(record)}><span>{record.visitPersonNum}</span></a>
65
-    // ),
66
-  },
67
-  {
68
-    title: '访问次数',
69
-    dataIndex: 'visitNum',
70
-    key: 'visitNum',
71
-    sorter: true,
72
-    // render: (text, record) => (
73
-    //   <Navigate onClick={toAddVisitNum(record)}>{record.visitNum}</Navigate>
74
-    //   // <a style={{ color: '#66B3FF' }} onClick={toAddVisitNum(record)}><span>{record.visitNum}</span></a>
75
-    // ),
76
-  },
77
-  {
78
-    title: '新增注册用户',
79
-    dataIndex: 'addRegistNum',
80
-    key: 'addRegistNum',
81
-    sorter: true,
82
-    // render: (text, record) => (
83
-    //   <Navigate onClick={toAddRegistNum(record)}>{record.addRegistNum}</Navigate>
84
-    //   // <a style={{ color: '#66B3FF' }} onClick={toAddRegistNum(record)}><span>{record.addRegistNum}</span></a>
85
-    // ),
86
-  },
87
-];
42
+  const toAddVisitPersonNum = rowData => () => {
43
+    if (rowData) {
44
+      router.push({
45
+        pathname: '/statistics/activity/visitPersonNum',
46
+        query: {
47
+          queryDate: rowData.date,
48
+          buildingId: params.buildingId || undefined,
49
+          activityType: params.activityType || undefined,
50
+        },
51
+      });
52
+      return;
53
+    }
54
+  };
55
+
56
+  const toAddVisitNum = rowData => () => {
57
+    if (rowData) {
58
+      router.push({
59
+        pathname: '/statistics/activity/visitNum',
60
+        query: {
61
+          queryDate: rowData.date,
62
+          buildingId: params.buildingId || undefined,
63
+          activityType: params.activityType || undefined,
64
+        },
65
+      });
66
+      return;
67
+    }
68
+  };
69
+
70
+  const toAddRegistNum = rowData => () => {
71
+    if (rowData) {
72
+      router.push({
73
+        pathname: '/statistics/activity/addRegistNum',
74
+        query: {
75
+          queryDate: rowData.date,
76
+          buildingId: params.buildingId || undefined,
77
+          activityType: params.activityType || undefined,
78
+        },
79
+      });
80
+      return;
81
+    }
82
+  };
83
+
84
+  const columns = [
85
+    {
86
+      title: '日期',
87
+      dataIndex: 'date',
88
+      key: 'date',
89
+    },
90
+    {
91
+      title: '分享人数',
92
+      dataIndex: 'sharePersonNum',
93
+      key: 'sharePersonNum',
94
+      sorter: true,
95
+      render: (text, record) => (
96
+        <Navigate onClick={toSharePersonNum(record)}>{record.sharePersonNum}</Navigate>
97
+      ),
98
+    },
99
+    {
100
+      title: '分享次数',
101
+      dataIndex: 'shareNum',
102
+      key: 'shareNum',
103
+      sorter: true,
104
+      render: (text, record) => <Navigate onClick={toShareNum(record)}>{record.shareNum}</Navigate>,
105
+    },
106
+
107
+    {
108
+      title: '访问人数',
109
+      dataIndex: 'visitPersonNum',
110
+      key: 'visitPersonNum',
111
+      sorter: true,
112
+      render: (text, record) => (
113
+        <Navigate onClick={toAddVisitPersonNum(record)}>{record.visitPersonNum}</Navigate>
114
+      ),
115
+    },
116
+    {
117
+      title: '访问次数',
118
+      dataIndex: 'visitNum',
119
+      key: 'visitNum',
120
+      sorter: true,
121
+      render: (text, record) => (
122
+        <Navigate onClick={toAddVisitNum(record)}>{record.visitNum}</Navigate>
123
+      ),
124
+    },
125
+    {
126
+      title: '新增注册用户',
127
+      dataIndex: 'addRegistNum',
128
+      key: 'addRegistNum',
129
+      sorter: true,
130
+      render: (text, record) => (
131
+        <Navigate onClick={toAddRegistNum(record)}>{record.addRegistNum}</Navigate>
132
+      ),
133
+    },
134
+  ];
88 135
 
89 136
   useEffect(() => {
90 137
     getTableList();

+ 5
- 5
src/pages/statistics/activity/compents/activityCount.jsx Прегледај датотеку

@@ -40,7 +40,7 @@ console.log(params,'params')
40 40
         // endDate: getDayEnd(params.endDate),
41 41
       }
42 42
     }).then(res => {
43
-    
43
+    setData(res)
44 44
     }).catch(err => {
45 45
 
46 46
     })
@@ -63,7 +63,7 @@ console.log(params,'params')
63 63
           <Card>
64 64
             <Statistic
65 65
               title="分享总次数"
66
-              value={data.allPersonNum || 0}
66
+              value={data.shareNum || 0}
67 67
               //   valueStyle={{ color: '#3f8600' }}
68 68
             />
69 69
           </Card>
@@ -72,7 +72,7 @@ console.log(params,'params')
72 72
           <Card>
73 73
             <Statistic
74 74
               title="分享总人数"
75
-              value={data.registerPersonNum || 0}
75
+              value={data.sharePersonNum || 0}
76 76
               //   valueStyle={{ color: '#cf1322' }}
77 77
             />
78 78
           </Card>
@@ -81,7 +81,7 @@ console.log(params,'params')
81 81
           <Card>
82 82
             <Statistic
83 83
               title="访问总次数"
84
-              value={data.todayVisitNum || 0}
84
+              value={data.visitNum || 0}
85 85
               //   valueStyle={{ color: '#3f8600' }}
86 86
             />
87 87
           </Card>
@@ -90,7 +90,7 @@ console.log(params,'params')
90 90
           <Card >
91 91
             <Statistic
92 92
               title="访问总人数"
93
-              value={data.todayAddPersonNum || 0}
93
+              value={data.visitPersonNum || 0}
94 94
               //   valueStyle={{ color: '#cf1322' }}
95 95
             />
96 96
           </Card>

+ 359
- 0
src/pages/statistics/activity/shareNum.jsx Прегледај датотеку

@@ -0,0 +1,359 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import {
3
+  Form,
4
+  Icon,
5
+  Input,
6
+  Button,
7
+  DatePicker,
8
+  Select,
9
+  Card,
10
+  Row,
11
+  Col,
12
+  Pagination,
13
+  Alert,
14
+  Table,
15
+  Avatar,
16
+  Radio,
17
+  Modal,
18
+  Descriptions,
19
+} from 'antd';
20
+import moment from 'moment';
21
+import request from '../../../utils/request';
22
+import apis from '../../../services/apis';
23
+import router from 'umi/router';
24
+import AuthButton from '@/components/AuthButton';
25
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
26
+import Prompt from 'umi/prompt';
27
+
28
+const { RangePicker } = DatePicker;
29
+const { Option } = Select;
30
+
31
+const formItemLayout = {
32
+  labelCol: { span: 10 },
33
+  wrapperCol: { span: 14 },
34
+};
35
+
36
+let daterange = [];
37
+let tableTitle = ['类型'];
38
+let queryDate = '';
39
+
40
+let columns = [
41
+  {
42
+    title: '分享者姓名',
43
+    dataIndex: 'sharePersonName',
44
+    key: 'sharePersonName',
45
+  },
46
+  {
47
+    title: '分享者类型',
48
+    dataIndex: 'shareType',
49
+    key: 'shareType',
50
+    render: (text, records) => {
51
+      if (records.sharePersonType === 'drift') {
52
+        return '游客';
53
+      }
54
+      if (records.sharePersonType === 'customer') {
55
+        return '普通客户';
56
+      }
57
+      if (records.sharePersonType === 'Realty Consultant') {
58
+        return '置业顾问';
59
+      }
60
+      if (records.sharePersonType === 'channel agent') {
61
+        return '专业经纪人';
62
+      }
63
+    },
64
+  },
65
+  {
66
+    title: '分享时间',
67
+    dataIndex: 'shareTime',
68
+    key: 'shareTime',
69
+    render: (x, row) => (
70
+      <>
71
+        <span>{`${moment(row.shareTime).format('YYYY-MM-DD HH:mm:ss')}`}</span>
72
+      </>
73
+    ),
74
+  },
75
+  {
76
+    title: '分享者电话',
77
+    dataIndex: 'sharePersonPhone',
78
+    key: 'sharePersonPhone',
79
+  },
80
+  // {
81
+  //   title: '访问人数',
82
+  //   dataIndex: 'visitPersonNum',
83
+  //   key: 'visitPersonNum',
84
+  // },
85
+];
86
+
87
+class SharePersonNum extends React.Component {
88
+  constructor(props) {
89
+    super(props);
90
+    console.log(props);
91
+    queryDate = props.location.query.queryDate;
92
+    let startDate;
93
+    let endDate;
94
+    if (props.location.query.queryDate) {
95
+      startDate =
96
+        moment(props.location.query.queryDate)
97
+          .hours(0)
98
+          .minutes(0)
99
+          .seconds(0)
100
+          .milliseconds(0)
101
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
102
+      endDate =
103
+        moment(props.location.query.queryDate)
104
+          .hours(23)
105
+          .minutes(59)
106
+          .seconds(59)
107
+          .milliseconds(999)
108
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
109
+    } else {
110
+      startDate =
111
+        moment(props.location.query.startDate)
112
+          .hours(0)
113
+          .minutes(0)
114
+          .seconds(0)
115
+          .milliseconds(0)
116
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
117
+      endDate =
118
+        moment(props.location.query.endDate)
119
+          .hours(23)
120
+          .minutes(59)
121
+          .seconds(59)
122
+          .milliseconds(999)
123
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
124
+    }
125
+    this.state = {
126
+      formData: {
127
+        sharePhone: '',
128
+        sharePersonType: '',
129
+        pageNum: '',
130
+        pageSize: '',
131
+        shareName: '',
132
+        sort: null,
133
+        colKey: null,
134
+        startDate: startDate,
135
+        endDate: endDate,
136
+        activityId: props.location.query.activityId,
137
+        activityType: props.location.query.activityType,
138
+        personId: props.location.query.personId,
139
+        buildingId: props.location.query.buildingId,
140
+      },
141
+      personData: [],
142
+      dataSoures: [],
143
+      tableData: [],
144
+      userType: 'all',
145
+      activityName: props.location.query.activityName,
146
+    };
147
+  }
148
+
149
+  componentDidMount() {
150
+    this.getTableList();
151
+  }
152
+
153
+  getTableList() {
154
+    const { formData } = this.state;
155
+    console.log(formData);
156
+    request({ ...apis.activityDataStatis.activityShareNum, params: formData })
157
+      .then(data => {
158
+        console.log(data);
159
+        this.setState({ tableData: data.records, total: data.total });
160
+      })
161
+      .catch();
162
+  }
163
+
164
+  handleSubmit = (e, props) => {
165
+    let startDate = null;
166
+    let endDate = null;
167
+    const sharePersonType = this.props.form.getFieldValue('sharePersonType');
168
+    const sharePersonPhone = this.props.form.getFieldValue('sharePersonPhone');
169
+    const sharePersonName = this.props.form.getFieldValue('sharePersonName');
170
+    const { formData } = this.state;
171
+    this.setState(
172
+      {
173
+        formData: {
174
+          ...formData,
175
+          sharePersonType: sharePersonType,
176
+          sharePersonPhone: sharePersonPhone,
177
+          sharePersonName: sharePersonName,
178
+          pageNum: 1,
179
+          pageSize: 999,
180
+        },
181
+      },
182
+      this.getTableList,
183
+    );
184
+  };
185
+
186
+  //重置搜索
187
+  handleReset = e => {
188
+    this.props.form.resetFields();
189
+    let startDate;
190
+    let endDate;
191
+    if (this.props.location.query.queryDate) {
192
+      startDate =
193
+        moment(this.props.location.query.queryDate)
194
+          .hours(0)
195
+          .minutes(0)
196
+          .seconds(0)
197
+          .milliseconds(0)
198
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
199
+      endDate =
200
+        moment(this.props.location.query.queryDate)
201
+          .hours(23)
202
+          .minutes(59)
203
+          .seconds(59)
204
+          .milliseconds(999)
205
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
206
+    } else {
207
+      startDate =
208
+        moment(this.props.location.query.startDate)
209
+          .hours(0)
210
+          .minutes(0)
211
+          .seconds(0)
212
+          .milliseconds(0)
213
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
214
+      endDate =
215
+        moment(this.props.location.query.endDate)
216
+          .hours(23)
217
+          .minutes(59)
218
+          .seconds(59)
219
+          .milliseconds(999)
220
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
221
+    }
222
+    this.setState(
223
+      {
224
+        formData: {
225
+          sharePhone: '',
226
+          sharePersonType: '',
227
+          pageNum: '',
228
+          pageSize: '',
229
+          shareName: '',
230
+          sort: null,
231
+          colKey: null,
232
+          startDate: startDate,
233
+          endDate: endDate,
234
+          activityId: this.props.location.query.activityId,
235
+          activityType: this.props.location.query.activityType,
236
+          personId: this.props.location.query.personId,
237
+          buildingId: this.props.location.query.buildingId,
238
+        },
239
+        personData: [],
240
+        dataSoures: [],
241
+        tableData: [],
242
+        userType: 'all',
243
+        activityName: this.props.location.query.activityName,
244
+      },
245
+      this.getTableList,
246
+    );
247
+  };
248
+
249
+  goback = () => {
250
+    router.go(-1);
251
+  };
252
+
253
+  exportActivityStats = () => {
254
+    const { formData } = this.state;
255
+    request({ ...apis.activityDataStatis.activityShareNumExport, params: formData })
256
+      .then(data => {
257
+        if (!data) {
258
+          return;
259
+        }
260
+        const url = window.URL.createObjectURL(new Blob([data]));
261
+        const link = document.createElement('a');
262
+        link.style.display = 'none';
263
+        link.href = url;
264
+        link.setAttribute('download', '分享统计.xlsx');
265
+        document.body.append(link);
266
+        link.click();
267
+      })
268
+      .catch();
269
+  };
270
+
271
+  //排序
272
+  handleTableChange = (pagination, filters, sorter) => {
273
+    console.log(pagination, filters, sorter);
274
+    const { formData } = this.state;
275
+    this.setState(
276
+      {
277
+        formData: {
278
+          ...formData,
279
+          sharePersonType: formData.sharePersonType,
280
+          sharePhone: formData.sharePhone,
281
+          shareName: formData.shareName,
282
+          pageNum: pagination.current,
283
+          pageSize: pagination.pageSize,
284
+          sort: sorter.order,
285
+          colKey: sorter.columnKey,
286
+        },
287
+      },
288
+      this.getTableList,
289
+    );
290
+  };
291
+
292
+  render() {
293
+    const { getFieldDecorator } = this.props.form;
294
+
295
+    return (
296
+      <Card>
297
+        <div align="right" style={{ marginBottom: '16px' }}>
298
+          <Button onClick={this.goback}>返回</Button>
299
+        </div>
300
+        {this.state.activityName && (
301
+          <div>
302
+            <span style={{ marginLeft: '20px' }}>分享内容:{this.state.activityName}</span>
303
+          </div>
304
+        )}
305
+        <Form
306
+          layout="inline"
307
+          onSubmit={e => this.handleSubmit(e, this.props)}
308
+          style={{ display: 'flex', alignItems: 'center' }}
309
+        >
310
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
311
+            {getFieldDecorator('sharePersonType')(
312
+              <Select placeholder="分享者类型" style={{ width: 150, marginLeft: '20px' }}>
313
+                <Option value="drift">游客</Option>
314
+                <Option value="customer">普通客户</Option>
315
+                <Option value="Realty Consultant">置业顾问</Option>
316
+                <Option value="channel agent">专业经纪人</Option>
317
+              </Select>,
318
+            )}
319
+          </Form.Item>
320
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
321
+            {getFieldDecorator('sharePersonPhone')(<Input placeholder="分享者电话" />)}
322
+          </Form.Item>
323
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
324
+            {getFieldDecorator('sharePersonName')(<Input placeholder="分享者姓名" />)}
325
+          </Form.Item>
326
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
327
+            <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
328
+              搜索
329
+            </Button>
330
+            <Button onClick={e => this.handleReset()} style={{ marginLeft: '30px' }}>
331
+              重置
332
+            </Button>
333
+          </Form.Item>
334
+          <AuthButton name="admin.statistical.activity.export" noRight={null}>
335
+            <Button
336
+              type="primary"
337
+              style={{ position: 'absolute', right: '27px', zIndex: 1 }}
338
+              onClick={this.exportActivityStats}
339
+            >
340
+              导出
341
+            </Button>
342
+          </AuthButton>
343
+        </Form>
344
+        <div>
345
+          <Table
346
+            style={{ marginTop: '20px' }}
347
+            dataSource={this.state.tableData}
348
+            columns={columns}
349
+            pagination={{ total: this.state.total }}
350
+            onChange={this.handleTableChange}
351
+            scroll={{ y: 500 }}
352
+          ></Table>
353
+        </div>
354
+      </Card>
355
+    );
356
+  }
357
+}
358
+const WrappedTypeForm = Form.create()(SharePersonNum);
359
+export default WrappedTypeForm;

+ 344
- 0
src/pages/statistics/activity/sharePersonNum.jsx Прегледај датотеку

@@ -0,0 +1,344 @@
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 request from '@/utils/request';
5
+import apis from '@/services/apis';
6
+import router from 'umi/router';
7
+import AuthButton from '@/components/AuthButton';
8
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
9
+import Navigate from '@/components/Navigate';
10
+
11
+const { RangePicker } = DatePicker;
12
+const { Option } = Select
13
+
14
+const formItemLayout = {
15
+  labelCol: { span: 10 },
16
+  wrapperCol: { span: 14 },
17
+};
18
+
19
+let daterange = []
20
+let tableTitle = ['类型']
21
+
22
+let staticStartDate = ''
23
+let staticEndDate = ''
24
+let queryDate = ''
25
+let activityName = ''
26
+let activityId = ''
27
+let activityType = ''
28
+
29
+const toShareNum = rowData => () => {
30
+  if (rowData) {
31
+    router.push({
32
+      pathname: '/statistics/activity/shareNum',
33
+      query: {
34
+        queryDate: queryDate,
35
+        personId: rowData.personId,
36
+        startDate: staticStartDate,
37
+        endDate: staticEndDate,
38
+        activityName: activityName,
39
+        activityId: activityId,
40
+        activityType: activityType
41
+      },
42
+    });
43
+    return
44
+  }
45
+}
46
+
47
+const toVisitPersonNum = rowData => () => {
48
+  if (rowData) {
49
+    router.push({
50
+      pathname: '/statistical/activity/visitPersonNum',
51
+      query: {
52
+        queryDate: queryDate,
53
+        personId: rowData.personId,
54
+        startDate: staticStartDate,
55
+        endDate: staticEndDate,
56
+        activityName: activityName,
57
+        activityId: activityId,
58
+        activityType: activityType
59
+      },
60
+    });
61
+    return
62
+  }
63
+}
64
+
65
+const toVisitNum = rowData => () => {
66
+  if (rowData) {
67
+    router.push({
68
+      pathname: '/statistical/activity/visitNum',
69
+      query: {
70
+        queryDate: queryDate,
71
+        personId: rowData.personId,
72
+        startDate: staticStartDate,
73
+        endDate: staticEndDate,
74
+        activityName: activityName,
75
+        activityId: activityId,
76
+        activityType: activityType
77
+      },
78
+    });
79
+    return
80
+  }
81
+}
82
+
83
+let columns = [
84
+  {
85
+    title: '分享者姓名',
86
+    dataIndex: 'sharePersonName',
87
+    key: 'sharePersonName',
88
+  },
89
+  {
90
+    title: '分享者类型',
91
+    dataIndex: 'sharePersonType',
92
+    key: 'sharePersonType',
93
+    render: (text, records) => {
94
+      if (records.sharePersonType === 'drift') { return '游客' }
95
+      if (records.sharePersonType === 'customer') { return '普通客户' }
96
+      if (records.sharePersonType === 'Realty Consultant') { return '置业顾问' }
97
+      if (records.sharePersonType === 'channel agent') { return '经纪人' }
98
+    },
99
+  },
100
+  {
101
+    title: '分享者电话',
102
+    dataIndex: 'sharePersonPhone',
103
+    key: 'sharePersonPhone',
104
+  },
105
+  {
106
+    title: '分享次数',
107
+    dataIndex: 'shareNum',
108
+    key: 'shareNum',
109
+    sorter: true,
110
+    render: (text, record) => (
111
+      <Navigate onClick={toShareNum(record)}>{record.shareNum}</Navigate>
112
+      // <a style={{ color: '#66B3FF' }} onClick={toShareNum(record)}><span>{record.shareNum}</span></a>
113
+    ),
114
+  },
115
+  {
116
+    title: '访问人数',
117
+    dataIndex: 'visitPersonNum',
118
+    key: 'visitPersonNum',
119
+    sorter: true,
120
+    render: (text, record) => (
121
+      <Navigate onClick={toVisitPersonNum(record)}>{record.visitPersonNum}</Navigate>
122
+      // <a style={{ color: '#66B3FF' }} onClick={toVisitPersonNum(record)}><span>{record.visitPersonNum}</span></a>
123
+    ),
124
+  },
125
+  {
126
+    title: '访问次数',
127
+    dataIndex: 'visitNum',
128
+    key: 'visitNum',
129
+    sorter: true,
130
+    render: (text, record) => (
131
+      <Navigate onClick={toVisitNum(record)}>{record.visitNum}</Navigate>
132
+      // <a style={{ color: '#66B3FF' }} onClick={toVisitNum(record)}><span>{record.visitNum}</span></a>
133
+    ),
134
+  },
135
+]
136
+
137
+class SharePersonNum extends React.Component {
138
+
139
+  constructor(props) {
140
+    super(props)
141
+    let startDate;
142
+    let endDate;
143
+    queryDate = props.location.query.queryDate
144
+    activityName = props.location.query.activityName
145
+    staticStartDate = props.location.query.startDate;
146
+    staticEndDate = props.location.query.endDate;
147
+    activityId = props.location.query.activityId;
148
+    activityType = props.location.query.activityType;
149
+
150
+    if (props.location.query.queryDate) {
151
+      console.log(queryDate, "props.location.query.queryDateprops.location.query.queryDate")
152
+      startDate = moment(props.location.query.queryDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
153
+      endDate = moment(props.location.query.queryDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
154
+      console.log(startDate, endDate, "endDateendDateendDateendDateendDateendDate")
155
+    } else {
156
+      startDate = moment(props.location.query.startDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
157
+      endDate = moment(props.location.query.endDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
158
+    }
159
+
160
+    console.log(startDate)
161
+    this.state = {
162
+      formData: {
163
+        sharePhone: '',
164
+        sharePersonType: '',
165
+        pageNum: '',
166
+        pageSize: '',
167
+        shareName: '',
168
+        sort: null,
169
+        colKey: null,
170
+        startDate: startDate,
171
+        endDate: endDate,
172
+        activityId: props.location.query.activityId,
173
+        activityType: props.location.query.activityType,
174
+        buildingId: props.location.query.buildingId,
175
+      },
176
+      personData: [],
177
+      dataSoures: [],
178
+      tableData: [],
179
+      userType: 'all',
180
+      activityName: props.location.query.activityName
181
+    }
182
+  }
183
+
184
+  componentDidMount() {
185
+    this.getTableList()
186
+  }
187
+
188
+  getTableList() {
189
+    const { formData } = this.state
190
+    request({ ...apis.activityDataStatis.activitySharePersonNum, params: formData }).then(data => {
191
+      console.log(data)
192
+      this.setState({ tableData: data.records, total: data.total })
193
+    }).catch()
194
+  }
195
+
196
+  handleSubmit = (e, props) => {
197
+    let startDate = null
198
+    let endDate = null
199
+    const sharePersonType = this.props.form.getFieldValue("sharePersonType");
200
+    const sharePersonPhone = this.props.form.getFieldValue("sharePersonPhone");
201
+    const sharePersonName = this.props.form.getFieldValue("sharePersonName");
202
+    const { formData } = this.state
203
+    this.setState({
204
+      formData: {
205
+        ...formData,
206
+        sharePersonType: sharePersonType,
207
+        sharePersonPhone: sharePersonPhone,
208
+        sharePersonName: sharePersonName,
209
+        pageNum: 1,
210
+        pageSize: 999
211
+      }
212
+    }, this.getTableList)
213
+  }
214
+
215
+  //重置搜索
216
+  handleReset = e => {
217
+    this.props.form.resetFields()
218
+    let startDate;
219
+    let endDate;
220
+    queryDate = this.props.location.query.queryDate
221
+    activityName = this.props.location.query.activityName
222
+    staticStartDate = this.props.location.query.startDate;
223
+    staticEndDate = this.props.location.query.endDate;
224
+    activityId = this.props.location.query.activityId;
225
+    activityType = this.props.location.query.activityType;
226
+
227
+    if (this.props.location.query.queryDate) {
228
+      startDate = moment(this.props.location.query.queryDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
229
+      endDate = moment(this.props.location.query.queryDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
230
+    } else {
231
+      startDate = moment(this.props.location.query.startDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
232
+      endDate = moment(this.props.location.query.endDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
233
+    }
234
+    this.setState({
235
+      formData: {
236
+        sharePhone: '',
237
+        sharePersonType: '',
238
+        pageNum: '',
239
+        pageSize: '',
240
+        shareName: '',
241
+        sort: null,
242
+        colKey: null,
243
+        startDate: startDate,
244
+        endDate: endDate,
245
+        activityId: this.props.location.query.activityId,
246
+        activityType: this.props.location.query.activityType,
247
+        buildingId: this.props.location.query.buildingId,
248
+      },
249
+      personData: [],
250
+      dataSoures: [],
251
+      tableData: [],
252
+      userType: 'all',
253
+      activityName: this.props.location.query.activityName
254
+    }, this.getTableList)
255
+  }
256
+
257
+  goback = () => {
258
+    router.go(-1);
259
+  }
260
+
261
+  exportActivityStats = () => {
262
+    const { formData } = this.state
263
+    request({ ...apis.activityDataStatis.activitySharePersonNumExport, params: formData }).then(data => {
264
+      if (!data) {
265
+        return
266
+      }
267
+      const url = window.URL.createObjectURL(new Blob([data]))
268
+      const link = document.createElement('a')
269
+      link.style.display = 'none'
270
+      link.href = url
271
+      link.setAttribute('download', '分享统计.xlsx')
272
+      document.body.append(link)
273
+      link.click()
274
+    }).catch()
275
+  }
276
+
277
+  //排序
278
+  handleTableChange = (pagination, filters, sorter) => {
279
+    console.log(pagination, filters, sorter)
280
+    const { formData } = this.state
281
+    this.setState({
282
+      formData: {
283
+        ...formData,
284
+        sharePersonType: formData.sharePersonType,
285
+        sharePhone: formData.sharePhone,
286
+        shareName: formData.shareName,
287
+        pageNum: pagination.current,
288
+        pageSize: pagination.pageSize,
289
+        sort: sorter.order,
290
+        colKey: sorter.columnKey
291
+      }
292
+    }, this.getTableList)
293
+  };
294
+
295
+  render() {
296
+    const { radioVal } = this.state
297
+    const { getFieldDecorator } = this.props.form;
298
+
299
+    return (
300
+      <Card>
301
+        <div align="right" style={{ marginBottom: '16px' }}><Button onClick={this.goback}>返回</Button></div>
302
+        {this.state.activityName&&<div>
303
+          <span style={{ marginLeft: '20px' }}>分享内容:{this.state.activityName}</span>
304
+        </div>}
305
+        <Form layout="inline" onSubmit={e => this.handleSubmit(e, this.props)}>
306
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
307
+            {getFieldDecorator('sharePersonType')(
308
+              <Select placeholder="分享者类型" style={{ width: 150, marginLeft: '20px' }}>
309
+                <Option value="drift">游客</Option>
310
+                <Option value="customer">普通客户</Option>
311
+                <Option value="Realty Consultant">置业顾问</Option>
312
+                <Option value="channel agent">经纪人</Option>
313
+              </Select>
314
+            )}
315
+          </Form.Item>
316
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
317
+            {getFieldDecorator('sharePersonPhone')(<Input placeholder="分享者电话" />)}
318
+          </Form.Item>
319
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
320
+            {getFieldDecorator('sharePersonName')(<Input placeholder="分享者姓名" />)}
321
+          </Form.Item>
322
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
323
+            <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
324
+              搜索
325
+            </Button>
326
+            <Button onClick={e => this.handleReset()} style={{ marginLeft: '30px' }}>重置</Button>
327
+          </Form.Item>
328
+          <AuthButton name="admin.statistical.activity.export" noRight={null}>
329
+            <Button type="primary" style={{ float: 'right', zIndex: 1, marginTop: '24px' }} onClick={this.exportActivityStats}>
330
+              导出
331
+            </Button>
332
+          </AuthButton>
333
+        </Form>
334
+        <div>
335
+
336
+          <Table style={{ marginTop: '20px' }} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total }} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
337
+        </div>
338
+      </Card>
339
+    )
340
+
341
+  }
342
+}
343
+const WrappedTypeForm = Form.create()(SharePersonNum);
344
+export default WrappedTypeForm

+ 363
- 0
src/pages/statistics/activity/visitNum.jsx Прегледај датотеку

@@ -0,0 +1,363 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import {
3
+  Form,
4
+  Icon,
5
+  Input,
6
+  Button,
7
+  DatePicker,
8
+  Select,
9
+  Card,
10
+  Row,
11
+  Col,
12
+  Pagination,
13
+  Alert,
14
+  Table,
15
+  Avatar,
16
+  Radio,
17
+  Modal,
18
+  Descriptions,
19
+} from 'antd';
20
+import moment from 'moment';
21
+import request from '../../../utils/request';
22
+import apis from '../../../services/apis';
23
+import router from 'umi/router';
24
+import AuthButton from '@/components/AuthButton';
25
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
26
+import WxDictSelect from '@/components/SelectButton/WxDictSelect';
27
+import Prompt from 'umi/prompt';
28
+
29
+const { RangePicker } = DatePicker;
30
+const { Option } = Select;
31
+
32
+const formItemLayout = {
33
+  labelCol: { span: 10 },
34
+  wrapperCol: { span: 14 },
35
+};
36
+
37
+let daterange = [];
38
+let tableTitle = ['类型'];
39
+let queryDate = '';
40
+
41
+let columns = [
42
+  {
43
+    title: '姓名',
44
+    dataIndex: 'nickName',
45
+    key: 'nickName',
46
+  },
47
+  {
48
+    title: '电话',
49
+    dataIndex: 'phone',
50
+    key: 'phone',
51
+  },
52
+  {
53
+    title: '性别',
54
+    dataIndex: 'gender',
55
+    key: 'gender',
56
+  },
57
+  {
58
+    title: '归属地',
59
+    dataIndex: 'province',
60
+    key: 'province',
61
+  },
62
+  {
63
+    title: '来源渠道',
64
+    dataIndex: 'personFrom',
65
+    key: 'personFrom',
66
+  },
67
+  {
68
+    title: '置业顾问',
69
+    dataIndex: 'realtyConsultant',
70
+    key: 'realtyConsultant',
71
+  },
72
+  {
73
+    title: '置业顾问电话',
74
+    dataIndex: 'realtyConsultantPhone',
75
+    key: 'realtyConsultantPhone',
76
+  },
77
+  {
78
+    title: '分享者',
79
+    dataIndex: 'sharePersonName',
80
+    key: 'sharePersonName',
81
+  },
82
+  {
83
+    title: '分享者电话',
84
+    dataIndex: 'sharePersonPhone',
85
+    key: 'sharePersonPhone',
86
+  },
87
+  {
88
+    title: '访问时间',
89
+    dataIndex: 'visitDate',
90
+    key: 'visitDate',
91
+    render: (x, row) => (
92
+      <>
93
+        <span>{`${moment(row.visitDate).format('YYYY-MM-DD HH:mm:ss')}`}</span>
94
+      </>
95
+    ),
96
+  },
97
+];
98
+
99
+class SharePersonNum extends React.Component {
100
+  constructor(props) {
101
+    super(props);
102
+    queryDate = props.location.query.queryDate;
103
+
104
+    let startDate;
105
+    let endDate;
106
+    if (props.location.query.queryDate) {
107
+      startDate =
108
+        moment(props.location.query.queryDate)
109
+          .hours(0)
110
+          .minutes(0)
111
+          .seconds(0)
112
+          .milliseconds(0)
113
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
114
+      endDate =
115
+        moment(props.location.query.queryDate)
116
+          .hours(23)
117
+          .minutes(59)
118
+          .seconds(59)
119
+          .milliseconds(999)
120
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
121
+    } else {
122
+      startDate =
123
+        moment(props.location.query.startDate)
124
+          .hours(0)
125
+          .minutes(0)
126
+          .seconds(0)
127
+          .milliseconds(0)
128
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
129
+      endDate =
130
+        moment(props.location.query.endDate)
131
+          .hours(23)
132
+          .minutes(59)
133
+          .seconds(59)
134
+          .milliseconds(999)
135
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
136
+    }
137
+    console.log(startDate);
138
+    this.state = {
139
+      formData: {
140
+        personFrom: '',
141
+        pageNum: '',
142
+        pageSize: '',
143
+        startDate: startDate,
144
+        endDate: endDate,
145
+        province: '',
146
+        realtyConsultant: '',
147
+        realtyConsultantPhone: '',
148
+        activityId: props.location.query.activityId,
149
+        activityType: props.location.query.activityType,
150
+        personId: props.location.query.personId,
151
+        buildingId: props.location.query.buildingId,
152
+      },
153
+      personData: [],
154
+      dataSoures: [],
155
+      tableData: [],
156
+      userType: 'all',
157
+      activityName: props.location.query.activityName,
158
+    };
159
+  }
160
+
161
+  componentDidMount() {
162
+    this.getTableList();
163
+  }
164
+
165
+  getTableList() {
166
+    const { formData } = this.state;
167
+    console.log(formData);
168
+    request({ ...apis.activityDataStatis.activityVisitNum, params: formData })
169
+      .then(data => {
170
+        console.log(data);
171
+        this.setState({ tableData: data.records, total: data.total });
172
+      })
173
+      .catch();
174
+  }
175
+
176
+  handleSubmit = (e, props) => {
177
+    let startDate = null;
178
+    let endDate = null;
179
+    const province = this.props.form.getFieldValue('province');
180
+    const personFrom = this.props.form.getFieldValue('personFrom');
181
+    const realtyConsultant = this.props.form.getFieldValue('realtyConsultant');
182
+    const realtyConsultantPhone = this.props.form.getFieldValue('realtyConsultantPhone');
183
+
184
+    const { formData } = this.state;
185
+    this.setState(
186
+      {
187
+        formData: {
188
+          ...formData,
189
+          personFrom: personFrom,
190
+          province: province,
191
+          realtyConsultant: realtyConsultant,
192
+          realtyConsultantPhone: realtyConsultantPhone,
193
+          pageNum: 1,
194
+          pageSize: 999,
195
+        },
196
+      },
197
+      this.getTableList,
198
+    );
199
+  };
200
+
201
+  //重置搜索
202
+  handleReset = e => {
203
+    this.props.form.resetFields();
204
+    let startDate;
205
+    let endDate;
206
+    if (this.props.location.query.queryDate) {
207
+      startDate =
208
+        moment(this.props.location.query.queryDate)
209
+          .hours(0)
210
+          .minutes(0)
211
+          .seconds(0)
212
+          .milliseconds(0)
213
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
214
+      endDate =
215
+        moment(this.props.location.query.queryDate)
216
+          .hours(23)
217
+          .minutes(59)
218
+          .seconds(59)
219
+          .milliseconds(999)
220
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
221
+    } else {
222
+      startDate =
223
+        moment(this.props.location.query.startDate)
224
+          .hours(0)
225
+          .minutes(0)
226
+          .seconds(0)
227
+          .milliseconds(0)
228
+          .format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
229
+      endDate =
230
+        moment(this.props.location.query.endDate)
231
+          .hours(23)
232
+          .minutes(59)
233
+          .seconds(59)
234
+          .milliseconds(999)
235
+          .format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
236
+    }
237
+    console.log(startDate);
238
+    this.setState(
239
+      {
240
+        formData: {
241
+          personFrom: '',
242
+          pageNum: '',
243
+          pageSize: '',
244
+          startDate: startDate,
245
+          endDate: endDate,
246
+          province: '',
247
+          realtyConsultant: '',
248
+          realtyConsultantPhone: '',
249
+          activityId: this.props.location.query.activityId,
250
+          activityType: this.props.location.query.activityType,
251
+          personId: this.props.location.query.personId,
252
+          buildingId: this.props.location.query.buildingId,
253
+        },
254
+        personData: [],
255
+        dataSoures: [],
256
+        tableData: [],
257
+        userType: 'all',
258
+        activityName: this.props.location.query.activityName,
259
+      },
260
+      this.getTableList,
261
+    );
262
+  };
263
+
264
+  goback = () => {
265
+    router.go(-1);
266
+  };
267
+
268
+  exportActivityStats = () => {
269
+    const { formData } = this.state;
270
+    request({ ...apis.activityDataStatis.activityVisitNumExport, params: formData })
271
+      .then(data => {
272
+        if (!data) {
273
+          return;
274
+        }
275
+        const url = window.URL.createObjectURL(new Blob([data]));
276
+        const link = document.createElement('a');
277
+        link.style.display = 'none';
278
+        link.href = url;
279
+        link.setAttribute('download', '访问统计.xlsx');
280
+        document.body.append(link);
281
+        link.click();
282
+      })
283
+      .catch();
284
+  };
285
+
286
+  //排序
287
+  handleTableChange = (pagination, filters, sorter) => {
288
+    console.log(pagination, filters, sorter);
289
+    const { formData } = this.state;
290
+    this.setState(
291
+      {
292
+        formData: {
293
+          ...formData,
294
+          personFrom: formData.personFrom,
295
+          pageNum: pagination.current,
296
+          pageSize: pagination.pageSize,
297
+        },
298
+      },
299
+      this.getTableList,
300
+    );
301
+  };
302
+
303
+  render() {
304
+    const { radioVal } = this.state;
305
+    const { getFieldDecorator } = this.props.form;
306
+
307
+    return (
308
+      <Card>
309
+        <div align="right" style={{ marginBottom: '16px' }}>
310
+          <Button onClick={this.goback}>返回</Button>
311
+        </div>
312
+        {this.state.activityName && (
313
+          <div>
314
+            <span style={{ marginLeft: '20px' }}>分享内容:{this.state.activityName}</span>
315
+          </div>
316
+        )}
317
+        <Form layout="inline" onSubmit={e => this.handleSubmit(e, this.props)}>
318
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
319
+            {getFieldDecorator('personFrom')(<WxDictSelect />)}
320
+          </Form.Item>
321
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
322
+            {getFieldDecorator('province')(<Input placeholder="请输入归属地" />)}
323
+          </Form.Item>
324
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
325
+            {getFieldDecorator('realtyConsultant')(<Input placeholder="置业顾问" />)}
326
+          </Form.Item>
327
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
328
+            {getFieldDecorator('realtyConsultantPhone')(<Input placeholder="置业顾问电话" />)}
329
+          </Form.Item>
330
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
331
+            <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
332
+              搜索
333
+            </Button>
334
+            <Button onClick={e => this.handleReset()} style={{ marginLeft: '30px' }}>
335
+              重置
336
+            </Button>
337
+          </Form.Item>
338
+          <AuthButton name="admin.statistical.activity.export" noRight={null}>
339
+            <Button
340
+              type="primary"
341
+              style={{ float: 'right', margin: '20px 0', zIndex: 1 }}
342
+              onClick={this.exportActivityStats}
343
+            >
344
+              导出
345
+            </Button>
346
+          </AuthButton>
347
+        </Form>
348
+        <div>
349
+          <Table
350
+            style={{ marginTop: '20px' }}
351
+            dataSource={this.state.tableData}
352
+            columns={columns}
353
+            pagination={{ total: this.state.total }}
354
+            onChange={this.handleTableChange}
355
+            scroll={{ y: 500 }}
356
+          ></Table>
357
+        </div>
358
+      </Card>
359
+    );
360
+  }
361
+}
362
+const WrappedTypeForm = Form.create()(SharePersonNum);
363
+export default WrappedTypeForm;

+ 264
- 0
src/pages/statistics/activity/visitPersonNum.jsx Прегледај датотеку

@@ -0,0 +1,264 @@
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 request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+import router from 'umi/router';
7
+import AuthButton from '@/components/AuthButton';
8
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
9
+import WxDictSelect from '@/components/SelectButton/WxDictSelect';
10
+import Prompt from 'umi/prompt';
11
+
12
+const { RangePicker } = DatePicker;
13
+const { Option } = Select
14
+
15
+const formItemLayout = {
16
+  labelCol: { span: 10 },
17
+  wrapperCol: { span: 14 },
18
+};
19
+
20
+let daterange = []
21
+let tableTitle = ['类型']
22
+let queryDate = ''
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: 'visitNum',
68
+    key: 'visitNum',
69
+  },
70
+]
71
+
72
+class SharePersonNum extends React.Component {
73
+
74
+  constructor(props) {
75
+    super(props)
76
+    queryDate = props.location.query.queryDate
77
+
78
+    let startDate;
79
+    let endDate;
80
+
81
+    if (props.location.query.queryDate) {
82
+      startDate = moment(props.location.query.queryDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
83
+      endDate = moment(props.location.query.queryDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
84
+    } else {
85
+      startDate = moment(props.location.query.startDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
86
+      endDate = moment(props.location.query.endDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
87
+    }
88
+    console.log(startDate)
89
+    this.state = {
90
+      formData: {
91
+        personFrom: '',
92
+        pageNum: '',
93
+        pageSize: '',
94
+        startDate: startDate,
95
+        endDate: endDate,
96
+        province: '',
97
+        realtyConsultant: '',
98
+        realtyConsultantPhone: '',
99
+        activityId: props.location.query.activityId,
100
+        activityType: props.location.query.activityType,
101
+        personId: props.location.query.personId,
102
+        buildingId: props.location.query.buildingId
103
+      },
104
+      personData: [],
105
+      dataSoures: [],
106
+      tableData: [],
107
+      userType: 'all',
108
+      activityName: props.location.query.activityName
109
+    }
110
+  }
111
+
112
+  componentDidMount() {
113
+    this.getTableList()
114
+  }
115
+
116
+  getTableList() {
117
+    const { formData } = this.state
118
+    console.log(formData)
119
+    request({ ...apis.activityDataStatis.activityVisitPersonNum, params: formData }).then(data => {
120
+      console.log(data)
121
+      this.setState({ tableData: data.records, total: data.total })
122
+    }).catch()
123
+  }
124
+
125
+  handleSubmit = (e, props) => {
126
+    let startDate = null
127
+    let endDate = null
128
+    const province = this.props.form.getFieldValue("province");
129
+    const personFrom = this.props.form.getFieldValue("personFrom");
130
+    const realtyConsultant = this.props.form.getFieldValue("realtyConsultant");
131
+    const realtyConsultantPhone = this.props.form.getFieldValue("realtyConsultantPhone");
132
+
133
+    const { formData } = this.state
134
+    this.setState({
135
+      formData: {
136
+        ...formData,
137
+        personFrom: personFrom,
138
+        province: province,
139
+        realtyConsultant: realtyConsultant,
140
+        realtyConsultantPhone: realtyConsultantPhone,
141
+        pageNum: 1,
142
+        pageSize: 999
143
+      }
144
+    }, this.getTableList)
145
+  }
146
+
147
+  //重置搜索
148
+  handleReset = e => {
149
+    this.props.form.resetFields()
150
+    let startDate;
151
+    let endDate;
152
+
153
+    if (this.props.location.query.queryDate) {
154
+      startDate = moment(this.props.location.query.queryDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
155
+      endDate = moment(this.props.location.query.queryDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
156
+    } else {
157
+      startDate = moment(this.props.location.query.startDate).hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss') + '.000Z';
158
+      endDate = moment(this.props.location.query.endDate).hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss') + '.999Z';
159
+    }
160
+    this.setState({
161
+      formData: {
162
+        personFrom: '',
163
+        pageNum: '',
164
+        pageSize: '',
165
+        startDate: startDate,
166
+        endDate: endDate,
167
+        province: '',
168
+        realtyConsultant: '',
169
+        realtyConsultantPhone: '',
170
+        activityId: this.props.location.query.activityId,
171
+        activityType: this.props.location.query.activityType,
172
+        personId: this.props.location.query.personId,
173
+        buildingId: this.props.location.query.buildingId
174
+      },
175
+      personData: [],
176
+      dataSoures: [],
177
+      tableData: [],
178
+      userType: 'all',
179
+      activityName: this.props.location.query.activityName
180
+    }, this.getTableList)
181
+  }
182
+
183
+  goback = () => {
184
+    router.go(-1);
185
+  }
186
+
187
+  exportActivityStats = () => {
188
+    const { formData } = this.state
189
+    request({ ...apis.activityDataStatis.activityVisitPersonNumExport, params: formData }).then(data => {
190
+      if (!data) {
191
+        return
192
+      }
193
+      const url = window.URL.createObjectURL(new Blob([data]))
194
+      const link = document.createElement('a')
195
+      link.style.display = 'none'
196
+      link.href = url
197
+      link.setAttribute('download', '访问统计.xlsx')
198
+      document.body.append(link)
199
+      link.click()
200
+    }).catch()
201
+  }
202
+
203
+  //排序
204
+  handleTableChange = (pagination, filters, sorter) => {
205
+    console.log(pagination, filters, sorter)
206
+    const { formData } = this.state
207
+    this.setState({
208
+      formData: {
209
+        ...formData,
210
+        personFrom: formData.personFrom,
211
+        pageNum: pagination.current,
212
+        pageSize: pagination.pageSize
213
+      }
214
+    }, this.getTableList)
215
+  };
216
+
217
+  render() {
218
+    const { radioVal } = this.state
219
+    const { getFieldDecorator } = this.props.form;
220
+
221
+    return (
222
+      <Card>
223
+        <div align="right" style={{ marginBottom: '16px' }}><Button onClick={this.goback}>返回</Button></div>
224
+        {this.state.activityName&&<div>
225
+          <span style={{ marginLeft: '20px' }}>分享内容:{this.state.activityName}</span>
226
+        </div>}
227
+        <Form layout="inline" onSubmit={e => this.handleSubmit(e, this.props)}>
228
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
229
+            {getFieldDecorator('personFrom')(
230
+              <WxDictSelect />,
231
+            )}
232
+          </Form.Item>
233
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
234
+            {getFieldDecorator('province')(<Input placeholder="请输入归属地" />)}
235
+          </Form.Item>
236
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
237
+            {getFieldDecorator('realtyConsultant')(<Input placeholder="置业顾问" />)}
238
+          </Form.Item>
239
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
240
+            {getFieldDecorator('realtyConsultantPhone')(<Input placeholder="置业顾问电话" />)}
241
+          </Form.Item>
242
+          <Form.Item style={{ marginTop: '20px', marginBottom: '20px' }}>
243
+            <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
244
+              搜索
245
+            </Button>
246
+            <Button onClick={e => this.handleReset()} style={{ marginLeft: '30px' }}>重置</Button>
247
+          </Form.Item>
248
+          <AuthButton name="admin.statistical.activity.export" noRight={null}>
249
+            <Button type="primary" style={{ float: 'right', margin: '20px 0', zIndex: 1 }} onClick={this.exportActivityStats}>
250
+              导出
251
+            </Button>
252
+          </AuthButton>
253
+        </Form>
254
+        <div>
255
+
256
+          <Table style={{ marginTop: '20px' }} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total }} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
257
+        </div>
258
+      </Card>
259
+    )
260
+
261
+  }
262
+}
263
+const WrappedTypeForm = Form.create()(SharePersonNum);
264
+export default WrappedTypeForm

+ 99
- 70
src/pages/statistics/building/BuildingStatistic/component/StatsChartLine.jsx Прегледај датотеку

@@ -1,81 +1,110 @@
1 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 2
 import echarts from 'echarts/lib/echarts';
5
-import EChart from '../../../../components/EchartsTest/EChart';
3
+import EChart from '@/components/EchartsTest/EChart';
4
+import request from '@/utils/request';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
6 7
 import router from 'umi/router';
8
+import { Table, Select, Row, Col, Menu, Dropdown, Card, Icon, message } from 'antd';
7 9
 
8
-class StatsChart extends React.Component {
10
+const formatDate = (start, end) => {
11
+  const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z';
12
+  const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z';
13
+  return { startDate, endDate };
14
+};
15
+const UserSource = props => {
16
+    const {buildingId,buildingName,params} = props 
17
+  const [data, setData] = useState({  });
18
+  //柱图
19
+//   // 获取图表数据
20
+//  const getTimeBarDate = (startDate, endDate) => {
21
+//     request({ ...apis.stats.timeBarList, params: { startDate: moment(startDate).format('YYYY-MM-DDT00:00:00.000') + 'Z', endDate: moment(endDate).format('YYYY-MM-DDT23:59:59.999') + 'Z', buildingId: this.state.buildingId } }).then((data) => {
22
+//       this.setState({ ...this.state, barData: data })
23
+//     })
24
+//   }
25
+  useEffect(() => {
26
+    getData(params);
27
+  }, [params]);
9 28
 
10
-  constructor(props) {
11
-    super(props)
12
-    this.state = {}
29
+  function getData(params) {
30
+    request({
31
+        ...apis.stats.timeBarList,
32
+      params: {  ...params,buildingId },
33
+    }).then(data => {
34
+      setData(data);
35
+    });
13 36
   }
14 37
 
15
-  render() {
16
-    const { data = {}} = this.props
17
-    const options = {
18
-      title: {
19
-          text: this.props.title,
20
-      },
21
-      tooltip: {
22
-          trigger: 'axis'
23
-      },
24
-      legend: {
25
-          data: ['公客数', '私客数', '新增客户数', '访问人数']
26
-      },
27
-      grid: {
28
-          left: '3%',
29
-          right: '4%',
30
-          bottom: '3%',
31
-          containLabel: true
32
-      },
33
-      toolbox: {
34
-          feature: {
35
-              saveAsImage: {}
36
-          }
37
-      },
38
-      xAxis: {
39
-          type: 'category',
40
-          boundaryGap: false,
41
-          axisLabel: {rotate: 45},
42
-          data: data.timeList || []
43
-      },
44
-      yAxis: {
45
-          type: 'value'
46
-      },
47
-      series: [
48
-          {
49
-              name: '公客数',
50
-              type: 'line',
51
-              data: data.gkList || []
52
-              
53
-          },
54
-          {
55
-              name: '私客数',
56
-              type: 'line',
57
-              data: data.skList || []
58
-          },
59
-          {
60
-              name: '新增客户数',
61
-              type: 'line',
62
-              data: data.khList || []
63
-          },
64
-          {
65
-              name: '访问人数',
66
-              type: 'line',
67
-              data: data.uvList || []
68
-          }
69
-      ]
70
-  };
71
-  
38
+  const options = {
39
+    // title: {
40
+    //     text: this.props.title,
41
+    // },
42
+    tooltip: {
43
+        trigger: 'axis'
44
+    },
45
+    legend: {
46
+        data: ['公客数', '私客数', '新增客户数', '访问人数']
47
+    },
48
+    grid: {
49
+        left: '3%',
50
+        right: '4%',
51
+        bottom: '3%',
52
+        containLabel: true
53
+    },
54
+    toolbox: {
55
+        feature: {
56
+            saveAsImage: {}
57
+        }
58
+    },
59
+    xAxis: {
60
+        type: 'category',
61
+        boundaryGap: false,
62
+        axisLabel: {rotate: 45},
63
+        data: data.timeList || []
64
+    },
65
+    yAxis: {
66
+        type: 'value'
67
+    },
68
+    series: [
69
+        {
70
+            name: '公客数',
71
+            type: 'line',
72
+            data: data.gkList || []
73
+            
74
+        },
75
+        {
76
+            name: '私客数',
77
+            type: 'line',
78
+            data: data.skList || []
79
+        },
80
+        {
81
+            name: '新增客户数',
82
+            type: 'line',
83
+            data: data.khList || []
84
+        },
85
+        {
86
+            name: '访问人数',
87
+            type: 'line',
88
+            data: data.uvList || []
89
+        }
90
+    ]
91
+};
92
+
93
+
72 94
 
73
-    return (
95
+
96
+  return (
74 97
     <>
75
-      <EChart options={options} style={{ width: '100%', height: '400px', }} />
98
+      <Card
99
+        title={`趋势图:${buildingName}`}
100
+        headStyle={{ textAlign: 'left' }}
101
+
102
+      >
103
+
104
+        <EChart options={options}  />
105
+      </Card>
76 106
     </>
77
-    )
78
-  }
79
-}
107
+  );
108
+};
80 109
 
81
-export default StatsChart
110
+export default UserSource;

+ 100
- 0
src/pages/statistics/building/detail.jsx Прегледај датотеку

@@ -0,0 +1,100 @@
1
+import React, { Component, useState, useEffect, useRef } from 'react';
2
+import { Card, Row, Col, Statistic, Icon, Tabs, Form, Select, Button, Modal } from 'antd';
3
+// import IndexEcharts from './components/indexEcharts';
4
+// import Swiper from './swiper/index';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import request from '@/utils/request';
8
+import apis from '@/services/apis';
9
+import TimeSelect from '../compents/TimeSelect';
10
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
11
+import Navigate from '@/components/Navigate';
12
+import StatsChartLine from './BuildingStatistic/component/StatsChartLine';
13
+// import ActivityCount from '../compents/activityCount';
14
+// import NewUsers from '../compents/NewUsers';
15
+// import OverviewDeatil from '../compents/OverviewDeatil';
16
+
17
+// import Count from './components/Count';
18
+// import SourceRole from './components/SourceRole';
19
+// import UserSex from './components/UserSex';
20
+// import UserConversion from './components/UserConversion';
21
+// import BuildingStatistic from './BuildingStatistic';
22
+const { TabPane } = Tabs;
23
+const { Option } = Select;
24
+
25
+const activityOverView = props => {
26
+  const { buildingId, buildingName } = props.location.query;
27
+
28
+  const timeRef = useRef();
29
+
30
+  const [data, setData] = useState({});
31
+  const [serachData, setSearchData] = useState({
32
+    startDate:
33
+      moment()
34
+        .subtract(7, 'day')
35
+        .format('YYYY-MM-DDT00:00:00.000') + 'Z',
36
+    endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
37
+  });
38
+  const [timeValue, setTimeValue] = useState();
39
+
40
+  const [time, setTime] = useState();
41
+
42
+  //重置搜索
43
+  const handleReset = e => {
44
+    props.form.resetFields();
45
+    timeRef.current.reset();
46
+    setSearchData({
47
+      startDate:
48
+        moment()
49
+          .subtract(7, 'day')
50
+          .format('YYYY-MM-DDT00:00:00.000') + 'Z',
51
+      endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
52
+    });
53
+  };
54
+
55
+  const onTimeChange = e => {
56
+    setTime(e);
57
+  };
58
+  const handleSubmit = e => {
59
+    props.form.validateFieldsAndScroll((err, values) => {
60
+      setTimeValue();
61
+      setSearchData({
62
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
63
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
64
+      });
65
+    });
66
+  };
67
+
68
+  const { getFieldDecorator } = props.form;
69
+
70
+  return (
71
+    <div>
72
+      <Form layout="inline" onSubmit={handleSubmit}>
73
+        <Form.Item>
74
+          <TimeSelect onChange={onTimeChange} ref={timeRef}></TimeSelect>
75
+        </Form.Item>
76
+        <Form.Item>
77
+          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
78
+            搜索
79
+          </Button>
80
+          <Button onClick={e => handleReset()} style={{ marginLeft: '30px' }}>
81
+            重置
82
+          </Button>
83
+        </Form.Item>
84
+      </Form>
85
+      <div style={{ marginTop: '20px' }}>
86
+        <StatsChartLine
87
+          params={serachData}
88
+          buildingId={buildingId}
89
+          buildingName={buildingName}
90
+        ></StatsChartLine>
91
+      </div>
92
+      <div style={{ marginTop: '20px' }}>
93
+        {/* <NewUsers params={serachData} dataZoom={false}></NewUsers> */}
94
+      </div>
95
+    </div>
96
+  );
97
+};
98
+
99
+const WrappedTypeForm = Form.create()(activityOverView);
100
+export default WrappedTypeForm;

+ 90
- 0
src/pages/statistics/building/detail/index.jsx Прегледај датотеку

@@ -0,0 +1,90 @@
1
+import React, { Component, useState, useEffect, useRef } from 'react';
2
+import { Card, Row, Col, Statistic, Icon, Tabs, Form, Select, Button, Modal } from 'antd';
3
+// import IndexEcharts from './components/indexEcharts';
4
+// import Swiper from './swiper/index';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import request from '@/utils/request';
8
+import apis from '@/services/apis';
9
+import TimeSelect from '../../compents/TimeSelect';
10
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
11
+import Navigate from '@/components/Navigate';
12
+import StatsChartLine from '../BuildingStatistic/component/StatsChartLine';
13
+import TableDetail from './tableDetail';
14
+
15
+const detail = props => {
16
+  const { buildingId, buildingName } = props.location.query;
17
+
18
+  const timeRef = useRef();
19
+
20
+  const [data, setData] = useState({});
21
+  const [serachData, setSearchData] = useState({
22
+    startDate:
23
+      moment()
24
+        .subtract(7, 'day')
25
+        .format('YYYY-MM-DDT00:00:00.000') + 'Z',
26
+    endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
27
+  });
28
+  const [timeValue, setTimeValue] = useState();
29
+
30
+  const [time, setTime] = useState();
31
+
32
+  //重置搜索
33
+  const handleReset = e => {
34
+    props.form.resetFields();
35
+    timeRef.current.reset();
36
+    setSearchData({
37
+      startDate:
38
+        moment()
39
+          .subtract(7, 'day')
40
+          .format('YYYY-MM-DDT00:00:00.000') + 'Z',
41
+      endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
42
+    });
43
+  };
44
+
45
+  const onTimeChange = e => {
46
+    setTime(e);
47
+  };
48
+  const handleSubmit = e => {
49
+    props.form.validateFieldsAndScroll((err, values) => {
50
+      setTimeValue();
51
+      setSearchData({
52
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
53
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
54
+      });
55
+    });
56
+  };
57
+
58
+  const { getFieldDecorator } = props.form;
59
+
60
+  return (
61
+    <div>
62
+      <Form layout="inline" onSubmit={handleSubmit}>
63
+        <Form.Item>
64
+          <TimeSelect onChange={onTimeChange} ref={timeRef}></TimeSelect>
65
+        </Form.Item>
66
+        <Form.Item>
67
+          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
68
+            搜索
69
+          </Button>
70
+          <Button onClick={e => handleReset()} style={{ marginLeft: '30px' }}>
71
+            重置
72
+          </Button>
73
+        </Form.Item>
74
+      </Form>
75
+      <div style={{ marginTop: '20px' }}>
76
+        <StatsChartLine
77
+          params={serachData}
78
+          buildingId={buildingId}
79
+          buildingName={buildingName}
80
+        ></StatsChartLine>
81
+      </div>
82
+      <div style={{ marginTop: '20px' }}>
83
+        <TableDetail params={serachData} buildingId={buildingId}></TableDetail>
84
+      </div>
85
+    </div>
86
+  );
87
+};
88
+
89
+const WrappedTypeForm = Form.create()(detail);
90
+export default WrappedTypeForm;

+ 111
- 0
src/pages/statistics/building/detail/tableDetail.jsx Прегледај датотеку

@@ -0,0 +1,111 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Row, Col, Statistic, Table, Button } from 'antd';
3
+// import IndexEcharts from './components/indexEcharts';
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import request from '@/utils/request';
7
+import apis from '@/services/apis';
8
+import AuthButton from '@/components/AuthButton';
9
+
10
+const detailData = props => {
11
+  const {params, buildingId }= props;
12
+
13
+  const [data, setData] = useState({});
14
+  useEffect(() => {
15
+    getTableData(params);
16
+  }, [params]);
17
+
18
+  //获取表格数据
19
+  const getTableData = params => {
20
+    request({ ...apis.stats.timeTableList, params: { ...params, buildingId: buildingId } }).then(
21
+      res => {
22
+        setData(res);
23
+        // this.setState({ ...this.state, tableData: data.records, total: data.total });
24
+      },
25
+    );
26
+  };
27
+
28
+  const handleTableChange = (pagination, filters, sorter) => {
29
+    console.log(pagination, filters, sorter);
30
+    // { startDate: moment(startDate).format('YYYY-MM-DDT00:00:00.000') + 'Z', endDate: moment(endDate).format('YYYY-MM-DDT23:59:59.999') + 'Z', buildingId, pageNum, pageSize, sortField, sortOrder }
31
+    getTableData({
32
+      pageNum: pagination.current,
33
+      sortField: sorter.columnKey,
34
+      sortOrder: sorter.order,
35
+      ...params,
36
+    });
37
+  };
38
+
39
+  const exportBuildingStats = () => {
40
+    request({ ...apis.stats.buildingTimeExport, params: { ...params, buildingId: buildingId } })
41
+      .then(data => {
42
+        if (!data) {
43
+          return;
44
+        }
45
+        const url = window.URL.createObjectURL(new Blob([data]));
46
+        const link = document.createElement('a');
47
+        link.style.display = 'none';
48
+        link.href = url;
49
+        link.setAttribute('download', '项目详情统计.xlsx');
50
+        document.body.append(link);
51
+        link.click();
52
+      })
53
+      .catch(() => {});
54
+  };
55
+
56
+  const columns = [
57
+    {
58
+      title: '日期',
59
+      dataIndex: 'createDate',
60
+      key: 'createDate',
61
+    },
62
+    {
63
+      title: '新增客户',
64
+      dataIndex: 'khNum',
65
+      key: 'kh_num',
66
+      sorter: true,
67
+    },
68
+    {
69
+      title: '公客',
70
+      dataIndex: 'gkNum',
71
+      key: 'gk_num',
72
+      sorter: true,
73
+    },
74
+    {
75
+      title: '私客',
76
+      dataIndex: 'skNum',
77
+      key: 'sk_num',
78
+      sorter: true,
79
+    },
80
+    {
81
+      title: '访问人数',
82
+      dataIndex: 'uvNum',
83
+      key: 'uv_num',
84
+      sorter: true,
85
+    },
86
+  ];
87
+
88
+  return (
89
+    <Card
90
+      title={'详细数据'}
91
+      headStyle={{ textAlign: 'left' }}
92
+
93
+    >
94
+      <div style={{ marginBottom: '20px', textAlign: 'right' }}>
95
+        <AuthButton name="admin.statistical.building.export" noRight={null}>
96
+          <Button type="primary" onClick={exportBuildingStats}>
97
+            导出
98
+          </Button>
99
+        </AuthButton>
100
+      </div>
101
+      <Table
102
+        dataSource={data?.records || []}
103
+        columns={columns}
104
+        pagination={{ total: data?.total }}
105
+        key={'createDate'}
106
+        onChange={handleTableChange}
107
+      ></Table>
108
+    </Card>
109
+  );
110
+};
111
+export default detailData;

+ 60
- 45
src/pages/statistics/building/detailData/index.jsx Прегледај датотеку

@@ -1,6 +1,7 @@
1 1
 import React, { Component, useState, useEffect } from 'react';
2 2
 import { Card, Row, Col, Statistic, Table, Button } from 'antd';
3 3
 // import IndexEcharts from './components/indexEcharts';
4
+import router from 'umi/router';
4 5
 import moment from 'moment';
5 6
 import request from '@/utils/request';
6 7
 import apis from '@/services/apis';
@@ -9,51 +10,7 @@ import BuildSelect from '@/components/SelectButton/BuildSelect';
9 10
 import TimeSelect from '../../compents/TimeSelect';
10 11
 // import StatsChart from './component/StatsChart';
11 12
 import AuthButton from '@/components/AuthButton';
12
-const columns = [
13
-  {
14
-    title: '项目名称',
15
-    dataIndex: 'buildingName',
16
-    key: 'buildingName',
17
-  },
18
-  {
19
-    title: '新增客户',
20
-    dataIndex: 'khNum',
21
-    key: 'kh_num',
22
-    sorter: true,
23
-  },
24
-  {
25
-    title: '公客',
26
-    dataIndex: 'gkNum',
27
-    key: 'gk_num',
28
-    sorter: true,
29
-  },
30
-  {
31
-    title: '私客',
32
-    dataIndex: 'skNum',
33
-    key: 'sk_num',
34
-    sorter: true,
35
-  },
36
-  {
37
-    title: '访问人数',
38
-    dataIndex: 'uvNum',
39
-    key: 'uv_num',
40
-    sorter: true,
41
-  },
42
-  {
43
-    title: '访问次数',
44
-    dataIndex: 'pvNum',
45
-    key: 'pv_num',
46
-    sorter: true,
47
-  },
48
-  {
49
-    title: '详情',
50
-    render: (_, record) => (
51
-      <Button type="link" onClick={() => this.toDetailPage(record)}>
52
-        查看详情
53
-      </Button>
54
-    ),
55
-  },
56
-];
13
+
57 14
 
58 15
 const detailData = props => {
59 16
   const [buildingId, setBuildingId] = useState('');
@@ -119,6 +76,64 @@ const detailData = props => {
119 76
       })
120 77
       .catch(() => {});
121 78
   };
79
+  //去详情页面
80
+ const toDetailPage = (record) => {
81
+    router.push({
82
+      pathname: '/statistics/building/detail',
83
+      query: {
84
+        buildingId: record.buildingId,
85
+        buildingName: record.buildingName
86
+      },
87
+    });
88
+  }
89
+
90
+  const columns = [
91
+    {
92
+      title: '项目名称',
93
+      dataIndex: 'buildingName',
94
+      key: 'buildingName',
95
+    },
96
+    {
97
+      title: '新增客户',
98
+      dataIndex: 'khNum',
99
+      key: 'kh_num',
100
+      sorter: true,
101
+    },
102
+    {
103
+      title: '公客',
104
+      dataIndex: 'gkNum',
105
+      key: 'gk_num',
106
+      sorter: true,
107
+    },
108
+    {
109
+      title: '私客',
110
+      dataIndex: 'skNum',
111
+      key: 'sk_num',
112
+      sorter: true,
113
+    },
114
+    {
115
+      title: '访问人数',
116
+      dataIndex: 'uvNum',
117
+      key: 'uv_num',
118
+      sorter: true,
119
+    },
120
+
121
+    {
122
+      title: '成交量',
123
+      dataIndex: 'cjNum',
124
+      key: 'cj_num',
125
+      sorter: true,
126
+    },
127
+
128
+    {
129
+      title: '详情',
130
+      render: (_, record) => (
131
+        <Button type="link" onClick={() => toDetailPage(record)}>
132
+          查看详情
133
+        </Button>
134
+      ),
135
+    },
136
+  ];
122 137
 
123 138
   return (
124 139
     <Card

+ 0
- 16
src/pages/statistics/dataReport/components/UserActive.jsx Прегледај датотеку

@@ -84,22 +84,6 @@ const UserSource = props => {
84 84
           </Select>
85 85
         }
86 86
       >
87
-        {/* <div >
88
-        <p><span style={{fontSize:'0.12rem',fontWeight:'600'}}>用户活跃数</span></p>
89
-
90
-          <Select
91
-            showSearch
92
-            style={{ width: 100 }}
93
-            placeholder="日活跃"
94
-            optionFilterProp="children"
95
-            onChange={onChange}
96
-          >
97
-            <Option value="day">日活跃</Option>
98
-            <Option value="month">月活跃</Option>
99
-
100
-          </Select>
101
-        
102
-       </div> */}
103 87
 
104 88
         <EChart options={options} style={piestyles} />
105 89
       </Card>

+ 1
- 1
src/pages/statistics/dataReport/components/UserBehavior.jsx Прегледај датотеку

@@ -52,7 +52,7 @@ const formatDate = (start, end) => {
52 52
 const UserBehaviorIndex = props => {
53 53
   const {
54 54
     startDate = moment()
55
-      .subtract(60, 'day')
55
+      .subtract(7,'day')
56 56
       .format('YYYY-MM-DD'),
57 57
     endDate = moment().format('YYYY-MM-DD'),
58 58
   } = props;