周立森 5 лет назад
Родитель
Сommit
3067792de3

+ 11
- 55
config/config.js Просмотреть файл

@@ -122,11 +122,6 @@ export default {
122 122
                   name: '项目列表',
123 123
                   component: './building/list/index',
124 124
                 },
125
-                {
126
-                  path: '/building/list/add',
127
-                  name: '', // 项目添加
128
-                  component: './building/list/add/index',
129
-                },
130 125
                 {
131 126
                   path: '/building/type',
132 127
                   name: '项目类型',
@@ -149,11 +144,6 @@ export default {
149 144
                   name: '客户列表',
150 145
                   component: './customer/customerlist/index',
151 146
                 },
152
-                {
153
-                  path: '/customer/customerlist/customerDetail',
154
-                  name: '',
155
-                  component: './customer/customerlist/customerDetail',
156
-                },
157 147
                 {
158 148
                   path: '/customer/drift/list',
159 149
                   name: '游客列表',
@@ -275,11 +265,6 @@ export default {
275 265
                   name: '资讯列表',
276 266
                   component: './news/list/NewsList',
277 267
                 },
278
-                {
279
-                  path: '/news/list/editNewsList',
280
-                  name: '',
281
-                  component: './news/list/editNewsList',
282
-                },
283 268
               ],
284 269
             },
285 270
             {
@@ -304,6 +289,7 @@ export default {
304 289
                 },
305 290
               ],
306 291
             },
292
+
307 293
             {
308 294
               path: '/staff',
309 295
               name: '员工管理',
@@ -319,7 +305,7 @@ export default {
319 305
                   name: '',
320 306
                   component: './staff/list/editStaff',
321 307
                 },
322
-
308
+             
323 309
                 {
324 310
                   path: '/staff/RoleList',
325 311
                   name: '角色管理',
@@ -330,51 +316,21 @@ export default {
330 316
                   name: '',
331 317
                   component: './staff/list/editRole',
332 318
                 },
333
-
319
+             
334 320
               ],
335 321
             },
336 322
             {
337
-              path: '/carouselFigure',
338
-              name: '轮播图管理',
323
+              path: '/indexEcharts',
324
+              name: 'echarts',
339 325
               component: '../layouts/BlankLayout',
340 326
               routes: [
341 327
                 {
342
-                  path: '/carouselFigure/carouselFigureList',
343
-                  name: '轮播图列表',
344
-                  component: './carouselFigure/carouselFigureList',
345
-                },
346
-                {
347
-                  path: '/carouselFigure/editCarousel',
348
-                  name: '',
349
-                  component: './carouselFigure/editCarousel',
350
-                },
351
-                {
352
-                  path: '/carouselFigure/advertisingList',
353
-                  name: '开屏广告',
354
-                  component: './carouselFigure/advertisingList',
355
-                },
356
-                {
357
-                  path: '/carouselFigure/editAdvertising',
358
-                  name: '',
359
-                  component: './carouselFigure/editAdvertising',
360
-                },
361
-              ],
362
-            },
363
-            {
364
-              path: '/system',
365
-              name: '系统管理',
366
-              component: '../layouts/BlankLayout',
367
-              routes: [
368
-                {
369
-                  path: '/system/messageList',
370
-                  name: '客户留言',
371
-                  component: './system/messageList',
372
-                },
373
-                {
374
-                  path: '/system/report',
375
-                  name: '报表数据',
376
-                  component: './system/report',
328
+                  path: '/indexEcharts/index',
329
+                  name: '报表',
330
+                  component: './indexEcharts/index',
377 331
                 },
332
+                
333
+
378 334
               ],
379 335
             },
