@ledvance/ui-biz-bundle 1.1.143 → 1.1.145
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/navigation/Routers.ts +1 -0
- package/src/newModules/biorhythm/BiorhythmActions.ts +1 -1
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +7 -6
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +39 -8
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +7 -4
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +10 -3
- package/src/newModules/energyConsumption/component/DateSelectedItem.tsx +1 -1
- package/src/newModules/energyConsumption/component/NewBarChart.tsx +3 -1
- package/src/newModules/energyConsumption/component/PowerLineChart.tsx +6 -12
- package/src/newModules/timeSchedule/Router.ts +13 -4
- package/src/newModules/timeSchedule/TimeScheduleAddPage.tsx +71 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +44 -36
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +1 -1
package/package.json
CHANGED
|
@@ -30,6 +30,7 @@ export const ui_biz_routerKey = {
|
|
|
30
30
|
'ui_biz_flag_page': 'ui_biz_flag_page',
|
|
31
31
|
'ui_biz_flag_page_edit': 'ui_biz_flag_page_edit',
|
|
32
32
|
'ui_biz_time_schedule_new': 'ui_biz_time_schedule_new',
|
|
33
|
+
'ui_biz_time_schedule_add_new': 'ui_biz_time_schedule_add_new',
|
|
33
34
|
'ui_biz_time_schedule_edit_new': 'ui_biz_time_schedule_edit_new',
|
|
34
35
|
'ui_biz_fixed_time_new': 'ui_biz_fixed_time_new',
|
|
35
36
|
'ui_biz_fixed_time_edit_new': 'ui_biz_fixed_time_edit_new',
|
|
@@ -359,7 +359,7 @@ function obj2Dp(obj: BiorhythmBean): string {
|
|
|
359
359
|
function vo2Dto(biorhythmBean: BiorhythmBean): RemoteBiorhythmBean {
|
|
360
360
|
return {
|
|
361
361
|
enable: biorhythmBean.enable,
|
|
362
|
-
repeatPeriod: biorhythmBean.weeks,
|
|
362
|
+
repeatPeriod: biorhythmBean.weeks.slice(0, 7),
|
|
363
363
|
gradientWay: BiorhythmGradientTypeMap[biorhythmBean.gradient],
|
|
364
364
|
rhythmPlan: biorhythmBean.planList.map(plan => {
|
|
365
365
|
const hour = Math.trunc(plan.time / 60).toString().padStart(2, '0')
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getSpecifiedTimeDpReportLogs
|
|
11
11
|
} from '@ledvance/base/src/models/TuyaApi'
|
|
12
12
|
import { exportCsvFile, localeNumber, loopsText, monthFormat, monthFormatShort } from '@ledvance/base/src/utils/common'
|
|
13
|
-
import { overDays
|
|
13
|
+
import { overDays } from '@ledvance/base/src/utils'
|
|
14
14
|
import dayjs from 'dayjs'
|
|
15
15
|
import CustomParseFormat from 'dayjs/plugin/customParseFormat'
|
|
16
16
|
import { isEmpty } from 'lodash'
|
|
@@ -75,7 +75,7 @@ const getDpResultByYear = async (devId: string, addEleDpCode: string, dateStr: s
|
|
|
75
75
|
key: `${monthFormat(month)} ${year}`,
|
|
76
76
|
value: (Number(curMonth[month]) || 0).toFixed(2),
|
|
77
77
|
headlineText: `${year}${month}`,
|
|
78
|
-
chartTitle: `${monthFormatShort(month)}
|
|
78
|
+
chartTitle: `${monthFormatShort(month)}`
|
|
79
79
|
}
|
|
80
80
|
})
|
|
81
81
|
}
|
|
@@ -99,7 +99,7 @@ const getDpResultByYearMonth = async (devId: string, addEleDpCode: string, dateS
|
|
|
99
99
|
|
|
100
100
|
// 格式化为 'YYYY/MM/DD' 格式
|
|
101
101
|
const formattedDate = `${year}/${month}/${day}`
|
|
102
|
-
const dateStr = `${day}
|
|
102
|
+
const dateStr = `${day}.${month}.${year}`
|
|
103
103
|
const dateObj = dayjs(formattedDate, 'YYYY/MM/DD')
|
|
104
104
|
const dayOfWeek = dateObj.day() % 7
|
|
105
105
|
const key = `${dateStr} (${loopsText[dayOfWeek]})`
|
|
@@ -107,7 +107,7 @@ const getDpResultByYearMonth = async (devId: string, addEleDpCode: string, dateS
|
|
|
107
107
|
key,
|
|
108
108
|
value: Number(dayList[time] || 0).toFixed(2),
|
|
109
109
|
headlineText: formattedDate,
|
|
110
|
-
chartTitle: `${Number(key?.split('
|
|
110
|
+
chartTitle: `${Number(key?.split('.')[0])} ${loopsText[dayOfWeek]}`
|
|
111
111
|
}
|
|
112
112
|
})
|
|
113
113
|
}
|
|
@@ -145,6 +145,7 @@ const getDpResultByDate = async (devId: string, addEleDpCode: string, date: stri
|
|
|
145
145
|
export interface PowerDataItem {
|
|
146
146
|
key: string
|
|
147
147
|
chartTitle: string
|
|
148
|
+
time: number,
|
|
148
149
|
value: number
|
|
149
150
|
}
|
|
150
151
|
|
|
@@ -165,11 +166,11 @@ export async function getPowerData(devId: string, powerDpCode: string, interval:
|
|
|
165
166
|
backoffFactor: 2
|
|
166
167
|
}
|
|
167
168
|
) as DpReportSataData[]
|
|
168
|
-
xLog('powerData', dpResult)
|
|
169
169
|
return dpResult.map(dp => {
|
|
170
170
|
return {
|
|
171
171
|
key: dp.timeStr,
|
|
172
|
-
chartTitle: dayjs.unix(dp.timeStamp).format('HH:mm:ss'),
|
|
172
|
+
chartTitle: dayjs.unix(dp.timeStamp).format('MM/DD/YYYY HH:mm:ss'),
|
|
173
|
+
time: dp.timeStamp * 1000,
|
|
173
174
|
value: parseFloat(dp.value) / 10
|
|
174
175
|
}
|
|
175
176
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { queryDpIds } from '@ledvance/base/src/api/native'
|
|
1
2
|
import InfoText from '@ledvance/base/src/components/InfoText'
|
|
2
3
|
import Page from '@ledvance/base/src/components/Page'
|
|
3
4
|
import Segmented from '@ledvance/base/src/components/Segmented'
|
|
@@ -7,10 +8,11 @@ import I18n from '@ledvance/base/src/i18n'
|
|
|
7
8
|
import { useDeviceId } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
8
9
|
import res from '@ledvance/base/src/res'
|
|
9
10
|
import { loopsText, monthFormat } from '@ledvance/base/src/utils/common'
|
|
10
|
-
import { overDays } from '@ledvance/base/src/utils
|
|
11
|
-
import
|
|
11
|
+
import { overDays } from '@ledvance/base/src/utils'
|
|
12
|
+
import { useIsFocused } from '@react-navigation/core'
|
|
13
|
+
import PowerLineChart from './component/PowerLineChart'
|
|
12
14
|
import { useRoute } from '@react-navigation/core'
|
|
13
|
-
import { useReactive, useUpdateEffect } from 'ahooks'
|
|
15
|
+
import { useInterval, useReactive, useUpdateEffect } from 'ahooks'
|
|
14
16
|
import dayjs from 'dayjs'
|
|
15
17
|
import React, { useCallback, useMemo } from 'react'
|
|
16
18
|
import { Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
@@ -29,6 +31,7 @@ const { withTheme } = Utils.ThemeUtils
|
|
|
29
31
|
export interface EnergyConsumptionChartProps {
|
|
30
32
|
addEleDpCode: string
|
|
31
33
|
powerDpCode: string
|
|
34
|
+
backTitle: string
|
|
32
35
|
headlineText: string
|
|
33
36
|
chartData: OverviewItem[],
|
|
34
37
|
over365Days?: boolean
|
|
@@ -40,9 +43,20 @@ export interface EnergyConsumptionChartProps {
|
|
|
40
43
|
|
|
41
44
|
const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
|
|
42
45
|
const devId = useDeviceId()
|
|
46
|
+
const isFocused = useIsFocused()
|
|
43
47
|
|
|
44
48
|
const params = useRoute().params as EnergyConsumptionChartProps
|
|
45
|
-
const { price, unit, date, addEleDpCode, powerDpCode, over365Days, over7Days } = params
|
|
49
|
+
const { backTitle, price, unit, date, addEleDpCode, powerDpCode, over365Days, over7Days } = params
|
|
50
|
+
|
|
51
|
+
useInterval(() => {
|
|
52
|
+
if (isFocused) {
|
|
53
|
+
const jsonData = JSON.stringify([powerDpCode])
|
|
54
|
+
queryDpIds(jsonData, devId).then()
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
5000,
|
|
58
|
+
{immediate: true}
|
|
59
|
+
)
|
|
46
60
|
const styles = StyleSheet.create({
|
|
47
61
|
listEmptyView: {
|
|
48
62
|
alignItems: 'center',
|
|
@@ -166,7 +180,7 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
|
|
|
166
180
|
state.headlineText = `${monthFormat(month)} ${year}`
|
|
167
181
|
break
|
|
168
182
|
case DateType.Day:
|
|
169
|
-
state.headlineText = `${day}
|
|
183
|
+
state.headlineText = `${day}.${month}.${year} (${loopsText[dayOfWeek]})`
|
|
170
184
|
break
|
|
171
185
|
}
|
|
172
186
|
}, [state.dateType, state.headlineText])
|
|
@@ -201,7 +215,7 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
|
|
|
201
215
|
|
|
202
216
|
return (
|
|
203
217
|
<Page
|
|
204
|
-
backText={
|
|
218
|
+
backText={backTitle}
|
|
205
219
|
showGreenery={false}
|
|
206
220
|
loading={state.loading}
|
|
207
221
|
greeneryIcon={res.energy_consumption_greenery}
|
|
@@ -279,8 +293,25 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
|
|
|
279
293
|
</>
|
|
280
294
|
) : (
|
|
281
295
|
<>
|
|
282
|
-
{
|
|
283
|
-
|
|
296
|
+
{
|
|
297
|
+
(state.loading || state.powerData.length <= 0) ? (
|
|
298
|
+
<View style={[styles.listEmptyView, {marginVertical: cx(70)}]}>
|
|
299
|
+
<Spacer height={cx(26)}/>
|
|
300
|
+
<Image
|
|
301
|
+
style={styles.listEmptyImage}
|
|
302
|
+
source={{ uri: res.ldv_timer_empty }}/>
|
|
303
|
+
<Spacer height={cx(14)}/>
|
|
304
|
+
<InfoText
|
|
305
|
+
text={I18n.getLang('power_chart_empty')}
|
|
306
|
+
icon={res.ic_info}
|
|
307
|
+
textStyle={styles.listEmptyText}
|
|
308
|
+
contentColor={props.theme?.global.fontColor}
|
|
309
|
+
/>
|
|
310
|
+
</View>
|
|
311
|
+
) : (
|
|
312
|
+
<PowerLineChart height={cx(400)} data={state.powerData}/>
|
|
313
|
+
)
|
|
314
|
+
}
|
|
284
315
|
<View style={styles.intervalContainer}>
|
|
285
316
|
{
|
|
286
317
|
[24 * 60, 6 * 60, 60, 5].map((item, index) => {
|
|
@@ -27,6 +27,7 @@ const { convertX: cx } = Utils.RatioUtils
|
|
|
27
27
|
const { withTheme } = Utils.ThemeUtils
|
|
28
28
|
|
|
29
29
|
export interface EnergyConsumptionDetailProps {
|
|
30
|
+
backTitle: string
|
|
30
31
|
addEleDpCode: string
|
|
31
32
|
powerDpCode: string
|
|
32
33
|
curMonth: OverviewItem
|
|
@@ -87,7 +88,7 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
|
|
|
87
88
|
|
|
88
89
|
// 格式化为 'YYYY/MM/DD' 格式
|
|
89
90
|
const formattedDate = `${year}/${month}/${day}`
|
|
90
|
-
const dateStr = `${day}
|
|
91
|
+
const dateStr = `${day}.${month}.${year}`
|
|
91
92
|
const dateObj = dayjs(formattedDate, "YYYY/MM/DD");
|
|
92
93
|
const dayOfWeek = dateObj.day() % 7;
|
|
93
94
|
const key = `${dateStr} (${loopsText[dayOfWeek]})`
|
|
@@ -95,7 +96,7 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
|
|
|
95
96
|
key,
|
|
96
97
|
value: Number(dayList[time] || 0).toFixed(2),
|
|
97
98
|
headlineText: formattedDate,
|
|
98
|
-
chartTitle: `${Number(key?.split('
|
|
99
|
+
chartTitle: `${Number(key?.split('.')[0])} ${loopsText[dayOfWeek]}`
|
|
99
100
|
}
|
|
100
101
|
})
|
|
101
102
|
|
|
@@ -104,7 +105,7 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
const getHourList = async (item: OverviewItem) => {
|
|
107
|
-
const value = item?.key?.split(' ')[0]?.split('
|
|
108
|
+
const value = item?.key?.split(' ')[0]?.split('.')
|
|
108
109
|
const date = `${value[2]}${value[1]}${value[0]}`
|
|
109
110
|
state.over7Days = overDays(date, 7)
|
|
110
111
|
if (state.over7Days) {
|
|
@@ -189,7 +190,7 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
|
|
|
189
190
|
|
|
190
191
|
return (
|
|
191
192
|
<Page
|
|
192
|
-
backText={
|
|
193
|
+
backText={params.backTitle}
|
|
193
194
|
headlineText={params.curMonth.key}
|
|
194
195
|
headlineIcon={state.overviewList.length ? res.download_icon : undefined}
|
|
195
196
|
onHeadlineIconClick={() => {
|
|
@@ -277,6 +278,7 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
|
|
|
277
278
|
headlineText={I18n.getLang('consumption_data_monthly_overview_field2_headline_text')}
|
|
278
279
|
headlineClick={() => {
|
|
279
280
|
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_chart, {
|
|
281
|
+
backTitle: params.backTitle,
|
|
280
282
|
headlineText: params.curMonth.key,
|
|
281
283
|
chartData: state.overviewList,
|
|
282
284
|
over365Days: state.over365Days,
|
|
@@ -292,6 +294,7 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
|
|
|
292
294
|
const res = await getHourList(item)
|
|
293
295
|
state.loading = false
|
|
294
296
|
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_chart, {
|
|
297
|
+
backTitle: params.backTitle,
|
|
295
298
|
headlineText: item.key,
|
|
296
299
|
chartData: res,
|
|
297
300
|
over7Days: state.over7Days,
|
|
@@ -188,7 +188,7 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
188
188
|
key: `${monthFormat(month)} ${year}`,
|
|
189
189
|
value: (Number(curMonth[month]) || 0).toFixed(2),
|
|
190
190
|
headlineText: `${year}${month}`,
|
|
191
|
-
chartTitle: `${monthFormatShort(month)}
|
|
191
|
+
chartTitle: `${monthFormatShort(month)}`
|
|
192
192
|
}
|
|
193
193
|
})
|
|
194
194
|
return monthData
|
|
@@ -222,6 +222,10 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
222
222
|
return titleMapping[value ? 0 : 1]
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
const backTitle = useMemo(() => {
|
|
226
|
+
return I18n.getLang(isGeneration ? 'sockets_headline_power' : 'consumption_data_annual_bar_chart_system_back_text')
|
|
227
|
+
}, [isGeneration])
|
|
228
|
+
|
|
225
229
|
const styles = StyleSheet.create({
|
|
226
230
|
showTip: {
|
|
227
231
|
marginHorizontal: cx(24)
|
|
@@ -318,8 +322,8 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
318
322
|
return (
|
|
319
323
|
<Page
|
|
320
324
|
style={{ position: 'relative' }}
|
|
321
|
-
backText={
|
|
322
|
-
headlineText={
|
|
325
|
+
backText={backTitle}
|
|
326
|
+
headlineText={backTitle}
|
|
323
327
|
headlineIcon={state.overviewList.length ? res.download_icon : undefined}
|
|
324
328
|
onHeadlineIconClick={() => {
|
|
325
329
|
const values = state.overviewList.map(item => [item.key, item.value, (Number(state.price) * Number(item.value)).toFixed(2)])
|
|
@@ -358,6 +362,7 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
358
362
|
return
|
|
359
363
|
}
|
|
360
364
|
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_chart, {
|
|
365
|
+
backTitle,
|
|
361
366
|
headlineText: chartHeadline,
|
|
362
367
|
chartData: state.overviewList,
|
|
363
368
|
price: state.price,
|
|
@@ -504,6 +509,7 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
504
509
|
headlineText={I18n.getLang('consumption_data_field4_headline_text')}
|
|
505
510
|
headlineClick={() => {
|
|
506
511
|
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_chart, {
|
|
512
|
+
backTitle,
|
|
507
513
|
headlineText: chartHeadline,
|
|
508
514
|
chartData: state.overviewList,
|
|
509
515
|
price: state.price,
|
|
@@ -515,6 +521,7 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
515
521
|
}}
|
|
516
522
|
overviewItemClick={(item) => {
|
|
517
523
|
navigation.navigate(ui_biz_routerKey.ui_biz_energy_consumption_detail, {
|
|
524
|
+
backTitle,
|
|
518
525
|
addEleDpCode: params.addEleDpCode,
|
|
519
526
|
powerDpCode: params.powerDpCode,
|
|
520
527
|
curMonth: item,
|
|
@@ -101,7 +101,7 @@ export default withTheme(function DateSelectedItem(props: DateSelectedItemProps)
|
|
|
101
101
|
state.date = `${datejs.month() + 1}/${datejs.year()}`;
|
|
102
102
|
break
|
|
103
103
|
case DateType.Day:
|
|
104
|
-
state.date = `${datejs.date()}
|
|
104
|
+
state.date = `${datejs.date()}.${datejs.month() + 1}.${datejs.year()}`;
|
|
105
105
|
}
|
|
106
106
|
state.modalMode = getModalMode(dateType);
|
|
107
107
|
}, [dateType, date]);
|
|
@@ -18,32 +18,26 @@ interface PowerLineChartProps {
|
|
|
18
18
|
const PowerLineChart = (props: PowerLineChartProps) => {
|
|
19
19
|
const echarts = useRef()
|
|
20
20
|
const { data, height } = props
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
const dataY = data?.map(item => {
|
|
25
|
-
return item.value
|
|
26
|
-
})
|
|
21
|
+
|
|
22
|
+
const values = data?.map(item => ([item.time, item.value]))
|
|
27
23
|
|
|
28
24
|
const option = {
|
|
29
25
|
tooltip: {
|
|
30
26
|
show: true,
|
|
31
27
|
triggerOn: 'mousemove|click',
|
|
32
28
|
trigger: 'axis',
|
|
29
|
+
position: ['30%', '50%']
|
|
33
30
|
},
|
|
34
31
|
grid: {
|
|
35
32
|
right: 0
|
|
36
33
|
},
|
|
37
34
|
xAxis: {
|
|
38
|
-
|
|
35
|
+
type: 'time',
|
|
39
36
|
axisTick: {
|
|
40
37
|
show: false,
|
|
41
38
|
},
|
|
42
39
|
axisLabel: {
|
|
43
40
|
show: true,
|
|
44
|
-
formatter: function (value: string) {
|
|
45
|
-
return value.substring(0, 5)
|
|
46
|
-
},
|
|
47
41
|
color: props.theme?.global.secondFontColor,
|
|
48
42
|
interval: 'auto',
|
|
49
43
|
rotate: 45,
|
|
@@ -79,7 +73,7 @@ const PowerLineChart = (props: PowerLineChartProps) => {
|
|
|
79
73
|
{
|
|
80
74
|
name: I18n.getLang('consumption_data_field2_value_text1'),
|
|
81
75
|
type: 'line',
|
|
82
|
-
data:
|
|
76
|
+
data: values,
|
|
83
77
|
areaStyle: {},
|
|
84
78
|
showSymbol: false,
|
|
85
79
|
color: '#F49431',
|
|
@@ -90,7 +84,7 @@ const PowerLineChart = (props: PowerLineChartProps) => {
|
|
|
90
84
|
start: 0,
|
|
91
85
|
type: 'inside',
|
|
92
86
|
zoomLock: false,
|
|
93
|
-
filterMode: '
|
|
87
|
+
filterMode: 'none'
|
|
94
88
|
},
|
|
95
89
|
customMapData: {}
|
|
96
90
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {NavigationRoute} from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { NavigationRoute } from 'tuya-panel-kit'
|
|
2
|
+
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
3
|
+
import NewTimeScheduleAddPage from './TimeScheduleAddPage'
|
|
4
|
+
import NewTimeScheduleEditPage from './TimeScheduleDetailPage'
|
|
5
|
+
import NewTimeSchedulePage from './TimeSchedulePage'
|
|
5
6
|
|
|
6
7
|
const NewTimeSchedulePageRouters: NavigationRoute[] = [
|
|
7
8
|
{
|
|
@@ -12,6 +13,14 @@ const NewTimeSchedulePageRouters: NavigationRoute[] = [
|
|
|
12
13
|
showOfflineView: false,
|
|
13
14
|
},
|
|
14
15
|
},
|
|
16
|
+
{
|
|
17
|
+
name: ui_biz_routerKey.ui_biz_time_schedule_add_new,
|
|
18
|
+
component: NewTimeScheduleAddPage,
|
|
19
|
+
options: {
|
|
20
|
+
hideTopbar: true,
|
|
21
|
+
showOfflineView: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
15
24
|
{
|
|
16
25
|
name: ui_biz_routerKey.ui_biz_time_schedule_edit_new,
|
|
17
26
|
component: NewTimeScheduleEditPage,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Card from '@ledvance/base/src/components/Card'
|
|
2
|
+
import Page from '@ledvance/base/src/components/Page'
|
|
3
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
4
|
+
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
5
|
+
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
6
|
+
import I18n from '@ledvance/base/src/i18n'
|
|
7
|
+
import { useNavigation } from '@react-navigation/native'
|
|
8
|
+
import { useReactive } from 'ahooks'
|
|
9
|
+
import React, { useCallback } from 'react'
|
|
10
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
11
|
+
import { Utils } from 'tuya-panel-kit'
|
|
12
|
+
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
13
|
+
import { TimeScheduleDetailPageParams } from './TimeScheduleDetailPage'
|
|
14
|
+
|
|
15
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
16
|
+
const { withTheme } = Utils.ThemeUtils
|
|
17
|
+
|
|
18
|
+
interface TimeScheduleAddProps {
|
|
19
|
+
theme?: ThemeType
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const TimeScheduleAddPage = (props: TimeScheduleAddProps) => {
|
|
23
|
+
const params = useParams<TimeScheduleDetailPageParams>()
|
|
24
|
+
const navigation = useNavigation()
|
|
25
|
+
const state = useReactive({
|
|
26
|
+
loading: false,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const nextPage = useCallback((suggestValue?: boolean) => {
|
|
30
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_time_schedule_edit_new, {
|
|
31
|
+
...params,
|
|
32
|
+
suggestValue
|
|
33
|
+
})
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
card: {
|
|
38
|
+
marginHorizontal: cx(24),
|
|
39
|
+
padding: cx(16)
|
|
40
|
+
},
|
|
41
|
+
text: {
|
|
42
|
+
color: props.theme?.global.fontColor,
|
|
43
|
+
fontSize: cx(16),
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Page
|
|
49
|
+
backText={I18n.getLang('motion_detection_add_time_schedule_system_back_text')}
|
|
50
|
+
headlineText={I18n.getLang('motion_detection_add_time_schedule_headline_text')}
|
|
51
|
+
loading={state.loading}
|
|
52
|
+
>
|
|
53
|
+
<View>
|
|
54
|
+
<Spacer/>
|
|
55
|
+
<Card style={styles.card} onPress={() => nextPage()}>
|
|
56
|
+
<Text style={styles.text}>{I18n.getLang('timeschedule_own')}</Text>
|
|
57
|
+
</Card>
|
|
58
|
+
<Spacer/>
|
|
59
|
+
<Card style={styles.card} onPress={() => nextPage(true)}>
|
|
60
|
+
<Text style={styles.text}>{I18n.getLang('timeschedule_on')}</Text>
|
|
61
|
+
</Card>
|
|
62
|
+
<Spacer/>
|
|
63
|
+
<Card style={styles.card} onPress={() => nextPage(false)}>
|
|
64
|
+
<Text style={styles.text}>{I18n.getLang('timeschedule_off')}</Text>
|
|
65
|
+
</Card>
|
|
66
|
+
</View>
|
|
67
|
+
</Page>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default withTheme(TimeScheduleAddPage)
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import Page from '@ledvance/base/src/components/Page'
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
1
|
+
import DeleteButton from '@ledvance/base/src/components/DeleteButton'
|
|
2
|
+
import DiySceneItem from '@ledvance/base/src/components/DiySceneItem'
|
|
3
|
+
import InfoText from '@ledvance/base/src/components/InfoText'
|
|
4
|
+
import Page from '@ledvance/base/src/components/Page'
|
|
5
|
+
import SegmentControl from '@ledvance/base/src/components/segmentControl'
|
|
6
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
7
|
+
import Summary from '@ledvance/base/src/components/Summary'
|
|
8
|
+
import Tag from '@ledvance/base/src/components/Tag'
|
|
9
|
+
import TextField from '@ledvance/base/src/components/TextField'
|
|
10
|
+
import LdvWeekView from '@ledvance/base/src/components/weekSelect'
|
|
11
|
+
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
12
|
+
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
13
|
+
import I18n from '@ledvance/base/src/i18n'
|
|
14
|
+
import { useDeviceId, useMoods, useSystemTimeFormate, } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
15
|
+
import { Result } from '@ledvance/base/src/models/modules/Result'
|
|
16
|
+
import res from '@ledvance/base/src/res'
|
|
17
|
+
import { convertTo12HourFormat, loopText, showDialog } from '@ledvance/base/src/utils/common'
|
|
18
|
+
import { ApplyForItem, DiySceneInfo } from '@ledvance/base/src/utils/interface'
|
|
19
|
+
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
20
|
+
import { useNavigation } from '@react-navigation/core'
|
|
21
|
+
import { useReactive } from 'ahooks'
|
|
22
|
+
import { cloneDeep, isEqual } from 'lodash'
|
|
23
|
+
import React, { useCallback, useEffect, useMemo } from 'react'
|
|
24
|
+
import { FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View, } from 'react-native'
|
|
25
|
+
import { SwitchButton, TimerPicker, Utils } from 'tuya-panel-kit'
|
|
26
|
+
import { MoodInfo, MoodUIInfo } from '../mood/Interface'
|
|
27
|
+
import { getRemoteMoodList } from '../mood/MoodActions'
|
|
28
|
+
import MoodItem from '../mood/MoodItem'
|
|
29
|
+
import ManualSettings from './components/ManuaSettings'
|
|
30
|
+
import { ComponentConfig, DeviceType, Timer, TimerActions, TimeScheduleDetailState, } from './Interface'
|
|
23
31
|
import {
|
|
24
32
|
defDeviceData,
|
|
25
33
|
defFanLightDeviceData,
|
|
26
34
|
defMixDeviceData,
|
|
27
35
|
defMoodStripDeviceData,
|
|
28
|
-
|
|
36
|
+
defOsramFanLightDeviceData,
|
|
29
37
|
defShutterDeviceData,
|
|
30
|
-
|
|
31
|
-
} from './TimeScheduleActions'
|
|
32
|
-
import
|
|
33
|
-
import {getRemoteMoodList} from '../mood/MoodActions';
|
|
34
|
-
import {MoodInfo, MoodUIInfo} from '../mood/Interface';
|
|
35
|
-
import Summary from '@ledvance/base/src/components/Summary'
|
|
36
|
-
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
37
|
-
import Tag from "@ledvance/base/src/components/Tag";
|
|
38
|
-
import DiySceneItem from '@ledvance/base/src/components/DiySceneItem';
|
|
39
|
-
import {ApplyForItem, DiySceneInfo} from "@ledvance/base/src/utils/interface";
|
|
38
|
+
defStripDeviceData
|
|
39
|
+
} from './TimeScheduleActions'
|
|
40
|
+
import { TimeSchedulePageParams } from './TimeSchedulePage'
|
|
40
41
|
|
|
41
42
|
const { convertX: cx } = Utils.RatioUtils;
|
|
42
43
|
const { toFixedString } = Utils.NumberUtils;
|
|
43
44
|
const { withTheme } = Utils.ThemeUtils
|
|
44
45
|
|
|
45
|
-
interface TimeScheduleDetailPageParams extends TimeSchedulePageParams {
|
|
46
|
+
export interface TimeScheduleDetailPageParams extends TimeSchedulePageParams {
|
|
46
47
|
mode: 'add' | 'update';
|
|
47
48
|
timeSchedule: Timer;
|
|
48
49
|
modDeleteTimeSchedule: (mode: TimerActions, timeSchedule: Timer) => Promise<Result<any>>;
|
|
49
50
|
refreshFn: () => void;
|
|
51
|
+
suggestValue?: boolean
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
@@ -81,7 +83,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
81
83
|
|
|
82
84
|
useEffect(() => {
|
|
83
85
|
const { applyForDisabled, timeSchedule, applyForList, mode } = params;
|
|
84
|
-
const cannotChoose = applyForDisabled || applyForList.length === 1;
|
|
86
|
+
const cannotChoose = applyForDisabled || applyForList.length === 1 || params.suggestValue !== undefined;
|
|
85
87
|
const cloneApplyList =
|
|
86
88
|
mode === 'add'
|
|
87
89
|
? cloneDeep(applyForList)
|
|
@@ -123,6 +125,12 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
123
125
|
state.mood = mood;
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
if (params.suggestValue !== undefined) {
|
|
129
|
+
state.selectedSkill.forEach(it => {
|
|
130
|
+
it.enable = !!params.suggestValue
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
126
134
|
state.initSelectedSkill = cloneDeep(state.selectedSkill)
|
|
127
135
|
|
|
128
136
|
if (!(Array.isArray(moods) && moods.length)) {
|
|
@@ -360,7 +368,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
360
368
|
});
|
|
361
369
|
state.loading = false;
|
|
362
370
|
if (res.success) {
|
|
363
|
-
navigation.
|
|
371
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_time_schedule_new)
|
|
364
372
|
}
|
|
365
373
|
}}
|
|
366
374
|
backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
|
|
@@ -118,7 +118,7 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
const navigateToEdit = useCallback((mode: 'add' | 'update', timeSchedule?: Timer) => {
|
|
121
|
-
const path = ui_biz_routerKey.ui_biz_time_schedule_edit_new;
|
|
121
|
+
const path = mode === 'add' ? ui_biz_routerKey.ui_biz_time_schedule_add_new : ui_biz_routerKey.ui_biz_time_schedule_edit_new;
|
|
122
122
|
navigation.navigate(path, {
|
|
123
123
|
mode,
|
|
124
124
|
name: path,
|