zlisen 3 年之前
父節點
當前提交
210b7ce88e

+ 24
- 0
config/routes.js 查看文件

@@ -629,6 +629,30 @@ export default [
629 629
                 component: './statistics/activity',
630 630
                 menuCode: '/statistics/activity',
631 631
               },
632
+              // {
633
+              //   path: '/statistics/activity/sharePersonNum',
634
+              //   name: '活动统计',
635
+              //   component: './statistics/activity/sharePersonNum',
636
+              //   menuCode: '/statistics/activity',
637
+              // },
638
+
639
+              
640
+
641
+
642
+              {
643
+                path: '/statistics/building',
644
+                name: '项目统计',
645
+                component: './statistics/building',
646
+                menuCode: '/statistics/activity',
647
+              },
648
+
649
+              {
650
+                path: '/statistics/consultant',
651
+                name: 'KPI',
652
+                component: './statistics/consultant',
653
+                menuCode: '/statistics/activity',
654
+              },
655
+              
632 656
             ],
633 657
           },
634 658
           {

+ 1
- 0
src/components/SelectButton/BuildSelect.jsx 查看文件

@@ -52,6 +52,7 @@ const BuildingSelect = props => {
52 52
       style={{ width: '300px' }}
53 53
       placeholder="请选择项目"
54 54
       onChange={props.onChange}
55
+      allowClear={props.allowClear||false}
55 56
       filterOption={(input, option) =>
56 57
         option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
57 58
       }>

+ 105
- 0
src/pages/statistics/activity/activityContent/index.jsx 查看文件

@@ -0,0 +1,105 @@
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 ActivityCount from '../compents/activityCount';
13
+import NewUsers from '../compents/NewUsers';
14
+import OverviewDeatil from '../compents/OverviewDeatil';
15
+import ContentTable from '../compents/ContentTable';
16
+// import Count from './components/Count';
17
+// import SourceRole from './components/SourceRole';
18
+// import UserSex from './components/UserSex';
19
+// import UserConversion from './components/UserConversion';
20
+// import BuildingStatistic from './BuildingStatistic';
21
+const { TabPane } = Tabs;
22
+const { Option } = Select;
23
+
24
+const activityOverView = props => {
25
+  const timeRef = useRef();
26
+
27
+  const [data, setData] = useState({});
28
+  const [serachData, setSearchData] = useState({
29
+    startDate:
30
+      moment()
31
+        .subtract(7, 'day')
32
+        .format('YYYY-MM-DDT00:00:00.000') + 'Z',
33
+    endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
34
+  });
35
+  const [timeValue, setTimeValue] = useState();
36
+
37
+  const [time, setTime] = useState();
38
+
39
+  
40
+  //重置搜索
41
+  const handleReset = e => {
42
+    props.form.resetFields();
43
+    timeRef.current.reset();
44
+    setSearchData({
45
+      startDate:
46
+        moment()
47
+          .subtract(7, 'day')
48
+          .format('YYYY-MM-DDT00:00:00.000') + 'Z',
49
+      endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
50
+    });
51
+  };
52
+
53
+  const onTimeChange = e => {
54
+    setTime(e);
55
+  };
56
+  const handleSubmit = e => {
57
+    props.form.validateFieldsAndScroll((err, values) => {
58
+      setTimeValue();
59
+      setSearchData({
60
+        ...values,
61
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
62
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
63
+      });
64
+    });
65
+  };
66
+
67
+
68
+  const { getFieldDecorator } = props.form;
69
+  console.log(timeValue, 'timeValue');
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>{getFieldDecorator('buildingId')(<BuildingSelect allowClear />)}</Form.Item>
77
+        <Form.Item>
78
+          {getFieldDecorator('targetType')(
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>
84
+              <Option value="live">直播</Option>
85
+            </Select>,
86
+          )}
87
+        </Form.Item>
88
+        <Form.Item>
89
+          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
90
+            搜索
91
+          </Button>
92
+          <Button onClick={e => handleReset()} style={{ marginLeft: '30px' }}>
93
+            重置
94
+          </Button>
95
+        </Form.Item>
96
+      </Form>
97
+      <div style={{ marginTop: '20px' }}>
98
+        <ContentTable params={serachData}></ContentTable>
99
+      </div>
100
+    </div>
101
+  );
102
+};
103
+
104
+const WrappedTypeForm = Form.create()(activityOverView);
105
+export default WrappedTypeForm;

+ 111
- 0
src/pages/statistics/activity/activityOverview/index.jsx 查看文件

@@ -0,0 +1,111 @@
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 ActivityCount from '../compents/activityCount';
13
+import NewUsers from '../compents/NewUsers';
14
+import OverviewDeatil from '../compents/OverviewDeatil';
15
+
16
+// import Count from './components/Count';
17
+// import SourceRole from './components/SourceRole';
18
+// import UserSex from './components/UserSex';
19
+// import UserConversion from './components/UserConversion';
20
+// import BuildingStatistic from './BuildingStatistic';
21
+const { TabPane } = Tabs;
22
+const { Option } = Select;
23
+
24
+const activityOverView = props => {
25
+  const timeRef = useRef();
26
+
27
+  const [data, setData] = useState({});
28
+  const [serachData, setSearchData] = useState({
29
+    startDate:
30
+      moment()
31
+        .subtract(7, 'day')
32
+        .format('YYYY-MM-DDT00:00:00.000') + 'Z',
33
+    endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
34
+  });
35
+  const [timeValue, setTimeValue] = useState();
36
+
37
+  const [time, setTime] = useState();
38
+
39
+
40
+  //重置搜索
41
+  const handleReset = e => {
42
+    props.form.resetFields();
43
+    timeRef.current.reset();
44
+    setSearchData({
45
+      startDate:
46
+        moment()
47
+          .subtract(7, 'day')
48
+          .format('YYYY-MM-DDT00:00:00.000') + 'Z',
49
+      endDate: moment().format('YYYY-MM-DDT23:59:59.999') + 'Z',
50
+    });
51
+  };
52
+
53
+  const onTimeChange = e => {
54
+    setTime(e);
55
+  };
56
+  const handleSubmit = e => {
57
+    props.form.validateFieldsAndScroll((err, values) => {
58
+      setTimeValue();
59
+      setSearchData({
60
+        ...values,
61
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
62
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
63
+      });
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>{getFieldDecorator('buildingId')(<BuildingSelect allowClear />)}</Form.Item>
77
+        <Form.Item>
78
+          {getFieldDecorator('targetType')(
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>
84
+              <Option value="live">直播</Option>
85
+            </Select>,
86
+          )}
87
+        </Form.Item>
88
+        <Form.Item>
89
+          <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }}>
90
+            搜索
91
+          </Button>
92
+          <Button onClick={e => handleReset()} style={{ marginLeft: '30px' }}>
93
+            重置
94
+          </Button>
95
+        </Form.Item>
96
+      </Form>
97
+      <div style={{ marginTop: '20px' }}>
98
+        <ActivityCount params={serachData}></ActivityCount>
99
+      </div>
100
+      <div style={{ marginTop: '20px' }}>
101
+        <NewUsers params={serachData} dataZoom={false}></NewUsers>
102
+      </div>
103
+      <div style={{ marginTop: '20px' }}>
104
+        <OverviewDeatil params={serachData} ></OverviewDeatil>
105
+      </div>
106
+    </div>
107
+  );
108
+};
109
+
110
+const WrappedTypeForm = Form.create()(activityOverView);
111
+export default WrappedTypeForm;

+ 141
- 0
src/pages/statistics/activity/compents/ContentTable.jsx 查看文件

@@ -0,0 +1,141 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card,Table,Button } from 'antd';
3
+import EChart from '../../../../components/EchartsTest/EChart';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+import Navigate from '@/components/Navigate';
9
+import AuthButton from '@/components/AuthButton';
10
+const ContentTable = props => {
11
+  const { params } = props;
12
+  const [data, setData] = useState({ records: [] });
13
+  const formatDate = (start, end) => {
14
+    const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z';
15
+    const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z';
16
+    return { startDate, endDate };
17
+  };
18
+
19
+  useEffect(() => {
20
+    getTableList({
21
+      ...params,
22
+    });
23
+  }, [params]);
24
+
25
+  function getTableList(params) {
26
+    request({
27
+      ...apis.activityDataStatis.activityDetailTableData,
28
+      params: {
29
+        ...params,
30
+      },
31
+    })
32
+      .then(data => {
33
+        console.log(data);
34
+        setData(data);
35
+        // this.setState({ tableData: data.records, total: data.total });
36
+      })
37
+      .catch();
38
+  }
39
+  const columns = [
40
+    {
41
+      title: '活动名称',
42
+      dataIndex: 'title',
43
+      key: 'title',
44
+      // sorter: true,
45
+    },
46
+    {
47
+      title: '访问人数',
48
+      dataIndex: 'visitPersonNum',
49
+      key: 'visit_person_num',
50
+      width: '25%',
51
+      sorter: true,
52
+      render: text => text || 0,
53
+    },
54
+    {
55
+      title: '访问次数',
56
+      dataIndex: 'visitNum',
57
+      key: 'visit_num',
58
+      width: '25%',
59
+      sorter: true,
60
+      render: text => text || 0,
61
+    },
62
+    {
63
+      title: '报名人数',
64
+      dataIndex: 'signNum',
65
+      key: 'sign_num',
66
+      width: '25%',
67
+      sorter: true,
68
+      // render: (text)=>text||0
69
+      render: (text, record) =>
70
+        text ? <Navigate onClick={() => toAddVisitNum(record)}>{record.signNum}</Navigate> : 0,
71
+      // <a style={{ color: '#66B3FF' }} onClick={toAddVisitNum(record)}><span>{record.visitNum}</span></a>
72
+    },
73
+  ];
74
+
75
+  const toAddVisitNum = record => {
76
+    router.push({
77
+      pathname: '/activity/SignupActivity/registrationRecord',
78
+      query: {
79
+        dynamicId: record.dynamicId,
80
+      },
81
+    });
82
+  };
83
+
84
+  //排序
85
+  const handleTableChange = (pagination, filters, sorter) => {
86
+    console.log(pagination, filters, sorter);
87
+    // Desc  和asc
88
+    const sortType =
89
+      sorter.order == 'ascend' ? 'asc' : sorter.order == 'descend' ? 'Desc' : undefined;
90
+    getTableList({
91
+      ...params,
92
+      pageNum: pagination.current,
93
+      pageSize: pagination.pageSize,
94
+      sortType: sortType,
95
+      sortField: sorter.columnKey,
96
+    });
97
+  };
98
+
99
+ const exportActivityStats = () => {
100
+
101
+    request({ ...apis.activityDataStatis.activityDetailTableDataExport, params: params }).then(data => {
102
+      if (!data) {
103
+        return
104
+      }
105
+      const url = window.URL.createObjectURL(new Blob([data]))
106
+      const link = document.createElement('a')
107
+      link.style.display = 'none'
108
+      link.href = url
109
+      link.setAttribute('download', '活动统计.xlsx')
110
+      document.body.append(link)
111
+      link.click()
112
+    }).catch()
113
+  }
114
+  return (
115
+    <Card>
116
+        <div style={{textAlign:'right'}}> 
117
+        <AuthButton name="admin.statistical.activity.export" noRight={null}>
118
+              <Button type="primary" style={{ float: 'right', margin: '20px 0', zIndex: 1 }} onClick={exportActivityStats}>
119
+                导出
120
+            </Button>
121
+            </AuthButton>
122
+        </div>
123
+        
124
+      <Table
125
+        columns={columns}
126
+        dataSource={data?.records}
127
+        key="dynamicId"
128
+        pagination={{ current: data?.current, pageSize: 10, total: data?.total }}
129
+        onChange={handleTableChange}
130
+      ></Table>
131
+    </Card>
132
+    // <>
133
+    //   <div ><p><span style={{fontSize:'0.12rem',fontWeight:'600'}}>活动趋势图</span></p></div>
134
+    //   <div style={{marginTop:'30px'}}>
135
+
136
+    //   </div>
137
+    // </>
138
+  );
139
+};
140
+
141
+export default ContentTable;

