Просмотр исходного кода

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

傅行帆 5 лет назад
Родитель
Сommit
6c2a4e378f
18 измененных файлов: 475 добавлений и 73 удалений
  1. 13
    4
      config/routes.js
  2. Двоичные данные
      src/assets/border.png
  3. Двоичные данные
      src/assets/consultantKPI.png
  4. Двоичные данные
      src/assets/customer.png
  5. Двоичные данные
      src/assets/items.png
  6. Двоичные данные
      src/assets/picture.png
  7. Двоичные данные
      src/assets/project.png
  8. Двоичные данные
      src/assets/report.png
  9. Двоичные данные
      src/assets/statistics.png
  10. 1
    0
      src/global.less
  11. 126
    0
      src/pages/Index.jsx
  12. 0
    2
      src/pages/statistical/activity/compenents/NewUsers.jsx
  13. 133
    26
      src/pages/statistical/activity/compenents/OverView.jsx
  14. 7
    7
      src/pages/statistical/consultant/homePagePersons.jsx
  15. 48
    4
      src/pages/statistical/consultant/index.jsx
  16. 54
    16
      src/pages/statistical/consultant/sharetable.jsx
  17. 54
    10
      src/pages/statistical/consultant/table.jsx
  18. 39
    4
      src/services/apis.js

+ 13
- 4
config/routes.js Просмотреть файл

