@ledvance/group-ui-biz-bundle 1.0.96 → 1.0.97

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.96",
7
+ "version": "1.0.97",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -157,6 +157,7 @@ const BiorhythmEditPage = (props: { theme?: ThemeType }) => {
157
157
 
158
158
  <Spacer />
159
159
  <TimerPicker
160
+ key={props.theme?.type}
160
161
  itemTextColor='#aeadb5'
161
162
  style={{ paddingVertical: cx(0), marginVertical: cx(0), backgroundColor: props.theme?.global.background }}
162
163
  pickerFontColor={props.theme?.global.fontColor}
@@ -10,7 +10,7 @@ import {
10
10
  getDefBiorhythmUIState,
11
11
  Plan,
12
12
  } from './BiorhythmBean'
13
- import { Modal, Utils } from 'tuya-panel-kit'
13
+ import { Dialog, Modal, Utils } from 'tuya-panel-kit'
14
14
  import { sortBy, cloneDeep } from 'lodash'
15
15
  import iconList from './iconListData'
16
16
  import pIdList from './pIdList'
@@ -264,6 +264,9 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
264
264
  state.loading = true
265
265
  state.enable = enable
266
266
  state.flag = Symbol()
267
+ },
268
+ onCancel: () => {
269
+ Dialog.close()
267
270
  }
268
271
  })
269
272
  state.loading = true
@@ -598,13 +601,16 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
598
601
  state.planList = defBiorhythmUIState.planList
599
602
  state.flag = Symbol()
600
603
  close()
604
+ },
605
+ onCancel: () => {
606
+
601
607
  }
602
608
  })
603
609
  }}
604
610
  />
605
611
  <Spacer />
606
612
  </View>
607
- ) || <></>
613
+ )
608
614
  }}
609
615
  />