+ 128
- 0
src/pages/statistics/activity/compents/NewUsers.jsx 查看文件

@@ -0,0 +1,128 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import {Card} from 'antd'
3
+import EChart from '../../../../components/EchartsTest/EChart';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+
9
+const NewUsers = props => {
10
+  const { params } = props;
11
+  const [data, setData] = useState({ records: [] });
12
+  const formatDate = (start, end) => {
13
+    const startDate = moment(start).format('YYYY-MM-DDT00:00:00.000') + 'Z';
14
+    const endDate = moment(end).format('YYYY-MM-DDT23:59:59.999') + 'Z';
15
+    return { startDate, endDate };
16
+  };
17
+
18
+  useEffect(() => {
19
+    NewsUserCount({
20
+      ...params,
21
+      ...formatDate(params.startDate, params.endDate),
22
+    });
23
+  }, [params]);
24
+
25
+  function NewsUserCount(params) {
26
+    request({
27
+      ...apis.activityDataStatis.selectAllActivityUser,
28
+      params: { ...params },
29
+    }).then(data => {
30
+      setData(data);
31
+    });
32
+  }
33
+
34
+  const dataZoom = props.dataZoom
35
+    ? [
36
+        {
37
+          type: 'inside',
38
+          start: 0,
39
+          end: 100,
40
+        },
41
+        {
42
+          type: 'slider',
43
+          start: 0,
44
+          end: 100,
45
+        },
46
+      ]
47
+    : undefined;
48
+  const dataset = data.selectAllActivityUser || [];
49
+  const options = {
50
+    color: [
51
+      'rgba(241,43,62,1)',
52
+      'rgba(254,146,156,1)',
53
+      'rgba(100,124,225,1)',
54
+      'rgba(162,185,255,1)',
55
+      'rgba(255,132,79,1)',
56
+    ],
57
+    tooltip: {
58
+      trigger: 'axis',
59
+    },
60
+    icon: 'rect',
61
+    legend: {
62
+      data: ['访问人数', '访问次数', '新增注册用户', '分享人数', '分享次数'],
63
+    },
64
+    toolbox: {},
65
+    xAxis: {
66
+      type: 'category',
67
+    },
68
+    yAxis: {},
69
+    dataZoom,
70
+    series: [
71
+      {
72
+        name: '访问人数',
73
+        type: 'line',
74
+        smooth: true,
75
+      },
76
+      {
77
+        name: '访问次数',
78
+        type: 'line',
79
+        smooth: true,
80
+      },
81
+      {
82
+        name: '新增注册用户',
83
+        type: 'line',
84
+        smooth: true,
85
+      },
86
+      {
87
+        name: '分享人数',
88
+        type: 'line',
89
+        smooth: true,
90
+      },
91
+      {
92
+        name: '分享次数',
93
+        type: 'line',
94
+        smooth: true,
95
+      },
96
+    ],
97
+    dataset: {
98
+      dimensions: [
99
+        'date',
100
+        'visitPersonCount',
101
+        'visitCount',
102
+        'addregistCount',
103
+        'sharePersonCount',
104
+        'shareCount',
105
+      ],
106
+      source: dataset,
107
+    },
108
+  };
109
+
110
+  const piestyles = {
111
+    width: '100%',
112
+    height: '400px',
113
+  };
114
+
115
+  return (
116
+    <Card title="活动趋势图" headStyle={{ textAlign: 'left' }}>
117
+      <EChart options={options} />
118
+    </Card>
119
+    // <>
120
+    //   <div ><p><span style={{fontSize:'0.12rem',fontWeight:'600'}}>活动趋势图</span></p></div>
121
+    //   <div style={{marginTop:'30px'}}>
122
+
123
+    //   </div>
124
+    // </>
125
+  );
126
+};
127
+
128
+export default NewUsers;

+ 157
- 0
src/pages/statistics/activity/compents/OverviewDeatil.jsx 查看文件

