@pisell/pisellos 2.1.36 → 2.2.1
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/dist/core/index.d.ts +8 -1
- package/dist/core/index.js +116 -42
- package/dist/effects/index.d.ts +1 -0
- package/dist/effects/index.js +29 -6
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +9 -10
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +1 -1
- package/dist/modules/Payment/index.js +63 -73
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/types.d.ts +19 -0
- package/dist/modules/ProductList/index.js +5 -14
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +152 -0
- package/dist/server/index.js +946 -0
- package/dist/server/modules/index.d.ts +16 -0
- package/dist/server/modules/index.js +21 -0
- package/dist/server/modules/menu/index.d.ts +63 -0
- package/dist/server/modules/menu/index.js +476 -0
- package/dist/server/modules/menu/types.d.ts +68 -0
- package/dist/server/modules/menu/types.js +16 -0
- package/dist/server/modules/products/index.d.ts +141 -0
- package/dist/server/modules/products/index.js +768 -0
- package/dist/server/modules/products/types.d.ts +94 -0
- package/dist/server/modules/products/types.js +43 -0
- package/dist/server/modules/quotation/index.d.ts +47 -0
- package/dist/server/modules/quotation/index.js +367 -0
- package/dist/server/modules/quotation/types.d.ts +50 -0
- package/dist/server/modules/quotation/types.js +20 -0
- package/dist/server/modules/schedule/index.d.ts +62 -0
- package/dist/server/modules/schedule/index.js +431 -0
- package/dist/server/modules/schedule/types.d.ts +1 -0
- package/dist/server/modules/schedule/types.js +2 -0
- package/dist/server/modules/schedule/utils.d.ts +32 -0
- package/dist/server/modules/schedule/utils.js +747 -0
- package/dist/server/types.d.ts +64 -0
- package/dist/server/types.js +1 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/index.js +6 -0
- package/dist/server/utils/product.d.ts +18 -0
- package/dist/server/utils/product.js +339 -0
- package/dist/server/utils/schedule.d.ts +14 -0
- package/dist/server/utils/schedule.js +108 -0
- package/dist/server/utils/time.d.ts +18 -0
- package/dist/server/utils/time.js +53 -0
- package/dist/solution/BookingByStep/index.d.ts +0 -16
- package/dist/solution/BookingByStep/index.js +57 -508
- package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/dist/solution/BookingByStep/utils/capacity.js +8 -24
- package/dist/solution/BookingTicket/index.d.ts +12 -0
- package/dist/solution/BookingTicket/index.js +122 -79
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.d.ts +1 -46
- package/dist/solution/Checkout/index.js +530 -850
- package/dist/solution/ShopDiscount/index.js +9 -10
- package/dist/types/index.d.ts +27 -0
- package/lib/core/index.d.ts +8 -1
- package/lib/core/index.js +48 -1
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- package/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +9 -10
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +1 -1
- package/lib/modules/Payment/index.js +56 -43
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/Product/types.d.ts +19 -0
- package/lib/modules/ProductList/index.js +4 -13
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +152 -0
- package/lib/server/index.js +555 -0
- package/lib/server/modules/index.d.ts +16 -0
- package/lib/server/modules/index.js +47 -0
- package/lib/server/modules/menu/index.d.ts +63 -0
- package/lib/server/modules/menu/index.js +234 -0
- package/lib/server/modules/menu/types.d.ts +68 -0
- package/lib/server/modules/menu/types.js +33 -0
- package/lib/server/modules/products/index.d.ts +141 -0
- package/lib/server/modules/products/index.js +434 -0
- package/lib/server/modules/products/types.d.ts +94 -0
- package/lib/server/modules/products/types.js +35 -0
- package/lib/server/modules/quotation/index.d.ts +47 -0
- package/lib/server/modules/quotation/index.js +177 -0
- package/lib/server/modules/quotation/types.d.ts +50 -0
- package/lib/server/modules/quotation/types.js +33 -0
- package/lib/server/modules/schedule/index.d.ts +62 -0
- package/lib/server/modules/schedule/index.js +231 -0
- package/lib/server/modules/schedule/types.d.ts +1 -0
- package/lib/server/modules/schedule/types.js +23 -0
- package/lib/server/modules/schedule/utils.d.ts +32 -0
- package/lib/server/modules/schedule/utils.js +451 -0
- package/lib/server/types.d.ts +64 -0
- package/lib/server/types.js +17 -0
- package/lib/server/utils/index.d.ts +5 -0
- package/lib/server/utils/index.js +25 -0
- package/lib/server/utils/product.d.ts +18 -0
- package/lib/server/utils/product.js +262 -0
- package/lib/server/utils/schedule.d.ts +14 -0
- package/lib/server/utils/schedule.js +88 -0
- package/lib/server/utils/time.d.ts +18 -0
- package/lib/server/utils/time.js +70 -0
- package/lib/solution/BookingByStep/index.d.ts +0 -16
- package/lib/solution/BookingByStep/index.js +44 -316
- package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
- package/lib/solution/BookingByStep/utils/capacity.js +8 -21
- package/lib/solution/BookingTicket/index.d.ts +12 -0
- package/lib/solution/BookingTicket/index.js +25 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.d.ts +1 -46
- package/lib/solution/Checkout/index.js +92 -289
- package/lib/solution/ShopDiscount/index.js +10 -11
- package/lib/types/index.d.ts +27 -0
- package/package.json +2 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../../types';
|
|
2
|
+
import { BaseModule } from '../../../modules/BaseModule';
|
|
3
|
+
import { ScheduleModuleAPI, ScheduleItem } from '../../../modules/Schedule/types';
|
|
4
|
+
/**
|
|
5
|
+
* Schedule 模块(扩展版本)
|
|
6
|
+
* 在原有基础上添加了 getAvailableScheduleIds 方法
|
|
7
|
+
*/
|
|
8
|
+
export declare class ScheduleModuleEx extends BaseModule implements Module, ScheduleModuleAPI {
|
|
9
|
+
protected defaultName: string;
|
|
10
|
+
protected defaultVersion: string;
|
|
11
|
+
private request;
|
|
12
|
+
private store;
|
|
13
|
+
private dbManager;
|
|
14
|
+
constructor(name?: string, version?: string);
|
|
15
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* 加载当前店铺下所有 schedule(从服务器)
|
|
18
|
+
*/
|
|
19
|
+
loadAllSchedule(): Promise<any>;
|
|
20
|
+
setScheduleList(list: ScheduleItem[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* 获取所有日程列表
|
|
23
|
+
*/
|
|
24
|
+
getScheduleList(): ScheduleItem[];
|
|
25
|
+
/**
|
|
26
|
+
* 根据 schedule IDs 获取日程数据
|
|
27
|
+
* 使用 Map 快速查询,时间复杂度 O(m),m 为 ids 数量
|
|
28
|
+
*/
|
|
29
|
+
getScheduleByIds(ids: number[]): ScheduleItem[];
|
|
30
|
+
/**
|
|
31
|
+
* 同步更新日程 Map 缓存
|
|
32
|
+
* 将 scheduleList 中的日程同步到 map,以 id 为 key
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private syncScheduleMap;
|
|
36
|
+
/**
|
|
37
|
+
* 清除缓存
|
|
38
|
+
*/
|
|
39
|
+
clear(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 判断日期是否在日程范围内
|
|
42
|
+
* @param date 日期
|
|
43
|
+
* @param scheduleList 日程列表
|
|
44
|
+
* @returns 是否在日程范围内
|
|
45
|
+
*/
|
|
46
|
+
getDateIsInSchedule(date: string, scheduleList: (ScheduleItem | number)[]): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 从 IndexDB 加载日程数据
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
private loadScheduleFromIndexDB;
|
|
52
|
+
/**
|
|
53
|
+
* 保存日程数据到 IndexDB
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
private saveScheduleToIndexDB;
|
|
57
|
+
/**
|
|
58
|
+
* 预加载模块数据(统一接口)
|
|
59
|
+
* 在模块注册后自动调用
|
|
60
|
+
*/
|
|
61
|
+
preload(): Promise<void>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
+
import { cloneDeep } from 'lodash-es';
|
|
26
|
+
import { BaseModule } from "../../../modules/BaseModule";
|
|
27
|
+
import dayjs from 'dayjs';
|
|
28
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
29
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
30
|
+
import { getDateIsInSchedule as _getDateIsInSchedule } from "./utils";
|
|
31
|
+
dayjs.extend(isSameOrBefore);
|
|
32
|
+
dayjs.extend(isSameOrAfter);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* IndexDB 存储名称
|
|
36
|
+
*/
|
|
37
|
+
var INDEXDB_STORE_NAME = 'schedule';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Schedule 模块(扩展版本)
|
|
41
|
+
* 在原有基础上添加了 getAvailableScheduleIds 方法
|
|
42
|
+
*/
|
|
43
|
+
export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
44
|
+
_inherits(ScheduleModuleEx, _BaseModule);
|
|
45
|
+
var _super = _createSuper(ScheduleModuleEx);
|
|
46
|
+
// IndexDBManager 实例
|
|
47
|
+
|
|
48
|
+
function ScheduleModuleEx(name, version) {
|
|
49
|
+
var _this;
|
|
50
|
+
_classCallCheck(this, ScheduleModuleEx);
|
|
51
|
+
_this = _super.call(this, name, version);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "defaultName", 'schedule');
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.1.0');
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "store", {});
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
_createClass(ScheduleModuleEx, [{
|
|
60
|
+
key: "initialize",
|
|
61
|
+
value: function () {
|
|
62
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
63
|
+
var appPlugin, app;
|
|
64
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
this.core = core;
|
|
68
|
+
|
|
69
|
+
// 获取依赖的插件
|
|
70
|
+
this.request = core.getPlugin('request');
|
|
71
|
+
if (this.request) {
|
|
72
|
+
_context.next = 4;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
throw new Error('ScheduleModule 需要 request 插件支持');
|
|
76
|
+
case 4:
|
|
77
|
+
this.store = options === null || options === void 0 ? void 0 : options.store;
|
|
78
|
+
if (options.initialState) {
|
|
79
|
+
this.store.scheduleList = options.initialState.scheduleList;
|
|
80
|
+
// 同步更新 Map 缓存
|
|
81
|
+
this.syncScheduleMap();
|
|
82
|
+
} else {
|
|
83
|
+
this.store.scheduleList = [];
|
|
84
|
+
this.store.map = new Map();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 获取并存储 dbManager
|
|
88
|
+
appPlugin = core.getPlugin('app');
|
|
89
|
+
if (appPlugin) {
|
|
90
|
+
app = appPlugin.getApp();
|
|
91
|
+
this.dbManager = app.dbManager;
|
|
92
|
+
if (this.dbManager) {
|
|
93
|
+
console.log('[Schedule] IndexDB Manager 已初始化');
|
|
94
|
+
} else {
|
|
95
|
+
console.warn('[Schedule] IndexDB Manager 未找到');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
case 8:
|
|
99
|
+
case "end":
|
|
100
|
+
return _context.stop();
|
|
101
|
+
}
|
|
102
|
+
}, _callee, this);
|
|
103
|
+
}));
|
|
104
|
+
function initialize(_x, _x2) {
|
|
105
|
+
return _initialize.apply(this, arguments);
|
|
106
|
+
}
|
|
107
|
+
return initialize;
|
|
108
|
+
}()
|
|
109
|
+
/**
|
|
110
|
+
* 加载当前店铺下所有 schedule(从服务器)
|
|
111
|
+
*/
|
|
112
|
+
}, {
|
|
113
|
+
key: "loadAllSchedule",
|
|
114
|
+
value: (function () {
|
|
115
|
+
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
116
|
+
var _scheduleList$data;
|
|
117
|
+
var scheduleList, list;
|
|
118
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
119
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
120
|
+
case 0:
|
|
121
|
+
_context2.next = 2;
|
|
122
|
+
return this.request.get("/schedule", {
|
|
123
|
+
num: 999
|
|
124
|
+
}, {
|
|
125
|
+
useCache: true
|
|
126
|
+
});
|
|
127
|
+
case 2:
|
|
128
|
+
scheduleList = _context2.sent;
|
|
129
|
+
list = ((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []; // 保存到 IndexDB
|
|
130
|
+
_context2.next = 6;
|
|
131
|
+
return this.saveScheduleToIndexDB(list);
|
|
132
|
+
case 6:
|
|
133
|
+
this.setScheduleList(list);
|
|
134
|
+
return _context2.abrupt("return", list);
|
|
135
|
+
case 8:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context2.stop();
|
|
138
|
+
}
|
|
139
|
+
}, _callee2, this);
|
|
140
|
+
}));
|
|
141
|
+
function loadAllSchedule() {
|
|
142
|
+
return _loadAllSchedule.apply(this, arguments);
|
|
143
|
+
}
|
|
144
|
+
return loadAllSchedule;
|
|
145
|
+
}())
|
|
146
|
+
}, {
|
|
147
|
+
key: "setScheduleList",
|
|
148
|
+
value: function setScheduleList(list) {
|
|
149
|
+
this.store.scheduleList = list;
|
|
150
|
+
// 同步更新 Map 缓存
|
|
151
|
+
this.syncScheduleMap();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 获取所有日程列表
|
|
156
|
+
*/
|
|
157
|
+
}, {
|
|
158
|
+
key: "getScheduleList",
|
|
159
|
+
value: function getScheduleList() {
|
|
160
|
+
return this.store.scheduleList;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 根据 schedule IDs 获取日程数据
|
|
165
|
+
* 使用 Map 快速查询,时间复杂度 O(m),m 为 ids 数量
|
|
166
|
+
*/
|
|
167
|
+
}, {
|
|
168
|
+
key: "getScheduleByIds",
|
|
169
|
+
value: function getScheduleByIds(ids) {
|
|
170
|
+
if (!ids || ids.length === 0) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
var result = [];
|
|
174
|
+
var _iterator = _createForOfIteratorHelper(ids),
|
|
175
|
+
_step;
|
|
176
|
+
try {
|
|
177
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
178
|
+
var id = _step.value;
|
|
179
|
+
var schedule = this.store.map.get(id);
|
|
180
|
+
if (schedule) {
|
|
181
|
+
result.push(schedule);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
} catch (err) {
|
|
185
|
+
_iterator.e(err);
|
|
186
|
+
} finally {
|
|
187
|
+
_iterator.f();
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 同步更新日程 Map 缓存
|
|
194
|
+
* 将 scheduleList 中的日程同步到 map,以 id 为 key
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
}, {
|
|
198
|
+
key: "syncScheduleMap",
|
|
199
|
+
value: function syncScheduleMap() {
|
|
200
|
+
this.store.map.clear();
|
|
201
|
+
var _iterator2 = _createForOfIteratorHelper(this.store.scheduleList),
|
|
202
|
+
_step2;
|
|
203
|
+
try {
|
|
204
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
205
|
+
var schedule = _step2.value;
|
|
206
|
+
this.store.map.set(schedule.id, schedule);
|
|
207
|
+
}
|
|
208
|
+
} catch (err) {
|
|
209
|
+
_iterator2.e(err);
|
|
210
|
+
} finally {
|
|
211
|
+
_iterator2.f();
|
|
212
|
+
}
|
|
213
|
+
console.log("[Schedule] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u65E5\u7A0B"));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* 清除缓存
|
|
218
|
+
*/
|
|
219
|
+
}, {
|
|
220
|
+
key: "clear",
|
|
221
|
+
value: (function () {
|
|
222
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
223
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
224
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
225
|
+
case 0:
|
|
226
|
+
this.store.scheduleList = [];
|
|
227
|
+
this.store.map.clear();
|
|
228
|
+
// 同时清空 IndexDB 中的数据
|
|
229
|
+
if (!this.dbManager) {
|
|
230
|
+
_context3.next = 12;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
_context3.prev = 3;
|
|
234
|
+
_context3.next = 6;
|
|
235
|
+
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
236
|
+
case 6:
|
|
237
|
+
console.log('[Schedule] IndexDB 缓存已清空');
|
|
238
|
+
_context3.next = 12;
|
|
239
|
+
break;
|
|
240
|
+
case 9:
|
|
241
|
+
_context3.prev = 9;
|
|
242
|
+
_context3.t0 = _context3["catch"](3);
|
|
243
|
+
console.error('[Schedule] 清空 IndexDB 缓存失败:', _context3.t0);
|
|
244
|
+
case 12:
|
|
245
|
+
case "end":
|
|
246
|
+
return _context3.stop();
|
|
247
|
+
}
|
|
248
|
+
}, _callee3, this, [[3, 9]]);
|
|
249
|
+
}));
|
|
250
|
+
function clear() {
|
|
251
|
+
return _clear.apply(this, arguments);
|
|
252
|
+
}
|
|
253
|
+
return clear;
|
|
254
|
+
}()
|
|
255
|
+
/**
|
|
256
|
+
* 判断日期是否在日程范围内
|
|
257
|
+
* @param date 日期
|
|
258
|
+
* @param scheduleList 日程列表
|
|
259
|
+
* @returns 是否在日程范围内
|
|
260
|
+
*/
|
|
261
|
+
)
|
|
262
|
+
}, {
|
|
263
|
+
key: "getDateIsInSchedule",
|
|
264
|
+
value: function getDateIsInSchedule(date, scheduleList) {
|
|
265
|
+
var _this2 = this;
|
|
266
|
+
var scheduleListData = [];
|
|
267
|
+
scheduleList.forEach(function (item) {
|
|
268
|
+
if (typeof item === 'number') {
|
|
269
|
+
scheduleListData.push.apply(scheduleListData, _toConsumableArray(_this2.getScheduleByIds([item])));
|
|
270
|
+
} else {
|
|
271
|
+
scheduleListData.push(item);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return _getDateIsInSchedule(date, scheduleListData);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* 从 IndexDB 加载日程数据
|
|
279
|
+
* @private
|
|
280
|
+
*/
|
|
281
|
+
}, {
|
|
282
|
+
key: "loadScheduleFromIndexDB",
|
|
283
|
+
value: (function () {
|
|
284
|
+
var _loadScheduleFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
285
|
+
var scheduleList;
|
|
286
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
287
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
if (this.dbManager) {
|
|
290
|
+
_context4.next = 2;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
return _context4.abrupt("return", []);
|
|
294
|
+
case 2:
|
|
295
|
+
_context4.prev = 2;
|
|
296
|
+
_context4.next = 5;
|
|
297
|
+
return this.dbManager.getAll(INDEXDB_STORE_NAME);
|
|
298
|
+
case 5:
|
|
299
|
+
scheduleList = _context4.sent;
|
|
300
|
+
return _context4.abrupt("return", scheduleList || []);
|
|
301
|
+
case 9:
|
|
302
|
+
_context4.prev = 9;
|
|
303
|
+
_context4.t0 = _context4["catch"](2);
|
|
304
|
+
console.error('[Schedule] 从 IndexDB 读取数据失败:', _context4.t0);
|
|
305
|
+
return _context4.abrupt("return", []);
|
|
306
|
+
case 13:
|
|
307
|
+
case "end":
|
|
308
|
+
return _context4.stop();
|
|
309
|
+
}
|
|
310
|
+
}, _callee4, this, [[2, 9]]);
|
|
311
|
+
}));
|
|
312
|
+
function loadScheduleFromIndexDB() {
|
|
313
|
+
return _loadScheduleFromIndexDB.apply(this, arguments);
|
|
314
|
+
}
|
|
315
|
+
return loadScheduleFromIndexDB;
|
|
316
|
+
}()
|
|
317
|
+
/**
|
|
318
|
+
* 保存日程数据到 IndexDB
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
)
|
|
322
|
+
}, {
|
|
323
|
+
key: "saveScheduleToIndexDB",
|
|
324
|
+
value: (function () {
|
|
325
|
+
var _saveScheduleToIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(scheduleList) {
|
|
326
|
+
var _this3 = this;
|
|
327
|
+
var savePromises;
|
|
328
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
329
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
if (this.dbManager) {
|
|
332
|
+
_context5.next = 2;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
return _context5.abrupt("return");
|
|
336
|
+
case 2:
|
|
337
|
+
_context5.prev = 2;
|
|
338
|
+
_context5.next = 5;
|
|
339
|
+
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
340
|
+
case 5:
|
|
341
|
+
// 逐个保存日程(每个日程是独立的记录)
|
|
342
|
+
savePromises = scheduleList.map(function (schedule) {
|
|
343
|
+
return _this3.dbManager.add(INDEXDB_STORE_NAME, schedule);
|
|
344
|
+
});
|
|
345
|
+
_context5.next = 8;
|
|
346
|
+
return Promise.all(savePromises);
|
|
347
|
+
case 8:
|
|
348
|
+
console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
|
|
349
|
+
_context5.next = 14;
|
|
350
|
+
break;
|
|
351
|
+
case 11:
|
|
352
|
+
_context5.prev = 11;
|
|
353
|
+
_context5.t0 = _context5["catch"](2);
|
|
354
|
+
console.error('[Schedule] 保存数据到 IndexDB 失败:', _context5.t0);
|
|
355
|
+
case 14:
|
|
356
|
+
case "end":
|
|
357
|
+
return _context5.stop();
|
|
358
|
+
}
|
|
359
|
+
}, _callee5, this, [[2, 11]]);
|
|
360
|
+
}));
|
|
361
|
+
function saveScheduleToIndexDB(_x3) {
|
|
362
|
+
return _saveScheduleToIndexDB.apply(this, arguments);
|
|
363
|
+
}
|
|
364
|
+
return saveScheduleToIndexDB;
|
|
365
|
+
}()
|
|
366
|
+
/**
|
|
367
|
+
* 预加载模块数据(统一接口)
|
|
368
|
+
* 在模块注册后自动调用
|
|
369
|
+
*/
|
|
370
|
+
)
|
|
371
|
+
}, {
|
|
372
|
+
key: "preload",
|
|
373
|
+
value: (function () {
|
|
374
|
+
var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
375
|
+
var cachedData, scheduleList;
|
|
376
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
377
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
378
|
+
case 0:
|
|
379
|
+
console.log('[Schedule] 开始预加载数据...');
|
|
380
|
+
_context6.prev = 1;
|
|
381
|
+
_context6.next = 4;
|
|
382
|
+
return this.loadScheduleFromIndexDB();
|
|
383
|
+
case 4:
|
|
384
|
+
cachedData = _context6.sent;
|
|
385
|
+
if (!(cachedData && cachedData.length > 0)) {
|
|
386
|
+
_context6.next = 10;
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
console.log("[Schedule] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
|
|
390
|
+
// 将缓存数据放入 store
|
|
391
|
+
this.store.scheduleList = cloneDeep(cachedData);
|
|
392
|
+
// 同步更新 Map 缓存
|
|
393
|
+
this.syncScheduleMap();
|
|
394
|
+
return _context6.abrupt("return");
|
|
395
|
+
case 10:
|
|
396
|
+
console.log('[Schedule] IndexDB 中没有缓存数据,从服务器加载...');
|
|
397
|
+
_context6.next = 16;
|
|
398
|
+
break;
|
|
399
|
+
case 13:
|
|
400
|
+
_context6.prev = 13;
|
|
401
|
+
_context6.t0 = _context6["catch"](1);
|
|
402
|
+
console.warn('[Schedule] 从 IndexDB 加载数据失败:', _context6.t0);
|
|
403
|
+
case 16:
|
|
404
|
+
_context6.next = 18;
|
|
405
|
+
return this.loadAllSchedule();
|
|
406
|
+
case 18:
|
|
407
|
+
scheduleList = _context6.sent;
|
|
408
|
+
if (!(scheduleList && scheduleList.length > 0)) {
|
|
409
|
+
_context6.next = 24;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
_context6.next = 22;
|
|
413
|
+
return this.saveScheduleToIndexDB(scheduleList);
|
|
414
|
+
case 22:
|
|
415
|
+
this.store.scheduleList = cloneDeep(scheduleList);
|
|
416
|
+
// 同步更新 Map 缓存
|
|
417
|
+
this.syncScheduleMap();
|
|
418
|
+
case 24:
|
|
419
|
+
case "end":
|
|
420
|
+
return _context6.stop();
|
|
421
|
+
}
|
|
422
|
+
}, _callee6, this, [[1, 13]]);
|
|
423
|
+
}));
|
|
424
|
+
function preload() {
|
|
425
|
+
return _preload.apply(this, arguments);
|
|
426
|
+
}
|
|
427
|
+
return preload;
|
|
428
|
+
}())
|
|
429
|
+
}]);
|
|
430
|
+
return ScheduleModuleEx;
|
|
431
|
+
}(BaseModule);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../modules/Schedule/types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import { ScheduleItem } from "../../../modules/Schedule/types";
|
|
3
|
+
export declare const getDateIsInSchedule: (dateTime: string, scheduleList: ScheduleItem[]) => boolean;
|
|
4
|
+
export type ScheduleTimeSlot = {
|
|
5
|
+
/** 开始时间 HH:mm */
|
|
6
|
+
start_time: string;
|
|
7
|
+
/** 结束时间 HH:mm */
|
|
8
|
+
end_time: string;
|
|
9
|
+
/** 开始日期时间 YYYY-MM-DD HH:mm:ss */
|
|
10
|
+
start_at: dayjs.Dayjs;
|
|
11
|
+
/** 结束日期时间 YYYY-MM-DD HH:mm:ss */
|
|
12
|
+
end_at: dayjs.Dayjs;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 获取当前日期日程时间点
|
|
16
|
+
* @param date 日期 YYYY-MM-DD
|
|
17
|
+
* @param scheduleList 日程列表
|
|
18
|
+
* @returns 当前日期日程时间点 结构,数组 [{
|
|
19
|
+
*
|
|
20
|
+
* // HH:mm
|
|
21
|
+
* end_time: string,
|
|
22
|
+
* // HH:mm
|
|
23
|
+
* start_time: string,
|
|
24
|
+
* // 日期时间
|
|
25
|
+
* // YYYY-MM-DD HH:mm:ss
|
|
26
|
+
* end_at: Dayjs,
|
|
27
|
+
* // YYYY-MM-DD HH:mm:ss
|
|
28
|
+
* start_at: Dayjs,
|
|
29
|
+
*
|
|
30
|
+
* }]
|
|
31
|
+
*/
|
|
32
|
+
export declare const getScheduleStartEndTimePoints: (date: string, scheduleList: ScheduleItem[]) => ScheduleTimeSlot[];
|