xujing 5 年之前
父節點
當前提交
467f0f3009
共有 2 個文件被更改,包括 118 次插入118 次删除
  1. 31
    31
      src/pages/statistical/building/component/StatsChart.jsx
  2. 87
    87
      src/pages/statistical/building/index.jsx

+ 31
- 31
src/pages/statistical/building/component/StatsChart.jsx 查看文件

@@ -13,50 +13,50 @@ class StatsChart extends React.Component {
13 13
   }
14 14
 
15 15
   render() {
16
-    const { data = {}} = this.props
16
+    const { data = {} } = this.props
17 17
     const options = {
18 18
       title: {
19 19
         text: this.props.title,
20 20
         subtext: this.props.subtext,
21
-    },
22
-    xAxis: {
21
+      },
22
+      xAxis: {
23 23
         type: 'category',
24
-        axisLabel: {rotate: 45},
24
+        axisLabel: { rotate: 45 },
25 25
         data: data.buildingNameList || []
26
-    },
27
-    grid: {
28
-      bottom:'30%'
29
-    },  
30
-    tooltip: {},
31
-    yAxis: {
26
+      },
27
+      grid: {
28
+        bottom: '30%'
29
+      },
30
+      tooltip: {},
31
+      yAxis: {
32 32
         type: 'value'
33
-    },
34
-    series: {
35
-      type: 'bar',
36
-      name: this.props.title,
37
-      barWidth: 50,
38
-      data: data.numList || [],
39
-      itemStyle: {
40
-        normal: {
41
-          barBorderRadius: [50, 50, 0, 0],
42
-          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
43
-            offset: 0,
44
-            color: '#FD8A95'
45
-          }, {
46
-            offset: 1,
47
-            color: '#F13043'
48
-          }]),
49
-          shadowColor: 'rgba(0, 0, 0, 0.4)',
33
+      },
34
+      series: {
35
+        type: 'bar',
36
+        name: this.props.title,
37
+        barWidth: 50,
38
+        data: data.numList || [],
39
+        itemStyle: {
40
+          normal: {
41
+            barBorderRadius: [50, 50, 0, 0],
42
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
43
+              offset: 0,
44
+              color: '#FD8A95'
45
+            }, {
46
+              offset: 1,
47
+              color: '#F13043'
48
+            }]),
49
+            shadowColor: 'rgba(0, 0, 0, 0.4)',
50 50
 
51
+          }
51 52
         }
52 53
       }
53 54
     }
54
-}
55 55
 
56 56
     return (
57
-    <>
58
-      <EChart options={options} style={{ width: '100%', height: '400px', }} />
59
-    </>
57
+      <>
58
+        <EChart options={options} style={{ width: '100%', height: '400px', padding: '0.09rem 0 0 0.09rem', boxShadow: '0px 0px 16px 2px rgba(0, 0, 0, 0.12)', marginBottom: '0.16rem', borderRadius: '12px' }} />
59
+      </>
60 60
     )
61 61
   }
62 62
 }

+ 87
- 87
src/pages/statistical/building/index.jsx 查看文件

@@ -32,24 +32,24 @@ class buildingStats extends React.Component {
32 32
   }
33 33
 
34 34
   componentDidMount() {
35
-    this.getBarData(moment().subtract(7, 'day').toDate(),new Date())
36
-    this.getTableData(moment().subtract(7, 'day').toDate(),new Date(),this.state.buildingId)
37
-    this.setState({...this.state, endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
38
-    
35
+    this.getBarData(moment().subtract(7, 'day').toDate(), new Date())
36
+    this.getTableData(moment().subtract(7, 'day').toDate(), new Date(), this.state.buildingId)
37
+    this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
38
+
39 39
   }
40 40
 
41 41
   // 获取图表数据
42 42
   getBarData = (startDate, endDate) => {
43 43
     request({ ...apis.stats.barList, params: { startDate, endDate } }).then((data) => {
44
-        this.setState({...this.state, barData: data})
45
-      })
44
+      this.setState({ ...this.state, barData: data })
45
+    })
46 46
   }
47 47
 
48 48
   //获取表格数据