@@ -0,0 +1,157 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Table, Button } from 'antd';
3
+import Navigate from '@/components/Navigate';
4
+import EChart from '../../../../components/EchartsTest/EChart';
5
+import request from '../../../../utils/request';
6
+import apis from '../../../../services/apis';
7
+import moment from 'moment';
8
+import router from 'umi/router';
9
+
10
+
11
+const NewUsers = props => {
12
+  const { params } = props;
13
+  const [data, setData] = useState({ records: [] });
14
+
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
+}
30
+
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
+  },
56
+
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
+];
88
+
89
+  useEffect(() => {
90
+    getTableList();
91
+  }, [params]);
92
+
93
+  const getTableList = payload => {
94
+    request({
95
+      ...apis.activityDataStatis.tableData,
96
+      params: { ...params, ...payload },
97
+    })
98
+      .then(res => {
99
+        setData(res);
100
+      })
101
+      .catch();
102
+  };
103
+
104
+  const exportActivityStats = () => {
105
+    request({ ...apis.activityDataStatis.tableDataExport, params: params })
106
+      .then(data => {
107
+        if (!data) {
108
+          return;
109
+        }
110
+        const url = window.URL.createObjectURL(new Blob([data]));
111
+        const link = document.createElement('a');
112
+        link.style.display = 'none';
113
+        link.href = url;
114
+        link.setAttribute('download', '活动统计.xlsx');
115
+        document.body.append(link);
116
+        link.click();
117
+      })
118
+      .catch();
119
+  };
120
+
121
+  //排序
122
+  const handleTableChange = (pagination, filters, sorter) => {
123
+    console.log(pagination, filters, sorter);
124
+    // Desc  和asc
125
+    const sortType =
126
+      sorter.order == 'ascend' ? 'asc' : sorter.order == 'descend' ? 'Desc' : undefined;
127
+    getTableList({
128
+      ...params,
129
+      pageNum: pagination.current,
130
+      pageSize: pagination.pageSize,
131
+      sortType: sortType,
132
+      sortField: sorter.columnKey,
133
+    });
134
+  };
135
+
136
+  return (
137
+    <Card title="详细数据" headStyle={{ textAlign: 'left' }}>
138
+      <div style={{ textAlign: 'right' }}>
139
+        <Button type="primary" onClick={exportActivityStats}>
140
+          导出
141
+        </Button>
142
+      </div>
143
+
144
+      <Table
145
+        key="date"
146
+        dataSource={data?.records}
147
+        columns={columns}
148
+        pagination={{ total: data?.total, current: data?.current, pageSize: data?.size }}
149
+        onChange={handleTableChange}
150
+        scroll={{ y: 500 }}
151
+      ></Table>
152
+    </Card>
153
+  );
154
+};
155
+
156
+export default NewUsers;
157
+// pagination={{ total: this.state.total}} onChange={this.handleTableChange}

+ 102
- 0
src/pages/statistics/activity/compents/activityCount.jsx 查看文件

@@ -0,0 +1,102 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Row, Col, Statistic, Icon } 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
+
10
+function getDayBegin(dt) {
11
+  return moment(dt, 'day').hours(0).minutes(0).seconds(0).milliseconds(0).format('YYYY-MM-DDTHH:mm:ss')+'.000Z';
12
+}
13
+
14
+
15
+function getDayEnd(dt) {
16
+  return moment(dt, 'day').hours(23).minutes(59).seconds(59).milliseconds(999).format('YYYY-MM-DDTHH:mm:ss')+'.999Z';
17
+}
18
+
19
+
20
+const Count = props => {
21
+  const {params} = props
22
+  const [data, setData] = useState([]);
23
+
24
+
25
+  const [checkData, setCheckData] = useState([]);
26
+
27
+  useEffect(() => {
28
+    getList()
29
+
30
+  }, [params]);
31
+
32
+ const getList =() => {
33
+
34
+console.log(params,'params')
35
+    request({
36
+      ...apis.activityDataStatis.total,
37
+      params: {
38
+        ...params,
39
+        // startDate: getDayBegin(params.startDate),
40
+        // endDate: getDayEnd(params.endDate),
41
+      }
42
+    }).then(res => {
43
+    
44
+    }).catch(err => {
45
+
46
+    })
47
+  }
48
+
49
+//   function getBuildingReports() {
50
+//     request({ ...apis.system.taBuildingReports }).then(data => {
51
+//       console.log(
52
+//         (data.records || []).map(x => x.reportCode),
53
+//         '22222222222222222',
54
+//       );
55
+//       setCheckData((data.records || []).map(x => x.reportCode));
56
+//     });
57
+//   }
58
+
59
+  return (
60
+    <>
61
+      <Row gutter={16} style={{textAlign:'center'}}>
62
+        <Col span={6}>
63
+          <Card>
64
+            <Statistic
65
+              title="分享总次数"
66
+              value={data.allPersonNum || 0}
67
+              //   valueStyle={{ color: '#3f8600' }}
68
+            />
69
+          </Card>
70
+        </Col>
71
+        <Col span={6}>
72
+          <Card>
73
+            <Statistic
74
+              title="分享总人数"
75
+              value={data.registerPersonNum || 0}
76
+              //   valueStyle={{ color: '#cf1322' }}
77
+            />
78
+          </Card>
79
+        </Col>
80
+        <Col span={6}>
81
+          <Card>
82
+            <Statistic
83
+              title="访问总次数"
84
+              value={data.todayVisitNum || 0}
85
+              //   valueStyle={{ color: '#3f8600' }}
86
+            />
87
+          </Card>
88
+        </Col>
89
+        <Col span={6}>
90
+          <Card >
91
+            <Statistic
92
+              title="访问总人数"
93
+              value={data.todayAddPersonNum || 0}
94
+              //   valueStyle={{ color: '#cf1322' }}
95
+            />
96
+          </Card>
97
+        </Col>
98
+      </Row>
99
+    </>
100
+  );
101
+};
102
+export default Count;

+ 144
- 0
src/pages/statistics/activity/index copy.jsx 查看文件

@@ -0,0 +1,144 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Row, Col, Statistic, Icon, Table } 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 Count from './components/Count';
13
+// import SourceRole from './components/SourceRole';
14
+// import UserSex from './components/UserSex';
15
+// import UserConversion from './components/UserConversion';
16
+// import BuildingStatistic from './BuildingStatistic';
17
+
18
+const DataReport = props => {
19
+  const [data, setData] = useState({});
20
+  const [time, setTime] = useState();
21
+  const [buildingValue, setBuildingValue] = useState();
22
+
23
+  useEffect(() => {
24
+    if (time) {
25
+      getTableList({
26
+        buildingId:buildingValue,
27
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
28
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
29
+      });
30
+    }
31
+  }, [time,buildingValue]);
32
+
33
+  const columns = [
34
+    {
35
+      title: '活动名称',
36
+      dataIndex: 'title',
37
+      key: 'title',
38
+      // sorter: true,
39
+    },
40
+    {
41
+      title: '访问人数',
42
+      dataIndex: 'visitPersonNum',
43
+      key: 'visit_person_num',
44
+      width:'25%',
45
+      sorter: true,
46
+      render: (text)=>text||0
47
+    },
48
+    {
49
+      title: '访问次数',
50
+      dataIndex: 'visitNum',
51
+      key: 'visit_num',
52
+      width:'25%',
53
+      sorter: true,
54
+      render: (text)=>text||0
55
+    },
56
+    {
57
+      title: '报名人数',
58
+      dataIndex: 'signNum',
59
+      key: 'sign_num',
60
+      width:'25%',
61
+      sorter: true,
62
+      // render: (text)=>text||0
63
+        render: (text, record) => (
64
+          text? <Navigate onClick={()=>toAddVisitNum(record)}>{record.signNum}</Navigate>:0
65
+          // <a style={{ color: '#66B3FF' }} onClick={toAddVisitNum(record)}><span>{record.visitNum}</span></a>
66
+        ),
67
+    },
68
+  ];
69
+
70
+  const  toAddVisitNum = (record)=>{
71
+    router.push({
72
+      pathname: '/activity/SignupActivity/registrationRecord',
73
+      query: {
74
+        dynamicId:record.dynamicId
75
+      },
76
+    });
77
+  }
78
+
79
+  //排序
80
+  const handleTableChange = (pagination, filters, sorter) => {
81
+    console.log(pagination, filters, sorter);
82
+    // Desc  和asc
83
+    const sortType=  sorter.order=="ascend"?'asc':sorter.order=="descend"?'Desc':undefined
84
+    getTableList({
85
+      buildingId:buildingValue,
86
+      startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
87
+      endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
88
+      pageNum: pagination.current,
89
+      pageSize: pagination.pageSize,
90
+      sortType: sortType,
91
+      sortField: sorter.columnKey,
92
+    });
93
+    // const { formData } = this.state
94
+    // this.setState({
95
+    //   formData: {
96
+    //     ...formData,
97
+    //     startDate: formData.startDate,
98
+    //     endDate: formData.endDate,
99
+    //     buildingId: formData.buildingId,
100
+    //     targetType: formData.targetType,
101
+    //     pageNum: pagination.current,
102
+    //     pageSize: pagination.pageSize,
103
+    //     sort: sorter.order,
104
+    //     colKey: sorter.columnKey
105
+    //   }
106
+    // }, this.getTableList)
107
+  };
108
+
109
+  function getTableList(params) {
110
+    request({
111
+      ...apis.activityDataStatis.activityDetailTableData,
112
+      params: {
113
+        ...params,
114
+      },
115
+    })
116
+      .then(data => {
117
+        console.log(data);
118
+        setData(data);
119
+        // this.setState({ tableData: data.records, total: data.total });
120
+      })
121
+      .catch();
122
+  }
123
+
124
+  const onTimeChange = e => {
125
+    setTime(e);
126
+  };
127
+
128
+  return (
129
+    <Card
130
+      title={<BuildingSelect value={buildingValue} onChange={e => setBuildingValue(e)} all />}
131
+      headStyle={{ textAlign: 'left' }}
132
+      extra={<TimeSelect onChange={onTimeChange}></TimeSelect>}
133
+    >
134
+      <Table
135
+        columns={columns}
136
+        dataSource={data?.records}
137
+        key="dynamicId"
138
+        pagination={{current:data?.current, pageSize: 10, total: data?.total }}
139
+        onChange={handleTableChange}
140
+      ></Table>
141
+    </Card>
142
+  );
143
+};
144
+export default DataReport;

