1
|
|
|
import React, { Fragment, useEffect, useState } from 'react'; |
2
|
|
|
import { |
3
|
|
|
Breadcrumb, |
4
|
|
|
BreadcrumbItem, |
5
|
|
|
Row, |
6
|
|
|
Col, |
7
|
|
|
Card, |
8
|
|
|
CardBody, |
9
|
|
|
Button, |
10
|
|
|
ButtonGroup, |
11
|
|
|
Form, |
12
|
|
|
FormGroup, |
13
|
|
|
Input, |
14
|
|
|
Label, |
15
|
|
|
CustomInput |
16
|
|
|
} from 'reactstrap'; |
17
|
|
|
import CountUp from 'react-countup'; |
18
|
|
|
import Datetime from 'react-datetime'; |
19
|
|
|
import moment from 'moment'; |
20
|
|
|
import loadable from '@loadable/component'; |
21
|
|
|
import Cascader from 'rc-cascader'; |
22
|
|
|
import CardSummary from '../common/CardSummary'; |
23
|
|
|
import LineChart from '../common/LineChart'; |
24
|
|
|
import { getCookieValue, createCookie } from '../../../helpers/utils'; |
25
|
|
|
import withRedirect from '../../../hoc/withRedirect'; |
26
|
|
|
import { withTranslation } from 'react-i18next'; |
27
|
|
|
import { periodTypeOptions } from '../common/PeriodTypeOptions'; |
28
|
|
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions'; |
29
|
|
|
import { toast } from 'react-toastify'; |
30
|
|
|
import { APIBaseURL } from '../../../config'; |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable')); |
34
|
|
|
|
35
|
|
|
const CombinedEquipmentEfficiency = ({ setRedirect, setRedirectUrl, t }) => { |
36
|
|
|
let current_moment = moment(); |
37
|
|
|
useEffect(() => { |
38
|
|
|
let is_logged_in = getCookieValue('is_logged_in'); |
39
|
|
|
let user_name = getCookieValue('user_name'); |
40
|
|
|
let user_display_name = getCookieValue('user_display_name'); |
41
|
|
|
let user_uuid = getCookieValue('user_uuid'); |
42
|
|
|
let token = getCookieValue('token'); |
43
|
|
|
if (is_logged_in === null || !is_logged_in) { |
44
|
|
|
setRedirectUrl(`/authentication/basic/login`); |
45
|
|
|
setRedirect(true); |
46
|
|
|
} else { |
47
|
|
|
//update expires time of cookies |
48
|
|
|
createCookie('is_logged_in', true, 1000 * 60 * 60 * 8); |
49
|
|
|
createCookie('user_name', user_name, 1000 * 60 * 60 * 8); |
50
|
|
|
createCookie('user_display_name', user_display_name, 1000 * 60 * 60 * 8); |
51
|
|
|
createCookie('user_uuid', user_uuid, 1000 * 60 * 60 * 8); |
52
|
|
|
createCookie('token', token, 1000 * 60 * 60 * 8); |
53
|
|
|
} |
54
|
|
|
}); |
55
|
|
|
// State |
56
|
|
|
// Query Parameters |
57
|
|
|
const [selectedSpaceName, setSelectedSpaceName] = useState(undefined); |
58
|
|
|
const [selectedSpaceID, setSelectedSpaceID] = useState(undefined); |
59
|
|
|
const [combinedEquipmentList, setCombinedEquipmentList] = useState([]); |
60
|
|
|
const [selectedCombinedEquipment, setSelectedCombinedEquipment] = useState(undefined); |
61
|
|
|
const [comparisonType, setComparisonType] = useState('month-on-month'); |
62
|
|
|
const [periodType, setPeriodType] = useState('daily'); |
63
|
|
|
const [basePeriodBeginsDatetime, setBasePeriodBeginsDatetime] = useState(current_moment.clone().subtract(1, 'months').startOf('month')); |
64
|
|
|
const [basePeriodEndsDatetime, setBasePeriodEndsDatetime] = useState(current_moment.clone().subtract(1, 'months')); |
65
|
|
|
const [basePeriodBeginsDatetimeDisabled, setBasePeriodBeginsDatetimeDisabled] = useState(true); |
66
|
|
|
const [basePeriodEndsDatetimeDisabled, setBasePeriodEndsDatetimeDisabled] = useState(true); |
67
|
|
|
const [reportingPeriodBeginsDatetime, setReportingPeriodBeginsDatetime] = useState(current_moment.clone().startOf('month')); |
68
|
|
|
const [reportingPeriodEndsDatetime, setReportingPeriodEndsDatetime] = useState(current_moment); |
69
|
|
|
const [fractionParameter, setFractionParameter] = useState(1); |
70
|
|
|
const [cascaderOptions, setCascaderOptions] = useState(undefined); |
71
|
|
|
const [isDisabled, setIsDisabled] = useState(true); |
72
|
|
|
//Results |
73
|
|
|
const [combinedEquipmentLineChartLabels, setCombinedEquipmentLineChartLabels] = useState([]); |
74
|
|
|
const [combinedEquipmentLineChartData, setCombinedEquipmentLineChartData] = useState({}); |
75
|
|
|
const [combinedEquipmentLineChartOptions, setCombinedEquipmentLineChartOptions] = useState([]); |
76
|
|
|
|
77
|
|
|
const [parameterLineChartLabels, setParameterLineChartLabels] = useState([]); |
78
|
|
|
const [parameterLineChartData, setParameterLineChartData] = useState({}); |
79
|
|
|
const [parameterLineChartOptions, setParameterLineChartOptions] = useState([]); |
80
|
|
|
|
81
|
|
|
const [detailedDataTableData, setDetailedDataTableData] = useState([]); |
82
|
|
|
const [detailedDataTableColumns, setDetailedDataTableColumns] = useState([{dataField: 'startdatetime', text: t('Datetime'), sort: true}]); |
83
|
|
|
|
84
|
|
|
|
85
|
|
|
useEffect(() => { |
86
|
|
|
let isResponseOK = false; |
87
|
|
|
fetch(APIBaseURL + '/spaces/tree', { |
88
|
|
|
method: 'GET', |
89
|
|
|
headers: { |
90
|
|
|
"Content-type": "application/json", |
91
|
|
|
"User-UUID": getCookieValue('user_uuid'), |
92
|
|
|
"Token": getCookieValue('token') |
93
|
|
|
}, |
94
|
|
|
body: null, |
95
|
|
|
|
96
|
|
|
}).then(response => { |
97
|
|
|
console.log(response) |
98
|
|
|
if (response.ok) { |
99
|
|
|
isResponseOK = true; |
100
|
|
|
} |
101
|
|
|
return response.json(); |
102
|
|
|
}).then(json => { |
103
|
|
|
console.log(json) |
104
|
|
|
if (isResponseOK) { |
105
|
|
|
// rename keys |
106
|
|
|
json = JSON.parse(JSON.stringify([json]).split('"id":').join('"value":').split('"name":').join('"label":')); |
107
|
|
|
setCascaderOptions(json); |
108
|
|
|
setSelectedSpaceName([json[0]].map(o => o.label)); |
109
|
|
|
setSelectedSpaceID([json[0]].map(o => o.value)); |
110
|
|
|
// get Combined Equipments by root Space ID |
111
|
|
|
let isResponseOK = false; |
112
|
|
|
fetch(APIBaseURL + '/spaces/' + [json[0]].map(o => o.value) + '/combinedequipments', { |
113
|
|
|
method: 'GET', |
114
|
|
|
headers: { |
115
|
|
|
"Content-type": "application/json", |
116
|
|
|
"User-UUID": getCookieValue('user_uuid'), |
117
|
|
|
"Token": getCookieValue('token') |
118
|
|
|
}, |
119
|
|
|
body: null, |
120
|
|
|
|
121
|
|
|
}).then(response => { |
122
|
|
|
if (response.ok) { |
123
|
|
|
isResponseOK = true; |
124
|
|
|
} |
125
|
|
|
return response.json(); |
126
|
|
|
}).then(json => { |
127
|
|
|
if (isResponseOK) { |
128
|
|
|
json = JSON.parse(JSON.stringify([json]).split('"id":').join('"value":').split('"name":').join('"label":')); |
129
|
|
|
console.log(json); |
130
|
|
|
setCombinedEquipmentList(json[0]); |
131
|
|
|
if (json[0].length > 0) { |
132
|
|
|
setSelectedCombinedEquipment(json[0][0].value); |
133
|
|
|
setIsDisabled(false); |
134
|
|
|
} else { |
135
|
|
|
setSelectedCombinedEquipment(undefined); |
136
|
|
|
setIsDisabled(true); |
137
|
|
|
} |
138
|
|
|
} else { |
139
|
|
|
toast.error(json.description) |
140
|
|
|
} |
141
|
|
|
}).catch(err => { |
142
|
|
|
console.log(err); |
143
|
|
|
}); |
144
|
|
|
// end of get Combined Equipments by root Space ID |
145
|
|
|
} else { |
146
|
|
|
toast.error(json.description) |
147
|
|
|
} |
148
|
|
|
}).catch(err => { |
149
|
|
|
console.log(err); |
150
|
|
|
}); |
151
|
|
|
|
152
|
|
|
}, []); |
153
|
|
|
|
154
|
|
|
const fractionParameterOptions = [ |
155
|
|
|
{ value: 1, label: '综合能效比EER' },]; |
156
|
|
|
|
157
|
|
|
const labelClasses = 'ls text-uppercase text-600 font-weight-semi-bold mb-0'; |
158
|
|
|
|
159
|
|
|
let onSpaceCascaderChange = (value, selectedOptions) => { |
160
|
|
|
setSelectedSpaceName(selectedOptions.map(o => o.label).join('/')); |
161
|
|
|
setSelectedSpaceID(value[value.length - 1]); |
162
|
|
|
|
163
|
|
|
let isResponseOK = false; |
164
|
|
|
fetch(APIBaseURL + '/spaces/' + value[value.length - 1] + '/combinedequipments', { |
165
|
|
|
method: 'GET', |
166
|
|
|
headers: { |
167
|
|
|
"Content-type": "application/json", |
168
|
|
|
"User-UUID": getCookieValue('user_uuid'), |
169
|
|
|
"Token": getCookieValue('token') |
170
|
|
|
}, |
171
|
|
|
body: null, |
172
|
|
|
|
173
|
|
|
}).then(response => { |
174
|
|
|
if (response.ok) { |
175
|
|
|
isResponseOK = true; |
176
|
|
|
} |
177
|
|
|
return response.json(); |
178
|
|
|
}).then(json => { |
179
|
|
|
if (isResponseOK) { |
180
|
|
|
json = JSON.parse(JSON.stringify([json]).split('"id":').join('"value":').split('"name":').join('"label":')); |
181
|
|
|
console.log(json) |
182
|
|
|
setCombinedEquipmentList(json[0]); |
183
|
|
|
if (json[0].length > 0) { |
184
|
|
|
setSelectedCombinedEquipment(json[0][0].value); |
185
|
|
|
setIsDisabled(false); |
186
|
|
|
} else { |
187
|
|
|
setSelectedCombinedEquipment(undefined); |
188
|
|
|
setIsDisabled(true); |
189
|
|
|
} |
190
|
|
|
} else { |
191
|
|
|
toast.error(json.description) |
192
|
|
|
} |
193
|
|
|
}).catch(err => { |
194
|
|
|
console.log(err); |
195
|
|
|
}); |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
|
199
|
|
|
let onComparisonTypeChange = ({ target }) => { |
200
|
|
|
console.log(target.value); |
201
|
|
|
setComparisonType(target.value); |
202
|
|
|
if (target.value === 'year-over-year') { |
203
|
|
|
setBasePeriodBeginsDatetimeDisabled(true); |
204
|
|
|
setBasePeriodEndsDatetimeDisabled(true); |
205
|
|
|
setBasePeriodBeginsDatetime(moment(reportingPeriodBeginsDatetime).subtract(1, 'years')); |
206
|
|
|
setBasePeriodEndsDatetime(moment(reportingPeriodEndsDatetime).subtract(1, 'years')); |
207
|
|
|
} else if (target.value === 'month-on-month') { |
208
|
|
|
setBasePeriodBeginsDatetimeDisabled(true); |
209
|
|
|
setBasePeriodEndsDatetimeDisabled(true); |
210
|
|
|
setBasePeriodBeginsDatetime(moment(reportingPeriodBeginsDatetime).subtract(1, 'months')); |
211
|
|
|
setBasePeriodEndsDatetime(moment(reportingPeriodEndsDatetime).subtract(1, 'months')); |
212
|
|
|
} else if (target.value === 'free-comparison') { |
213
|
|
|
setBasePeriodBeginsDatetimeDisabled(false); |
214
|
|
|
setBasePeriodEndsDatetimeDisabled(false); |
215
|
|
|
} else if (target.value === 'none-comparison') { |
216
|
|
|
setBasePeriodBeginsDatetime(undefined); |
217
|
|
|
setBasePeriodEndsDatetime(undefined); |
218
|
|
|
setBasePeriodBeginsDatetimeDisabled(true); |
219
|
|
|
setBasePeriodEndsDatetimeDisabled(true); |
220
|
|
|
} |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
let onBasePeriodBeginsDatetimeChange = (newDateTime) => { |
224
|
|
|
setBasePeriodBeginsDatetime(newDateTime); |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
let onBasePeriodEndsDatetimeChange = (newDateTime) => { |
228
|
|
|
setBasePeriodEndsDatetime(newDateTime); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
let onReportingPeriodBeginsDatetimeChange = (newDateTime) => { |
232
|
|
|
setReportingPeriodBeginsDatetime(newDateTime); |
233
|
|
|
if (comparisonType === 'year-over-year') { |
234
|
|
|
setBasePeriodBeginsDatetime(newDateTime.clone().subtract(1, 'years')); |
235
|
|
|
} else if (comparisonType === 'month-on-month') { |
236
|
|
|
setBasePeriodBeginsDatetime(newDateTime.clone().subtract(1, 'months')); |
237
|
|
|
} |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
let onReportingPeriodEndsDatetimeChange = (newDateTime) => { |
241
|
|
|
setReportingPeriodEndsDatetime(newDateTime); |
242
|
|
|
if (comparisonType === 'year-over-year') { |
243
|
|
|
setBasePeriodEndsDatetime(newDateTime.clone().subtract(1, 'years')); |
244
|
|
|
} else if (comparisonType === 'month-on-month') { |
245
|
|
|
setBasePeriodEndsDatetime(newDateTime.clone().subtract(1, 'months')); |
246
|
|
|
} |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
var getValidBasePeriodBeginsDatetimes = function (currentDate) { |
250
|
|
|
return currentDate.isBefore(moment(basePeriodEndsDatetime, 'MM/DD/YYYY, hh:mm:ss a')); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
var getValidBasePeriodEndsDatetimes = function (currentDate) { |
254
|
|
|
return currentDate.isAfter(moment(basePeriodBeginsDatetime, 'MM/DD/YYYY, hh:mm:ss a')); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
var getValidReportingPeriodBeginsDatetimes = function (currentDate) { |
258
|
|
|
return currentDate.isBefore(moment(reportingPeriodEndsDatetime, 'MM/DD/YYYY, hh:mm:ss a')); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
var getValidReportingPeriodEndsDatetimes = function (currentDate) { |
262
|
|
|
return currentDate.isAfter(moment(reportingPeriodBeginsDatetime, 'MM/DD/YYYY, hh:mm:ss a')); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
// Handler |
266
|
|
|
const handleSubmit = e => { |
267
|
|
|
e.preventDefault(); |
268
|
|
|
console.log('handleSubmit'); |
269
|
|
|
console.log(selectedSpaceID); |
270
|
|
|
console.log(selectedCombinedEquipment); |
271
|
|
|
console.log(periodType); |
272
|
|
|
console.log(basePeriodBeginsDatetime != null ? basePeriodBeginsDatetime.format('YYYY-MM-DDTHH:mm:ss') : undefined); |
273
|
|
|
console.log(basePeriodEndsDatetime != null ? basePeriodEndsDatetime.format('YYYY-MM-DDTHH:mm:ss') : undefined); |
274
|
|
|
console.log(reportingPeriodBeginsDatetime.format('YYYY-MM-DDTHH:mm:ss')); |
275
|
|
|
console.log(reportingPeriodEndsDatetime.format('YYYY-MM-DDTHH:mm:ss')); |
276
|
|
|
|
277
|
|
|
// Reinitialize tables |
278
|
|
|
setDetailedDataTableData([]); |
279
|
|
|
|
280
|
|
|
let isResponseOK = false; |
281
|
|
|
fetch(APIBaseURL + '/reports/combinedequipmentefficiency?' + |
282
|
|
|
'combinedequipmentid=' + selectedCombinedEquipment + |
283
|
|
|
'&fractionparameterid=' + fractionParameter + |
284
|
|
|
'&periodtype=' + periodType + |
285
|
|
|
'&baseperiodstartdatetime=' + (basePeriodBeginsDatetime != null ? basePeriodBeginsDatetime.format('YYYY-MM-DDTHH:mm:ss') : '') + |
286
|
|
|
'&baseperiodenddatetime=' + (basePeriodEndsDatetime != null ? basePeriodEndsDatetime.format('YYYY-MM-DDTHH:mm:ss') : '') + |
287
|
|
|
'&reportingperiodstartdatetime=' + reportingPeriodBeginsDatetime.format('YYYY-MM-DDTHH:mm:ss') + |
288
|
|
|
'&reportingperiodenddatetime=' + reportingPeriodEndsDatetime.format('YYYY-MM-DDTHH:mm:ss'), { |
289
|
|
|
method: 'GET', |
290
|
|
|
headers: { |
291
|
|
|
"Content-type": "application/json", |
292
|
|
|
"User-UUID": getCookieValue('user_uuid'), |
293
|
|
|
"Token": getCookieValue('token') |
294
|
|
|
}, |
295
|
|
|
body: null, |
296
|
|
|
|
297
|
|
|
}).then(response => { |
298
|
|
|
if (response.ok) { |
299
|
|
|
isResponseOK = true; |
300
|
|
|
} |
301
|
|
|
return response.json(); |
302
|
|
|
}).then(json => { |
303
|
|
|
if (isResponseOK) { |
304
|
|
|
console.log(json) |
305
|
|
|
|
306
|
|
|
setCombinedEquipmentLineChartLabels({ |
307
|
|
|
a0: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
308
|
|
|
a1: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
309
|
|
|
a2: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
310
|
|
|
a3: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
311
|
|
|
}); |
312
|
|
|
|
313
|
|
|
setCombinedEquipmentLineChartData({ |
314
|
|
|
a0: [4, 1, 6, 2, 7, 12, 4, 6, 5, 4, 5, 10], |
315
|
|
|
a1: [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8], |
316
|
|
|
a2: [1, 0, 2, 1, 2, 1, 1, 0, 0, 1, 0, 2], |
317
|
|
|
a3: [1, 0, 2, 1, 2, 1, 1, 0, 0, 1, 0, 2] |
318
|
|
|
}); |
319
|
|
|
|
320
|
|
|
setCombinedEquipmentLineChartOptions([ |
321
|
|
|
{ value: 'a', label: '综合能效比EER' }, |
322
|
|
|
]); |
323
|
|
|
|
324
|
|
|
setParameterLineChartLabels({ |
325
|
|
|
a0: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
326
|
|
|
a1: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
327
|
|
|
a2: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
328
|
|
|
a3: ['2020-07-01','2020-07-02', '2020-07-03', '2020-07-04', '2020-07-05', '2020-07-06', '2020-07-07', '2020-07-08', '2020-07-09','2020-07-10','2020-07-11','2020-07-12'], |
329
|
|
|
}); |
330
|
|
|
|
331
|
|
|
setParameterLineChartData({ |
332
|
|
|
a0: [40, 31, 36, 32, 27, 32, 34, 26, 25, 24, 25, 30], |
333
|
|
|
a1: [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8], |
334
|
|
|
a2: [1, 0, 2, 1, 2, 1, 1, 0, 0, 1, 0, 2], |
335
|
|
|
a3: [1, 0, 2, 1, 2, 1, 1, 0, 0, 1, 0, 2], |
336
|
|
|
a4: [1, 0, 2, 1, 2, 1, 1, 0, 0, 1, 0, 2] |
337
|
|
|
}); |
338
|
|
|
|
339
|
|
|
setParameterLineChartOptions([ |
340
|
|
|
{ value: 'a0', label: '室外温度' }, |
341
|
|
|
{ value: 'a1', label: '相对湿度' }, |
342
|
|
|
{ value: 'a2', label: '电费率' }, |
343
|
|
|
{ value: 'a3', label: '自来水费率' }, |
344
|
|
|
{ value: 'a4', label: '天然气费率' } |
345
|
|
|
]); |
346
|
|
|
|
347
|
|
|
setDetailedDataTableData([ |
348
|
|
|
{ |
349
|
|
|
id: 1, |
350
|
|
|
startdatetime: '2020-07-01', |
351
|
|
|
a: '9872', |
352
|
|
|
b: '55975', |
353
|
|
|
c: '5.67', |
354
|
|
|
}, |
355
|
|
|
{ |
356
|
|
|
id: 2, |
357
|
|
|
startdatetime: '2020-07-02', |
358
|
|
|
a: '9872', |
359
|
|
|
b: '55975', |
360
|
|
|
c: '5.67', |
361
|
|
|
}, |
362
|
|
|
{ |
363
|
|
|
id: 3, |
364
|
|
|
startdatetime: '2020-07-03', |
365
|
|
|
a: '9872', |
366
|
|
|
b: '55975', |
367
|
|
|
c: '5.67', |
368
|
|
|
}, |
369
|
|
|
{ |
370
|
|
|
id: 4, |
371
|
|
|
startdatetime: '2020-07-04', |
372
|
|
|
a: '9872', |
373
|
|
|
b: '55975', |
374
|
|
|
c: '5.67', |
375
|
|
|
}, |
376
|
|
|
{ |
377
|
|
|
id: 5, |
378
|
|
|
startdatetime: '2020-07-05', |
379
|
|
|
a: '9872', |
380
|
|
|
b: '55975', |
381
|
|
|
c: '5.67', |
382
|
|
|
}, |
383
|
|
|
{ |
384
|
|
|
id: 6, |
385
|
|
|
startdatetime: '2020-07-06', |
386
|
|
|
a: '9872', |
387
|
|
|
b: '55975', |
388
|
|
|
c: '5.67', |
389
|
|
|
}, |
390
|
|
|
{ |
391
|
|
|
id: 7, |
392
|
|
|
startdatetime: '2020-07-07', |
393
|
|
|
a: '9872', |
394
|
|
|
b: '55975', |
395
|
|
|
c: '5.67', |
396
|
|
|
}, |
397
|
|
|
{ |
398
|
|
|
id: 8, |
399
|
|
|
startdatetime: '2020-07-08', |
400
|
|
|
a: '9872', |
401
|
|
|
b: '55975', |
402
|
|
|
c: '5.67', |
403
|
|
|
}, |
404
|
|
|
{ |
405
|
|
|
id: 9, |
406
|
|
|
startdatetime: '2020-07-09', |
407
|
|
|
a: '9872', |
408
|
|
|
b: '55975', |
409
|
|
|
c: '5.67', |
410
|
|
|
}, |
411
|
|
|
{ |
412
|
|
|
id: 10, |
413
|
|
|
startdatetime: '2020-07-10', |
414
|
|
|
a: '9872', |
415
|
|
|
b: '55975', |
416
|
|
|
c: '5.67', |
417
|
|
|
}, |
418
|
|
|
{ |
419
|
|
|
id: 11, |
420
|
|
|
startdatetime: '2020-07-11', |
421
|
|
|
a: '9872', |
422
|
|
|
b: '55975', |
423
|
|
|
c: '5.67', |
424
|
|
|
}, |
425
|
|
|
{ |
426
|
|
|
id: 12, |
427
|
|
|
startdatetime: '2020-07-12', |
428
|
|
|
a: '9872', |
429
|
|
|
b: '55975', |
430
|
|
|
c: '5.67', |
431
|
|
|
}, |
432
|
|
|
{ |
433
|
|
|
id: 13, |
434
|
|
|
startdatetime: t('Total'), |
435
|
|
|
a: '118464', |
436
|
|
|
b: '671700', |
437
|
|
|
c: '5.67', |
438
|
|
|
} |
439
|
|
|
]); |
440
|
|
|
|
441
|
|
|
setDetailedDataTableColumns([ |
442
|
|
|
{ |
443
|
|
|
dataField: 'startdatetime', |
444
|
|
|
text: t('Datetime'), |
445
|
|
|
sort: true |
446
|
|
|
}, { |
447
|
|
|
dataField: 'a', |
448
|
|
|
text: '电 (kWh)', |
449
|
|
|
sort: true |
450
|
|
|
}, { |
451
|
|
|
dataField: 'b', |
452
|
|
|
text: '冷 (kWh)', |
453
|
|
|
sort: true |
454
|
|
|
}, { |
455
|
|
|
dataField: 'c', |
456
|
|
|
text: '综合能效比EER (kWh/kWh)', |
457
|
|
|
sort: true |
458
|
|
|
} |
459
|
|
|
]); |
460
|
|
|
} else { |
461
|
|
|
toast.error(json.description) |
462
|
|
|
} |
463
|
|
|
}).catch(err => { |
464
|
|
|
console.log(err); |
465
|
|
|
}); |
466
|
|
|
|
467
|
|
|
}; |
468
|
|
|
|
469
|
|
|
return ( |
470
|
|
|
<Fragment> |
471
|
|
|
<div> |
472
|
|
|
<Breadcrumb> |
473
|
|
|
<BreadcrumbItem>{t('Combined Equipment Data')}</BreadcrumbItem><BreadcrumbItem active>{t('Efficiency')}</BreadcrumbItem> |
474
|
|
|
</Breadcrumb> |
475
|
|
|
</div> |
476
|
|
|
<Card className="bg-light mb-3"> |
477
|
|
|
<CardBody className="p-3"> |
478
|
|
|
<Form onSubmit={handleSubmit}> |
479
|
|
|
<Row form> |
480
|
|
|
<Col xs="auto"> |
481
|
|
|
<FormGroup className="form-group"> |
482
|
|
|
<Label className={labelClasses} for="space"> |
483
|
|
|
{t('Space')} |
484
|
|
|
</Label> |
485
|
|
|
<br /> |
486
|
|
|
<Cascader options={cascaderOptions} |
487
|
|
|
onChange={onSpaceCascaderChange} |
488
|
|
|
changeOnSelect |
489
|
|
|
expandTrigger="hover"> |
490
|
|
|
<Input value={selectedSpaceName || ''} readOnly /> |
491
|
|
|
</Cascader> |
492
|
|
|
</FormGroup> |
493
|
|
|
</Col> |
494
|
|
|
<Col xs="auto"> |
495
|
|
|
<FormGroup> |
496
|
|
|
<Label className={labelClasses} for="combinedEquipmentSelect"> |
497
|
|
|
{t('Combined Equipment')} |
498
|
|
|
</Label> |
499
|
|
|
<CustomInput type="select" id="combinedEquipmentSelect" name="combinedEquipmentSelect" onChange={({ target }) => setSelectedCombinedEquipment(target.value)} |
500
|
|
|
> |
501
|
|
|
{combinedEquipmentList.map((combinedEquipment, index) => ( |
502
|
|
|
<option value={combinedEquipment.value} key={combinedEquipment.value}> |
503
|
|
|
{combinedEquipment.label} |
504
|
|
|
</option> |
505
|
|
|
))} |
506
|
|
|
</CustomInput> |
507
|
|
|
</FormGroup> |
508
|
|
|
</Col> |
509
|
|
|
<Col xs="auto"> |
510
|
|
|
<FormGroup> |
511
|
|
|
<Label className={labelClasses} for="fractionParameter"> |
512
|
|
|
{t('Fraction Parameter')} |
513
|
|
|
</Label> |
514
|
|
|
<CustomInput type="select" id="fractionParameter" name="fractionParameter" value={fractionParameter} onChange={({ target }) => setFractionParameter(target.value)} |
515
|
|
|
> |
516
|
|
|
{fractionParameterOptions.map((fractionParameter, index) => ( |
517
|
|
|
<option value={fractionParameter.value} key={fractionParameter.value}> |
518
|
|
|
{fractionParameter.label} |
519
|
|
|
</option> |
520
|
|
|
))} |
521
|
|
|
</CustomInput> |
522
|
|
|
</FormGroup> |
523
|
|
|
</Col> |
524
|
|
|
<Col xs="auto"> |
525
|
|
|
<FormGroup> |
526
|
|
|
<Label className={labelClasses} for="comparisonType"> |
527
|
|
|
{t('Comparison Types')} |
528
|
|
|
</Label> |
529
|
|
|
<CustomInput type="select" id="comparisonType" name="comparisonType" |
530
|
|
|
defaultValue="month-on-month" |
531
|
|
|
onChange={onComparisonTypeChange} |
532
|
|
|
> |
533
|
|
|
{comparisonTypeOptions.map((comparisonType, index) => ( |
534
|
|
|
<option value={comparisonType.value} key={comparisonType.value} > |
535
|
|
|
{t(comparisonType.label)} |
536
|
|
|
</option> |
537
|
|
|
))} |
538
|
|
|
</CustomInput> |
539
|
|
|
</FormGroup> |
540
|
|
|
</Col> |
541
|
|
|
<Col xs="auto"> |
542
|
|
|
<FormGroup> |
543
|
|
|
<Label className={labelClasses} for="periodType"> |
544
|
|
|
{t('Period Types')} |
545
|
|
|
</Label> |
546
|
|
|
<CustomInput type="select" id="periodType" name="periodType" defaultValue="daily" onChange={({ target }) => setPeriodType(target.value)} |
547
|
|
|
> |
548
|
|
|
{periodTypeOptions.map((periodType, index) => ( |
549
|
|
|
<option value={periodType.value} key={periodType.value} > |
550
|
|
|
{t(periodType.label)} |
551
|
|
|
</option> |
552
|
|
|
))} |
553
|
|
|
</CustomInput> |
554
|
|
|
</FormGroup> |
555
|
|
|
</Col> |
556
|
|
|
<Col xs="auto"> |
557
|
|
|
<FormGroup className="form-group"> |
558
|
|
|
<Label className={labelClasses} for="basePeriodBeginsDatetime"> |
559
|
|
|
{t('Base Period Begins')}{t('(Optional)')} |
560
|
|
|
</Label> |
561
|
|
|
<Datetime id='basePeriodBeginsDatetime' |
562
|
|
|
value={basePeriodBeginsDatetime} |
563
|
|
|
inputProps={{ disabled: basePeriodBeginsDatetimeDisabled }} |
564
|
|
|
onChange={onBasePeriodBeginsDatetimeChange} |
565
|
|
|
isValidDate={getValidBasePeriodBeginsDatetimes} |
566
|
|
|
closeOnSelect={true} /> |
567
|
|
|
</FormGroup> |
568
|
|
|
</Col> |
569
|
|
|
<Col xs="auto"> |
570
|
|
|
<FormGroup className="form-group"> |
571
|
|
|
<Label className={labelClasses} for="basePeriodEndsDatetime"> |
572
|
|
|
{t('Base Period Ends')}{t('(Optional)')} |
573
|
|
|
</Label> |
574
|
|
|
<Datetime id='basePeriodEndsDatetime' |
575
|
|
|
value={basePeriodEndsDatetime} |
576
|
|
|
inputProps={{ disabled: basePeriodEndsDatetimeDisabled }} |
577
|
|
|
onChange={onBasePeriodEndsDatetimeChange} |
578
|
|
|
isValidDate={getValidBasePeriodEndsDatetimes} |
579
|
|
|
closeOnSelect={true} /> |
580
|
|
|
</FormGroup> |
581
|
|
|
</Col> |
582
|
|
|
<Col xs="auto"> |
583
|
|
|
<FormGroup className="form-group"> |
584
|
|
|
<Label className={labelClasses} for="reportingPeriodBeginsDatetime"> |
585
|
|
|
{t('Reporting Period Begins')} |
586
|
|
|
</Label> |
587
|
|
|
<Datetime id='reportingPeriodBeginsDatetime' |
588
|
|
|
value={reportingPeriodBeginsDatetime} |
589
|
|
|
onChange={onReportingPeriodBeginsDatetimeChange} |
590
|
|
|
isValidDate={getValidReportingPeriodBeginsDatetimes} |
591
|
|
|
closeOnSelect={true} /> |
592
|
|
|
</FormGroup> |
593
|
|
|
</Col> |
594
|
|
|
<Col xs="auto"> |
595
|
|
|
<FormGroup className="form-group"> |
596
|
|
|
<Label className={labelClasses} for="reportingPeriodEndsDatetime"> |
597
|
|
|
{t('Reporting Period Ends')} |
598
|
|
|
</Label> |
599
|
|
|
<Datetime id='reportingPeriodEndsDatetime' |
600
|
|
|
value={reportingPeriodEndsDatetime} |
601
|
|
|
onChange={onReportingPeriodEndsDatetimeChange} |
602
|
|
|
isValidDate={getValidReportingPeriodEndsDatetimes} |
603
|
|
|
closeOnSelect={true} /> |
604
|
|
|
</FormGroup> |
605
|
|
|
</Col> |
606
|
|
|
<Col xs="auto"> |
607
|
|
|
<FormGroup> |
608
|
|
|
<br></br> |
609
|
|
|
<ButtonGroup id="submit"> |
610
|
|
|
<Button color="success" disabled={isDisabled} >{t('Submit')}</Button> |
611
|
|
|
</ButtonGroup> |
612
|
|
|
</FormGroup> |
613
|
|
|
</Col> |
614
|
|
|
</Row> |
615
|
|
|
</Form> |
616
|
|
|
</CardBody> |
617
|
|
|
</Card> |
618
|
|
|
<div className="card-deck"> |
619
|
|
|
<CardSummary rate="0.0%" title={t('COMBINED_EQUIPMENT Reporting Period Output CATEGORY UNIT', { 'COMBINED_EQUIPMENT': '冷站', 'CATEGORY': '冷', 'UNIT': '(kWh)' })} |
620
|
|
|
color="info" > |
621
|
|
|
<CountUp end={32988.833} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
622
|
|
|
</CardSummary> |
623
|
|
|
<CardSummary rate="0.0%" title={t('COMBINED_EQUIPMENT Reporting Period Consumption CATEGORY UNIT', { 'COMBINED_EQUIPMENT': '冷站', 'CATEGORY': '电', 'UNIT': '(kWh)' })} |
624
|
|
|
color="info" > |
625
|
|
|
<CountUp end={5880.36} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
626
|
|
|
</CardSummary> |
627
|
|
|
<CardSummary rate="+2.0%" title={t('COMBINED_EQUIPMENT Reporting Period Cumulative Comprehensive Efficiency UNIT', { 'COMBINED_EQUIPMENT': '冷站', 'UNIT': '(kWh/kWh)' })} |
628
|
|
|
color="warning" > |
629
|
|
|
<CountUp end={32988.833 / 5880.36} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
630
|
|
|
</CardSummary> |
631
|
|
|
<CardSummary rate="0.0%" title={t('COMBINED_EQUIPMENT Instantaneous Comprehensive Efficiency UNIT', { 'COMBINED_EQUIPMENT': '冷站', 'UNIT': '(kWh/kWh)' })} |
632
|
|
|
color="warning" > |
633
|
|
|
<CountUp end={32988.833 / 5880.36 + 1} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
634
|
|
|
</CardSummary> |
635
|
|
|
</div> |
636
|
|
|
<div className="card-deck"> |
637
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Output CATEGORY UNIT', { 'EQUIPMENT': '冷机#1', 'CATEGORY': '冷', 'UNIT': '(kWh)' })} |
638
|
|
|
color="info" > |
639
|
|
|
<CountUp end={12988.833} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
640
|
|
|
</CardSummary> |
641
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Consumption CATEGORY UNIT', { 'EQUIPMENT': '冷机#1', 'CATEGORY': '电', 'UNIT': '(kWh)' })} |
642
|
|
|
color="info" > |
643
|
|
|
<CountUp end={2000} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
644
|
|
|
</CardSummary> |
645
|
|
|
<CardSummary rate="+2.0%" title={t('EQUIPMENT Reporting Period Cumulative Efficiency UNIT', { 'EQUIPMENT': '冷机#1', 'UNIT': '(kWh/kWh)' })} |
646
|
|
|
color="warning" > |
647
|
|
|
<CountUp end={12988.833 / 2000} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
648
|
|
|
</CardSummary> |
649
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Instantaneous Efficiency UNIT', { 'EQUIPMENT': '冷机#1', 'UNIT': '(kWh/kWh)' })} |
650
|
|
|
color="warning" > |
651
|
|
|
<CountUp end={12988.833 / 2000 + 1} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
652
|
|
|
</CardSummary> |
653
|
|
|
</div> |
654
|
|
|
<div className="card-deck"> |
655
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Output CATEGORY UNIT', { 'EQUIPMENT': '冷机#2', 'CATEGORY': '冷', 'UNIT': '(kWh)' })} |
656
|
|
|
color="info" > |
657
|
|
|
<CountUp end={22988.833} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
658
|
|
|
</CardSummary> |
659
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Consumption CATEGORY UNIT', { 'EQUIPMENT': '冷机#2', 'CATEGORY': '电', 'UNIT': '(kWh)' })} |
660
|
|
|
color="info" > |
661
|
|
|
<CountUp end={3000} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
662
|
|
|
</CardSummary> |
663
|
|
|
<CardSummary rate="+2.0%" title={t('EQUIPMENT Reporting Period Cumulative Efficiency UNIT', { 'EQUIPMENT': '冷机#2', 'UNIT': '(kWh/kWh)' })} |
664
|
|
|
color="warning" > |
665
|
|
|
<CountUp end={22988.833 / 3000} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
666
|
|
|
</CardSummary> |
667
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Instantaneous Efficiency UNIT', { 'EQUIPMENT': '冷机#2', 'UNIT': '(kWh/kWh)' })} |
668
|
|
|
color="warning" > |
669
|
|
|
<CountUp end={22988.833 / 3000 + 1} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
670
|
|
|
</CardSummary> |
671
|
|
|
</div> |
672
|
|
|
<div className="card-deck"> |
673
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Output CATEGORY UNIT', { 'EQUIPMENT': '冷冻泵', 'CATEGORY': '冷', 'UNIT': '(kWh)' })} |
674
|
|
|
color="info" > |
675
|
|
|
<CountUp end={32988.833} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
676
|
|
|
</CardSummary> |
677
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Consumption CATEGORY UNIT', { 'EQUIPMENT': '冷冻泵', 'CATEGORY': '电', 'UNIT': '(kWh)' })} |
678
|
|
|
color="info" > |
679
|
|
|
<CountUp end={200} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
680
|
|
|
</CardSummary> |
681
|
|
|
<CardSummary rate="+2.0%" title={t('EQUIPMENT Reporting Period Cumulative Efficiency UNIT', { 'EQUIPMENT': '冷冻泵', 'UNIT': '(kWh/kWh)' })} |
682
|
|
|
color="warning" > |
683
|
|
|
<CountUp end={32988.833 / 200} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
684
|
|
|
</CardSummary> |
685
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Instantaneous Efficiency UNIT', { 'EQUIPMENT': '冷冻泵', 'UNIT': '(kWh/kWh)' })} |
686
|
|
|
color="warning" > |
687
|
|
|
<CountUp end={32988.833 / 200 + 1} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
688
|
|
|
</CardSummary> |
689
|
|
|
</div> |
690
|
|
|
<div className="card-deck"> |
691
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Output CATEGORY UNIT', { 'EQUIPMENT': '冷却泵', 'CATEGORY': '冷', 'UNIT': '(kWh)' })} |
692
|
|
|
color="info" > |
693
|
|
|
<CountUp end={32988.833} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
694
|
|
|
</CardSummary> |
695
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Consumption CATEGORY UNIT', { 'EQUIPMENT': '冷却泵', 'CATEGORY': '电', 'UNIT': '(kWh)' })} |
696
|
|
|
color="info" > |
697
|
|
|
<CountUp end={300} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
698
|
|
|
</CardSummary> |
699
|
|
|
<CardSummary rate="+2.0%" title={t('EQUIPMENT Reporting Period Cumulative Efficiency UNIT', { 'EQUIPMENT': '冷却泵', 'UNIT': '(kWh/kWh)' })} |
700
|
|
|
color="warning" > |
701
|
|
|
<CountUp end={32988.833 / 300} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
702
|
|
|
</CardSummary> |
703
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Instantaneous Efficiency UNIT', { 'EQUIPMENT': '冷却泵', 'UNIT': '(kWh/kWh)' })} |
704
|
|
|
color="warning" > |
705
|
|
|
<CountUp end={32988.833 / 300 + 1} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
706
|
|
|
</CardSummary> |
707
|
|
|
</div> |
708
|
|
|
<div className="card-deck"> |
709
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Output CATEGORY UNIT', { 'EQUIPMENT': '冷却塔', 'CATEGORY': '冷', 'UNIT': '(kWh)' })} |
710
|
|
|
color="info" > |
711
|
|
|
<CountUp end={32988.833} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
712
|
|
|
</CardSummary> |
713
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Reporting Period Consumption CATEGORY UNIT', { 'EQUIPMENT': '冷却塔', 'CATEGORY': '电', 'UNIT': '(kWh)' })} |
714
|
|
|
color="info" > |
715
|
|
|
<CountUp end={380.36} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
716
|
|
|
</CardSummary> |
717
|
|
|
<CardSummary rate="+2.0%" title={t('EQUIPMENT Reporting Period Cumulative Efficiency UNIT', { 'EQUIPMENT': '冷却塔', 'UNIT': '(kWh/kWh)' })} |
718
|
|
|
color="warning" > |
719
|
|
|
<CountUp end={32988.833 / 380.36} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
720
|
|
|
</CardSummary> |
721
|
|
|
<CardSummary rate="0.0%" title={t('EQUIPMENT Instantaneous Efficiency UNIT', { 'EQUIPMENT': '冷却塔', 'UNIT': '(kWh/kWh)' })} |
722
|
|
|
color="warning" > |
723
|
|
|
<CountUp end={32988.833 / 380.36 + 1} duration={2} prefix="" separator="," decimals={2} decimal="." /> |
724
|
|
|
</CardSummary> |
725
|
|
|
</div> |
726
|
|
|
<LineChart reportingTitle={t('COMBINED_EQUIPMENT Reporting Period Cumulative Comprehensive Efficiency VALUE UNIT', { 'COMBINED_EQUIPMENT': '冷站', 'VALUE': 5.609, 'UNIT': '(kWh/kWh)' })} |
727
|
|
|
baseTitle={t('COMBINED_EQUIPMENT Base Period Cumulative Comprehensive Efficiency VALUE UNIT', { 'COMBINED_EQUIPMENT': '冷站', 'VALUE': 4.321, 'UNIT': '(kWh/kWh)' })} |
728
|
|
|
labels={combinedEquipmentLineChartLabels} |
729
|
|
|
data={combinedEquipmentLineChartData} |
730
|
|
|
options={combinedEquipmentLineChartOptions}> |
731
|
|
|
</LineChart> |
732
|
|
|
<LineChart reportingTitle={t('Related Parameters')} |
733
|
|
|
baseTitle='' |
734
|
|
|
labels={parameterLineChartLabels} |
735
|
|
|
data={parameterLineChartData} |
736
|
|
|
options={parameterLineChartOptions}> |
737
|
|
|
</LineChart> |
738
|
|
|
<br /> |
739
|
|
|
<DetailedDataTable data={detailedDataTableData} title={t('Detailed Data')} columns={detailedDataTableColumns} pagesize={50} > |
740
|
|
|
</DetailedDataTable> |
741
|
|
|
|
742
|
|
|
</Fragment> |
743
|
|
|
); |
744
|
|
|
}; |
745
|
|
|
|
746
|
|
|
export default withTranslation()(withRedirect(CombinedEquipmentEfficiency)); |
747
|
|
|
|