49
-  getTableData = (startDate, endDate, buildingId,pageNum,pageSize,sortField,sortOrder) => {
50
-    request({ ...apis.stats.tableList, params: { startDate, endDate, buildingId,pageNum,pageSize,sortField,sortOrder } }).then((data) => {
51
-        this.setState({...this.state, tableData: data.records, total: data.total})
52
-      })
49
+  getTableData = (startDate, endDate, buildingId, pageNum, pageSize, sortField, sortOrder) => {
50
+    request({ ...apis.stats.tableList, params: { startDate, endDate, buildingId, pageNum, pageSize, sortField, sortOrder } }).then((data) => {
51
+      this.setState({ ...this.state, tableData: data.records, total: data.total })
52
+    })
53 53
   }
54 54
 
55 55
   formatDate = (start, end) => {
@@ -66,33 +66,33 @@ class buildingStats extends React.Component {
66 66
 
67 67
   //切换三个标签页
68 68
   getDataOf = (days) => {
69
-    this.getBarData(moment().subtract(days, 'day').toDate(),new Date())
70
-    this.getTableData(moment().subtract(days, 'day').toDate(),new Date(),this.state.buildingId)
69
+    this.getBarData(moment().subtract(days, 'day').toDate(), new Date())
70
+    this.getTableData(moment().subtract(days, 'day').toDate(), new Date(), this.state.buildingId)
71 71
     this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(days, 'day').toDate() })
72 72
   }
73 73
 
74 74
   //点击查询
75 75
   datalist = () => {
76
-    this.getBarData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],daterange[1] === undefined ? new Date() : daterange[1])
77
-    this.getTableData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],daterange[1] === undefined ? new Date() : daterange[1],this.state.buildingId)
78
-    this.setState({ 
76
+    this.getBarData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0], daterange[1] === undefined ? new Date() : daterange[1])
77
+    this.getTableData(daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0], daterange[1] === undefined ? new Date() : daterange[1], this.state.buildingId)
78
+    this.setState({
79 79
       ...this.state,
80 80
       endDate: daterange[1] === undefined ? new Date() : daterange[1],
81 81
       startDate: daterange[0] === undefined ? moment().subtract(7, 'day').toDate() : daterange[0],
82 82
     })
83
-    
83
+
84 84
   }
85
-  
85
+
86 86
   //切换楼盘信息
87 87
   handleBuildingChange = (e) => {
88
-    this.getTableData(this.state.startDate,this.state.endDate,e)
89
-    this.setState({...this.state, buildingId: e})
88
+    this.getTableData(this.state.startDate, this.state.endDate, e)
89
+    this.setState({ ...this.state, buildingId: e })
90 90
   }
91 91
 
92 92
   //排序
93 93
   handleTableChange = (pagination, filters, sorter) => {
94 94
     console.log(pagination, filters, sorter)
95
-    this.getTableData(this.state.startDate,this.state.endDate,this.state.buildingId,pagination.current,10,sorter.columnKey,sorter.order)
95
+    this.getTableData(this.state.startDate, this.state.endDate, this.state.buildingId, pagination.current, 10, sorter.columnKey, sorter.order)
96 96
   };
97 97
 
98 98
   //导出