+ 66
- 123
src/pages/statistics/activity/index.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import React, { Component, useState, useEffect } from 'react';
2
-import { Card, Row, Col, Statistic, Icon, Table } from 'antd';
2
+import { Card, Row, Col, Statistic, Icon, Modal, Tabs, Button } from 'antd';
3 3
 // import IndexEcharts from './components/indexEcharts';
4 4
 // import Swiper from './swiper/index';
5 5
 import moment from 'moment';
@@ -9,136 +9,79 @@ import apis from '@/services/apis';
9 9
 import TimeSelect from '../compents/TimeSelect';
10 10
 import BuildingSelect from '@/components/SelectButton/BuildSelect';
11 11
 import Navigate from '@/components/Navigate';
12
-// import Count from './components/Count';
13
-// import SourceRole from './components/SourceRole';
14
-// import UserSex from './components/UserSex';
15
-// import UserConversion from './components/UserConversion';
16
-// import BuildingStatistic from './BuildingStatistic';
12
+import ActivityOverview from './activityOverview';
13
+import ActivityContent from './activityContent';
17 14
 
18
-const DataReport = props => {
19
-  const [data, setData] = useState({});
20
-  const [time, setTime] = useState();
21
-  const [buildingValue, setBuildingValue] = useState();
22 15
 
23
-  useEffect(() => {
24
-    if (time) {
25
-      getTableList({
26
-        buildingId:buildingValue,
27
-        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
28
-        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
29
-      });
30
-    }
31
-  }, [time,buildingValue]);
16
+const { TabPane } = Tabs;
32 17
 
33
-  const columns = [
34
-    {
35
-      title: '活动名称',
36
-      dataIndex: 'title',
37
-      key: 'title',
38
-      // sorter: true,
39
-    },
40
-    {
41
-      title: '访问人数',
42
-      dataIndex: 'visitPersonNum',
43
-      key: 'visit_person_num',
44
-      width:'25%',
45
-      sorter: true,
46
-      render: (text)=>text||0
47
-    },
48
-    {
49
-      title: '访问次数',
50
-      dataIndex: 'visitNum',
51
-      key: 'visit_num',
52
-      width:'25%',
53
-      sorter: true,
54
-      render: (text)=>text||0
55
-    },
56
-    {
57
-      title: '报名人数',
58
-      dataIndex: 'signNum',
59
-      key: 'sign_num',
60
-      width:'25%',
61
-      sorter: true,
62
-      // render: (text)=>text||0
63
-        render: (text, record) => (
64
-          text? <Navigate onClick={()=>toAddVisitNum(record)}>{record.signNum}</Navigate>:0
65
-          // <a style={{ color: '#66B3FF' }} onClick={toAddVisitNum(record)}><span>{record.visitNum}</span></a>
66
-        ),
67
-    },
68
-  ];
18
+const activity = props => {
69 19
 
70
-  const  toAddVisitNum = (record)=>{
71
-    router.push({
72
-      pathname: '/activity/SignupActivity/registrationRecord',
73
-      query: {
74
-        dynamicId:record.dynamicId
75
-      },
76
-    });
77
-  }
20
+  const [helpVisible, setHelpVisible] = useState(false);
78 21
 
79
-  //排序
80
-  const handleTableChange = (pagination, filters, sorter) => {
81
-    console.log(pagination, filters, sorter);
82
-    // Desc  和asc
83
-    const sortType=  sorter.order=="ascend"?'asc':sorter.order=="descend"?'Desc':undefined
84
-    getTableList({
85
-      buildingId:buildingValue,
86
-      startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
87
-      endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
88
-      pageNum: pagination.current,
89
-      pageSize: pagination.pageSize,
90
-      sortType: sortType,
91
-      sortField: sorter.columnKey,
92
-    });
93
-    // const { formData } = this.state
94
-    // this.setState({
95
-    //   formData: {
96
-    //     ...formData,
97
-    //     startDate: formData.startDate,
98
-    //     endDate: formData.endDate,
99
-    //     buildingId: formData.buildingId,
100
-    //     targetType: formData.targetType,
101
-    //     pageNum: pagination.current,
102
-    //     pageSize: pagination.pageSize,
103
-    //     sort: sorter.order,
104
-    //     colKey: sorter.columnKey
105
-    //   }
106
-    // }, this.getTableList)
107
-  };
108 22
 
109
-  function getTableList(params) {
110
-    request({
111
-      ...apis.activityDataStatis.activityDetailTableData,
112
-      params: {
113
-        ...params,
114
-      },
115
-    })
116
-      .then(data => {
117
-        console.log(data);
118
-        setData(data);
119
-        // this.setState({ tableData: data.records, total: data.total });
120
-      })
121
-      .catch();
23
+  function callback(key) {
24
+    console.log(key);
122 25
   }
123 26
 
124
-  const onTimeChange = e => {
125
-    setTime(e);
126
-  };
127
-
128 27
   return (
129
-    <Card
130
-      title={<BuildingSelect value={buildingValue} onChange={e => setBuildingValue(e)} all />}
131
-      headStyle={{ textAlign: 'left' }}
132
-      extra={<TimeSelect onChange={onTimeChange}></TimeSelect>}
133
-    >
134
-      <Table
135
-        columns={columns}
136
-        dataSource={data?.records}
137
-        key="dynamicId"
138
-        pagination={{current:data?.current, pageSize: 10, total: data?.total }}
139
-        onChange={handleTableChange}
140
-      ></Table>
141
-    </Card>
28
+    <div>
29
+      <Tabs
30
+        onChange={callback}
31
+        type="card"
32
+        tabBarExtraContent={
33
+          <Button type="link" onClick={() => setHelpVisible(true)}>
34
+            指标说明
35
+          </Button>
36
+        }
37
+      >
38
+        <TabPane tab="统计总况" key="1">
39
+          <ActivityOverview></ActivityOverview>
40
+        </TabPane>
41
+        <TabPane tab="统计内容" key="2">
42
+          <ActivityContent></ActivityContent>
43
+        </TabPane>
44
+      </Tabs>
45
+
46
+      <Modal
47
+        title="指标说明"
48
+        visible={helpVisible}
49
+        onCancel={() => setHelpVisible(false)}
50
+        footer={null}
51
+      >
52
+        <Row>
53
+          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '4px' }}>分享人数:</p>
54
+          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>
55
+            分享小程序活动的总人数
56
+          </p>
57
+        </Row>
58
+        <Row>
59
+          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '4px' }}>分享次数:</p>
60
+          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>
61
+            触发小程序活动分享的总次数
62
+          </p>
63
+        </Row>
64
+        <Row>
65
+          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '4px' }}>新增注册用户:</p>
66
+          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>
67
+            通过分享的活动授权手机号的总人数
68
+          </p>
69
+        </Row>
70
+        <Row>
71
+          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '4px' }}>访问人数:</p>
72
+          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>
73
+            访问小程序活动的总人数
74
+          </p>
75
+        </Row>
76
+
77
+        <Row>
78
+          <p style={{ fontSize: '0.106rem', color: '#333', marginBottom: '4px' }}>访问次数:</p>
79
+          <p style={{ fontSize: '0.106rem', color: '#999', marginBottom: '8px' }}>
80
+            访问小程序活动的总次数
81
+          </p>
82
+        </Row>
83
+      </Modal>
84
+    </div>
142 85
   );
