@ray-js/lamp-schedule-core 1.0.4-beta-9 → 1.0.4-beta-11
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.
|
@@ -17,6 +17,13 @@ import { LOCAL_TIMER_CATEGORY } from '../constant';
|
|
|
17
17
|
import { getAll, useLocalTimerCloudProperty } from '../utils/ScheduleCloudProperty';
|
|
18
18
|
import { getTimerState, getTimerReducer } from '../context/timer';
|
|
19
19
|
import { timerReportParser } from '../dpParser';
|
|
20
|
+
const sortDataList = dataList => {
|
|
21
|
+
return dataList.sort((a, b) => {
|
|
22
|
+
const aTime = a.time;
|
|
23
|
+
const bTime = b.time;
|
|
24
|
+
return aTime.localeCompare(bTime);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
20
27
|
|
|
21
28
|
// 添加本地定时
|
|
22
29
|
export const useLocalTimerAdd = isSupportLocalTimer => {
|
|
@@ -175,7 +182,8 @@ export const getTimerListWithFlush = (dispatch, actions) => {
|
|
|
175
182
|
const onDpChangeFn = data => {
|
|
176
183
|
var _data$dps;
|
|
177
184
|
// 专门处理 timer_report dp 变化
|
|
178
|
-
|
|
185
|
+
const timerReportId = 38;
|
|
186
|
+
if (data !== null && data !== void 0 && (_data$dps = data.dps) !== null && _data$dps !== void 0 && _data$dps[timerReportId]) {
|
|
179
187
|
var _data$dps2;
|
|
180
188
|
const {
|
|
181
189
|
rtcTimerList = []
|
|
@@ -184,9 +192,13 @@ const onDpChangeFn = data => {
|
|
|
184
192
|
actions,
|
|
185
193
|
dispatch
|
|
186
194
|
} = getTimerReducer();
|
|
187
|
-
const dpValue = data === null || data === void 0 || (_data$dps2 = data.dps) === null || _data$dps2 === void 0 ? void 0 : _data$dps2[
|
|
195
|
+
const dpValue = data === null || data === void 0 || (_data$dps2 = data.dps) === null || _data$dps2 === void 0 ? void 0 : _data$dps2[timerReportId];
|
|
188
196
|
const dpParsedValue = timerReportParser.parser(dpValue);
|
|
189
|
-
|
|
197
|
+
// 如果 timerReport 有删除id,需要同步删除对应的 rtcTimerList
|
|
198
|
+
const rtcTimerListFiltered = rtcTimerList.filter(item => {
|
|
199
|
+
return dpParsedValue === null || dpParsedValue === void 0 ? void 0 : dpParsedValue.find(i => +i.id === +item.timerId);
|
|
200
|
+
});
|
|
201
|
+
const timerList = rtcTimerListFiltered.map(item => {
|
|
190
202
|
var _dpParsedValue$find$s, _dpParsedValue$find;
|
|
191
203
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
192
204
|
status: (_dpParsedValue$find$s = dpParsedValue === null || dpParsedValue === void 0 || (_dpParsedValue$find = dpParsedValue.find(i => +i.id === +item.timerId)) === null || _dpParsedValue$find === void 0 ? void 0 : _dpParsedValue$find.status) !== null && _dpParsedValue$find$s !== void 0 ? _dpParsedValue$find$s : false
|
|
@@ -256,8 +268,9 @@ export const useLocalTimerList = isSupportLocalTimer => {
|
|
|
256
268
|
isAppPush: false
|
|
257
269
|
};
|
|
258
270
|
});
|
|
271
|
+
const sortedLocalTimerList = sortDataList(_localTimerList);
|
|
259
272
|
resolve({
|
|
260
|
-
timers:
|
|
273
|
+
timers: sortedLocalTimerList
|
|
261
274
|
});
|
|
262
275
|
}).catch(err => {
|
|
263
276
|
ScheduleLogger.error('useLocalTimerList getAll error:', err);
|