@@ -127,52 +127,52 @@ class buildingStats extends React.Component {
127 127
 
128 128
   render() {
129 129
     const columns = [
130
-        {
131
-          title: '项目名称',
132
-          dataIndex: 'buildingName',
133
-          key: 'buildingName',
134
-        },
135
-        {
136
-          title: '新增客户',
137
-          dataIndex: 'khNum',
138
-          key: 'kh_num',
139
-          sorter: true,
140
-        },
141
-        {
142
-          title: '公客',
143
-          dataIndex: 'gkNum',
144
-          key: 'gk_num',
145
-          sorter: true,
146
-        },
147
-        {
148
-          title: '私客',
149
-          dataIndex: 'skNum',
150
-          key: 'sk_num',
151
-          sorter: true,
152
-        },
153
-        {
154
-            title: '访问人数',
155
-            dataIndex: 'uvNum',
156
-            key: 'uv_num',
157
-            sorter: true,
158
-        },
159
-        {
160
-            title: '访问次数',
161
-            dataIndex: 'pvNum',
162
-            key: 'pv_num',
163
-            sorter: true,
164
-        },
165
-        {
166
-            title: '详情',
167
-            render: (_, record) => (
168
-                    <Button type="link" style={{ color: 'red' }} onClick={() => this.toDetailPage(record)}>查看详情</Button>
169
-                ),
170
-        },
171
-      ];
130
+      {
131
+        title: '项目名称',
132
+        dataIndex: 'buildingName',
133
+        key: 'buildingName',
134
+      },
135
+      {
136
+        title: '新增客户',
137
+        dataIndex: 'khNum',
138
+        key: 'kh_num',
139
+        sorter: true,
140
+      },
141
+      {
142
+        title: '公客',
143
+        dataIndex: 'gkNum',
144
+        key: 'gk_num',
145
+        sorter: true,
146
+      },
147
+      {
148
+        title: '私客',
149
+        dataIndex: 'skNum',
150
+        key: 'sk_num',
151
+        sorter: true,
152
+      },
153
+      {
154
+        title: '访问人数',
155
+        dataIndex: 'uvNum',
156
+        key: 'uv_num',
157
+        sorter: true,
158
+      },
159
+      {
160
+        title: '访问次数',
161
+        dataIndex: 'pvNum',
162
+        key: 'pv_num',
163
+        sorter: true,
164
+      },
165
+      {
166
+        title: '详情',
167
+        render: (_, record) => (
168
+          <Button type="link" style={{ color: 'red' }} onClick={() => this.toDetailPage(record)}>查看详情</Button>
169
+        ),
170
+      },
171
+    ];
172 172
 
173 173
     return (
174
-    <div>
175
-      <Radio.Group buttonStyle="solid" defaultValue="a">
174
+      <div>
175
+        <Radio.Group buttonStyle="solid" defaultValue="a">
176 176
           <Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
177 177
           <Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
178 178
           <Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
@@ -189,38 +189,38 @@ class buildingStats extends React.Component {
189 189
           查询
190 190
         </Button>
191 191
         <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
192
-
192
+        <div style={{fontSize:'0.09rem',color:'#999',marginBottom:'0.16rem'}}>最多显示6个项目,其他项目请在下方详细数据中搜索</div>
193 193
         <Row>
194
-            <Col span={12}>
195
-                <StatsChart title="项目公客排行" data={this.state.barData.gkBarMap} />
196
-            </Col>
197
-            <Col span={12}>
198
-                <StatsChart title="项目私客排行" data={this.state.barData.skBarMap} />
199
-            </Col>
194
+          <Col span={12} style={{paddingRight:'0.08rem'}}>
195
+            <StatsChart title="项目公客排行" data={this.state.barData.gkBarMap} />
196
+          </Col>
197
+          <Col span={12}style={{paddingLeft:'0.08rem'}}>
198
+            <StatsChart title="项目私客排行" data={this.state.barData.skBarMap} />
199
+          </Col>
200 200
         </Row>
201 201
         <Row>
202
-            <Col span={12}>
203
-                <StatsChart title="项目访问人数排行" subtext="项目详情访问情况" data={this.state.barData.wgBarMap} />
204
-            </Col>
205
-            <Col span={12}>
206
-                <StatsChart title="项目访问次数排行" subtext="项目详情访问情况,与上方时间筛选无关" data={this.state.barData.fwBarMap} />
207
-            </Col>
202
+          <Col span={12} style={{paddingRight:'0.08rem'}}>
203
+            <StatsChart title="项目访问人数排行" subtext="项目详情访问情况" data={this.state.barData.wgBarMap} />
204
+          </Col>
205
+          <Col span={12} style={{paddingLeft:'0.08rem'}}>
206
+            <StatsChart title="项目访问次数排行" subtext="项目详情访问情况,与上方时间筛选无关" data={this.state.barData.fwBarMap} />
207
+          </Col>
208 208
         </Row>
209 209
         <Row>
210
-            <Col span={22}>
211
-              <span style={{marginRight: '10px'}} >详细数据</span>
212
-              <BuildSelect slot='action' onChange={(e => this.handleBuildingChange(e))} value={this.state.buildingId}></BuildSelect>
213
-            </Col>
214
-            <Col span={2}>
210
+          <Col span={22}>
211
+            <span style={{ marginRight: '10px' }} >详细数据</span>
212
+            <BuildSelect slot='action' onChange={(e => this.handleBuildingChange(e))} value={this.state.buildingId}></BuildSelect>
213
+          </Col>
214
+          <Col span={2}>
215 215
             <AuthButton name="admin.statistical.building.export" noRight={null}>
216 216
               <Button type="primary" onClick={this.exportBuildingStats}>导出</Button>
217 217
             </AuthButton>
218
-            </Col>
218
+          </Col>
219 219
         </Row>
220
-        
221
-        
222
-        <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total}} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
223
-    </div>
220
+
221
+
222
+        <Table style={{ marginTop: '20px' }} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total }} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
223
+      </div>
224 224
     )
225 225
   }
226 226
 }