143 86
 };
144
-export default DataReport;
87
+export default activity;

+ 72
- 0
src/pages/statistics/building/BuildingStatistic/component/StatsChart.jsx 查看文件

@@ -0,0 +1,72 @@
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 echarts from 'echarts/lib/echarts';
5
+import EChart from '@/components/EchartsTest/EChart';
6
+import router from 'umi/router';
7
+
8
+class StatsChart extends React.Component {
9
+
10
+  constructor(props) {
11
+    super(props)
12
+    this.state = {}
13
+  }
14
+
15
+  render() {
16
+    const { data = [] } = this.props
17
+    const options = {
18
+      title: {
19
+        text: this.props.title,
20
+        subtext: this.props.subtext,
21
+      },
22
+      xAxis: {
23
+        type: 'category',
24
+        axisLabel: { rotate: 45 },
25
+        // data: data.buildingNameList || []
26
+      },
27
+      grid: {
28
+        bottom: '30%'
29
+      },
30
+      tooltip: {},
31
+      yAxis: {
32
+        type: 'value'
33
+      },
34
+      dataset: {
35
+        // 用 dimensions 指定了维度的顺序。直角坐标系中,
36
+        // 默认把第一个维度映射到 X 轴上,第二个维度映射到 Y 轴上。
37
+        // 如果不指定 dimensions,也可以通过指定 series.encode
38
+        // 完成映射,参见后文。
39
+        dimensions: ['buildingName', 'num' ],
40
+        source: data
41
+    },
42
+      series: {
43
+        type: 'bar',
44
+        name: this.props.title,
45
+        barWidth: 50,
46
+        // data: data.numList || [],
47
+        itemStyle: {
48
+          normal: {
49
+            barBorderRadius: [50, 50, 0, 0],
50
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
51
+              offset: 0,
52
+              color: '#FFC6AA'
53
+            }, {
54
+              offset: 1,
55
+              color: '#FF7E48'
56
+            }]),
57
+            shadowColor: 'rgba(0, 0, 0, 0.4)',
58
+
59
+          }
60
+        }
61
+      }
62
+    }
63
+
64
+    return (
65
+      <>
66
+        <EChart options={options} style={{ width: '100%', height: '400px'}} />
67
+      </>
68
+    )
69
+  }
70
+}
71
+
72
+export default StatsChart

+ 81
- 0
src/pages/statistics/building/BuildingStatistic/component/StatsChartLine.jsx 查看文件

@@ -0,0 +1,81 @@
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 echarts from 'echarts/lib/echarts';
5
+import EChart from '../../../../components/EchartsTest/EChart';
6
+import router from 'umi/router';
7
+
8
+class StatsChart extends React.Component {
9
+
10
+  constructor(props) {
11
+    super(props)
12
+    this.state = {}
13
+  }
14
+
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
+  
72
+
73
+    return (
74
+    <>
75
+      <EChart options={options} style={{ width: '100%', height: '400px', }} />
76
+    </>
77
+    )
78
+  }
79
+}
80
+
81
+export default StatsChart

+ 72
- 0
src/pages/statistics/building/BuildingStatistic/index.jsx 查看文件

@@ -0,0 +1,72 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Row, Col, Statistic, Icon, Button } from 'antd';
3
+// import IndexEcharts from './components/indexEcharts';
4
+import moment from 'moment';
5
+import request from '@/utils/request';
6
+import apis from '@/services/apis';
7
+import CitySelect from '@/components/SelectButton/CitySelect2';
8
+import TimeSelect from '../../compents/TimeSelect';
9
+import StatsChart from './component/StatsChart';
10
+
11
+const BuildingStatistic = props => {
12
+  const [cityId, setCityId] = useState('');
13
+  const [time, setTime] = useState();
14
+
15
+  const [data, setData] = useState({});
16
+  useEffect(() => {
17
+    if (time) {
18
+      getData({
19
+        cityId: cityId || undefined,
20
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
21
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
22
+      });
23
+    }
24
+  }, [cityId, time]);
25
+  const onTimeChange = e => {
26
+    console.log(e, 'onTimeChange');
27
+    setTime(e);
28
+    // getData({ startDate: e[0], endDate: e[1] });
29
+  };
30
+
31
+  const getData = params => {
32
+    request({
33
+      ...apis.stats.barList,
34
+      params: {
35
+        ...params,
36
+      },
37
+    }).then(data => {
38
+      setData(data);
39
+    });
40
+  };
41
+
42
+  return (
43
+    <Card
44
+      title={<CitySelect value={cityId} onChange={e => setCityId(e)} all />}
45
+      headStyle={{ textAlign: 'left' }}
46
+      extra={<TimeSelect onChange={onTimeChange}></TimeSelect>}
47
+    >
48
+      <div style={{ fontSize: '12px', color: '#ccc', marginBottom: '10px' }}>
49
+        最多显示6个项目,更多项目数据请在下方详细数据中搜索
50
+      </div>
51
+      <div>
52
+        <Row>
53
+          <Col span={12}>
54
+            <StatsChart title="项目公客排行" data={data.gkList} />
55
+          </Col>
56
+          <Col span={12}>
57
+            <StatsChart title="项目私客排行" data={data.skList} />
58
+          </Col>
59
+        </Row>
60
+        <Row>
61
+          <Col span={12}>
62
+            <StatsChart title="项目访问人数排行" subtext="项目详情访问情况" data={data.visitList} />
63
+          </Col>
64
+          <Col span={12}>
65
+            <StatsChart title="成交量排行" data={data.successList} />
66
+          </Col>
67
+        </Row>
68
+      </div>
69
+    </Card>
70
+  );
71
+};
72
+export default BuildingStatistic;

+ 146
- 0
src/pages/statistics/building/detailData/index.jsx 查看文件

@@ -0,0 +1,146 @@
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 moment from 'moment';
5
+import request from '@/utils/request';
6
+import apis from '@/services/apis';
7
+import CitySelect from '@/components/SelectButton/CitySelect2';
8
+import BuildSelect from '@/components/SelectButton/BuildSelect';
9
+import TimeSelect from '../../compents/TimeSelect';
10
+// import StatsChart from './component/StatsChart';
11
+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
+];
57
+
58
+const detailData = props => {
59
+  const [buildingId, setBuildingId] = useState('');
60
+  const [time, setTime] = useState();
61
+
62
+  const [data, setData] = useState({});
63
+  useEffect(() => {
64
+    if (time) {
65
+      getTableData({
66
+        buildingId: buildingId || undefined,
67
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
68
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
69
+      });
70
+    }
71
+  }, [buildingId, time]);
72
+  const onTimeChange = e => {
73
+    console.log(e, 'onTimeChange');
74
+    setTime(e);
75
+    // getData({ startDate: e[0], endDate: e[1] });
76
+  };
77
+  //获取表格数据
78
+  const getTableData = params => {
79
+    request({ ...apis.stats.tableList, params: { ...params } }).then(res => {
80
+      setData(res);
81
+      // this.setState({ ...this.state, tableData: data.records, total: data.total });
82
+    });
83
+  };
84
+  const handleTableChange = (pagination, filters, sorter) => {
85
+    console.log(pagination, filters, sorter);
86
+    // { 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 }
87
+    getTableData({
88
+      buildingId: buildingId || undefined,
89
+      startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
90
+      endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
91
+      pageNum: pagination.current,
92
+      sortField: sorter.columnKey,
93
+      sortOrder: sorter.order,
94
+    });
95
+    // {current:pagination.current, sorter.columnKey, sorter.order})
96
+  };
97
+
98
+  //导出
99
+ const exportBuildingStats = () => {
100
+    request({
101
+      ...apis.stats.buildingExport,
102
+      params: {
103
+        buildingId: buildingId || undefined,
104
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
105
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
106
+      },
107
+    })
108
+      .then(data => {
109
+        if (!data) {
110
+          return;
111
+        }
112
+        const url = window.URL.createObjectURL(new Blob([data]));
113
+        const link = document.createElement('a');
114
+        link.style.display = 'none';
115
+        link.href = url;
116
+        link.setAttribute('download', '项目统计.xlsx');
117
+        document.body.append(link);
118
+        link.click();
119
+      })
120
+      .catch(() => {});
121
+  };
122
+
123
+  return (
124
+    <Card
125
+      title={<BuildSelect value={buildingId} onChange={e => setBuildingId(e)} all />}
126
+      headStyle={{ textAlign: 'left' }}
127
+      extra={<TimeSelect onChange={onTimeChange}></TimeSelect>}
128
+    >
129
+      <div style={{marginBottom:'20px',textAlign:'right'}}>
130
+        <AuthButton name="admin.statistical.building.export" noRight={null}>
131
+          <Button type="primary" onClick={exportBuildingStats}>
132
+            导出
133
+          </Button>
134
+        </AuthButton>
135
+      </div>
136
+      <Table
137
+        dataSource={data?.records || []}
138
+        columns={columns}
139
+        pagination={{ total: data?.total }}
140
+        onChange={handleTableChange}
141
+        scroll={{ y: 500 }}
142
+      ></Table>
143
+    </Card>
144
+  );
145
+};
146
+export default detailData;

