@ray-js/lamp-schedule-core 1.0.4-beta-8 → 1.0.4-beta-10
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/lib/conflict/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { scheduleLogger } from '../utils/ScheduleLogger';
|
|
|
6
6
|
import { checkConflicts } from './ConflictResolver';
|
|
7
7
|
import { ScheduleDataManager } from './scheduleDataManager';
|
|
8
8
|
import { transScheduleListToConflictList } from './transform';
|
|
9
|
+
import { EScheduleFunctionType } from '../types';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 冲突检测
|
|
@@ -58,7 +59,27 @@ export class Conflict {
|
|
|
58
59
|
static remove(current) {
|
|
59
60
|
const [cur] = transScheduleListToConflictList([current]);
|
|
60
61
|
scheduleLogger.debug('Conflict.remove cur, current:', cur, current);
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
// 如果转换后为空(例如倒计时为0时,status为false会被过滤),需要特殊处理
|
|
64
|
+
if (!cur) {
|
|
65
|
+
// 对于倒计时类型,即使status为false,也需要删除冲突数据(因为倒计时的id是固定的)
|
|
66
|
+
if (current.type === EScheduleFunctionType.COUNTDOWN) {
|
|
67
|
+
const countdownSchedule = {
|
|
68
|
+
id: `${EScheduleFunctionType.COUNTDOWN}`,
|
|
69
|
+
type: EScheduleFunctionType.COUNTDOWN,
|
|
70
|
+
data: {
|
|
71
|
+
status: false,
|
|
72
|
+
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
73
|
+
startTime: '',
|
|
74
|
+
endTime: ''
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
scheduleLogger.debug('Conflict.remove: 倒计时为0,使用固定id删除', countdownSchedule);
|
|
78
|
+
ScheduleDataManager.getInstance().deleteData(countdownSchedule);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
ScheduleDataManager.getInstance().deleteData(cur);
|
|
62
83
|
}
|
|
63
84
|
|
|
64
85
|
/**
|
|
@@ -175,7 +175,8 @@ export const getTimerListWithFlush = (dispatch, actions) => {
|
|
|
175
175
|
const onDpChangeFn = data => {
|
|
176
176
|
var _data$dps;
|
|
177
177
|
// 专门处理 timer_report dp 变化
|
|
178
|
-
|
|
178
|
+
const timerReportId = 38;
|
|
179
|
+
if (data !== null && data !== void 0 && (_data$dps = data.dps) !== null && _data$dps !== void 0 && _data$dps[timerReportId]) {
|
|
179
180
|
var _data$dps2;
|
|
180
181
|
const {
|
|
181
182
|
rtcTimerList = []
|
|
@@ -184,9 +185,13 @@ const onDpChangeFn = data => {
|
|
|
184
185
|
actions,
|
|
185
186
|
dispatch
|
|
186
187
|
} = getTimerReducer();
|
|
187
|
-
const dpValue = data === null || data === void 0 || (_data$dps2 = data.dps) === null || _data$dps2 === void 0 ? void 0 : _data$dps2[
|
|
188
|
+
const dpValue = data === null || data === void 0 || (_data$dps2 = data.dps) === null || _data$dps2 === void 0 ? void 0 : _data$dps2[timerReportId];
|
|
188
189
|
const dpParsedValue = timerReportParser.parser(dpValue);
|
|
189
|
-
|
|
190
|
+
// 如果 timerReport 有删除id,需要同步删除对应的 rtcTimerList
|
|
191
|
+
const rtcTimerListFiltered = rtcTimerList.filter(item => {
|
|
192
|
+
return dpParsedValue === null || dpParsedValue === void 0 ? void 0 : dpParsedValue.find(i => +i.id === +item.timerId);
|
|
193
|
+
});
|
|
194
|
+
const timerList = rtcTimerListFiltered.map(item => {
|
|
190
195
|
var _dpParsedValue$find$s, _dpParsedValue$find;
|
|
191
196
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
192
197
|
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
|