|
@@ -34,24 +34,24 @@ class buildingDetailStats extends React.Component {
|
34
|
34
|
}
|
35
|
35
|
|
36
|
36
|
componentDidMount() {
|
37
|
|
- this.getTimeBarDate(moment().subtract(6, 'day').toDate(),new Date())
|
38
|
|
- this.getTimeTableData(moment().subtract(6, 'day').toDate(),new Date())
|
39
|
|
- this.setState({...this.state, endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
|
40
|
|
-
|
|
37
|
+ this.getTimeBarDate(moment().subtract(6, 'day').toDate(), new Date())
|
|
38
|
+ this.getTimeTableData(moment().subtract(6, 'day').toDate(), new Date())
|
|
39
|
+ this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(7, 'day').toDate() })
|
|
40
|
+
|
41
|
41
|
}
|
42
|
42
|
|
43
|
43
|
// 获取图表数据
|
44
|
44
|
getTimeBarDate = (startDate, endDate) => {
|
45
|
45
|
request({ ...apis.stats.timeBarList, params: { startDate: moment(startDate).format('YYYY-MM-DDT00:00:00.000') + 'Z', endDate: moment(endDate).format('YYYY-MM-DDT23:59:59.999') + 'Z', buildingId: this.state.buildingId } }).then((data) => {
|
46
|
|
- this.setState({...this.state, barData: data})
|
47
|
|
- })
|
|
46
|
+ this.setState({ ...this.state, barData: data })
|
|
47
|
+ })
|
48
|
48
|
}
|
49
|
49
|
|
50
|
50
|
//获取表格数据
|
51
|
|
- getTimeTableData = (startDate, endDate,pageNum,pageSize,sortField,sortOrder) => {
|
52
|
|
- request({ ...apis.stats.timeTableList, params: { startDate: moment(startDate).format('YYYY-MM-DDT00:00:00.000') + 'Z', endDate: moment(endDate).format('YYYY-MM-DDT23:59:59.999') + 'Z', buildingId: this.state.buildingId,pageNum,pageSize,sortField,sortOrder } }).then((data) => {
|
53
|
|
- this.setState({...this.state, tableData: data.records, total: data.total})
|
54
|
|
- })
|
|
51
|
+ getTimeTableData = (startDate, endDate, pageNum, pageSize, sortField, sortOrder) => {
|
|
52
|
+ request({ ...apis.stats.timeTableList, params: { startDate: moment(startDate).format('YYYY-MM-DDT00:00:00.000') + 'Z', endDate: moment(endDate).format('YYYY-MM-DDT23:59:59.999') + 'Z', buildingId: this.state.buildingId, pageNum, pageSize, sortField, sortOrder } }).then((data) => {
|
|
53
|
+ this.setState({ ...this.state, tableData: data.records, total: data.total })
|
|
54
|
+ })
|
55
|
55
|
}
|
56
|
56
|
|
57
|
57
|
formatDate = (start, end) => {
|
|
@@ -67,28 +67,28 @@ class buildingDetailStats extends React.Component {
|
67
|
67
|
}
|
68
|
68
|
|
69
|
69
|
//切换三个标签页
|
70
|
|
- getDataOf = (days,val) => {
|
71
|
|
- this.getTimeBarDate(moment().subtract(days, 'day').toDate(),new Date())
|
72
|
|
- this.getTimeTableData(moment().subtract(days, 'day').toDate(),new Date())
|
|
70
|
+ getDataOf = (days, val) => {
|
|
71
|
+ this.getTimeBarDate(moment().subtract(days, 'day').toDate(), new Date())
|
|
72
|
+ this.getTimeTableData(moment().subtract(days, 'day').toDate(), new Date())
|
73
|
73
|
this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(days, 'day').toDate(), radioValue: val })
|
74
|
74
|
}
|
75
|
75
|
|
76
|
76
|
//点击查询
|
77
|
77
|
datalist = () => {
|
78
|
|
- this.getTimeBarDate(daterange[0] === undefined ? moment().subtract(6, 'day').toDate() : daterange[0],daterange[1] === undefined ? new Date() : daterange[1])
|
79
|
|
- this.getTimeTableData(daterange[0] === undefined ? moment().subtract(6, 'day').toDate() : daterange[0],daterange[1] === undefined ? new Date() : daterange[1])
|
80
|
|
- this.setState({
|
|
78
|
+ this.getTimeBarDate(daterange[0] === undefined ? moment().subtract(6, 'day').toDate() : daterange[0], daterange[1] === undefined ? new Date() : daterange[1])
|
|
79
|
+ this.getTimeTableData(daterange[0] === undefined ? moment().subtract(6, 'day').toDate() : daterange[0], daterange[1] === undefined ? new Date() : daterange[1])
|
|
80
|
+ this.setState({
|
81
|
81
|
...this.state,
|
82
|
82
|
endDate: daterange[1] === undefined ? new Date() : daterange[1],
|
83
|
83
|
startDate: daterange[0] === undefined ? moment().subtract(6, 'day').toDate() : daterange[0],
|
84
|
84
|
})
|
85
|
|
-
|
|
85
|
+
|
86
|
86
|
}
|
87
|
87
|
|
88
|
88
|
//排序
|
89
|
89
|
handleTableChange = (pagination, filters, sorter) => {
|
90
|
90
|
console.log(pagination, filters, sorter)
|
91
|
|
- this.getTimeTableData(this.state.startDate,this.state.endDate,pagination.current,10,sorter.columnKey,sorter.order)
|
|
91
|
+ this.getTimeTableData(this.state.startDate, this.state.endDate, pagination.current, 10, sorter.columnKey, sorter.order)
|
92
|
92
|
};
|
93
|
93
|
|
94
|
94
|
//导出
|
|
@@ -110,93 +110,93 @@ class buildingDetailStats extends React.Component {
|
110
|
110
|
})
|
111
|
111
|
}
|
112
|
112
|
|
113
|
|
- //重置搜索
|
|
113
|
+ //重置搜索
|
114
|
114
|
handleReset = () => {
|
115
|
115
|
daterange = []
|
116
|
116
|
this.props.form.resetFields();
|
117
|
117
|
this.setState({ ...this.state, endDate: new Date(), startDate: moment().subtract(6, 'day').toDate(), radioValue: "a" })
|
118
|
|
- this.getTimeBarDate(moment().subtract(6, 'day').toDate(),new Date())
|
119
|
|
- this.getTimeTableData(moment().subtract(6, 'day').toDate(),new Date())
|
|
118
|
+ this.getTimeBarDate(moment().subtract(6, 'day').toDate(), new Date())
|
|
119
|
+ this.getTimeTableData(moment().subtract(6, 'day').toDate(), new Date())
|
120
|
120
|
}
|
121
|
121
|
|
122
|
122
|
render() {
|
123
|
123
|
const columns = [
|
124
|
|
- {
|
125
|
|
- title: '日期',
|
126
|
|
- dataIndex: 'createDate',
|
127
|
|
- key: 'createDate',
|
128
|
|
- },
|
129
|
|
- {
|
130
|
|
- title: '新增客户',
|
131
|
|
- dataIndex: 'khNum',
|
132
|
|
- key: 'kh_num',
|
133
|
|
- sorter: true,
|
134
|
|
- },
|
135
|
|
- {
|
136
|
|
- title: '公客',
|
137
|
|
- dataIndex: 'gkNum',
|
138
|
|
- key: 'gk_num',
|
139
|
|
- sorter: true,
|
140
|
|
- },
|
141
|
|
- {
|
142
|
|
- title: '私客',
|
143
|
|
- dataIndex: 'skNum',
|
144
|
|
- key: 'sk_num',
|
145
|
|
- sorter: true,
|
146
|
|
- },
|
147
|
|
- {
|
148
|
|
- title: '访问人数',
|
149
|
|
- dataIndex: 'uvNum',
|
150
|
|
- key: 'uv_num',
|
151
|
|
- sorter: true,
|
152
|
|
- },
|
153
|
|
- ];
|
|
124
|
+ {
|
|
125
|
+ title: '日期',
|
|
126
|
+ dataIndex: 'createDate',
|
|
127
|
+ key: 'createDate',
|
|
128
|
+ },
|
|
129
|
+ {
|
|
130
|
+ title: '新增客户',
|
|
131
|
+ dataIndex: 'khNum',
|
|
132
|
+ key: 'kh_num',
|
|
133
|
+ sorter: true,
|
|
134
|
+ },
|
|
135
|
+ {
|
|
136
|
+ title: '公客',
|
|
137
|
+ dataIndex: 'gkNum',
|
|
138
|
+ key: 'gk_num',
|
|
139
|
+ sorter: true,
|
|
140
|
+ },
|
|
141
|
+ {
|
|
142
|
+ title: '私客',
|
|
143
|
+ dataIndex: 'skNum',
|
|
144
|
+ key: 'sk_num',
|
|
145
|
+ sorter: true,
|
|
146
|
+ },
|
|
147
|
+ {
|
|
148
|
+ title: '访问人数',
|
|
149
|
+ dataIndex: 'uvNum',
|
|
150
|
+ key: 'uv_num',
|
|
151
|
+ sorter: true,
|
|
152
|
+ },
|
|
153
|
+ ];
|
154
|
154
|
|
155
|
155
|
const { getFieldDecorator } = this.props.form;
|
156
|
156
|
return (
|
157
|
|
- <div>
|
158
|
|
- <Form layout="inline">
|
159
|
|
- <Radio.Group buttonStyle="solid" value={this.state.radioValue}>
|
160
|
|
- <Radio.Button value="c" onClick={() => this.getDataOf(0,"c")}>今日</Radio.Button>
|
161
|
|
- <Radio.Button value="a" onClick={() => this.getDataOf(6,"a")}>最近7天</Radio.Button>
|
162
|
|
- <Radio.Button value="b" onClick={() => this.getDataOf(30,"b")}>最近1月</Radio.Button>
|
163
|
|
- </Radio.Group>
|
164
|
|
- <Form.Item>
|
165
|
|
- {getFieldDecorator('time', {
|
166
|
|
- initialValue: [],
|
167
|
|
- })(
|
168
|
|
- <RangePicker
|
169
|
|
- style={{ paddingLeft: '30px' }}
|
170
|
|
- ranges={{
|
171
|
|
- Today: [moment(), moment()],
|
172
|
|
- 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
173
|
|
- }}
|
174
|
|
- onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
|
175
|
|
- />
|
176
|
|
- )}
|
177
|
|
- </Form.Item>
|
178
|
|
- <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
|
179
|
|
- 搜索
|
|
157
|
+ <div>
|
|
158
|
+ <Form layout="inline">
|
|
159
|
+ <Radio.Group buttonStyle="solid" value={this.state.radioValue}>
|
|
160
|
+ <Radio.Button value="c" onClick={() => this.getDataOf(0, "c")}>今日</Radio.Button>
|
|
161
|
+ <Radio.Button value="a" onClick={() => this.getDataOf(6, "a")}>最近7天</Radio.Button>
|
|
162
|
+ <Radio.Button value="b" onClick={() => this.getDataOf(30, "b")}>最近1月</Radio.Button>
|
|
163
|
+ </Radio.Group>
|
|
164
|
+ <Form.Item>
|
|
165
|
+ {getFieldDecorator('time', {
|
|
166
|
+ initialValue: [],
|
|
167
|
+ })(
|
|
168
|
+ <RangePicker
|
|
169
|
+ style={{ paddingLeft: '30px' }}
|
|
170
|
+ ranges={{
|
|
171
|
+ Today: [moment(), moment()],
|
|
172
|
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
173
|
+ }}
|
|
174
|
+ onChange={(_dates, dateStrings) => this.onChangetime(_dates, dateStrings)}
|
|
175
|
+ />
|
|
176
|
+ )}
|
|
177
|
+ </Form.Item>
|
|
178
|
+ <Button type="primary" htmlType="submit" style={{ marginLeft: '30px' }} onClick={() => this.datalist()}>
|
|
179
|
+ 搜索
|
180
|
180
|
</Button>
|
181
|
|
- <Button onClick={this.handleReset} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
|
182
|
|
- <Button type="primary" style={{ marginLeft: '30px' }} onClick={() => router.go(-1)}>
|
183
|
|
- 返回
|
|
181
|
+ <Button onClick={this.handleReset} style={{ marginBottom: '18px', marginLeft: '30px' }}>重置</Button>
|
|
182
|
+ <Button style={{ float: 'right' }} onClick={() => router.go(-1)}>
|
|
183
|
+ 返回
|
184
|
184
|
</Button>
|
185
|
185
|
</Form>
|
186
|
186
|
<StatsChartLine title={this.state.buildingName} data={this.state.barData} />
|
187
|
187
|
<Row>
|
188
|
|
- <Col span={22}>
|
189
|
|
- <span>详细数据</span>
|
190
|
|
- </Col>
|
191
|
|
- <Col span={2}>
|
|
188
|
+ <Col span={22}>
|
|
189
|
+ <span>详细数据</span>
|
|
190
|
+ </Col>
|
|
191
|
+ <Col span={2}>
|
192
|
192
|
<AuthButton name="admin.statistical.building.content.export" noRight={null}>
|
193
|
193
|
<Button type="primary" onClick={this.exportBuildingStats}>导出</Button>
|
194
|
194
|
</AuthButton>
|
195
|
|
- </Col>
|
|
195
|
+ </Col>
|
196
|
196
|
</Row>
|
197
|
|
-
|
198
|
|
- <Table style={{marginTop:'20px'}} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total}} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
|
199
|
|
- </div>
|
|
197
|
+
|
|
198
|
+ <Table style={{ marginTop: '20px' }} dataSource={this.state.tableData} columns={columns} pagination={{ total: this.state.total }} onChange={this.handleTableChange} scroll={{ y: 500 }}></Table>
|
|
199
|
+ </div>
|
200
|
200
|
)
|
201
|
201
|
}
|
202
|
202
|
}
|