+ 25
- 0
src/pages/statistics/building/index.jsx 查看文件

@@ -0,0 +1,25 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Row, Col, Statistic, Icon } from 'antd';
3
+// import IndexEcharts from './components/indexEcharts';
4
+// import Swiper from './swiper/index';
5
+import router from 'umi/router';
6
+import request from '@/utils/request';
7
+import apis from '@/services/apis';
8
+import BuildingStatistic from './BuildingStatistic';
9
+import DetailData from './detailData';
10
+
11
+const building = props => {
12
+  const [data, setData] = useState([]);
13
+
14
+  return (
15
+    <>
16
+      <div style={{ marginBottom: '20px' }}>
17
+        <BuildingStatistic></BuildingStatistic>
18
+      </div>
19
+      <div style={{ marginBottom: '20px' }}>
20
+        <DetailData></DetailData>
21
+      </div>
22
+    </>
23
+  );
24
+};
25
+export default building;

+ 47
- 15
src/pages/statistics/compents/TimeSelect.jsx 查看文件

@@ -1,18 +1,29 @@
1
-import React, { Component, useState, useEffect } from 'react';
1
+import React, { Component, useState, useImperativeHandle,useEffect } from 'react';
2 2
 import { Card, Row, Col, Statistic, Icon, Button, DatePicker } from 'antd';
3 3
 import ButtonGroup from 'antd/lib/button/button-group';
4 4
 import moment from 'moment';
5 5
 
6 6
 const { RangePicker } = DatePicker;
