@ledvance/ui-biz-bundle 1.1.165 → 1.1.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +4 -18
- package/src/newModules/energyConsumption/EnergyConsumptionChart/PowerChartSection.tsx +5 -4
- package/src/newModules/energyConsumption/co2Data.ts +7 -0
- package/src/newModules/energyConsumption/component/PowerLineChart.tsx +17 -2
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +53 -51
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +10 -0
package/package.json
CHANGED
|
@@ -3,7 +3,6 @@ import I18n from '@ledvance/base/src/i18n'
|
|
|
3
3
|
import { useDp } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
4
4
|
import {
|
|
5
5
|
DpReportSataData,
|
|
6
|
-
DpResultByMonthResData,
|
|
7
6
|
getDataWithSpecified,
|
|
8
7
|
getDpResultByHour,
|
|
9
8
|
getDpResultByMonth,
|
|
@@ -148,7 +147,8 @@ export interface PowerDataItem {
|
|
|
148
147
|
key: string
|
|
149
148
|
chartTitle: string
|
|
150
149
|
time: number,
|
|
151
|
-
value: number
|
|
150
|
+
value: number,
|
|
151
|
+
interval: number,
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// 常量抽离(便于维护)
|
|
@@ -161,21 +161,6 @@ const RETRY_CONFIG = {
|
|
|
161
161
|
backoffFactor: 2,
|
|
162
162
|
} as const;
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* 创建一个0值填充的数据点
|
|
166
|
-
* @param timePoint Dayjs对象
|
|
167
|
-
* @returns PowerDataItem
|
|
168
|
-
*/
|
|
169
|
-
function createZeroPaddingPoint(timePoint: dayjs.Dayjs): PowerDataItem {
|
|
170
|
-
const timeMs = timePoint.valueOf();
|
|
171
|
-
return {
|
|
172
|
-
key: timePoint.format('HH:mm:ss'),
|
|
173
|
-
chartTitle: timePoint.format('MM/DD/YYYY HH:mm:ss'),
|
|
174
|
-
time: timeMs,
|
|
175
|
-
value: 0,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
164
|
/**
|
|
180
165
|
* 获取设备功率数据
|
|
181
166
|
* @param devId 设备ID
|
|
@@ -205,7 +190,8 @@ export async function getPowerData(devId: string, powerDpCode: string, interval:
|
|
|
205
190
|
key: dp.timeStr,
|
|
206
191
|
chartTitle: dayjs.unix(dp.timeStamp).format('MM/DD/YYYY HH:mm:ss'),
|
|
207
192
|
time: dp.timeStamp * 1000,
|
|
208
|
-
value: parseFloat(dp.value) / 10
|
|
193
|
+
value: parseFloat(dp.value) / 10,
|
|
194
|
+
interval: interval
|
|
209
195
|
}
|
|
210
196
|
})
|
|
211
197
|
}
|
|
@@ -3,12 +3,13 @@ import React from 'react'
|
|
|
3
3
|
import { Text, TouchableOpacity, View } from 'react-native'
|
|
4
4
|
import PowerLineChart from '../component/PowerLineChart'
|
|
5
5
|
import { EmptyDataView } from './EmptyDataView'
|
|
6
|
+
import { PowerRangeInterval } from '../co2Data'
|
|
6
7
|
|
|
7
8
|
const INTERVAL_OPTIONS = [
|
|
8
|
-
{ label: 'charttime_type1', value:
|
|
9
|
-
{ label: 'charttime_type2', value:
|
|
10
|
-
{ label: 'charttime_type3', value:
|
|
11
|
-
{ label: 'charttime_type4', value:
|
|
9
|
+
{ label: 'charttime_type1', value: PowerRangeInterval.DAY_1 },
|
|
10
|
+
{ label: 'charttime_type2', value: PowerRangeInterval.HOUR_6 },
|
|
11
|
+
{ label: 'charttime_type3', value: PowerRangeInterval.HOUR_1 },
|
|
12
|
+
{ label: 'charttime_type4', value: PowerRangeInterval.MINUTE_5 },
|
|
12
13
|
]
|
|
13
14
|
|
|
14
15
|
export const PowerChartSection = ({ isLandscape, state, actions, styles, theme, chartHeight }) => {
|
|
@@ -23664,3 +23664,10 @@ export enum ChartType {
|
|
|
23664
23664
|
kWh = 'kWh',
|
|
23665
23665
|
Watt = 'Watt',
|
|
23666
23666
|
}
|
|
23667
|
+
|
|
23668
|
+
export enum PowerRangeInterval {
|
|
23669
|
+
MINUTE_5 = 5,
|
|
23670
|
+
HOUR_1 = 1 * 60,
|
|
23671
|
+
HOUR_6 = 6 * 60,
|
|
23672
|
+
DAY_1 = 24 * 60,
|
|
23673
|
+
}
|
|
@@ -5,6 +5,7 @@ import React, { useRef } from 'react'
|
|
|
5
5
|
import { View } from 'react-native'
|
|
6
6
|
import { Utils } from 'tuya-panel-kit'
|
|
7
7
|
import { PowerDataItem } from '../EnergyConsumptionActions'
|
|
8
|
+
import { PowerRangeInterval } from '../co2Data'
|
|
8
9
|
import dayjs from 'dayjs'
|
|
9
10
|
|
|
10
11
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -24,6 +25,8 @@ const GAP_THRESHOLD_MS = 5 * 1000 // 5 秒
|
|
|
24
25
|
*/
|
|
25
26
|
function fillGaps(items: PowerDataItem[]): PowerDataItem[] {
|
|
26
27
|
if (!items || items.length < 2) return items
|
|
28
|
+
// MINUTE_5 模式下数据点本身间隔约 30s,不做间隙补充
|
|
29
|
+
if (items[0].interval === PowerRangeInterval.MINUTE_5) return items
|
|
27
30
|
const result: PowerDataItem[] = []
|
|
28
31
|
for (let i = 0; i < items.length; i++) {
|
|
29
32
|
result.push(items[i])
|
|
@@ -45,10 +48,11 @@ function fillGaps(items: PowerDataItem[]): PowerDataItem[] {
|
|
|
45
48
|
}
|
|
46
49
|
const gapDayjs = dayjs(gapTime)
|
|
47
50
|
result.push({
|
|
48
|
-
key: gapDayjs.format('
|
|
51
|
+
key: gapDayjs.format('MM/DD/YYYY HH:mm:ss'),
|
|
49
52
|
chartTitle: gapDayjs.format('MM/DD/YYYY HH:mm:ss'),
|
|
50
53
|
time: gapTime,
|
|
51
54
|
value: gapValue,
|
|
55
|
+
interval: cur.interval,
|
|
52
56
|
})
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -73,7 +77,18 @@ const PowerLineChart = (props: PowerLineChartProps) => {
|
|
|
73
77
|
show: true,
|
|
74
78
|
triggerOn: 'mousemove|click',
|
|
75
79
|
trigger: 'axis',
|
|
76
|
-
position: ['30%', '50%']
|
|
80
|
+
position: ['30%', '50%'],
|
|
81
|
+
formatter: function (params) {
|
|
82
|
+
if (!params || !params.length) return ''
|
|
83
|
+
var item = params[0]
|
|
84
|
+
var date = new Date(item.value[0])
|
|
85
|
+
function pad(num) {
|
|
86
|
+
return num < 10 ? '0' + num : num
|
|
87
|
+
}
|
|
88
|
+
var time = pad(date.getMonth() + 1) + '/' + pad(date.getDate()) + '/' + date.getFullYear() + ' ' +
|
|
89
|
+
pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())
|
|
90
|
+
return (time + '<br/>' + item.marker + item.seriesName + ': ' + '<b>' + item.value[1] + '</b>')
|
|
91
|
+
}
|
|
77
92
|
},
|
|
78
93
|
grid: {
|
|
79
94
|
right: '5%'
|
|
@@ -454,59 +454,61 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
454
454
|
<Spacer height={cx(30)} />
|
|
455
455
|
|
|
456
456
|
{/* Apply for */}
|
|
457
|
-
|
|
458
|
-
<
|
|
459
|
-
{
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
{state.selectedSkill.length
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
457
|
+
{(!params.applyForDisabled && params.applyForList.length > 1) && (
|
|
458
|
+
<View style={styles.cardContainer}>
|
|
459
|
+
<Text style={styles.itemTitle}>
|
|
460
|
+
{I18n.getLang('timeschedule_add_schedule_subheadline_text')}
|
|
461
|
+
</Text>
|
|
462
|
+
<Spacer height={cx(10)} />
|
|
463
|
+
<View style={[styles.applyContent, { paddingTop: state.selectedSkill.length ? cx(10) : 0 }]}>
|
|
464
|
+
{state.selectedSkill.length === 0 ? (
|
|
465
|
+
<Text style={{color: props.theme?.global.fontColor}}>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text>
|
|
466
|
+
) : (
|
|
467
|
+
state.selectedSkill.map(skill => (
|
|
468
|
+
<View
|
|
469
|
+
style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}
|
|
470
|
+
key={skill.dp}
|
|
471
|
+
>
|
|
472
|
+
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{skill.key}</Text>
|
|
473
|
+
{showSelectedIcon && (
|
|
474
|
+
<TouchableOpacity
|
|
475
|
+
onPress={() => {
|
|
476
|
+
state.selectedSkill = state.selectedSkill.filter(s => skill.dp !== s.dp);
|
|
477
|
+
state.unSelectedSkill = [...state.unSelectedSkill, skill];
|
|
478
|
+
}}
|
|
479
|
+
style={{ paddingHorizontal: cx(5) }}
|
|
480
|
+
>
|
|
481
|
+
<Image
|
|
482
|
+
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
483
|
+
source={{ uri: res.ic_arrows_nav_clear}}
|
|
484
|
+
/>
|
|
485
|
+
</TouchableOpacity>
|
|
486
|
+
)}
|
|
487
|
+
</View>
|
|
488
|
+
))
|
|
489
|
+
)}
|
|
490
|
+
</View>
|
|
491
|
+
{state.unSelectedSkill.map((item: ApplyForItem) => {
|
|
492
|
+
return (
|
|
493
|
+
<TouchableOpacity
|
|
494
|
+
style={styles.applyItem}
|
|
495
|
+
key={item.dp}
|
|
496
|
+
onPress={() => {
|
|
497
|
+
state.selectedSkill = [...state.selectedSkill, item];
|
|
498
|
+
state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
|
|
499
|
+
}}
|
|
470
500
|
>
|
|
471
|
-
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
<Image
|
|
481
|
-
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
482
|
-
source={{ uri: res.ic_arrows_nav_clear}}
|
|
483
|
-
/>
|
|
484
|
-
</TouchableOpacity>
|
|
485
|
-
)}
|
|
486
|
-
</View>
|
|
487
|
-
))
|
|
488
|
-
)}
|
|
501
|
+
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{item.key}</Text>
|
|
502
|
+
<Image
|
|
503
|
+
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
504
|
+
source={{ uri: res.device_panel_timer_add}}
|
|
505
|
+
/>
|
|
506
|
+
</TouchableOpacity>
|
|
507
|
+
);
|
|
508
|
+
})}
|
|
509
|
+
<Spacer />
|
|
489
510
|
</View>
|
|
490
|
-
|
|
491
|
-
return (
|
|
492
|
-
<TouchableOpacity
|
|
493
|
-
style={styles.applyItem}
|
|
494
|
-
key={item.dp}
|
|
495
|
-
onPress={() => {
|
|
496
|
-
state.selectedSkill = [...state.selectedSkill, item];
|
|
497
|
-
state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
|
|
498
|
-
}}
|
|
499
|
-
>
|
|
500
|
-
<Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{item.key}</Text>
|
|
501
|
-
<Image
|
|
502
|
-
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
503
|
-
source={{ uri: res.device_panel_timer_add}}
|
|
504
|
-
/>
|
|
505
|
-
</TouchableOpacity>
|
|
506
|
-
);
|
|
507
|
-
})}
|
|
508
|
-
<Spacer />
|
|
509
|
-
</View>
|
|
511
|
+
)}
|
|
510
512
|
|
|
511
513
|
{/* device state */}
|
|
512
514
|
<Text style={[styles.itemTitle, styles.cardContainer]}>
|
|
@@ -101,6 +101,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
101
101
|
title={item.name || item.key}
|
|
102
102
|
color={getBlockColor(item as any)}
|
|
103
103
|
colorAlpha={1}
|
|
104
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
105
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
104
106
|
enable={item.enable}
|
|
105
107
|
setEnable={(enable: boolean) => {
|
|
106
108
|
state.applyForList = state.applyForList.map((apply, index) => {
|
|
@@ -259,6 +261,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
259
261
|
title={item.key}
|
|
260
262
|
color={getBlockColor(item.type)}
|
|
261
263
|
colorAlpha={1}
|
|
264
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
265
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
262
266
|
enable={item.enable}
|
|
263
267
|
setEnable={(enable: boolean) => {
|
|
264
268
|
state.applyForList[idx].enable = enable;
|
|
@@ -329,6 +333,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
329
333
|
title={state.applyForList[0]?.name || state.applyForList[0]?.key}
|
|
330
334
|
color={getBlockColor()}
|
|
331
335
|
colorAlpha={1}
|
|
336
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
337
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
332
338
|
enable={state.applyForList[0]?.enable}
|
|
333
339
|
setEnable={(enable: boolean) => {
|
|
334
340
|
state.applyForList[0].enable = enable;
|
|
@@ -408,6 +414,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
408
414
|
title={item.key}
|
|
409
415
|
color={getBlockColor(item.type)}
|
|
410
416
|
colorAlpha={1}
|
|
417
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
418
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
411
419
|
enable={item.enable}
|
|
412
420
|
setEnable={(enable: boolean) => {
|
|
413
421
|
state.applyForList[idx].enable = enable;
|
|
@@ -499,6 +507,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
499
507
|
icon={{ uri: PowerStripIcon[item.index ?? 0] }}
|
|
500
508
|
disabledEdit={true}
|
|
501
509
|
onNameChange={() => { }}
|
|
510
|
+
onText={I18n.getLang('routine_push_msg_on')}
|
|
511
|
+
offText={I18n.getLang('watchapp_entitystate_off')}
|
|
502
512
|
enabled={item.enable}
|
|
503
513
|
onSwitchChange={async enable => {
|
|
504
514
|
state.applyForList = state.applyForList.map((apply, index) => {
|