@@ -21,13 +21,22 @@ export default [
21 21
         routes: [
22 22
           {
23 23
             path: '/',
24
-            redirect: '/welcome',
24
+            redirect: '/index',
25 25
           },
26 26
           {
27
-            path: '/welcome',
27
+            path: '/index',
28 28
             name: '首页',
29
-            component: './Welcome',
29
+            component: './Index',
30 30
           },
31
+          // {
32
+          //   path: '/',
33
+          //   redirect: '/welcome',
34
+          // },
35
+          // {
36
+          //   path: '/welcome',
37
+          //   name: '首页',
38
+          //   component: './Welcome',
39
+          // },
31 40
           {
32 41
             path: '/indexEcharts',
33 42
             name: '图表管理',
@@ -599,7 +608,7 @@ export default [
599 608
               },
600 609
               {
601 610
                 path: '/statistical/consultant/homePagePersons',
602
-                name: '主页访问数',
611
+                name: '主页访问数',
603 612
                 hideInMenu: true,
604 613
                 component: './statistical/consultant/homePagePersons',
605 614
               },

Двоичные данные
src/assets/border.png Просмотреть файл


Двоичные данные
src/assets/consultantKPI.png Просмотреть файл


Двоичные данные
src/assets/customer.png Просмотреть файл


Двоичные данные
src/assets/items.png Просмотреть файл


Двоичные данные
src/assets/picture.png Просмотреть файл


Двоичные данные
src/assets/project.png Просмотреть файл


Двоичные данные
src/assets/report.png Просмотреть файл


Двоичные данные
src/assets/statistics.png Просмотреть файл


+ 1
- 0
src/global.less Просмотреть файл

@@ -50,6 +50,7 @@ ol {
50 50
 
51 51
 .ant-layout-header .ant-pro-global-header{
52 52
   background:#393C39;
53
+  border-bottom: 0.6px solid rgb(156, 153, 153);
53 54
 }
54 55
 .ant-layout .ant-pro-sider-menu-sider.light .ant-pro-sider-menu-logo{
55 56
   background:#EF273A;

+ 126
- 0
src/pages/Index.jsx Просмотреть файл

@@ -0,0 +1,126 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Typography, Alert, Row, Col, Button } from 'antd';
3
+import router from 'umi/router';
4
+import request from '../utils/request';
5
+import bgImg from '../assets/picture.png';
6
+import itemsImg from '../assets/items.png';
7
+import consultantImg from '../assets/consultantKPI.png';
8
+import projectImg from '../assets/project.png';
9
+import reportImg from '../assets/report.png';
10
+import customerImg from '../assets/customer.png';
11
+import statisticsImg from '../assets/statistics.png';
12
+import borderImg from '../assets/border.png';
13
+
14
+const index = (props) => {
15
+
16
+    const [data, setData] = useState([])
17
+
18
+
19
+    useEffect(() => {
20
+
21
+    }, [])
22
+    const list = [
23
+        {
24
+            title: '项目列表',
25
+            img: itemsImg,
26
+            path: '/building/list',
27
+            value: '1',
28
+        },
29
+        {
30
+            title: '客户列表',
31
+            img: customerImg,
32
+            path: '',
33
+            value: '2',
34
+        },
35
+        {
36
+            title: '数据报表',
37
+            img: reportImg,
38
+            path: '',
39
+            value: '3',
40
+        },
41
+
42
+        {
43
+            title: '项目统计',
44
+            img: projectImg,
45
+            path: '',
46
+            value: '4',
47
+        },
48
+        {
49
+            title: '活动统计',
50
+            img: statisticsImg,
51
+            path: '',
52
+            value: '5',
53
+        },
54
+        {
55
+            title: '置业顾问KPI',
56
+            img: consultantImg,
57
+            path: '',
58
+            value: '6',
59
+        },
60
+
61
+    ]
62
+    const goNow = (path) => {
63
+        router.push({
64
+            pathname: path,
65
+        });
66
+    }
67
+
68
+
69
+
70
+    return (
71
+        <>
72
+            <div style={{
73
+                width: 'calc(100% + 48px)',
74
+                height: '0',
75
+                paddingBottom: 'calc(29.64% + 14.23px)',
76
+                position: 'relative',
77
+                top: '-24px',
78
+                left: '-24px',
79
+                backgroundImage: `url('` + bgImg + `')`,
80
+                backgroundRepeat: 'no-repeat',
81
+                backgroundSize: '100% 100%',
82
+            }} >
83
+            </div>
84
+            <div style={{
85
+                backgroundColor: '#fff',
86
+                margin: '-24px -24px 0.24rem -24px',
87
+                paddingBottom: '0.2rem',
88
+
89
+            }} >
90
+                <h2 style={{
91
+                    fontSize: '0.11rem',
92
+                    padding: '0.2rem 0 16px 24px'
93
+                }}>快捷入口</h2>
94
+                <Row style={{ textAlign: 'center' }}>
95
+                    {list.map(item => (
96
+                        <Col span={4} key={item.value} onClick={() => goNow(item.path)}>
97
+                            <div style={{
98
+                                width: '1.2rem',
99
+                                height: '0px',
100
+                                margin: '0 auto',
101
+                                paddingBottom: '0.66rem',
102
+                                position: 'relative',
103
+                                backgroundImage: `url('` + borderImg + `')`,
104
+                                backgroundRepeat: 'no-repeat',
105
+                                backgroundSize: '100% 100%',
106
+                                paddingTop: '0.12rem'
107
+                            }}>
108
+                                <p style={{ color: '#FF7F49', fontSize: '0.11rem', letterSpacing: '0.026rem', fontWeight: '600', }}>{item.title}</p>
109
+                                <img style={{ position: 'absolute', left: '0.08rem', bottom: '0.1rem', width: '0.3rem' }} src={item.img} alt="" />
110
+                            </div>
111
+                        </Col>
112
+                    ))}
113
+
114
+
115
+
116
+                </Row>
117
+
118
+            </div>
119
+
120
+
121
+        </>
122
+    )
123
+
124
+}
125
+export default index
126
+

+ 0
- 2
src/pages/statistical/activity/compenents/NewUsers.jsx Просмотреть файл

@@ -19,8 +19,6 @@ const NewUsers = (props) => {
19 19
 
20 20
   useEffect(() => {
21 21
     NewsUserCount({
22
-      // startDate: `${moment(props.startDate).format('YYYY-MM-DD HH:mm:ss')}`, 
23
-      // endDate: `${moment(props.endDate).format('YYYY-MM-DD HH:mm:ss')}`, 
24 22
       startDate: props.startDate, 
25 23
       endDate: props.endDate, 
26 24
       buildingId: props.buildingId, 

+ 133
- 26
src/pages/statistical/activity/compenents/OverView.jsx Просмотреть файл

@@ -25,45 +25,75 @@ let tableTitle = ['类型']
25 25
 let columns = [
26 26
   {
27 27
     title: '日期',
28
-    dataIndex: 'createTime',
29
-    key: 'createTime',
28
+    dataIndex: 'date',
29
+    key: 'date',
30 30
   },
31 31
   {
32 32
     title: '分享人数',
33 33
     dataIndex: 'sharePersonNum',
34 34
     key: 'sharePersonNum',
35
+    sorter: true,
35 36
   },
36 37
   {
37 38
     title: '分享次数',
38 39
     dataIndex: 'shareNum',
39 40
     key: 'shareNum',
41
+    sorter: true,
40 42
   },
41 43
   {
42 44
     title: '访问人数',
43 45
     dataIndex: 'visitPersonNum',
44 46
     key: 'visitPersonNum',
47
+    sorter: true,
45 48
   },
46 49
   {
47 50
     title: '访问次数',
48 51
     dataIndex: 'visitNum',
49 52
     key: 'visitNum',
53
+    sorter: true,
50 54
   },
51 55
   {
52 56
     title: '新增注册用户',
53 57
     dataIndex: 'addRegistNum',
54 58
     key: 'addRegistNum',
59
+    sorter: true,
55 60
   },
56 61
 ]
57 62
 
58 63
 
64
+function getDayBegin(dt) {
65
+  return moment(dt, 'day').hours(0).minutes(0).seconds(0).milliseconds(0).toDate();
66
+}
67
+
68
+
69
+function getDayEnd(dt) {
70
+  return moment(dt, 'day').hours(23).minutes(59).seconds(59).milliseconds(999).toDate();
71
+}
72
+
73
+
59 74
 class OverView extends React.Component {
60 75
 
61 76
   constructor(props) {
62 77
     super(props)
78
+
79
+    const defaultDays = 7
80
+
63 81
     this.state = {
82
+      radioVal: defaultDays,
83
+      formData: {
84
+        startDate: moment().subtract(7, 'day').toDate(),
85
+        endDate: new Date,
86
+        buildingId: '',
87
+        targetType: '',
88
+        pageNum:'',
89
+        pageSize:'',
90
+        sort:null,
91
+        colKey:null
92
+      },
64 93
       personData: [],  
65 94
       dataSoures: [],
66 95
       tableData: [],
96
+      barData: {},
67 97
       userType: 'all',
68 98
       endDate: '',
69 99
       startDate: '',
@@ -74,11 +104,13 @@ class OverView extends React.Component {
74 104
 
75 105
   componentDidMount() {
76 106
     this.getList()
107
+    this.getTableList()
77 108
   }
78 109
 
79
-  getList (params) {
80
-    console.log("params",params);
81
-    request({ ...apis.activityDataStatis.total, params: { ...params } }).then(res => {
110
+  getList () {
111
+    console.log('getlist')
112
+    const { formData } = this.state
113
+    request({ ...apis.activityDataStatis.total, params: formData }).then(res => {
82 114
       this.setState({ personData: res })
83 115
     }).catch(err => {
84 116
       <Alert
@@ -92,6 +124,25 @@ class OverView extends React.Component {
92 124
     })
93 125
   }
94 126
 
127
+  getTableList () {
128
+    const { formData } = this.state
129
+    request({ ...apis.activityDataStatis.tableData, params: formData }).then(data => {
130
+      console.log(data)
131
+      this.setState({ tableData: data.records, total: data.total})
132
+    }).catch()
133
+  }
134
+
135
+  getBarData = (startDate, endDate) => {
136
+    console.log(startDate, 'startDate')
137
+    console.log(endDate, 'endDate')
138
+    request({
139
+      ...apis.activityDataStatis.selectAllActivityUser,
140
+      params: { startDate, endDate }
141
+    }).then((data) => {
142
+      this.setState({barData: data})
143
+    })
144
+  }
145
+
95 146
   formatDate = (start, end) => {
96 147
     const tempStartDate = `${moment(start).format('YYYY-MM-DDT00:00:00.000')}Z`
97 148
     const tempEndDate = `${moment(end).format('YYYY-MM-DDT23:59:59.999')}Z`
@@ -104,7 +155,6 @@ class OverView extends React.Component {
104 155
   }
105 156
 
106 157
   handleSubmit = (e, props) => {
107
-    console.log(this.props.form.getFieldValue("startDate"), 'eeeeeee')
108 158
     let startDate = null
109 159
     let endDate = null
110 160
     const buildingId = this.props.form.getFieldValue("buildingId");
@@ -115,12 +165,16 @@ class OverView extends React.Component {
115 165
     if (this.props.form.getFieldValue("endDate") != undefined){
116 166
       endDate = this.props.form.getFieldValue("endDate").toDate()
117 167
     }
118
-    e.preventDefault();
119
-    props.form.validateFields((err, values) => {
120
-        if (!err) {
121
-          this.getList({buildingId: buildingId, targetType: targetType, startDate: startDate, endDate: endDate})
122
-        }
123
-      });
168
+    const { formData } = this.state
169
+    this.setState({
170
+      formData: {
171
+        ...formData,
172
+        startDate: startDate,
173
+        endDate: endDate,
174
+        buildingId: buildingId,
175
+        targetType: targetType
176
+      }
177
+    }, this.getAllList)
124 178
     this.setState({ startDate: startDate, endDate: endDate, buildingId: this.props.form.getFieldValue("buildingId"), targetType: this.props.form.getFieldValue("targetType") })
125 179
   }
126 180
 
@@ -129,8 +183,23 @@ class OverView extends React.Component {
129 183
     this.props.form.resetFields()
130 184
   }
131 185
 
186
+  exportActivityStats = () => {
187
+    const { formData } = this.state
188
+    request({ ...apis.activityDataStatis.tableDataExport, params: formData }).then(data => {
189
+      if (!data) {
190
+        return
191
+      }
192
+      const url = window.URL.createObjectURL(new Blob([data]))
193
+        const link = document.createElement('a')
194
+        link.style.display = 'none'
195
+        link.href = url
196
+        link.setAttribute('download', '活动统计.xlsx')
197
+        document.body.append(link)
198
+        link.click()
199
+    }).catch()
200
+  }
201
+
132 202
   getDataOf = (days) => {
133
-    console.log(77777777)
134 203
     this.setState({ endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
135 204
     this.getList({ endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
136 205
   }
@@ -179,15 +248,49 @@ class OverView extends React.Component {
179 248
 
180 249
   }
181 250
 
182
-  handleSelectChange = (e) => {
183
-    this.setState({ userType: e }, () => {
184
-      this.onTabledatas(this.state.dataSoures)
185
-    })
251
+  //排序
252
+  handleTableChange = (pagination, filters, sorter) => {
253
+    console.log(pagination, filters, sorter)
254
+    const { formData } = this.state
255
+    this.setState({
256
+      formData: {
257
+        ...formData,
258
+        startDate: formData.startDate,
259
+        endDate: formData.endDate,
260
+        buildingId: formData.buildingId,
261
+        targetType: formData.targetType,
262
+        pageNum: pagination.current,
263
+        pageSize: pagination.pageSize,
264
+        sort: sorter.order,
265
+        colKey: sorter.columnKey
266
+      }
267
+    }, this.getAllList)
268
+  };
269
+
270
+  getAllList(){
271
+    this.getList()
272
+    this.getTableList()
273
+  }
274
+
275
+  handleRadioChange = (e) => {
276
+    const { formData } = this.state
277
+    const val = e.target.value;
278
+    this.setState({
279
+      radioVal: val - 0,
280
+      formData: {
281
+        ...formData,
282
+        startDate: moment().subtract(val, 'day').toDate(),
283
+        endDate: new Date,
284
+      }
285
+    }, this.getAllList)
186 286
   }
187 287
 
188 288
 
189 289
   render() {
290
+    const { radioVal } = this.state
190 291
     const { getFieldDecorator } = this.props.form;
292
+    const startDate = this.state.formData.startDate
293
+    const endDate = this.state.formData.endDate
191 294
 
192 295
     return (
193 296
     <>
@@ -198,19 +301,23 @@ class OverView extends React.Component {
198 301
         borderRadius: '12px',
199 302
         minHeight: '60vh'
200 303
       }}>
201
-        <Radio.Group buttonStyle="solid" defaultValue="a">
202
-          <Radio.Button value="c" onClick={() => this.getDataOf(1)}>今日</Radio.Button>
203
-          <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
204
-          <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
304
+        <Radio.Group buttonStyle="solid" value={radioVal} onChange={this.handleRadioChange}>
305
+          <Radio.Button value={0}>今日</Radio.Button>
306
+          <Radio.Button value={7}>最近7天</Radio.Button>
307
+          <Radio.Button value={30}>最近1月</Radio.Button>
205 308
         </Radio.Group>
206 309
         <Form layout="inline" onSubmit={e => this.handleSubmit(e, this.props)}>
207 310
             <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
208
-            {getFieldDecorator('startDate')(
311
+            {getFieldDecorator('startDate', {initialValue: moment(startDate)
312
+              
313
+            })(
209 314
                 <DatePicker placeholder="开始日期"/>,
210 315
             )}
211 316
             </Form.Item>
212 317
             <Form.Item style={{marginTop:'20px', marginBottom:'20px'}}>
213
-            {getFieldDecorator('endDate')(
318
+            {getFieldDecorator('endDate', {initialValue: moment(endDate)
319
+              
320
+            })(
214 321
                 <DatePicker placeholder="结束日期"/>,
215 322
             )}
216 323
             </Form.Item>
@@ -274,15 +381,15 @@ class OverView extends React.Component {
274 381
           
275 382
             <div style={{ display: 'flex' }}>
276 383
                 <div className={style.bar}>
277
-                    <NewUsers startDate={this.state.startDate} endDate={this.state.endDate} buildingId={this.state.buildingId} targetType={this.state.targetType} dataZoom={false}></NewUsers>
384
+                    <NewUsers startDate={this.state.formData.startDate} endDate={this.state.formData.endDate} buildingId={this.state.buildingId} targetType={this.state.targetType} dataZoom={false}></NewUsers>
278 385
                 </div>
279 386
             </div >
280 387
             <AuthButton name="admin.customer.import" noRight={null}>
281
-            <Button type="primary" style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
388
+            <Button type="primary" style={{ float: 'right', margin: '20px 0', zIndex: 1 }} onClick={this.exportActivityStats}>
282 389
                 导出
283 390
             </Button>
284 391
             </AuthButton>
285
-          <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={false} scroll={{ y: 500 }}></Table>
392
+          <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total}} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
286 393
         </div>
287 394
       </div>
288 395
     </>

+ 7
- 7
src/pages/statistical/consultant/homePagePersons.jsx Просмотреть файл

@@ -30,7 +30,7 @@ function record(props) {
30 30
 
31 31
     // 查询列表
32 32
     const getList = (params) => {
33
-        request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
33
+        request({ ...apis.stats.homePagePersons, params: { ...params }, }).then((data) => {
34 34
             setData(data)
35 35
         })
36 36
     }
@@ -83,17 +83,17 @@ function record(props) {
83 83
         },
84 84
         {
85 85
             title: '访问次数',
86
-            dataIndex: 'verifyStatus',
87
-            key: 'verifyStatus',
86
+            dataIndex: 'visitTimes',
87
+            key: 'visitTimes',
88 88
             align: 'center',
89
-            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.verifyStatus}</span>,
89
+            render: (_, record) => <span style={{ color: 'blue', cursor: 'pointer' }} onClick={() => toPersonDetail(record.personId)} >{record.visitTimes}</span>,
90 90
         },
91 91
         {
92 92
             title: '最后访问时间',
93
-            dataIndex: 'reportDate',
94
-            key: 'reportDate',
93
+            dataIndex: 'visitTime',
94
+            key: 'visitTime',
95 95
             align: 'center',
96
-            render: (_, record) => <><span>{record.reportDate && moment(record.reportDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
96
+            render: (_, record) => <><span>{record.visitTime && moment(record.visitTime).format('YYYY-MM-DD HH:mm:ss')}</span></>,
97 97
         },
98 98
 
99 99
     ];

+ 48
- 4
src/pages/statistical/consultant/index.jsx Просмотреть файл

@@ -146,6 +146,17 @@ function record(props) {
146 146
                     userId: record.userId,
147 147
                 },
148 148
             });
149
+        } else if (type === 'sharePersons') {
150
+            router.push({
151
+                pathname: '/statistical/consultant/table',
152
+                query: {
153
+                    startDate: formData.startDate,
154
+                    endDate: formData.endDate,
155
+                    buildingId: formData.buildingId,
156
+                    userId: record.userId,
157
+                    type: 'sharePersons',
158
+                },
159
+            });
149 160
         } else if (type === 'homePagePersons') {
150 161
             router.push({
151 162
                 pathname: '/statistical/consultant/homePagePersons',
@@ -156,6 +167,39 @@ function record(props) {
156 167
                     userId: record.userId,
157 168
                 },
158 169
             });
170
+        } else if (type === 'homePageNums') {
171
+            router.push({
172
+                pathname: '/statistical/consultant/table',
173
+                query: {
174
+                    startDate: formData.startDate,
175
+                    endDate: formData.endDate,
176
+                    buildingId: formData.buildingId,
177
+                    userId: record.userId,
178
+                    type: 'homePageNums',
179
+                },
180
+            });
181
+        } else if (type === 'chatPersons') {
182
+            router.push({
183
+                pathname: '/statistical/consultant/table',
184
+                query: {
185
+                    startDate: formData.startDate,
186
+                    endDate: formData.endDate,
187
+                    buildingId: formData.buildingId,
188
+                    userId: record.userId,
189
+                    type: 'chatPersons',
190
+                },
191
+            });
192
+        } else if (type === 'favorNum') {
193
+            router.push({
194
+                pathname: '/statistical/consultant/table',
195
+                query: {
196
+                    startDate: formData.startDate,
197
+                    endDate: formData.endDate,
198
+                    buildingId: formData.buildingId,
199
+                    userId: record.userId,
200
+                    type: 'favorNum',
201
+                },
202
+            });
159 203
         }
160 204
 
161 205
     }
@@ -231,7 +275,7 @@ function record(props) {
231 275
             key: 'sharePersons',
232 276
             align: 'center',
233 277
             sorter: (a, b) => a.sharePersons - b.sharePersons,
234
-            render: (txt, record, index) => clickCon(txt, record),
278
+            render: (txt, record, index) => clickCon(txt, record, 'sharePersons'),
235 279
         },
236 280
         {
237 281
             title: '主页访问人数',
@@ -247,7 +291,7 @@ function record(props) {
247 291
             key: 'homePageNums',
248 292
             align: 'center',
249 293
             sorter: (a, b) => a.homePageNums - b.homePageNums,
250
-            render: (txt, record, index) => clickCon(txt, record),
294
+            render: (txt, record, index) => clickCon(txt, record, 'homePageNums'),
251 295
         },
252 296
         {
253 297
             title: '咨询数',
@@ -255,7 +299,7 @@ function record(props) {
255 299
             key: 'chatPersons',
256 300
             align: 'center',
257 301
             sorter: (a, b) => a.chatPersons - b.chatPersons,
258
-            render: (txt, record, index) => clickCon(txt, record),
302
+            render: (txt, record, index) => clickCon(txt, record, 'chatPersons'),
259 303
         },
260 304
         {
261 305
             title: '点赞数',
@@ -263,7 +307,7 @@ function record(props) {
263 307
             key: 'favorNum',
264 308
             align: 'center',
265 309
             sorter: (a, b) => a.favorNum - b.favorNum,
266
-            render: (txt, record, index) => clickCon(txt, record),
310
+            render: (txt, record, index) => clickCon(txt, record, 'favorNum'),
267 311
         },
268 312
     ];
269 313
     // 下载文档

+ 54
- 16
src/pages/statistical/consultant/sharetable.jsx Просмотреть файл

@@ -5,6 +5,50 @@ import moment from 'moment';
5 5
 import apis from '../../../services/apis';
6 6
 import request from '../../../utils/request'
7 7
 
8
+const typeList = [
9
+    {
10
+        label: '报名活动',
11
+        value: 'activity'
12
+    },
13
+    {
14
+        label: '助力活动',
15
+        value: 'help'
16
+    },
17
+    {
18
+        label: '拼团活动',
19
+        value: 'group'
20
+    },
21
+    {
22
+        label: 'H5活动',
23
+        value: 'h5'
24
+    },
25
+    {
26
+        label: '直播活动',
27
+        value: 'live'
28
+    },
29
+    {
30
+        label: '房源列表',
31
+        value: 'house'
32
+    },
33
+    {
34
+        label: '项目',
35
+        value: ' project'
36
+    },
37
+    {
38
+        label: '资讯',
39
+        value: 'news'
40
+    },
41
+    {
42
+        label: '首页',
43
+        value: 'mian'
44
+    },
45
+]
46
+
47
+
48
+function getType(type) {
49
+    return typeList.filter(t => t.value === type)[0].label
50
+}
51
+
8 52
 /**
9 53
   @param {*} props
10 54
   @returns
@@ -28,7 +72,7 @@ function record(props) {
28 72
 
29 73
     // 查询列表
30 74
     const getList = (params) => {
31
-        request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
75
+        request({ ...apis.stats.shareNum, params: { ...params }, }).then((data) => {
32 76
             setData(data)
33 77
         })
34 78
     }
@@ -43,17 +87,16 @@ function record(props) {
43 87
         e.preventDefault();
44 88
         props.form.validateFields((err, values) => {
45 89
             if (!err) {
46
-                console.log('提交数据: ', values)
47
-
90
+                console.log('提交数据: ', values, { ...formData, ...values })
91
+                getList({ ...formData, ...values });
48 92
             }
49 93
         });
50
-        // getList(formData);
51 94
     }
52 95
     // 更新页码
53 96
     const changePageNum = (pageNumber) => {
54 97
         props.form.validateFields((err, values) => {
55 98
             if (!err) {
56
-                getList({ ...formData, pageNum: pageNumber });
99
+                getList({ ...formData, pageNum: pageNumber, ...values });
57 100
             }
58 101
         });
59 102
     }
@@ -67,6 +110,7 @@ function record(props) {
67 110
             dataIndex: 'intention',
68 111
             key: 'intention',
69 112
             align: 'center',
113
+            render: (_, record) => <><span>{() => getType(record.targetType)}{record.targetName}</span></>
70 114
         },
71 115
         {
72 116
             title: '分享时间',
@@ -86,22 +130,16 @@ function record(props) {
86 130
             <Form layout="inline">
87 131
                 <div style={{ display: 'flex', alignItems: 'center' }}>
88 132
                     <Form.Item>
89
-                        {getFieldDecorator('eventType')(
133
+                        {getFieldDecorator('targetType')(
90 134
                             <Select placeholder="分享类型" style={{ width: 150 }}>
91
-                                <Option value="activity_share">报名活动</Option>
92
-                                <Option value="help_share">助力活动</Option>
93
-                                <Option value="group_share">拼团活动</Option>
94
-                                <Option value="h5_share">H5活动</Option>
95
-                                <Option value="live_share">直播活动</Option>
96
-                                <Option value="house_share">房源列表</Option>
97
-                                <Option value="building_share">项目</Option>
98
-                                <Option value="news_share">资讯</Option>
99
-                                <Option value="index_share">首页</Option>
135
+                                {typeList.map((item, index) => (
136
+                                    <Option key={index} value={item.value}>{item.label}</Option>
137
+                                ))}
100 138
                             </Select>
101 139
                         )}
102 140
                     </Form.Item>
103 141
                     <Form.Item>
104
-                        {getFieldDecorator('activityName')(
142
+                        {getFieldDecorator('targetName')(
105 143
                             <Input
106 144
                                 prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
107 145
                                 placeholder="分享标题"

+ 54
- 10
src/pages/statistical/consultant/table.jsx Просмотреть файл

@@ -29,10 +29,30 @@ function record(props) {
29 29
     }, [])
30 30
 
31 31
     // 查询列表
32
+    const typeTag = props.location.query.type || ''
33
+
32 34
     const getList = (params) => {
33
-        request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
34
-            setData(data)
35
-        })
35
+        if (typeTag == 'sharePersons') {
36
+            request({ ...apis.stats.sharePersons, params: { ...params }, }).then((data) => {
37
+                setData(data)
38
+            })
39
+        }
40
+        else if (typeTag == 'homePageNums') {
41
+            request({ ...apis.stats.homePageNums, params: { ...params }, }).then((data) => {
42
+                setData(data)
43
+            })
44
+        }
45
+        else if (typeTag == 'chatPersons') {
46
+            request({ ...apis.stats.chatPersons, params: { ...params }, }).then((data) => {
47
+                setData(data)
48
+            })
49
+        }
50
+        else {
51
+            request({ ...apis.stats.totalPersons, params: { ...params }, }).then((data) => {
52
+                setData(data)
53
+            })
54
+        }
55
+
36 56
     }
37 57
 
38 58
     // 更新页码
@@ -51,9 +71,8 @@ function record(props) {
51 71
             },
52 72
         });
53 73
     }
54
-    // 表格数据
55
-    const columns = [
56 74
 
75
+    const basicColunms = [
57 76
         {
58 77
             title: '头像',
59 78
             dataIndex: 'picture',
@@ -81,15 +100,40 @@ function record(props) {
81 100
             align: 'center',
82 101
             render: (_, record) => <span>{record.sex == 1 ? '男' : '女'}</span>,
83 102
         },
103
+    ]
104
+
105
+    // 表格数据
106
+    const lastColum = typeTag == 'homePageNums' ? [
84 107
         {
85
-            title: '报备时间',
86
-            dataIndex: 'reportDate',
87
-            key: 'reportDate',
108
+            title: '访问时间',
109
+            dataIndex: 'visitTime',
110
+            key: 'visitTime',
88 111
             align: 'center',
89
-            render: (_, record) => <><span>{record.reportDate && moment(record.reportDate).format('YYYY-MM-DD HH:mm:ss')}</span></>,
112
+            render: (_, record) => <> <span>{record.visitTime && moment(record.visitTime).format('YYYY-MM-DD HH:mm:ss')}</span></>,
90 113
         },
114
+    ] : typeTag == 'chatPersons' ?
115
+            [
116
+                {
117
+                    title: '最后咨询时间',
118
+                    dataIndex: 'visitTime',
119
+                    key: 'visitTime',
120
+                    align: 'center',
121
+                    render: (_, record) => <> <span>{record.visitTime && moment(record.visitTime).format('YYYY-MM-DD HH:mm:ss')}</span></>,
122
+                },
123
+
124
+            ] : typeTag == 'favorNum' ? [] :
125
+                [
126
+                    {
127
+                        title: '报备时间',
128
+                        dataIndex: 'reportDate',
129
+                        key: 'reportDate',
130
+                        align: 'center',
131
+                        render: (_, record) => <><span>{record.reportDate && moment(record.reportDate).format('YYYY-MM-DD HH:mm:ss')}</span>}</>,
132
+                    },
133
+                ]
134
+    const columns = basicColunms.concat(lastColum)
135
+
91 136
 
92
-    ];
93 137
 
94 138
     return (
95 139
 

+ 39
- 4
src/services/apis.js Просмотреть файл

@@ -1594,7 +1594,7 @@ export default {
1594 1594
       action: 'admin.contract.id.put',
1595 1595
     },
1596 1596
   },
1597
-  activityDataStatis:{
1597
+  activityDataStatis: {
1598 1598
     total: {
1599 1599
       method: 'GET',
1600 1600
       url: `${prefix}/activityStatistical/total`,
@@ -1602,9 +1602,19 @@ export default {
1602 1602
     },
1603 1603
     selectAllActivityUser: {
1604 1604
       method: 'GET',
1605
-      url: `${prefix}/selectAllActivityUser`,
1605
+      url: `${prefix}/activityStatistical/selectAllActivityUser`,
1606 1606
       action: 'admin.contract.list.get',
1607 1607
     },
1608
+    tableData: {
1609
+      method: 'GET',
1610
+      url: `${prefix}/activityStatistical/selectTableData`,
1611
+      action: 'admin.contract.list.get',
1612
+    },
1613
+    tableDataExport: {
1614
+      method: 'GET',
1615
+      url: `${prefix}/activityStatistical/tableDataExport`,
1616
+      action: 'admin.contract.list.get',
1617
+    }
1608 1618
   },
1609 1619
   stats: {
1610 1620
     barList: {
@@ -1627,10 +1637,35 @@ export default {
1627 1637
       url: `${prefix}/stats/consultant/kpi`,
1628 1638
       action: 'admin.contract.list.post',
1629 1639
     },
1630
-    totalPersons: { // 客户总计
1640
+    totalPersons: { // 客户总计 //新增用户
1631 1641
       method: 'GET',
1632 1642
       url: `${prefix}/stats/consultant/customer`,
1633
-      action: 'admin.contract.list.post',
1643
+      action: 'admin.contract.list.get',
1644
+    },
1645
+    sharePersons: { // 分享拓客
1646
+      method: 'GET',
1647
+      url: `${prefix}/stats/consultant/share/customer`,
1648
+      action: 'admin.contract.list.get',
1649
+    },
1650
+    homePagePersons: { // 主页访问人数
1651
+      method: 'GET',
1652
+      url: `${prefix}/stats/consultant/homepage/persons`,
1653
+      action: 'admin.contract.list.get',
1654
+    },
1655
+    homePageNums: { // 主页访问次数
1656
+      method: 'GET',
1657
+      url: `${prefix}/stats/consultant/homepage/times`,
1658
+      action: 'admin.contract.list.get',
1659
+    },
1660
+    chatPersons: { // 咨询数
1661
+      method: 'GET',
1662
+      url: `${prefix}/stats/consultant/chat/persons`,
1663
+      action: 'admin.contract.list.get',
1664
+    },
1665
+    shareNum: { // 分享次数
1666
+      method: 'GET',
1667
+      url: `${prefix}/stats/consultant/share/targets`,
1668
+      action: 'admin.contract.list.get',
1634 1669
     },
1635 1670
 
1636 1671
     buildingExport: {