7
-const TimeSelect = props => {
8
-  const { value, onChange=()=>{},buttonType='link' } = props;
7
+
8
+const TimeSelect = React.forwardRef((props, ref) => {
9
+  const { value = 'week', onChange = () => {}, buttonType = 'link' } = props;
9 10
 
10 11
   const [rangePickerValue, setRangePickerValue] = useState();
11 12
   const [type, setType] = useState('week');
12 13
   //   const [rangePickerValue,setRangePickerValue] = useState()
13
-  useEffect(() => {
14
-    // setType('week');
15
-  }, []);
14
+
15
+  useImperativeHandle(ref, () => ({
16
+    reset: () => {
17
+      setType(value);
18
+    },
19
+    // getSearchData: searchData,
20
+  }));
21
+  // useEffect(() => {
22
+  //   // setType('week');
23
+  //   if (value == 'today' || value == 'week' || value == 'month') {
24
+  //     setType(value);
25
+  //   }
26
+  // }, [value]);
16 27
   useEffect(() => {
17 28
     console.log(type);
18 29
     if (type == 'today') {
@@ -47,22 +58,43 @@ const TimeSelect = props => {
47 58
   const selectDate = e => {};
48 59
 
49 60
   const handleRangePickerChange = e => {
61
+    setType('other');
50 62
     onChange(e);
51 63
   };
52 64
 
53 65
   return (
54 66
     <div style={{ display: 'flex' }}>
55 67
       <div>
56
-        <Button type={buttonType} style={type==='today'?undefined:{color:'rgba(0,0,0,0.65)'}} onClick={() => setType('today')}>今日</Button>
57
-        <Button type={buttonType} style={type==='week'?undefined:{color:'rgba(0,0,0,0.65)'}} onClick={() => setType('week')}>最近一周</Button>
58
-        <Button type={buttonType} style={type==='month'?undefined:{color:'rgba(0,0,0,0.65)'}} onClick={() => setType('month')}>最近一月</Button>
68
+        <Button
69
+          type={buttonType}
70
+          style={type === 'today' ? undefined : { color: 'rgba(0,0,0,0.65)' }}
71
+          onClick={() => setType('today')}
72
+        >
73
+          今日
74
+        </Button>
75
+        <Button
76
+          type={buttonType}
77
+          style={type === 'week' ? undefined : { color: 'rgba(0,0,0,0.65)' }}
78
+          onClick={() => setType('week')}
79
+        >
80
+          最近一周
81
+        </Button>
82
+        <Button
83
+          type={buttonType}
84
+          style={type === 'month' ? undefined : { color: 'rgba(0,0,0,0.65)' }}
85
+          onClick={() => setType('month')}
86
+        >
87
+          最近一月
88
+        </Button>
89
+      </div>
90
+      <div>
91
+        <RangePicker
92
+          value={rangePickerValue}
93
+          onChange={handleRangePickerChange}
94
+          style={{ width: 256 }}
95
+        />
59 96
       </div>
60
-      <RangePicker
61
-        value={rangePickerValue}
62
-        onChange={handleRangePickerChange}
63
-        style={{ width: 256 }}
64
-      />
65 97
     </div>
66 98
   );
67
-};
99
+});
68 100
 export default TimeSelect;

+ 314
- 0
src/pages/statistics/consultant/index.jsx 查看文件

@@ -0,0 +1,314 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+import { Card, Row, Col, Button, Icon, Table } 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 Count from './components/Count';
13
+// import SourceRole from './components/SourceRole';
14
+// import UserSex from './components/UserSex';
15
+// import UserConversion from './components/UserConversion';
16
+// import BuildingStatistic from './BuildingStatistic';
17
+import AuthButton from '@/components/AuthButton';
18
+const clickCon = (val, record, type) => {
19
+  if (val == 0) {
20
+    return (
21
+      <>
22
+        <span>{val}</span>
23
+      </>
24
+    );
25
+  }
26
+  return (
27
+    <>
28
+      <span style={{ color: '#1D74D9', cursor: 'pointer' }} onClick={() => toDetail(record, type)}>
29
+        {val}
30
+      </span>
31
+    </>
32
+  );
33
+};
34
+
35
+const consultant = props => {
36
+  const [data, setData] = useState({});
37
+  const [totalRow, setTotalRow] = useState({});
38
+
39
+  const [time, setTime] = useState();
40
+  const [buildingValue, setBuildingValue] = useState();
41
+
42
+  useEffect(() => {
43
+    if (time) {
44
+      getList({
45
+        buildingId: buildingValue,
46
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
47
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
48
+      });
49
+    }
50
+  }, [time, buildingValue]);
51
+
52
+  // 查询列表
53
+  const getList = params => {
54
+    // updataLoading(true);
55
+
56
+    request({ ...apis.stats.consultantKPI, params: { ...params } })
57
+      .then(data => {
58
+        setData(data.paged);
59
+        setTotalRow(data.total);
60
+        // updataLoading(false);
61
+      })
62
+      .catch(err => {
63
+        // updataLoading(false);
64
+      });
65
+  };
66
+
67
+  const columns = [
68
+    {
69
+      title: '项目',
70
+      dataIndex: 'buildingName',
71
+      key: 'buildingName',
72
+      align: 'center',
73
+      render: (txt, _, index) => (index ? txt : <span>总计</span>),
74
+    },
75
+
76
+    {
77
+      title: '置业顾问名称',
78
+      dataIndex: 'userName',
79
+      key: 'userName',
80
+      align: 'center',
81
+    },
82
+    {
83
+      title: '置业顾问电话',
84
+      dataIndex: 'phone',
85
+      key: 'phone',
86
+      align: 'center',
87
+    },
88
+    {
89
+      title: '客户总计',
90
+      dataIndex: 'totalPersons',
91
+      key: 'totalPersons',
92
+      align: 'center',
93
+      sorter: true,
94
+
95
+      render: (txt, record, index) =>
96
+        index ? clickCon(txt, record, 'totalPersons') : <strong>{txt}</strong>,
97
+    },
98
+    {
99
+      title: '新增客户',
100
+      dataIndex: 'newPersons',
101
+      key: 'newPersons',
102
+      align: 'center',
103
+      sorter: true,
104
+
105
+      render: (txt, record, index) =>
106
+        index ? clickCon(txt, record, 'newPersons') : <strong>{txt}</strong>,
107
+    },
108
+    {
109
+      title: '分享次数',
110
+      dataIndex: 'shareNum',
111
+      key: 'shareNum',
112
+      align: 'center',
113
+      sorter: true,
114
+
115
+      render: (txt, record, index) =>
116
+        index ? clickCon(txt, record, 'shareNum') : <strong>{txt}</strong>,
117
+    },
118
+    {
119
+      title: '分享访问人数',
120
+      dataIndex: 'visitPersons',
121
+      key: 'visitPersons',
122
+      align: 'center',
123
+      sorter: true,
124
+
125
+      render: (txt, record, index) =>
126
+        index ? clickCon(txt, record, 'visitPersons') : <strong>{txt}</strong>,
127
+    },
128
+    {
129
+      title: '分享访问次数',
130
+      dataIndex: 'visitNum',
131
+      key: 'visitNum',
132
+      align: 'center',
133
+      sorter: true,
134
+
135
+      render: (txt, record, index) =>
136
+        index ? clickCon(txt, record, 'visitNum') : <strong>{txt}</strong>,
137
+    },
138
+
139
+    {
140
+      title: '分享拓客',
141
+      dataIndex: 'sharePersons',
142
+      key: 'sharePersons',
143
+      align: 'center',
144
+      sorter: true,
145
+
146
+      render: (txt, record, index) =>
147
+        index ? clickCon(txt, record, 'sharePersons') : <strong>{txt}</strong>,
148
+    },
149
+    {
150
+      title: '主页访问人数',
151
+      dataIndex: 'homePagePersons',
152
+      key: 'homePagePersons',
153
+      align: 'center',
154
+      sorter: true,
155
+
156
+      render: (txt, record, index) =>
157
+        index ? clickCon(txt, record, 'homePagePersons') : <strong>{txt}</strong>,
158
+    },
159
+    {
160
+      title: '主页访问次数',
161
+      dataIndex: 'homePageNums',
162
+      key: 'homePageNums',
163
+      align: 'center',
164
+      sorter: true,
165
+
166
+      render: (txt, record, index) =>
167
+        index ? clickCon(txt, record, 'homePageNums') : <strong>{txt}</strong>,
168
+    },
169
+    {
170
+      title: '咨询数',
171
+      dataIndex: 'chatPersons',
172
+      key: 'chatPersons',
173
+      align: 'center',
174
+      sorter: true,
175
+
176
+      render: (txt, record, index) =>
177
+        index ? clickCon(txt, record, 'chatPersons') : <strong>{txt}</strong>,
178
+    },
179
+    {
180
+      title: '点赞数',
181
+      dataIndex: 'favorNum',
182
+      key: 'favorNum',
183
+      align: 'center',
184
+      sorter: true,
185
+
186
+      render: (txt, record, index) =>
187
+        index ? clickCon(txt, record, 'favorNum') : <strong>{txt}</strong>,
188
+    },
189
+  ];
190
+
191
+  const toAddVisitNum = record => {
192
+    router.push({
193
+      pathname: '/activity/SignupActivity/registrationRecord',
194
+      query: {
195
+        dynamicId: record.dynamicId,
196
+      },
197
+    });
198
+  };
199
+
200
+  //排序
201
+  const handleChange = (pagination, filters, sorter) => {
202
+    console.log(pagination, filters, sorter);
203
+    // Desc  和asc
204
+    const sortType =
205
+      sorter.order == 'ascend' ? 'asc' : sorter.order == 'descend' ? 'Desc' : undefined;
206
+    getTableList({
207
+      buildingId: buildingValue,
208
+      startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
209
+      endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
210
+      pageNum: pagination.current,
211
+      pageSize: pagination.pageSize,
212
+      sortType: sortType,
213
+      sortField: sorter.columnKey,
214
+    });
215
+  };
216
+
217
+  function getTableList(params) {
218
+    request({
219
+      ...apis.activityDataStatis.activityDetailTableData,
220
+      params: {
221
+        ...params,
222
+      },
223
+    })
224
+      .then(data => {
225
+        console.log(data);
226
+        setData(data);
227
+        // this.setState({ tableData: data.records, total: data.total });
228
+      })
229
+      .catch();
230
+  }
231
+
232
+  const onTimeChange = e => {
233
+    setTime(e);
234
+  };
235
+
236
+  // 下载文档
237
+  function download(data) {
238
+    if (!data) {
239
+      return;
240
+    }
241
+    const url = window.URL.createObjectURL(new Blob([data]));
242
+    const link = document.createElement('a');
243
+    link.style.display = 'none';
244
+    link.href = url;
245
+    link.setAttribute('download', '置业顾问KPI.xlsx');
246
+    document.body.append(link);
247
+    link.click();
248
+  }
249
+  // 导出
250
+  function exportRecord() {
251
+    updataBtnloading(true);
252
+    request({
253
+      ...apis.stats.exportConsultantKPI,
254
+      responseType: 'blob',
255
+      params: {
256
+        buildingId: buildingValue,
257
+        startDate: moment(time[0]).format('YYYY-MM-DDT00:00:00.000') + 'Z',
258
+        endDate: moment(time[1]).format('YYYY-MM-DDT23:59:59.999') + 'Z',
259
+      },
260
+    })
261
+      .then(response => {
262
+        download(response);
263
+        updataBtnloading(false);
264
+      })
265
+      .catch(error => {
266
+        updataBtnloading(false);
267
+      });
268
+  }
269
+
270
+  const list = data.records;
271
+  const _list = list && list.length > 0 ? [totalRow, ...list] : [];
272
+  let row = 0;
273
+  return (
274
+    <Card
275
+      title={<BuildingSelect value={buildingValue} onChange={e => setBuildingValue(e)} all />}
276
+      headStyle={{ textAlign: 'left' }}
277
+      extra={<TimeSelect onChange={onTimeChange}></TimeSelect>}
278
+    >
279
+      <div>
280
+        <AuthButton name="admin.statistical.consultant.export" noRight={null}>
281
+          <Button
282
+            type="primary"
283
+            onClick={exportRecord}
284
+            // loading={btnloading}
285
+            style={{ float: 'right', margin: '20px 23px 20px 0', zIndex: 1 }}
286
+          >
287
+            导出
288
+          </Button>
289
+        </AuthButton>
290
+      </div>
291
+      <Table
292
+        rowKey={record => data.current * data.size + row++}
293
+        style={{ marginTop: '30px' }}
294
+        dataSource={_list}
295
+        // dataSource={data.records}
296
+        columns={columns}
297
+        pagination={{ current: data?.current, total: data?.total }}
298
+        onChange={handleChange}
299
+        // onChange={handleChange}
300
+        // loading={loading}
301
+      />
302
+      {/* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
303
+        <Pagination
304
+          showQuickJumper
305
+          defaultCurrent={1}
306
+          total={data.total}
307
+          onChange={changePageNum}
308
+          current={data.current}
309
+        />
310
+      </div> */}
311
+    </Card>
312
+  );
313
+};
314
+export default consultant;

+ 4
- 4
src/pages/statistics/dataReport/components/IntentionalCustomers.jsx 查看文件

@@ -38,9 +38,9 @@ const UserBehavior = props => {
38 38
   const [buildingId, setBuildingId] = useState();
39 39
 
40 40
   useEffect(() => {
41
-    IntentionUsers({ pageNum: 1, pageSize: 5 });
41
+    IntentionUsers({ buildingId:buildingId,pageNum: 1, pageSize: 5 });
42 42
     // getUserBehaviorProfile(formatDate(props.startDate, props.endDate))
43
-  }, []);
43
+  }, [buildingId]);
44 44
   function IntentionUsers(params) {
45 45
     request({
46 46
       ...apis.indexEcharts.intentionUsers,
@@ -85,8 +85,8 @@ const UserBehavior = props => {
85 85
   ];
86 86
 
87 87
   function handleBuildingChange(e) {
88
-    console.log(e, '-----');
89
-    IntentionUsers({ pageNum: 1, pageSize: 5, buildingId: e });
88
+    console.log(e, '--eeeeww---');
89
+    // IntentionUsers({ pageNum: 1, pageSize: 5, buildingId: e });
90 90
     setBuildingId(e);
91 91
   }
92 92
 

+ 0
- 1
src/pages/statistics/dataReport/components/NewUsers.jsx 查看文件

@@ -100,7 +100,6 @@ const NewUsers = props => {
100 100
 
101 101
   return (
102 102
     <Layout>
103
-      {' '}
104 103
       <EChart options={options} style={piestyles} />
105 104
     </Layout>
106 105
   );

+ 65
- 57
src/pages/statistics/dataReport/components/UserBehavior.jsx 查看文件

@@ -4,13 +4,12 @@ import request from '@/utils/request';
4 4
 import apis from '@/services/apis';
5 5
 import moment from 'moment';
6 6
 import router from 'umi/router';
7
-import 'echarts/lib/component/dataZoom'
7
+import 'echarts/lib/component/dataZoom';
8 8
 import { Table, Select, Row, Col, Menu, Dropdown, Button, Icon, message, Modal, Card } from 'antd';
9
-import BuildSelect from '@/components/SelectButton/BuildSelect'
9
+import BuildSelect from '@/components/SelectButton/BuildSelect';
10 10
 
11 11
 const { Option } = Select;
12 12
 
13
-
14 13
 const eventcolumns = [
15 14
   {
16 15
     title: '编号',
@@ -43,71 +42,85 @@ const eventcolumns = [
43 42
       </>
44 43
     ),
45 44
   },
46
-]
47
-
48
-
45
+];
49 46
 
50 47
 const formatDate = (start, end) => {
51
-  const startDate = `${moment(start).format('YYYY-MM-DDT00:00:00.000')}Z`
52
-  const endDate = `${moment(end).format('YYYY-MM-DDT23:59:59.999')}Z`
53
-  return { startDate, endDate }
54
-}
48
+  const startDate = `${moment(start).format('YYYY-MM-DDT00:00:00.000')}Z`;
49
+  const endDate = `${moment(end).format('YYYY-MM-DDT23:59:59.999')}Z`;
50
+  return { startDate, endDate };
51
+};
55 52
 const UserBehaviorIndex = props => {
56
-    const { startDate = moment().subtract(7, 'day').format('YYYY-MM-DD'), endDate = moment().format('YYYY-MM-DD') } = props;
57
-  const [data, setData] = useState({ records: [] })
58
-  const [visibleData, setVisibleData] = useState({ visible: false, row: {} })
59
-  const [buildingId, setBuildingId] = useState('')
53
+  const {
54
+    startDate = moment()
55
+      .subtract(60, 'day')
56
+      .format('YYYY-MM-DD'),
57
+    endDate = moment().format('YYYY-MM-DD'),
58
+  } = props;
59
+  const [data, setData] = useState({ records: [] });
60
+  const [visibleData, setVisibleData] = useState({ visible: false, row: {} });
61
+  const [buildingId, setBuildingId] = useState('');
60 62
 
61 63
   // 柱图
62 64
   useEffect(() => {
63
-    const date = formatDate(startDate, endDate)
65
+    const date = formatDate(startDate, endDate);
64 66
     getUserBehaviorSummary({
65 67
       ...date,
66 68
       activity: props.activity,
67 69
       event: props.event,
68 70
       eventType: props.eventType,
69 71
       buildingId: props.buildingId,
70
-    })
72
+    });
71 73
     // getUserBehaviorProfile(formatDate(props.startDate, props.endDate))
72
-  }, [startDate, endDate, props.activity, props.event, props.eventType, props.buildingId])
74
+  }, [startDate, endDate, props.activity, props.event, props.eventType, props.buildingId]);
73 75
 
74
-  const [recordList, setList] = useState([])
76
+  const [recordList, setList] = useState([]);
75 77
   function getUserBehaviorSummary(params) {
76 78
     request({
77 79
       ...apis.indexEcharts.userBehavior.tsUserBehavior,
78 80
       params,
79 81
     }).then(data => {
80
-      setData(data || {})
82
+      setData(data || {});
81 83
       // setList((data.data.records || []).filter(e => e.activity !== '客户'))
82
-    })
84
+    });
83 85
   }