610
616
  {!state.enable && (
@@ -1,173 +1,180 @@
1
- import {useGroupEzvizConfig} from "@ledvance/base/src/models/modules/NativePropsSlice";
1
+ import { useGroupEzvizConfig } from "@ledvance/base/src/models/modules/NativePropsSlice";
2
2
  import {
3
- DpResultByMonthResData,
4
- getDataWithSpecified,
5
- getDpResultByHour,
6
- getDpResultByMonth
3
+ DpResultByMonthResData,
4
+ getDataWithSpecified,
5
+ getDpResultByHour,
6
+ getDpResultByMonth
7
7
  } from "@ledvance/base/src/models/TuyaApi";
8
- import {overDays} from "@ledvance/base/src/utils";
9
- import {loopsText, monthFormat, monthFormatShort} from "@ledvance/base/src/utils/common";
10
- import {DateType} from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/co2Data";
11
- import {OverviewItem} from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/EnergyConsumptionPage";
8
+ import { overDays } from "@ledvance/base/src/utils";
9
+ import { exportCsvFile, loopsText, monthFormat, monthFormatShort } from "@ledvance/base/src/utils/common";
10
+ import { DateType } from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/co2Data";
11
+ import { OverviewItem } from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/EnergyConsumptionPage";
12
12
  import dayjs from "dayjs";
13
- import {isNumber} from "lodash";
14
- import {EnergyData, UnitList} from "./component/EnergyModal";
13
+ import { isNumber } from "lodash";
14
+ import { EnergyData, UnitList } from "./component/EnergyModal";
15
+ import I18n from "@ledvance/base/src/i18n";
15
16
 
16
17
  interface LightConfig {
17
- energyConsumption?: EnergyData
18
+ energyConsumption?: EnergyData
18
19
  }
19
20
 
20
21
  export const useEnergyConsumption = () => {
21
- return useGroupEzvizConfig<LightConfig, EnergyData>('energyConsumption', {unit: UnitList[0], price: ''})
22
+ return useGroupEzvizConfig<LightConfig, EnergyData>('energyConsumption', { unit: UnitList[0], price: '' })
22
23
  }
23
24
 
24
25
  export const unitDivision = (str: string) => {
25
- if (!str) {
26
- return ['', '']
27
- }
28
- const strIndex = str.indexOf('(' || '(')
29
- const unit = str.substring(strIndex)
30
- const name = str.split(unit)[0]
31
- return [name, unit]
26
+ if (!str) {
27
+ return ['', '']
28
+ }
29
+ const strIndex = str.indexOf('(' || '(')
30
+ const unit = str.substring(strIndex)
31
+ const name = str.split(unit)[0]
32
+ return [name, unit]
32
33
  }
33
34
 
34
35
 
35
36
  export async function getElectricity(devIdGroup: string[], addEleDpCode: string, date: string, dateType: DateType): Promise<OverviewItem[]> {
36
- let res: OverviewItem[] = []
37
- switch (dateType) {
38
- case DateType.Year:
39
- res = await getDpResultByYear(devIdGroup, addEleDpCode, date)
40
- break
41
- case DateType.Month:
42
- res = await getDpResultByYearMonth(devIdGroup, addEleDpCode, date)
43
- break
44
- case DateType.Day:
45
- res = await getDpResultByDate(devIdGroup, addEleDpCode, date);
46
- break
47
- }
48
- return res
37
+ let res: OverviewItem[] = []
38
+ switch (dateType) {
39
+ case DateType.Year:
40
+ res = await getDpResultByYear(devIdGroup, addEleDpCode, date)
41
+ break
42
+ case DateType.Month:
43
+ res = await getDpResultByYearMonth(devIdGroup, addEleDpCode, date)
44
+ break
45
+ case DateType.Day:
46
+ res = await getDpResultByDate(devIdGroup, addEleDpCode, date);
47
+ break
48
+ }
49
+ return res
49
50
  }
50
51
 
51
52
  let dpResultByMonthCache: DpResultByMonthResData[] | undefined
52
53
  const getDpResultByYear = async (devIdGroup: string[], addEleDpCode: string, dateStr: string): Promise<OverviewItem[]> => {
53
- const year = dateStr;
54
- let successGroup = dpResultByMonthCache;
55
- if (!successGroup) {
56
- const promiseGroup = devIdGroup.map(devId =>
57
- getDpResultByMonth(devId, addEleDpCode, 'sum').catch(error => ({error}))
58
- );
59
- // @ts-ignore
60
- dpResultByMonthCache = (await Promise.all(promiseGroup)).filter(v => !v.error);
61
- successGroup = dpResultByMonthCache
62
- }
63
- if (!successGroup) {
64
- return []
65
- }
54
+ const year = dateStr;
55
+ let successGroup = dpResultByMonthCache;
56
+ if (!successGroup) {
57
+ const promiseGroup = devIdGroup.map(devId =>
58
+ getDpResultByMonth(devId, addEleDpCode, 'sum').catch(error => ({ error }))
59
+ );
66
60
  // @ts-ignore
67
- const mergedData = {}
68
- successGroup.forEach(item => {
69
- const monthData = item.years[year];
70
- if (monthData) {
71
- Object.keys(monthData).forEach(month => {
72
- if (mergedData[month] === undefined) {
73
- mergedData[month] = 0
74
- }
75
- const monthNum = Number(monthData[month])
76
- mergedData[month] += Number(isNumber(monthNum) ? monthNum : 0)
77
- })
78
- }
79
- })
80
- const curMonthList = Object.keys(mergedData).sort((a, b) => parseInt(b) - parseInt(a));
81
- return curMonthList.map(month => {
82
- return {
83
- key: `${monthFormat(month)} ${year}`,
84
- value: (Number(mergedData[month]) || 0).toFixed(2),
85
- headlineText: `${year}${month}`,
86
- chartTitle: `${monthFormatShort(month)}\n${year}`
61
+ dpResultByMonthCache = (await Promise.all(promiseGroup)).filter(v => !v.error);
62
+ successGroup = dpResultByMonthCache
63
+ }
64
+ if (!successGroup) {
65
+ return []
66
+ }
67
+ // @ts-ignore
68
+ const mergedData = {}
69
+ successGroup.forEach(item => {
70
+ const monthData = item.years[year];
71
+ if (monthData) {
72
+ Object.keys(monthData).forEach(month => {
73
+ if (mergedData[month] === undefined) {
74
+ mergedData[month] = 0
87
75
  }
88
- })
76
+ const monthNum = Number(monthData[month])
77
+ mergedData[month] += Number(isNumber(monthNum) ? monthNum : 0)
78
+ })
79
+ }
80
+ })
81
+ const curMonthList = Object.keys(mergedData).sort((a, b) => parseInt(b) - parseInt(a));
82
+ return curMonthList.map(month => {
83
+ return {
84
+ key: `${monthFormat(month)} ${year}`,
85
+ value: (Number(mergedData[month]) || 0).toFixed(2),
86
+ headlineText: `${year}${month}`,
87
+ chartTitle: `${monthFormatShort(month)}\n${year}`
88
+ }
89
+ })
89
90
  }
90
91
 
91
92
 
92
93
  const getDpResultByYearMonth = async (deviceIdGroup: string[], addEleDpCode: string, dateStr: string): Promise<OverviewItem[]> => {
93
- const date = dayjs(dateStr)
94
- const startDay = date.startOf('month').format('YYYYMMDD')
95
- const endDay = date.endOf('month').format('YYYYMMDD')
96
- const promiseGroup = deviceIdGroup.map(devId => getDataWithSpecified(devId, addEleDpCode, startDay, endDay, 'sum').catch(error => ({error})))
97
- const res = await Promise.all(promiseGroup);
98
- // @ts-ignore
99
- const successGroup: DpResultByDataWithSpecifiedResData[] = res.filter(v => !v.error);
100
- const mergedData = {}
101
- successGroup.forEach(item => {
102
- if (item.result) {
103
- Object.keys(item.result).forEach(day => {
104
- if (mergedData[day] === undefined) {
105
- mergedData[day] = 0
106
- }
107
- const dayNum = Number(item.result[day])
108
- mergedData[day] += Number(isNumber(dayNum) ? dayNum : 0)
109
- })
94
+ const date = dayjs(dateStr)
95
+ const startDay = date.startOf('month').format('YYYYMMDD')
96
+ const endDay = date.endOf('month').format('YYYYMMDD')
97
+ const promiseGroup = deviceIdGroup.map(devId => getDataWithSpecified(devId, addEleDpCode, startDay, endDay, 'sum').catch(error => ({ error })))
98
+ const res = await Promise.all(promiseGroup);
99
+ // @ts-ignore
100
+ const successGroup: DpResultByDataWithSpecifiedResData[] = res.filter(v => !v.error);
101
+ const mergedData = {}
102
+ successGroup.forEach(item => {
103
+ if (item.result) {
104
+ Object.keys(item.result).forEach(day => {
105
+ if (mergedData[day] === undefined) {
106
+ mergedData[day] = 0
110
107
  }
111
- })
112
- return Object.keys(mergedData).filter(v => Number(mergedData[v]) > 0).map(time => {
113
- // 提取年、月和日
114
- const year = time.slice(0, 4);
115
- const month = time.slice(4, 6);
116
- const day = time.slice(6, 8);
108
+ const dayNum = Number(item.result[day])
109
+ mergedData[day] += Number(isNumber(dayNum) ? dayNum : 0)
110
+ })
111
+ }
112
+ })
113
+ return Object.keys(mergedData).filter(v => Number(mergedData[v]) > 0).map(time => {
114
+ // 提取年、月和日
115
+ const year = time.slice(0, 4);
116
+ const month = time.slice(4, 6);
117
+ const day = time.slice(6, 8);
117
118
 
118
- // 格式化为 'YYYY/MM/DD' 格式
119
- const formattedDate = `${year}/${month}/${day}`
120
- const dateStr = `${day}/${month}/${year}`
121
- const dateObj = dayjs(formattedDate, "YYYY/MM/DD");
122
- const dayOfWeek = dateObj.day() % 7;
123
- const key = `${dateStr} (${loopsText[dayOfWeek]})`
124
- return {
125
- key,
126
- value: Number(mergedData[time] || 0).toFixed(2),
127
- headlineText: formattedDate,
128
- chartTitle: `${Number(key?.split('/')[0])}\n${loopsText[dayOfWeek]}`
129
- }
130
- })
119
+ // 格式化为 'YYYY/MM/DD' 格式
120
+ const formattedDate = `${year}/${month}/${day}`
121
+ const dateStr = `${day}/${month}/${year}`
122
+ const dateObj = dayjs(formattedDate, "YYYY/MM/DD");
123
+ const dayOfWeek = dateObj.day() % 7;
124
+ const key = `${dateStr} (${loopsText[dayOfWeek]})`
125
+ return {
126
+ key,
127
+ value: Number(mergedData[time] || 0).toFixed(2),
128
+ headlineText: formattedDate,
129
+ chartTitle: `${Number(key?.split('/')[0])}\n${loopsText[dayOfWeek]}`
130
+ }
131
+ })
131
132
  }
132
133
 
133
134
 
134
135
  const getDpResultByDate = async (deviceIdGroup: string[], addEleDpCode: string, date: string): Promise<OverviewItem[]> => {
135
- if (overDays(date, 7)) {
136
- console.log("getDpResultByDate overDays true")
137
- return []
138
- }
139
- const promiseGroup = deviceIdGroup.map(devId => getDpResultByHour(devId, addEleDpCode, date, 'sum').catch(error => ({error})))
140
- const res = await Promise.all(promiseGroup);
141
- // @ts-ignore
142
- const successGroup: DpResultByDataWithSpecifiedResData[] = res.filter(v => !v.error);
143
- const mergedData = {}
144
- successGroup.forEach(item => {
145
- if (item) {
146
- Object.keys(item).forEach(day => {
147
- if (mergedData[day] === undefined) {
148
- mergedData[day] = 0
149
- }
150
- const dayNum = Number(item[day])
151
- mergedData[day] += Number(isNumber(dayNum) ? dayNum : 0)
152
- })
136
+ if (overDays(date, 7)) {
137
+ console.log("getDpResultByDate overDays true")
138
+ return []
139
+ }
140
+ const promiseGroup = deviceIdGroup.map(devId => getDpResultByHour(devId, addEleDpCode, date, 'sum').catch(error => ({ error })))
141
+ const res = await Promise.all(promiseGroup);
142
+ // @ts-ignore
143
+ const successGroup: DpResultByDataWithSpecifiedResData[] = res.filter(v => !v.error);
144
+ const mergedData = {}
145
+ successGroup.forEach(item => {
146
+ if (item) {
147
+ Object.keys(item).forEach(day => {
148
+ if (mergedData[day] === undefined) {
149
+ mergedData[day] = 0
153
150
  }
154
- });
151
+ const dayNum = Number(item[day])
152
+ mergedData[day] += Number(isNumber(dayNum) ? dayNum : 0)
153
+ })
154
+ }
155
+ });
155
156
 
156
157
 
157
- const list: Array<OverviewItem> = []
158
- const resData = Object.keys(mergedData)?.map(val => {
159
- return {key: Number(val?.slice(8, 10)), value: Number(mergedData[val])}
158
+ const list: Array<OverviewItem> = []
159
+ const resData = Object.keys(mergedData)?.map(val => {
160
+ return { key: Number(val?.slice(8, 10)), value: Number(mergedData[val]) }
161
+ })
162
+ for (let i = 0; i <= 23; i++) {
163
+ const hourData = resData?.find(val => val?.key === i)
164
+ const hourKey = hourData?.key || i
165
+ const hourValue = Number(hourData?.value) || 0
166
+ list.push({
167
+ key: `${hourKey.toString().padStart(2, '0')}:00`,
168
+ value: hourValue,
169
+ chartTitle: `${hourKey}:00`,
170
+ headlineText: `${hourKey}:00`
160
171
  })
161
- for (let i = 0; i <= 23; i++) {
162
- const hourData = resData?.find(val => val?.key === i)
163
- const hourKey = hourData?.key || i
164
- const hourValue = Number(hourData?.value) || 0
165
- list.push({
166
- key: `${hourKey.toString().padStart(2, '0')}:00`,
167
- value: hourValue,
168
- chartTitle: `${hourKey}:00`,
169
- headlineText: `${hourKey}:00`
170
- })
171
- }
172
- return list
172
+ }
173
+ return list
174
+ }
175
+
176
+ export const exportEnergyCsv = (values: any[][], unit: string) => {
177
+ const headers = [I18n.getLang('date'), `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')} (kWh)`, `Price(${unit})`]
178
+ const functionName = `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}`
179
+ exportCsvFile(headers, values, functionName)
173
180
  }
@@ -1,26 +1,26 @@
1
1
  import React, { useCallback } from "react";
2
- import { Platform, View, StyleSheet, Image, Text, TouchableOpacity} from "react-native";
2
+ import { View, StyleSheet, Image, TouchableOpacity } from "react-native";
3
3
  import { useRoute } from '@react-navigation/core'
4
4
  import Page from "@ledvance/base/src/components/Page";
5
5
  import res from "@ledvance/base/src/res";
6
6
  import I18n from "@ledvance/base/src/i18n";
7
7
  import { Utils } from "tuya-panel-kit";
8
- import { exportFile, loopsText, monthFormat } from "@ledvance/base/src/utils/common";
8
+ import { loopsText, monthFormat } from "@ledvance/base/src/utils/common";
9
9
  import { OverviewItem } from "./EnergyConsumptionPage";
10
10
  import Spacer from "@ledvance/base/src/components/Spacer";
11
11
  import InfoText from "@ledvance/base/src/components/InfoText";
12
12
  import ThemeType from '@ledvance/base/src/config/themeType'
13
- import {overDays} from "@ledvance/base/src/utils/index";
13
+ import { overDays } from "@ledvance/base/src/utils/index";
14
14
  import dayjs from "dayjs";
15
15
  import { DateType } from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/co2Data";
16
16
  import { useReactive, useUpdateEffect } from "ahooks";
17
17
  import DateTypeItem from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/component/DateTypeItem";
18
18
  import DateSelectedItem from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/component/DateSelectedItem";
19
19
  import NewBarChart from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/component/NewBarChart";
20
- import { getElectricity } from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/EnergyConsumptionActions";
20
+ import { exportEnergyCsv, getElectricity } from "@ledvance/group-ui-biz-bundle/src/modules/energyConsumption/EnergyConsumptionActions";
21
21
  import DateSwitch from "./component/DateSwitch";
22
22
 
23
- const { convertX: cx, height, width } = Utils.RatioUtils
23
+ const { convertX: cx } = Utils.RatioUtils
24
24
  const { withTheme } = Utils.ThemeUtils
25
25
 
26
26
  export interface EnergyConsumptionChartProps {
@@ -37,7 +37,7 @@ export interface EnergyConsumptionChartProps {
37
37
 
38
38
  const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
39
39
  const params = useRoute().params as EnergyConsumptionChartProps
40
- const {price, unit, date, addEleDpCode,deviceIdGroup,over365Days, over7Days} = params;
40
+ const { price, unit, date, addEleDpCode, deviceIdGroup, over365Days, over7Days } = params;
41
41
 
42
42
  const styles = StyleSheet.create({
43
43
  listEmptyView: {
@@ -96,7 +96,7 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
96
96
  getElectricity(deviceIdGroup, addEleDpCode, state.date, state.dateType).then((res) => {
97
97
  state.chartData = res;
98
98
  state.loading = false;
99
- }).catch(()=>{
99
+ }).catch(() => {
100
100
  state.loading = false;
101
101
  });
102
102
  }, [state.date]);
@@ -148,72 +148,75 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
148
148
  }, [state.dateType, state.over365Days, state.over7Days]);
149
149
 
150
150
  return (
151
- <Page
152
- backText={I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}
153
- showGreenery={false}
154
- greeneryIcon={res.energy_consumption_greenery}
155
- loading={state.loading}
156
- headlineContent={
157
- <View style={{width: '100%',flexDirection:'row'}}>
158
- <DateSwitch
159
- style={{flex: 1}}
160
- date={state.date}
161
- dateType={state.dateType}
162
- headlineText={state.headlineText}
163
- onDateChange={(date) => {
164
- state.date = date;
165
- }}/>
166
- <TouchableOpacity onPress={() => {
167
- exportFile(state.chartData, params.price, params.unit)
168
- }}>
169
- <Image
170
- style={styles.downloadIcon}
171
- source={state.chartData?.length ? res.download_icon : undefined}/>
172
- </TouchableOpacity>
173
- </View>
174
- }
175
- >
176
- <View style={{ marginHorizontal: cx(24) }}>
177
- <View style={{flexDirection: 'row'}}>
178
- <DateTypeItem
179
- style={{flex: 1}}
180
- dateType={state.dateType}
181
- onDateTypeChange={(dateType) => {
182
- state.dateType = dateType;
183
- }}/>
184
- <DateSelectedItem
185
- style={{flex: 1, marginStart: cx(10),marginBottom:cx(15)}}
186
- dateType={state.dateType}
187
- date={state.date}
188
- onDateChange={date => {
189
- state.date = date;
190
- }}
191
- />
151
+ <Page
152
+ backText={I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}
153
+ showGreenery={false}
154
+ greeneryIcon={res.energy_consumption_greenery}
155
+ loading={state.loading}
156
+ headlineContent={
157
+ <View style={{ width: '100%', flexDirection: 'row' }}>
158
+ <DateSwitch
159
+ style={{ flex: 1 }}
160
+ date={state.date}
161
+ dateType={state.dateType}
162
+ headlineText={state.headlineText}
163
+ onDateChange={(date) => {
164
+ state.date = date;
165
+ }} />
166
+ <TouchableOpacity
167
+ style={{ width: cx(30) }}
168
+ onPress={() => {
169
+ const values = state.chartData.map(item => [item.key, item.value, (Number(params.price) * Number(item.value)).toFixed(2)])
170
+ exportEnergyCsv(values, params.unit)
171
+ }}>
172
+ <Image
173
+ style={styles.downloadIcon}
174
+ source={state.chartData?.length ? res.download_icon : undefined} />
175
+ </TouchableOpacity>
176
+ </View>
177
+ }
178
+ >
179
+ <View style={{ marginHorizontal: cx(24) }}>
180
+ <View style={{ flexDirection: 'row' }}>
181
+ <DateTypeItem
182
+ style={{ flex: 1 }}
183
+ dateType={state.dateType}
184
+ onDateTypeChange={(dateType) => {
185
+ state.dateType = dateType;
186
+ }} />
187
+ <DateSelectedItem
188
+ style={{ flex: 1, marginStart: cx(10), marginBottom: cx(15) }}
189
+ dateType={state.dateType}
190
+ date={state.date}
191
+ onDateChange={date => {
192
+ state.date = date;
193
+ }}
194
+ />
192
195
 
193
- </View>
194
- {
195
- (state.chartData.length <= 0) ? (
196
- <View style={styles.listEmptyView}>
197
- <Spacer height={cx(26)} />
198
- <Image
199
- style={styles.listEmptyImage}
200
- source={{ uri: res.ldv_timer_empty }} />
201
- <Spacer height={cx(14)} />
202
- <InfoText
203
- text={getEmptyDataTip()}
204
- icon={res.ic_info}
205
- textStyle={styles.listEmptyText}
206
- contentColor={props.theme?.global.fontColor}
207
- />
208
- </View>
209
- ) : (
210
- state.chartData.length > 0 && !state.loading &&
211
- <NewBarChart height={cx(400)} data={state.chartData} price={state.price}
212
- unit={unit}/>
213
- )
214
- }
215
196
  </View>
216
- </Page>
197
+ {
198
+ (state.chartData.length <= 0) ? (
199
+ <View style={styles.listEmptyView}>
200
+ <Spacer height={cx(26)} />
201
+ <Image
202
+ style={styles.listEmptyImage}
203
+ source={{ uri: res.ldv_timer_empty }} />
204
+ <Spacer height={cx(14)} />
205
+ <InfoText
206
+ text={getEmptyDataTip()}
207
+ icon={res.ic_info}
208
+ textStyle={styles.listEmptyText}
209
+ contentColor={props.theme?.global.fontColor}
210
+ />
211
+ </View>
212
+ ) : (
213
+ state.chartData.length > 0 && !state.loading &&
214
+ <NewBarChart height={cx(400)} data={state.chartData} price={state.price}
215
+ unit={unit} />
216
+ )
217
+ }
218
+ </View>
219
+ </Page>
217
220
  )
218
221
  }
219
222
 
@@ -13,7 +13,7 @@ import { DpResultByDataWithSpecifiedResData, getDataWithSpecified, getDpResultBy
13
13
  import { useTimeZoneCity } from "@ledvance/base/src/models/modules/NativePropsSlice";
14
14
  import { cloneDeep, isNumber } from "lodash";
15
15
  import { OverviewItem, PopupType } from "./EnergyConsumptionPage";
16
- import { exchangeNumber, exportFile, localeNumber, loopsText } from '@ledvance/base/src/utils/common'
16
+ import { exchangeNumber, localeNumber, loopsText } from '@ledvance/base/src/utils/common'
17
17
  import dayjs from "dayjs";
18
18
  import { ui_biz_routerKey } from '../../navigation/Routers'
19
19
  import { EnergyConsumptionChartProps } from "./EnergyConsumptionChart";
@@ -21,6 +21,7 @@ import { overDays } from "@ledvance/base/src/utils";
21
21
  import EnergyPopup, { EnergyData } from "./component/EnergyModal";
22
22
  import { carbonDioxideEmission, countryAndRegion } from "./co2Data";
23
23
  import ThemeType from '@ledvance/base/src/config/themeType'
24
+ import { exportEnergyCsv } from "./EnergyConsumptionActions";
24
25
 
25
26
  const { convertX: cx } = Utils.RatioUtils
26
27
  const { withTheme } = Utils.ThemeUtils
@@ -216,7 +217,8 @@ const EnergyConsumptionDetail = (props: { theme?: ThemeType }) => {
216
217
  headlineText={params.curMonth.key}
217
218
  headlineIcon={state.overviewList.length ? res.download_icon : undefined}
218
219
  onHeadlineIconClick={() => {
219
- exportFile(state.overviewList, params.price, params.unit);
220
+ const values = state.overviewList.map(item => [item.key, item.value, (Number(params.price) * Number(item.value)).toFixed(2)])
221
+ exportEnergyCsv(values, params.unit)
220
222
  }}
221
223
  showGreenery={false}
222
224
  greeneryIcon={res.energy_consumption_greenery}
@@ -302,10 +304,10 @@ const EnergyConsumptionDetail = (props: { theme?: ThemeType }) => {
302
304
  headlineText: params.curMonth.key,
303
305
  chartData: state.overviewList,
304
306
  over365Days: state.over365Days,
305
- price:state.price,
306
- unit:state.unit,
307
- addEleDpCode:params.addEleDpCode,
308
- date:params.curMonth.headlineText,
307
+ price: state.price,
308
+ unit: state.unit,
309
+ addEleDpCode: params.addEleDpCode,
310
+ date: params.curMonth.headlineText,
309
311
  deviceIdGroup: params.deviceIdGroup,
310
312
  } as EnergyConsumptionChartProps)
311
313
  }}
@@ -318,9 +320,9 @@ const EnergyConsumptionDetail = (props: { theme?: ThemeType }) => {
318
320
  chartData: res,
319
321
  over7Days: state.over7Days,
320
322
  addEleDpCode: params.addEleDpCode,
321
- price:state.price,
322
- unit:state.unit,
323
- date:item.headlineText,
323
+ price: state.price,
324
+ unit: state.unit,
325
+ date: item.headlineText,
324
326
  deviceIdGroup: params.deviceIdGroup,
325
327
  } as EnergyConsumptionChartProps)
326
328
  }}
@@ -16,7 +16,6 @@ import { useTimeZoneCity } from '@ledvance/base/src/models/modules/NativePropsSl
16
16
  import { flattenDeep, isNumber, sumBy } from 'lodash';
17
17
  import {
18
18
  exchangeNumber,
19
- exportFile,
20
19
  localeNumber,
21
20
  monthFormat,
22
21
  monthFormatShort,
@@ -28,6 +27,7 @@ import { EnergyConsumptionDetailProps } from './EnergyConsumptionDetail';
28
27
  import { EnergyConsumptionChartProps } from './EnergyConsumptionChart';
29
28
  import SegmentControl from '@ledvance/base/src/components/segmentControl';
30
29
  import ThemeType from '@ledvance/base/src/config/themeType'
30
+ import { exportEnergyCsv } from "./EnergyConsumptionActions";
31
31
 
32
32
  const { convertX: cx } = Utils.RatioUtils;
33
33
  const { withTheme } = Utils.ThemeUtils;
@@ -285,7 +285,8 @@ const EnergyConsumptionPage = (props: { theme?: ThemeType }) => {
285
285
  )}
286
286
  headlineIcon={(state.isSolarMode ? state.solarOverviewList : state.wifiOverviewList).length ? res.download_icon : undefined}
287
287
  onHeadlineIconClick={() => {
288
- exportFile(state.isSolarMode ? state.solarOverviewList : state.wifiOverviewList, state.price, state.unit);
288
+ const values = (state.isSolarMode ? state.solarOverviewList : state.wifiOverviewList).map(item => [item.key, item.value, (Number(state.price) * Number(item.value)).toFixed(2)])
289
+ exportEnergyCsv(values, state.unit)
289
290
  }}
290
291
  showGreenery={state.isSolarMode}
291
292
  greeneryIcon={res.energy_consumption_greenery}
@@ -309,7 +310,7 @@ const EnergyConsumptionPage = (props: { theme?: ThemeType }) => {
309
310
  {/* tip */}
310
311
  <Spacer height={cx(15)} />
311
312
  <View style={styles.showTip}>
312
- <Text style={{ fontSize: cx(14) }}>
313
+ <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor, }}>
313
314
  {I18n.getLang(
314
315
  state.isSolarMode
315
316
  ? 'generation_data_description_text'