@pisell/pisellos 0.0.569 → 0.10.2
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.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -84,7 +84,9 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
84
84
|
app = appPlugin.getApp();
|
|
85
85
|
this.dbManager = app.dbManager;
|
|
86
86
|
this.logger = app.logger;
|
|
87
|
-
if (this.dbManager) {
|
|
87
|
+
if (this.dbManager) {
|
|
88
|
+
console.log('[Menu] IndexDB Manager 已初始化');
|
|
89
|
+
} else {
|
|
88
90
|
console.warn('[Menu] IndexDB Manager 未找到');
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -260,6 +262,7 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
260
262
|
} finally {
|
|
261
263
|
_iterator2.f();
|
|
262
264
|
}
|
|
265
|
+
console.log("[Menu] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u9910\u724C"));
|
|
263
266
|
}
|
|
264
267
|
|
|
265
268
|
/**
|
|
@@ -282,31 +285,33 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
282
285
|
|
|
283
286
|
// 同时清空 IndexDB 中的数据
|
|
284
287
|
if (!this.dbManager) {
|
|
285
|
-
_context4.next =
|
|
288
|
+
_context4.next = 17;
|
|
286
289
|
break;
|
|
287
290
|
}
|
|
288
291
|
_context4.prev = 5;
|
|
289
292
|
_context4.next = 8;
|
|
290
293
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
291
294
|
case 8:
|
|
295
|
+
console.log('[Menu] IndexDB 缓存已清空');
|
|
292
296
|
this.logInfo('IndexDB 缓存已清空');
|
|
293
|
-
_context4.next =
|
|
297
|
+
_context4.next = 17;
|
|
294
298
|
break;
|
|
295
|
-
case
|
|
296
|
-
_context4.prev =
|
|
299
|
+
case 12:
|
|
300
|
+
_context4.prev = 12;
|
|
297
301
|
_context4.t0 = _context4["catch"](5);
|
|
298
302
|
errorMessage = _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0);
|
|
299
303
|
console.error('[Menu] 清空 IndexDB 缓存失败:', _context4.t0);
|
|
300
304
|
this.logError('清空 IndexDB 缓存失败', {
|
|
301
305
|
error: errorMessage
|
|
302
306
|
});
|
|
303
|
-
case 16:
|
|
304
|
-
this.logInfo('缓存清空完成');
|
|
305
307
|
case 17:
|
|
308
|
+
console.log('[Menu] 缓存已清空');
|
|
309
|
+
this.logInfo('缓存清空完成');
|
|
310
|
+
case 19:
|
|
306
311
|
case "end":
|
|
307
312
|
return _context4.stop();
|
|
308
313
|
}
|
|
309
|
-
}, _callee4, this, [[5,
|
|
314
|
+
}, _callee4, this, [[5, 12]]);
|
|
310
315
|
}));
|
|
311
316
|
function clear() {
|
|
312
317
|
return _clear.apply(this, arguments);
|
|
@@ -397,13 +402,14 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
397
402
|
_context6.next = 10;
|
|
398
403
|
return Promise.all(savePromises);
|
|
399
404
|
case 10:
|
|
405
|
+
console.log("[Menu] \u5DF2\u5C06 ".concat(menuList.length, " \u6761\u9910\u724C\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
|
|
400
406
|
this.logInfo('餐牌数据已保存到 IndexDB', {
|
|
401
407
|
menuCount: menuList.length
|
|
402
408
|
});
|
|
403
|
-
_context6.next =
|
|
409
|
+
_context6.next = 19;
|
|
404
410
|
break;
|
|
405
|
-
case
|
|
406
|
-
_context6.prev =
|
|
411
|
+
case 14:
|
|
412
|
+
_context6.prev = 14;
|
|
407
413
|
_context6.t0 = _context6["catch"](4);
|
|
408
414
|
errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
|
|
409
415
|
console.error('[Menu] 保存数据到 IndexDB 失败:', _context6.t0);
|
|
@@ -411,11 +417,11 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
411
417
|
menuCount: menuList.length,
|
|
412
418
|
error: errorMessage
|
|
413
419
|
});
|
|
414
|
-
case
|
|
420
|
+
case 19:
|
|
415
421
|
case "end":
|
|
416
422
|
return _context6.stop();
|
|
417
423
|
}
|
|
418
|
-
}, _callee6, this, [[4,
|
|
424
|
+
}, _callee6, this, [[4, 14]]);
|
|
419
425
|
}));
|
|
420
426
|
function saveMenuToIndexDB(_x4) {
|
|
421
427
|
return _saveMenuToIndexDB.apply(this, arguments);
|
|
@@ -435,17 +441,19 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
435
441
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
436
442
|
while (1) switch (_context7.prev = _context7.next) {
|
|
437
443
|
case 0:
|
|
444
|
+
console.log('[Menu] 开始预加载数据...');
|
|
438
445
|
startTime = Date.now();
|
|
439
446
|
this.logInfo('开始预加载数据');
|
|
440
|
-
_context7.prev =
|
|
441
|
-
_context7.next =
|
|
447
|
+
_context7.prev = 3;
|
|
448
|
+
_context7.next = 6;
|
|
442
449
|
return this.loadMenuFromIndexDB();
|
|
443
|
-
case
|
|
450
|
+
case 6:
|
|
444
451
|
cachedData = _context7.sent;
|
|
445
452
|
if (!(cachedData && cachedData.length > 0)) {
|
|
446
|
-
_context7.next =
|
|
453
|
+
_context7.next = 15;
|
|
447
454
|
break;
|
|
448
455
|
}
|
|
456
|
+
console.log("[Menu] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u9910\u724C\u6570\u636E"));
|
|
449
457
|
// 将缓存数据放入 store
|
|
450
458
|
this.store.menuList = cloneDeep(cachedData);
|
|
451
459
|
// 同步更新 Map 缓存
|
|
@@ -458,30 +466,31 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
458
466
|
source: 'IndexDB'
|
|
459
467
|
});
|
|
460
468
|
return _context7.abrupt("return");
|
|
461
|
-
case
|
|
469
|
+
case 15:
|
|
470
|
+
console.log('[Menu] IndexDB 中没有缓存数据,从服务器加载...');
|
|
462
471
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
463
|
-
_context7.next =
|
|
472
|
+
_context7.next = 24;
|
|
464
473
|
break;
|
|
465
|
-
case
|
|
466
|
-
_context7.prev =
|
|
467
|
-
_context7.t0 = _context7["catch"](
|
|
474
|
+
case 19:
|
|
475
|
+
_context7.prev = 19;
|
|
476
|
+
_context7.t0 = _context7["catch"](3);
|
|
468
477
|
errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
|
|
469
478
|
console.warn('[Menu] 从 IndexDB 加载数据失败:', _context7.t0);
|
|
470
479
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
471
480
|
error: errorMessage
|
|
472
481
|
});
|
|
473
|
-
case
|
|
474
|
-
_context7.next =
|
|
482
|
+
case 24:
|
|
483
|
+
_context7.next = 26;
|
|
475
484
|
return this.loadMenuList();
|
|
476
|
-
case
|
|
485
|
+
case 26:
|
|
477
486
|
menuList = _context7.sent;
|
|
478
487
|
if (!(menuList && menuList.length > 0)) {
|
|
479
|
-
_context7.next =
|
|
488
|
+
_context7.next = 37;
|
|
480
489
|
break;
|
|
481
490
|
}
|
|
482
|
-
_context7.next =
|
|
491
|
+
_context7.next = 30;
|
|
483
492
|
return this.saveMenuToIndexDB(menuList);
|
|
484
|
-
case
|
|
493
|
+
case 30:
|
|
485
494
|
this.store.menuList = cloneDeep(menuList);
|
|
486
495
|
// 同步更新 Map 缓存
|
|
487
496
|
this.syncMenuMap();
|
|
@@ -492,18 +501,18 @@ export var MenuModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
492
501
|
duration: "".concat(_duration2, "ms"),
|
|
493
502
|
source: 'Server'
|
|
494
503
|
});
|
|
495
|
-
_context7.next =
|
|
504
|
+
_context7.next = 39;
|
|
496
505
|
break;
|
|
497
|
-
case
|
|
506
|
+
case 37:
|
|
498
507
|
_duration3 = Date.now() - startTime;
|
|
499
508
|
this.logWarning('预加载完成但未获取到数据', {
|
|
500
509
|
duration: "".concat(_duration3, "ms")
|
|
501
510
|
});
|
|
502
|
-
case
|
|
511
|
+
case 39:
|
|
503
512
|
case "end":
|
|
504
513
|
return _context7.stop();
|
|
505
514
|
}
|
|
506
|
-
}, _callee7, this, [[
|
|
515
|
+
}, _callee7, this, [[3, 19]]);
|
|
507
516
|
}));
|
|
508
517
|
function preload() {
|
|
509
518
|
return _preload.apply(this, arguments);
|
|
@@ -113,6 +113,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
113
113
|
case 0:
|
|
114
114
|
changedOrders = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
|
|
115
115
|
source = _args.length > 1 ? _args[1] : undefined;
|
|
116
|
+
console.log('触发emitOrdersChanged');
|
|
116
117
|
payload = {
|
|
117
118
|
list: this.store.list,
|
|
118
119
|
changedOrders: changedOrders.map(function (order) {
|
|
@@ -120,9 +121,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
120
121
|
}),
|
|
121
122
|
source: source
|
|
122
123
|
};
|
|
123
|
-
_context.next =
|
|
124
|
+
_context.next = 6;
|
|
124
125
|
return this.core.effects.emit(OrderHooks.onOrdersChanged, payload);
|
|
125
|
-
case
|
|
126
|
+
case 6:
|
|
126
127
|
case "end":
|
|
127
128
|
return _context.stop();
|
|
128
129
|
}
|
|
@@ -1438,6 +1439,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1438
1439
|
pubsub: {
|
|
1439
1440
|
callback: function callback(res) {
|
|
1440
1441
|
var _message$id, _message$order_id, _message$type;
|
|
1442
|
+
console.log('orderDataSource', res);
|
|
1441
1443
|
var pubsubReceivedAt = Date.now();
|
|
1442
1444
|
var message = _this12.normalizeOrderSyncMessage(res);
|
|
1443
1445
|
if (!message) return;
|
|
@@ -124,7 +124,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
124
124
|
app = appPlugin.getApp();
|
|
125
125
|
this.dbManager = app.dbManager;
|
|
126
126
|
this.logger = app.logger;
|
|
127
|
-
if (this.dbManager) {
|
|
127
|
+
if (this.dbManager) {
|
|
128
|
+
console.log('[Products] IndexDB Manager 已初始化');
|
|
129
|
+
} else {
|
|
128
130
|
console.warn('[Products] IndexDB Manager 未找到');
|
|
129
131
|
}
|
|
130
132
|
}
|
|
@@ -845,13 +847,14 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
845
847
|
_context7.prev = 29;
|
|
846
848
|
_context7.t0 = _context7["catch"](4);
|
|
847
849
|
errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
|
|
850
|
+
console.log("[ProductsModule] \uD83C\uDF10 ERROR", _context7.t0);
|
|
848
851
|
this.logError('prepareProductsWithPrice 处理失败', {
|
|
849
852
|
schedule_date: schedule_date,
|
|
850
853
|
error: errorMessage
|
|
851
854
|
});
|
|
852
|
-
case 33:
|
|
853
|
-
return _context7.abrupt("return", []);
|
|
854
855
|
case 34:
|
|
856
|
+
return _context7.abrupt("return", []);
|
|
857
|
+
case 35:
|
|
855
858
|
case "end":
|
|
856
859
|
return _context7.stop();
|
|
857
860
|
}
|
|
@@ -1080,8 +1083,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1080
1083
|
// 创建 legacy 报价单格式化器
|
|
1081
1084
|
var legacyPriceFormatter = function legacyPriceFormatter(products, context) {
|
|
1082
1085
|
if (!context.priceData || context.priceData.length === 0) {
|
|
1086
|
+
console.log('[ProductsModule] 💰 没有价格数据,跳过 legacy 报价单价格应用');
|
|
1083
1087
|
return products;
|
|
1084
1088
|
}
|
|
1089
|
+
console.log("[ProductsModule] \uD83D\uDCB0 \u5E94\u7528 legacy \u62A5\u4EF7\u5355\u4EF7\u683C\u5230 ".concat(products.length, " \u4E2A\u5546\u54C1"));
|
|
1085
1090
|
return applyPriceDataToProducts(products, context.priceData);
|
|
1086
1091
|
};
|
|
1087
1092
|
var i18nFormatter = function i18nFormatter(products, context) {
|
|
@@ -1097,6 +1102,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1097
1102
|
this.formatters.push(i18nFormatter);
|
|
1098
1103
|
this.formatters.push(detailValueFormatter);
|
|
1099
1104
|
this.isBuiltinFormatterRegistered = true;
|
|
1105
|
+
console.log('[ProductsModule] ✅ 内置商品格式化器已注册(智能定价优先)');
|
|
1100
1106
|
}
|
|
1101
1107
|
|
|
1102
1108
|
/**
|
|
@@ -1144,9 +1150,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1144
1150
|
// 插入到内置智能定价格式化器之后;legacy 报价单启用时需跳过它。
|
|
1145
1151
|
var insertIndex = this.isBuiltinFormatterRegistered ? this.isLegacyPriceFormatterEnabled ? 2 : 1 : 0;
|
|
1146
1152
|
this.formatters.splice(insertIndex, 0, formatter);
|
|
1153
|
+
console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u5728\u4F4D\u7F6E ".concat(insertIndex + 1, " \u63D2\u5165\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ").concat(this.formatters.length, " \u4E2A"));
|
|
1147
1154
|
} else {
|
|
1148
1155
|
// 追加到末尾
|
|
1149
1156
|
this.formatters.push(formatter);
|
|
1157
|
+
console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u6CE8\u518C\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ".concat(this.formatters.length, " \u4E2A"));
|
|
1150
1158
|
}
|
|
1151
1159
|
}
|
|
1152
1160
|
|
|
@@ -1162,9 +1170,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1162
1170
|
// 保留 legacy 兜底(如果启用)和智能定价格式化器。
|
|
1163
1171
|
var builtinCount = this.isLegacyPriceFormatterEnabled ? 2 : 1;
|
|
1164
1172
|
this.formatters = this.formatters.slice(0, builtinCount);
|
|
1173
|
+
console.log('[ProductsModule] 🧹 已清空自定义格式化器,保留内置智能定价格式化器');
|
|
1165
1174
|
} else {
|
|
1166
1175
|
this.formatters = [];
|
|
1167
1176
|
this.isBuiltinFormatterRegistered = false;
|
|
1177
|
+
console.log('[ProductsModule] 🧹 已清空所有格式化器');
|
|
1168
1178
|
}
|
|
1169
1179
|
}
|
|
1170
1180
|
|
|
@@ -1180,6 +1190,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1180
1190
|
var keys = Array.from(this.productsPriceCache.keys());
|
|
1181
1191
|
var oldestKey = keys[0];
|
|
1182
1192
|
this.productsPriceCache.delete(oldestKey);
|
|
1193
|
+
console.log("[ProductsModule] \uD83E\uDDF9 \u6E05\u7406\u8FC7\u671F\u5546\u54C1\u4EF7\u683C\u7F13\u5B58: ".concat(oldestKey));
|
|
1183
1194
|
}
|
|
1184
1195
|
}
|
|
1185
1196
|
|
|
@@ -1191,6 +1202,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1191
1202
|
key: "clearPriceCache",
|
|
1192
1203
|
value: function clearPriceCache() {
|
|
1193
1204
|
this.productsPriceCache.clear();
|
|
1205
|
+
console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
|
|
1194
1206
|
}
|
|
1195
1207
|
|
|
1196
1208
|
/**
|
|
@@ -1702,31 +1714,33 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1702
1714
|
|
|
1703
1715
|
// 同时清空 IndexDB 中的所有数据(包括商品和元数据)
|
|
1704
1716
|
if (!this.dbManager) {
|
|
1705
|
-
_context17.next =
|
|
1717
|
+
_context17.next = 16;
|
|
1706
1718
|
break;
|
|
1707
1719
|
}
|
|
1708
1720
|
_context17.prev = 4;
|
|
1709
1721
|
_context17.next = 7;
|
|
1710
1722
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1711
1723
|
case 7:
|
|
1724
|
+
console.log('[Products] IndexDB 缓存已清空');
|
|
1712
1725
|
this.logInfo('IndexDB 缓存已清空');
|
|
1713
|
-
_context17.next =
|
|
1726
|
+
_context17.next = 16;
|
|
1714
1727
|
break;
|
|
1715
|
-
case
|
|
1716
|
-
_context17.prev =
|
|
1728
|
+
case 11:
|
|
1729
|
+
_context17.prev = 11;
|
|
1717
1730
|
_context17.t0 = _context17["catch"](4);
|
|
1718
1731
|
errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
|
|
1719
1732
|
console.error('[Products] 清空 IndexDB 缓存失败:', _context17.t0);
|
|
1720
1733
|
this.logError('清空 IndexDB 缓存失败', {
|
|
1721
1734
|
error: errorMessage
|
|
1722
1735
|
});
|
|
1723
|
-
case 15:
|
|
1724
|
-
this.logInfo('缓存清空完成');
|
|
1725
1736
|
case 16:
|
|
1737
|
+
console.log('[Products] 缓存已清空');
|
|
1738
|
+
this.logInfo('缓存清空完成');
|
|
1739
|
+
case 18:
|
|
1726
1740
|
case "end":
|
|
1727
1741
|
return _context17.stop();
|
|
1728
1742
|
}
|
|
1729
|
-
}, _callee17, this, [[4,
|
|
1743
|
+
}, _callee17, this, [[4, 11]]);
|
|
1730
1744
|
}));
|
|
1731
1745
|
function clear() {
|
|
1732
1746
|
return _clear.apply(this, arguments);
|
|
@@ -2066,21 +2080,23 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2066
2080
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2067
2081
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2068
2082
|
case 0:
|
|
2083
|
+
console.log('[Products] 开始预加载数据...');
|
|
2069
2084
|
tTotal = performance.now();
|
|
2070
2085
|
this.logInfo('开始预加载数据');
|
|
2071
|
-
_context24.prev =
|
|
2086
|
+
_context24.prev = 3;
|
|
2072
2087
|
tIndexDB = performance.now();
|
|
2073
|
-
_context24.next =
|
|
2088
|
+
_context24.next = 7;
|
|
2074
2089
|
return this.loadProductsFromIndexDB();
|
|
2075
|
-
case
|
|
2090
|
+
case 7:
|
|
2076
2091
|
cachedData = _context24.sent;
|
|
2077
2092
|
perfMark('preload.loadFromIndexDB', performance.now() - tIndexDB, {
|
|
2078
2093
|
count: (_cachedData$length = cachedData === null || cachedData === void 0 ? void 0 : cachedData.length) !== null && _cachedData$length !== void 0 ? _cachedData$length : 0
|
|
2079
2094
|
});
|
|
2080
2095
|
if (!(cachedData && cachedData.length > 0)) {
|
|
2081
|
-
_context24.next =
|
|
2096
|
+
_context24.next = 20;
|
|
2082
2097
|
break;
|
|
2083
2098
|
}
|
|
2099
|
+
console.log("[Products] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u4E2A\u5546\u54C1"));
|
|
2084
2100
|
// IndexDB 反序列化的数据已经是全新的,无需 cloneDeep
|
|
2085
2101
|
this.store.list = cachedData;
|
|
2086
2102
|
tSync = performance.now();
|
|
@@ -2100,23 +2116,24 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2100
2116
|
});
|
|
2101
2117
|
this.lastPreloadCompletedAtMs = Date.now();
|
|
2102
2118
|
return _context24.abrupt("return");
|
|
2103
|
-
case
|
|
2119
|
+
case 20:
|
|
2120
|
+
console.log('[Products] IndexDB 中没有缓存数据,从服务器加载...');
|
|
2104
2121
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
2105
|
-
_context24.next =
|
|
2122
|
+
_context24.next = 29;
|
|
2106
2123
|
break;
|
|
2107
|
-
case
|
|
2108
|
-
_context24.prev =
|
|
2109
|
-
_context24.t0 = _context24["catch"](
|
|
2124
|
+
case 24:
|
|
2125
|
+
_context24.prev = 24;
|
|
2126
|
+
_context24.t0 = _context24["catch"](3);
|
|
2110
2127
|
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
2111
2128
|
console.warn('[Products] 从 IndexDB 加载数据失败:', _context24.t0);
|
|
2112
2129
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
2113
2130
|
error: errorMessage
|
|
2114
2131
|
});
|
|
2115
|
-
case
|
|
2132
|
+
case 29:
|
|
2116
2133
|
tServer = performance.now();
|
|
2117
|
-
_context24.next =
|
|
2134
|
+
_context24.next = 32;
|
|
2118
2135
|
return this.loadProductsByServer();
|
|
2119
|
-
case
|
|
2136
|
+
case 32:
|
|
2120
2137
|
products = _context24.sent;
|
|
2121
2138
|
perfMark('preload.loadFromServer', performance.now() - tServer, {
|
|
2122
2139
|
count: (_products$length3 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length3 !== void 0 ? _products$length3 : 0
|
|
@@ -2148,11 +2165,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2148
2165
|
duration: "".concat(Math.round(performance.now() - tTotal), "ms")
|
|
2149
2166
|
});
|
|
2150
2167
|
}
|
|
2151
|
-
case
|
|
2168
|
+
case 35:
|
|
2152
2169
|
case "end":
|
|
2153
2170
|
return _context24.stop();
|
|
2154
2171
|
}
|
|
2155
|
-
}, _callee24, this, [[
|
|
2172
|
+
}, _callee24, this, [[3, 24]]);
|
|
2156
2173
|
}));
|
|
2157
2174
|
function preload() {
|
|
2158
2175
|
return _preload.apply(this, arguments);
|
|
@@ -2196,6 +2213,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2196
2213
|
return function (message) {
|
|
2197
2214
|
var data = (message === null || message === void 0 ? void 0 : message.data) || message;
|
|
2198
2215
|
if (!data) return;
|
|
2216
|
+
console.log("[ProductsModule] \u6536\u5230\u540C\u6B65\u6D88\u606F [".concat(channelKey, "]:"), data);
|
|
2199
2217
|
_this11.logInfo('收到同步消息', {
|
|
2200
2218
|
channelKey: channelKey,
|
|
2201
2219
|
action: data.action,
|
|
@@ -82,7 +82,9 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
82
82
|
if (appPlugin) {
|
|
83
83
|
app = appPlugin.getApp();
|
|
84
84
|
this.dbManager = app.dbManager;
|
|
85
|
-
if (this.dbManager) {
|
|
85
|
+
if (this.dbManager) {
|
|
86
|
+
console.log('[Quotation] IndexDB Manager 已初始化');
|
|
87
|
+
} else {
|
|
86
88
|
console.warn('[Quotation] IndexDB Manager 未找到');
|
|
87
89
|
}
|
|
88
90
|
}
|
|
@@ -317,24 +319,27 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
317
319
|
|
|
318
320
|
// 同时清空 IndexDB 中的数据
|
|
319
321
|
if (!this.dbManager) {
|
|
320
|
-
_context5.next =
|
|
322
|
+
_context5.next = 11;
|
|
321
323
|
break;
|
|
322
324
|
}
|
|
323
325
|
_context5.prev = 2;
|
|
324
326
|
_context5.next = 5;
|
|
325
327
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
326
328
|
case 5:
|
|
327
|
-
|
|
329
|
+
console.log('[Quotation] IndexDB 缓存已清空');
|
|
330
|
+
_context5.next = 11;
|
|
328
331
|
break;
|
|
329
|
-
case
|
|
330
|
-
_context5.prev =
|
|
332
|
+
case 8:
|
|
333
|
+
_context5.prev = 8;
|
|
331
334
|
_context5.t0 = _context5["catch"](2);
|
|
332
335
|
console.error('[Quotation] 清空 IndexDB 缓存失败:', _context5.t0);
|
|
333
|
-
case
|
|
336
|
+
case 11:
|
|
337
|
+
console.log('[Quotation] 缓存已清空');
|
|
338
|
+
case 12:
|
|
334
339
|
case "end":
|
|
335
340
|
return _context5.stop();
|
|
336
341
|
}
|
|
337
|
-
}, _callee5, this, [[2,
|
|
342
|
+
}, _callee5, this, [[2, 8]]);
|
|
338
343
|
}));
|
|
339
344
|
function clear() {
|
|
340
345
|
return _clear.apply(this, arguments);
|
|
@@ -490,17 +495,18 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
490
495
|
_context7.next = 8;
|
|
491
496
|
return Promise.all(savePromises);
|
|
492
497
|
case 8:
|
|
493
|
-
|
|
498
|
+
console.log("[Quotation] \u5DF2\u5C06 ".concat(quotationList.length, " \u6761\u62A5\u4EF7\u5355\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
|
|
499
|
+
_context7.next = 14;
|
|
494
500
|
break;
|
|
495
|
-
case
|
|
496
|
-
_context7.prev =
|
|
501
|
+
case 11:
|
|
502
|
+
_context7.prev = 11;
|
|
497
503
|
_context7.t0 = _context7["catch"](2);
|
|
498
504
|
console.error('[Quotation] 保存数据到 IndexDB 失败:', _context7.t0);
|
|
499
|
-
case
|
|
505
|
+
case 14:
|
|
500
506
|
case "end":
|
|
501
507
|
return _context7.stop();
|
|
502
508
|
}
|
|
503
|
-
}, _callee7, this, [[2,
|
|
509
|
+
}, _callee7, this, [[2, 11]]);
|
|
504
510
|
}));
|
|
505
511
|
function saveQuotationToIndexDB(_x5) {
|
|
506
512
|
return _saveQuotationToIndexDB.apply(this, arguments);
|
|
@@ -520,45 +526,48 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
520
526
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
521
527
|
while (1) switch (_context8.prev = _context8.next) {
|
|
522
528
|
case 0:
|
|
523
|
-
|
|
524
|
-
_context8.
|
|
529
|
+
console.log('[Quotation] 开始预加载数据...');
|
|
530
|
+
_context8.prev = 1;
|
|
531
|
+
_context8.next = 4;
|
|
525
532
|
return this.loadQuotationFromIndexDB();
|
|
526
|
-
case
|
|
533
|
+
case 4:
|
|
527
534
|
cachedData = _context8.sent;
|
|
528
535
|
if (!(cachedData && cachedData.length > 0)) {
|
|
529
|
-
_context8.next =
|
|
536
|
+
_context8.next = 10;
|
|
530
537
|
break;
|
|
531
538
|
}
|
|
539
|
+
console.log("[Quotation] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u62A5\u4EF7\u5355\u6570\u636E"));
|
|
532
540
|
// 将缓存数据放入 store
|
|
533
541
|
this.store.quotationList = cloneDeep(cachedData);
|
|
534
542
|
this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
|
|
535
543
|
return _context8.abrupt("return");
|
|
536
|
-
case 8:
|
|
537
|
-
_context8.next = 13;
|
|
538
|
-
break;
|
|
539
544
|
case 10:
|
|
540
|
-
|
|
541
|
-
_context8.
|
|
542
|
-
|
|
545
|
+
console.log('[Quotation] IndexDB 中没有缓存数据,从服务器加载...');
|
|
546
|
+
_context8.next = 16;
|
|
547
|
+
break;
|
|
543
548
|
case 13:
|
|
544
|
-
_context8.
|
|
549
|
+
_context8.prev = 13;
|
|
550
|
+
_context8.t0 = _context8["catch"](1);
|
|
551
|
+
console.warn('[Quotation] 从 IndexDB 加载数据失败:', _context8.t0);
|
|
552
|
+
case 16:
|
|
553
|
+
_context8.next = 18;
|
|
545
554
|
return this.loadQuotationList();
|
|
546
|
-
case
|
|
555
|
+
case 18:
|
|
547
556
|
quotationList = _context8.sent;
|
|
548
557
|
if (!(quotationList && quotationList.length > 0)) {
|
|
549
|
-
_context8.next =
|
|
558
|
+
_context8.next = 24;
|
|
550
559
|
break;
|
|
551
560
|
}
|
|
552
|
-
_context8.next =
|
|
561
|
+
_context8.next = 22;
|
|
553
562
|
return this.saveQuotationToIndexDB(quotationList);
|
|
554
|
-
case
|
|
563
|
+
case 22:
|
|
555
564
|
this.store.quotationList = cloneDeep(quotationList);
|
|
556
565
|
this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
|
|
557
|
-
case
|
|
566
|
+
case 24:
|
|
558
567
|
case "end":
|
|
559
568
|
return _context8.stop();
|
|
560
569
|
}
|
|
561
|
-
}, _callee8, this, [[
|
|
570
|
+
}, _callee8, this, [[1, 13]]);
|
|
562
571
|
}));
|
|
563
572
|
function preload() {
|
|
564
573
|
return _preload.apply(this, arguments);
|
|
@@ -790,16 +790,17 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
790
790
|
});
|
|
791
791
|
case 4:
|
|
792
792
|
result = _context8.sent;
|
|
793
|
+
console.log('result', result);
|
|
793
794
|
this.logInfo('setupResourceSync: 资源列表查询结果', {
|
|
794
795
|
result: result
|
|
795
796
|
});
|
|
796
797
|
if (!(result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && (_result$data = _result$data.list) !== null && _result$data !== void 0 && _result$data.length)) {
|
|
797
|
-
_context8.next =
|
|
798
|
+
_context8.next = 10;
|
|
798
799
|
break;
|
|
799
800
|
}
|
|
800
|
-
_context8.next =
|
|
801
|
+
_context8.next = 10;
|
|
801
802
|
return this.mergeResourcesToStore(result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.list);
|
|
802
|
-
case
|
|
803
|
+
case 10:
|
|
803
804
|
case "end":
|
|
804
805
|
return _context8.stop();
|
|
805
806
|
}
|