84 86
 
85
-
86
-  const seriesMaker = (data.selectUserBehavior || []).filter(e => e.activity !== '客户' && e.activity !== '首页').reduce((series, item) => {
87
-    let { date, activityCount, activity } = item
88
-    date = moment(date).format('YYYY-MM-DD')
89
-    if (!activityCount) activityCount = 0
90
-
91
-    // 使用对象, 可以去重
92
-    series[`${activity}`] = (series[`${activity}`] || []).concat([[date, activityCount]])
93
-
94
-    return series;
95
-  }, {})
96
-
97
-
98
-  const dataZoom = props.dataZoom ? [
99
-    {
100
-      type: 'inside',
101
-      start: 0,
102
-      end: 100,
103
-    },
104
-    {
105
-      type: 'slider',
106
-      start: 0,
107
-      end: 100,
108
-    },
109
-  ] : undefined
110
-
87
+  const seriesMaker = (data.selectUserBehavior || [])
88
+    .filter(
89
+      e =>
90
+        e.activity !== '客户' &&
91
+        e.activity !== '首页' &&
92
+        e.activity !== 'H5' &&
93
+        e.activity !== '房源' &&
94
+        e.activity !== '其他'&&
95
+        e.activity !== '咨询'&&
96
+        e.activity !== '个人中心',
97
+    )
98
+    .reduce((series, item) => {
99
+      let { date, activityCount, activity } = item;
100
+      date = moment(date).format('YYYY-MM-DD');
101
+      if (!activityCount) activityCount = 0;
102
+
103
+      // 使用对象, 可以去重
104
+      series[`${activity}`] = (series[`${activity}`] || []).concat([[date, activityCount]]);
105
+
106
+      return series;
107
+    }, {});
108
+  console.log(seriesMaker, 'seriesMaker----');
109
+
110
+  const dataZoom = props.dataZoom
111
+    ? [
112
+        {
113
+          type: 'inside',
114
+          start: 0,
115
+          end: 100,
116
+        },
117
+        {
118
+          type: 'slider',
119
+          start: 0,
120
+          end: 100,
121
+        },
122
+      ]
123
+    : undefined;
111 124
 
112 125
   const options = {
113 126
     title: {},
@@ -130,20 +143,15 @@ const UserBehaviorIndex = props => {
130 143
       name: x,
131 144
       data: seriesMaker[x],
132 145
     })),
133
-  }
134
-
135
-
136
-
146
+  };
137 147
 
138 148
   return (
139 149
     <>
140
-       <Card title="用户行为" headStyle={{ textAlign: 'left' }}>
141
-
142
-        <EChart options={options}  />
150
+      <Card title="用户行为" headStyle={{ textAlign: 'left' }}>
151
+        <EChart options={options} />
143 152
       </Card>
144
-      
145 153
     </>
146
-  )
147
-}
154
+  );
155
+};
148 156
 
149
-export default UserBehaviorIndex
157
+export default UserBehaviorIndex;

+ 2
- 2
src/pages/statistics/dataReport/components/UserSex.jsx 查看文件

@@ -71,10 +71,10 @@ const UserSource = props => {
71 71
         show: false,
72 72
       },
73 73
       data: [
74
-        { name: '男', value: data.maleNum||0 },
74
+        { name: '男', value: data?.maleNum||0 },
75 75
         {
76 76
           name: '女',
77
-          value: data.femaleNum||0,
77
+          value: data?.femaleNum||0,
78 78
         },
79 79
       ],
80 80
     },

+ 1
- 1
src/pages/statistics/dataReport/components/userSource.jsx 查看文件

@@ -28,7 +28,7 @@ const UserSource = props => {
28 28
       ...apis.indexEcharts.selectPersonFrom,
29 29
       params,
30 30
     }).then(data => {
31
-      console.log(data, '222222');
31
+
32 32
       setxData(data.tdWxDicts.map(x => x.sceneAlias));
33 33
       setFromData(data.tdWxDicts.map(x => x.fromData));
34 34
       setRegisterData(data.tdWxDicts.map(x => x.registerSum));