|
@@ -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
|
//导出
|
|
@@ -125,104 +125,123 @@ class buildingStats extends React.Component {
|
125
|
125
|
});
|
126
|
126
|
}
|
127
|
127
|
|
|
128
|
+ //重置搜索
|
|
129
|
+ handleReset = () => {
|
|
130
|
+ daterange = []
|
|
131
|
+ this.props.form.resetFields();
|
|
132
|
+ }
|
|
133
|
+
|
128
|
134
|
render() {
|
129
|
135
|
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
|
|
- ];
|
|
136
|
+ {
|
|
137
|
+ title: '项目名称',
|
|
138
|
+ dataIndex: 'buildingName',
|
|
139
|
+ key: 'buildingName',
|
|
140
|
+ },
|
|
141
|
+ {
|
|
142
|
+ title: '新增客户',
|
|
143
|
+ dataIndex: 'khNum',
|
|
144
|
+ key: 'kh_num',
|
|
145
|
+ sorter: true,
|
|
146
|
+ },
|
|
147
|
+ {
|
|
148
|
+ title: '公客',
|
|
149
|
+ dataIndex: 'gkNum',
|
|
150
|
+ key: 'gk_num',
|
|
151
|
+ sorter: true,
|
|
152
|
+ },
|
|
153
|
+ {
|
|
154
|
+ title: '私客',
|
|
155
|
+ dataIndex: 'skNum',
|
|
156
|
+ key: 'sk_num',
|
|
157
|
+ sorter: true,
|
|
158
|
+ },
|
|
159
|
+ {
|
|
160
|
+ title: '访问人数',
|
|
161
|
+ dataIndex: 'uvNum',
|
|
162
|
+ key: 'uv_num',
|
|
163
|
+ sorter: true,
|
|
164
|
+ },
|
|
165
|
+ {
|
|
166
|
+ title: '访问次数',
|
|
167
|
+ dataIndex: 'pvNum',
|
|
168
|
+ key: 'pv_num',
|
|
169
|
+ sorter: true,
|
|
170
|
+ },
|
|
171
|
+ {
|
|
172
|
+ title: '详情',
|
|
173
|
+ render: (_, record) => (
|
|
174
|
+ <Button type="link" style={{ color: 'red' }} onClick={() => this.toDetailPage(record)}>查看详情</Button>
|
|
175
|
+ ),
|
|
176
|
+ },
|
|
177
|
+ ];
|
172
|
178
|
|
|
179
|
+ const { getFieldDecorator } = this.props.form;
|
173
|
180
|
return (
|
|
181
|
+
|
174
|
182
|
<div>
|
|
183
|
+ <Form layout="inline">
|
175
|
184
|
<Radio.Group buttonStyle="solid" defaultValue="a">
|
176
|
185
|
<Radio.Button value="c" onClick={() => this.getDataOf(0)}>今日</Radio.Button>
|
177
|
186
|
<Radio.Button value="a" onClick={() => this.getDataOf(7)}>最近7天</Radio.Button>
|
178
|
187
|
<Radio.Button value="b" onClick={() => this.getDataOf(30)}>最近1月</Radio.Button>
|
179
|
188
|
</Radio.Group>
|
180
|
|
- <RangePicker
|
181
|
|
- style={{ paddingLeft: '30px' }}
|
182
|
|
- ranges={{
|
183
|
|
- Today: [moment(), moment()],
|
184
|
|
- 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
185
|
|
- }}
|
186
|
|
- onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
|
187
|
|
- />
|
|
189
|
+ <Form.Item>
|
|
190
|
+ {getFieldDecorator('time', {
|
|
191
|
+ initialValue: [],
|
|
192
|
+ rules: [{ required: true, message: '请上传封面图1' }],
|
|
193
|
+ })(
|
|
194
|
+ <RangePicker
|
|
195
|
+ style={{ paddingLeft: '30px' }}
|
|
196
|
+ ranges={{
|
|
197
|
+ Today: [moment(), moment()],
|
|
198
|
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
199
|
+ }}
|
|
200
|
+ onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
|
|
201
|
+ />
|
|
202
|
+ )}
|
|
203
|
+ </Form.Item>
|
188
|
204
|
<Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
|
189
|
205
|
查询
|
190
|
206
|
</Button>
|
191
|
|
- <Button type="danger" onClick={() => router.go(-1)} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
|
192
|
|
-
|
|
207
|
+ <Button type="danger" onClick={this.handleReset} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
|
|
208
|
+ </Form>
|
|
209
|
+ <div style={{fontSize:'0.09rem',color:'#999',marginBottom:'0.16rem'}}>最多显示6个项目,其他项目请在下方详细数据中搜索</div>
|
193
|
210
|
<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>
|
|
211
|
+ <Col span={12} style={{paddingRight:'0.08rem'}}>
|
|
212
|
+ <StatsChart title="项目公客排行" data={this.state.barData.gkBarMap} />
|
|
213
|
+ </Col>
|
|
214
|
+ <Col span={12}style={{paddingLeft:'0.08rem'}}>
|
|
215
|
+ <StatsChart title="项目私客排行" data={this.state.barData.skBarMap} />
|
|
216
|
+ </Col>
|
200
|
217
|
</Row>
|
201
|
218
|
<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>
|
|
219
|
+ <Col span={12} style={{paddingRight:'0.08rem'}}>
|
|
220
|
+ <StatsChart title="项目访问人数排行" subtext="项目详情访问情况" data={this.state.barData.wgBarMap} />
|
|
221
|
+ </Col>
|
|
222
|
+ <Col span={12} style={{paddingLeft:'0.08rem'}}>
|
|
223
|
+ <StatsChart title="项目访问次数排行" subtext="项目详情访问情况,与上方时间筛选无关" data={this.state.barData.fwBarMap} />
|
|
224
|
+ </Col>
|
208
|
225
|
</Row>
|
209
|
226
|
<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}>
|
|
227
|
+ <Col span={22}>
|
|
228
|
+ <span style={{ marginRight: '10px' }} >详细数据</span>
|
|
229
|
+ <BuildSelect slot='action' onChange={(e => this.handleBuildingChange(e))} value={this.state.buildingId}></BuildSelect>
|
|
230
|
+ </Col>
|
|
231
|
+ <Col span={2}>
|
215
|
232
|
<AuthButton name="admin.statistical.building.export" noRight={null}>
|
216
|
233
|
<Button type="primary" onClick={this.exportBuildingStats}>导出</Button>
|
217
|
234
|
</AuthButton>
|
218
|
|
- </Col>
|
|
235
|
+ </Col>
|
219
|
236
|
</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>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+ <Table style={{ marginTop: '20px' }} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total }} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
|
|
240
|
+ </div>
|
224
|
241
|
)
|
225
|
242
|
}
|
226
|
243
|
}
|
227
|
244
|
|
228
|
|
-export default buildingStats
|
|
245
|
+const WrappedHeader = Form.create({ name: 'record' })(buildingStats);
|
|
246
|
+
|
|
247
|
+export default WrappedHeader
|