380 336
             {
@@ -440,7 +396,7 @@ export default {
440 396
 
441 397
   proxy: {
442 398
     '/api/': {
443
-      target: 'http://127.0.0.1:8080/',
399
+      target: 'http://192.168.0.11:8080/',
444 400
       changeOrigin: true,
445 401
       // pathRewrite: { '^/server': '' },
446 402
     },

+ 2
- 0
package.json Просмотреть файл

@@ -45,6 +45,7 @@
45 45
     "@antv/data-set": "^0.10.2",
46 46
     "antd": "^3.20.0",
47 47
     "classnames": "^2.2.6",
48
+    "dayjs": "^1.8.16",
48 49
     "dva": "^2.4.1",
49 50
     "echarts": "^4.3.0",
50 51
     "lodash": "^4.17.11",
@@ -68,6 +69,7 @@
68 69
     "@ant-design/colors": "^3.1.0",
69 70
     "@ant-design/pro-cli": "^1.0.0",
70 71
     "@types/classnames": "^2.2.7",
72
+    "@types/echarts": "^4.1.14",
71 73
     "@types/express": "^4.17.0",
72 74
     "@types/history": "^4.7.2",
73 75
     "@types/jest": "^24.0.13",

+ 160
- 0
src/pages/indexEcharts/components/UserSource.jsx Просмотреть файл

@@ -0,0 +1,160 @@
1
+import React, { Component, useState, useEffect } from 'react';
2
+
3
+// 引入 ECharts 主模块
4
+import echarts from 'echarts/lib/echarts';
5
+// 引入环形图
6
+import 'echarts/lib/chart/pie';
7
+import 'echarts/lib/chart/bar'
8
+
9
+// 引入提示框和标题组件
10
+import 'echarts/lib/component/tooltip';
11
+import 'echarts/lib/component/title';
12
+import 'echarts/lib/component/visualMap';
13
+import request from '../../../utils/request';
14
+import apis from '../../../services/apis';
15
+import dayjs from 'dayjs';
16
+
17
+
18
+// 
19
+class UserSource extends React.Component {
20
+
21
+  state = {
22
+    piedata: {},
23
+    loading: false,
24
+    dataset: {},
25
+    reportOpts: {
26
+      legend: {},
27
+      color: ['#286DD0', '#8565CE', '#6A96F8', '#F5749E', '#8B7FE2'],
28
+      tooltip: {},
29
+      yAxis: {},
30
+      grid: [
31
+        { right: '50%' },
32
+        { right: '5%' }
33
+      ],
34
+    },
35
+    userType: 'all',
36
+    tableTitle: ['日期'],
37
+  }
38
+
39
+
40
+
41
+  initCharts = () => {
42
+
43
+
44
+
45
+    console.log(this.dataset, '5555')
46
+    // 基于准备好的dom,初始化echarts实例
47
+    var myChart = echarts.init(document.getElementById('usersourcebar'));
48
+    const source = this.dataset.columnar || [];
49
+
50
+    // 柱图
51
+    const barOptions = {
52
+
53
+
54
+      xAxis: { type: 'category' },
55
+      legend: {
56
+        left: '20%',
57
+        data: ['所有用户', '注册用户'],
58
+      },
59
+      series: [
60
+        { type: 'bar', name: '所有用户', datasetIndex: 0 },
61
+        { type: 'bar', name: '注册用户' },
62
+      ],
63
+      dataset: {
64
+        id: 'bar',
65
+        dimensions: ['fromName', 'userCount', 'registered'],
66
+        source: source,
67
+      },
68
+
69
+    };
70
+    const { person_estate_agent = 0, person_null = 0, person_realty_consultant = 0 } = this.dataset.pie || {};
71
+    const pieOptions = {
72
+
73
+
74
+      xAxis: {},
75
+      legend: {
76
+        left: '70%',
77
+        data: ['来源置业顾问', '来源全民经纪人', '自主进入'],
78
+      },
79
+      series: [
80
+        {
81
+          type: 'pie',
82
+          datasetIndex: 1,
83
+          center: ['75%', '50%'],
84
+          radius: [0, '50%'],
85
+        },
86
+      ],
87
+      dataset: {
88
+        id: 'pie',
89
+        source: [
90
+          { form: '来源置业顾问', value: person_realty_consultant },
91
+          { form: '来源全民经纪人', value: person_estate_agent },
92
+          { form: '自主进入', value: person_null },
93
+        ]
94
+      },
95
+
96
+    };
97
+    // 绘制图表
98
+    myChart.setOption({
99
+      // ...this.reportOpts,
100
+      xAxis: { type: 'category' },
101
+        legend: {
102
+          left: '20%',
103
+          data: ['所有用户', '注册用户'],
104
+        },
105
+        series: [
106
+          { type: 'bar', name: '所有用户', datasetIndex: 0 },
107
+          { type: 'bar', name: '注册用户' },
108
+        ],
109
+        dataset: {
110
+          id: 'bar',
111
+          dimensions: [ 'fromName', 'userCount', 'registered' ],
112
+          source: source,
113
+        },
114
+    });
115
+
116
+
117
+  }
118
+
119
+
120
+  componentDidMount () {
121
+    this.initCharts();
122
+  }
123
+  componentDidUpdate () {  //当图表切换的时候,重新执行
124
+    this.initCharts();
125
+  }
126
+
127
+
128
+
129
+  render () {
130
+    this.piedata = this.props.data;
131
+    this.dataset = this.piedata || {};
132
+
133
+    return (
134
+
135
+
136
+      <div>
137
+        {/* 饼图 */}
138
+
139
+        {/* <div class="chart-box" v-if="mode == 'all' || mode == 'report'">
140
+      <h3>用户来源 <small>{{subtitle}}</small></h3>
141
+      <v-chart v-loading="loading" class="chart" options="options" />
142
+    </div>
143
+    <div class="chart-box" v-if="mode == 'all' || mode == 'table'">
144
+      <el-select v-model="userType">
145
+        <el-option label="所有用户" value="all"></el-option>
146
+        <el-option label="注册用户" value="registered"></el-option>
147
+      </el-select>
148
+      <el-table v-loading="loading" data="tableData"  border  center  style="width: 100%; margin-top: 16px" height="400">
149
+        <el-table-column v-for="(item, index) in tableTitle" key="index" label="item" prop="index == 0 ? 'label' : item"></el-table-column>
150
+      </el-table>
151
+    </div> */}
152
+
153
+        <div id="usersourcebar" style={{ width: '1060px', height: '560px' }}></div>
154
+
155
+      </div>
156
+    );
157
+  }
158
+}
159
+
160
+export default UserSource;

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

@@ -0,0 +1,50 @@
1
+
2
+import React, { useState, useEffect }  from 'react';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Row, Col, Tag, Pagination, Modal, DatePicker } from 'antd';
4
+import { FormattedMessage } from 'umi-plugin-react/locale';
5
+// import styles from '../../style/GoodsList.less';
6
+import router from 'umi/router';
7
+
8
+import request from '../../utils/request'
9
+import apis from '../../services/apis';
10
+// import Styles from './style.less';/
11
+import UserSource from './components/UserSource.jsx';
12
+
13
+
14
+
15
+
16
+const header = (props) => {
17
+  const [ data, setData ] = useState({records: []})
18
+  //柱图
19
+  
20
+  useEffect(() => {
21
+    userResource()
22
+  }, [])
23
+  
24
+  function userResource() {
25
+        request({
26
+          ...apis.indexEcharts.userResource,
27
+           params: { pageNum: 1, pageSize:9999}
28
+        }).then((data) => {
29
+            // console.log(data , '3333')
30
+            setData(data)
31
+        })
32
+      }
33
+
34
+  
35
+
36
+  
37
+
38
+
39
+
40
+  const { getFieldDecorator } = props.form
41
+  return (
42
+
43
+    <>
44
+     <UserSource data={data} ></UserSource>
45
+    </>
46
+  )
47
+}
48
+const WrappedHeader = Form.create({ name: 'header' })(header);
49
+
50
+export default WrappedHeader

+ 1
- 1
src/pages/staff/list/StaffList.jsx Просмотреть файл

@@ -146,7 +146,7 @@ function CartBody (props) {
146 146
             data.labels.map((item, index) => {
147 147
               const color = colors[item];
148 148
               console.log(color, '------');
149
-              return <Tag className={Styles.cardTag}  color = {color}>{item}</Tag>
149
+              return <Tag className={Styles.cardTag} color={color}>{item}</Tag>
150 150
             })
151 151
           }
152 152
         </span>

+ 11
- 11
src/pages/staff/list/editRole.jsx Просмотреть файл

@@ -132,27 +132,27 @@ const Edit = (props) => {
132 132
       textAlign: 'left',
133 133
     };
134 134
 
135
-{/* <Checkbox>{Permission[index]}</Checkbox> */}
135
+    {/* <Checkbox>{Permission[index]}</Checkbox> */ }
136 136
     return <>
137 137
       <div style={{}}>
138 138
 
139 139
         {Permission.map((item, index) => (
140 140
 
141 141
 
142
-          <Card title={<Checkbox>{Permission[index]}</Checkbox>} bordered={true} style={{ width: '100%' }}>
143
-            
144
-              {dataSource.map((items, indexs) => (
142
+          <Card title={<Checkbox value=''>{Permission[index]}</Checkbox>} bordered={true} style={{ width: '100%' }}>
143
+
144
+            {dataSource.map((items, indexs) => (
145 145
               <>
146
-                <Card.Grid style={gridStyle1}><Checkbox>{items.name}</Checkbox></Card.Grid>
147
-                
146
+                <Card.Grid style={gridStyle1}><Checkbox value=''>{items.name}</Checkbox></Card.Grid>
147
+
148 148
                 <Card.Grid style={gridStyle2}>
149
-                {items.per.map((itemss,indexss) =>(
150
-                  <Checkbox>{items.per[indexss]}</Checkbox>
151
-                ))}
149
+                  {items.per.map((itemss, indexss) => (
150
+                    <Checkbox value=''>{items.per[indexss]}</Checkbox>
151
+                  ))}
152 152
                 </Card.Grid>
153
-                </>
153
+              </>
154 154
             ))}
155
-            
155
+
156 156
           </Card>
157 157
 
158 158
 

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

@@ -109,4 +109,55 @@ export default {
109 109
       url: `${prefix}/customer/recommend/get/id`,
110 110
     },
111 111
   },
112
+  indexEcharts: {
113
+    userResource: {
114
+      method: 'GET',
115
+      url: `${prefix}/selectUserResource`
116
+    },
117
+
118
+  }
119
+  // indexEcharts:{
120
+  //   list:{
121
+  //     method:'get',
122
+  //     url: `${commPrefix}/indexStatistical`
123
+  //   },
124
+  //   userResource: {
125
+  //       method:'get',
126
+  //       url: `${commPrefix}/selectUserResource`
127
+  //   },
128
+  //   userConversion: {
129
+  //     method:'get',
130
+  //     url: `${commPrefix}/selectConversion`
131
+  //   },
132
+  //   userActive: {
133
+  //     method:'get',
134
+  //     url: `${commPrefix}/selectActiveUserCount`
135
+  //   },
136
+  //   newUser: {
137
+  //     method:'get',
138
+  //     url: `${commPrefix}/selectNewsUserCount`
139
+  //   },
140
+  //   userBehavior: {
141
+  //     summary: {
142
+  //       method:'get',
143
+  //       url: `${commPrefix}/selectUserBehavior`
144
+  //     },
145
+  //     profile: {
146
+  //       method:'get',
147
+  //       url: `${commPrefix}/selectEventAll`
148
+  //     },
149
+  //   },
150
+  //   intentionUsers: {
151
+  //     method:'get',
152
+  //     url: `${commPrefix}/selectIntentionUser`
153
+  //   },
154
+  //   userSex: {
155
+  //     method:'get',
156
+  //     url: `${commPrefix}/selectSexUser`
157
+  //   },
158
+  //   userCity: {
159
+  //     method:'get',
160
+  //     url: `${commPrefix}/selectCityUser`
161
+  //   },
162
+  // },
112 163
 }