@pisell/pisellos 2.3.69 → 2.3.71
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 +0 -7
- package/dist/core/index.js +65 -109
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/types.js +1 -0
- package/dist/modules/Quotation/index.d.ts +0 -6
- package/dist/modules/Quotation/index.js +19 -75
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +2 -8
- package/dist/server/index.js +140 -206
- package/dist/server/modules/floor-plan/index.d.ts +0 -4
- package/dist/server/modules/floor-plan/index.js +98 -240
- package/dist/server/modules/menu/index.js +23 -48
- package/dist/server/modules/order/index.d.ts +7 -17
- package/dist/server/modules/order/index.js +207 -419
- package/dist/server/modules/products/index.d.ts +2 -8
- package/dist/server/modules/products/index.js +75 -167
- package/dist/server/modules/resource/index.js +13 -21
- package/dist/solution/BaseSales/index.js +15 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -15
- package/dist/solution/BookingTicket/index.js +21 -6
- package/lib/core/index.d.ts +0 -7
- package/lib/core/index.js +2 -20
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Quotation/index.d.ts +0 -6
- package/lib/modules/Quotation/index.js +5 -49
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +2 -8
- package/lib/server/index.js +17 -52
- package/lib/server/modules/floor-plan/index.d.ts +0 -4
- package/lib/server/modules/floor-plan/index.js +6 -54
- package/lib/server/modules/menu/index.js +5 -31
- package/lib/server/modules/order/index.d.ts +7 -17
- package/lib/server/modules/order/index.js +40 -197
- package/lib/server/modules/products/index.d.ts +2 -8
- package/lib/server/modules/products/index.js +24 -97
- package/lib/server/modules/resource/index.js +2 -7
- package/lib/solution/BaseSales/index.js +4 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -15
- package/lib/solution/BookingTicket/index.js +15 -5
- package/package.json +1 -1
|
@@ -10,7 +10,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
|
|
|
10
10
|
private store;
|
|
11
11
|
private request;
|
|
12
12
|
private logger;
|
|
13
|
-
private dbManager;
|
|
14
13
|
private floorPlanDataSource;
|
|
15
14
|
private pendingSyncMessages;
|
|
16
15
|
private syncTimer?;
|
|
@@ -29,9 +28,6 @@ export declare class FloorPlanModule extends BaseModule implements Module {
|
|
|
29
28
|
private mergeItems;
|
|
30
29
|
private removeByIds;
|
|
31
30
|
private loadListFromServer;
|
|
32
|
-
private loadListFromSQLite;
|
|
33
|
-
private saveListToSQLite;
|
|
34
|
-
private refreshListFromServer;
|
|
35
31
|
fetchByIdFromServer(id: number | string): Promise<FloorPlanItem | null>;
|
|
36
32
|
fetchByCodeFromServer(code: string): Promise<FloorPlanItem | null>;
|
|
37
33
|
preload(): Promise<void>;
|
|
@@ -29,7 +29,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
29
29
|
import { BaseModule } from "../../../modules/BaseModule";
|
|
30
30
|
import { FloorPlanHooks } from "./types";
|
|
31
31
|
var FLOOR_PLAN_SYNC_DEBOUNCE_MS = 3000;
|
|
32
|
-
var FLOOR_PLAN_STORE_NAME = 'floor_plans';
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
* 平面图模块:预加载列表、pubsub 同步、供 OS Server 路由读本地 store
|
|
@@ -46,7 +45,6 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
46
45
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
47
46
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
48
47
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
49
|
-
_defineProperty(_assertThisInitialized(_this), "dbManager", void 0);
|
|
50
48
|
_defineProperty(_assertThisInitialized(_this), "floorPlanDataSource", void 0);
|
|
51
49
|
_defineProperty(_assertThisInitialized(_this), "pendingSyncMessages", []);
|
|
52
50
|
_defineProperty(_assertThisInitialized(_this), "syncTimer", void 0);
|
|
@@ -77,7 +75,6 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
77
75
|
if (appPlugin) {
|
|
78
76
|
app = appPlugin.getApp();
|
|
79
77
|
this.logger = app.logger;
|
|
80
|
-
this.dbManager = app.sqlite || app.dbManager;
|
|
81
78
|
}
|
|
82
79
|
this.initFloorPlanDataSource();
|
|
83
80
|
this.setupFloorPlanSync();
|
|
@@ -263,155 +260,35 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
263
260
|
}
|
|
264
261
|
return loadListFromServer;
|
|
265
262
|
}()
|
|
266
|
-
}, {
|
|
267
|
-
key: "loadListFromSQLite",
|
|
268
|
-
value: function () {
|
|
269
|
-
var _loadListFromSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
270
|
-
var list;
|
|
271
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
272
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
273
|
-
case 0:
|
|
274
|
-
if (this.dbManager) {
|
|
275
|
-
_context3.next = 2;
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
return _context3.abrupt("return", []);
|
|
279
|
-
case 2:
|
|
280
|
-
_context3.prev = 2;
|
|
281
|
-
_context3.next = 5;
|
|
282
|
-
return this.dbManager.getAll(FLOOR_PLAN_STORE_NAME);
|
|
283
|
-
case 5:
|
|
284
|
-
list = _context3.sent;
|
|
285
|
-
return _context3.abrupt("return", Array.isArray(list) ? list : []);
|
|
286
|
-
case 9:
|
|
287
|
-
_context3.prev = 9;
|
|
288
|
-
_context3.t0 = _context3["catch"](2);
|
|
289
|
-
this.logWarning('从 SQLite 读取平面图失败', {
|
|
290
|
-
error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
291
|
-
});
|
|
292
|
-
return _context3.abrupt("return", []);
|
|
293
|
-
case 13:
|
|
294
|
-
case "end":
|
|
295
|
-
return _context3.stop();
|
|
296
|
-
}
|
|
297
|
-
}, _callee3, this, [[2, 9]]);
|
|
298
|
-
}));
|
|
299
|
-
function loadListFromSQLite() {
|
|
300
|
-
return _loadListFromSQLite.apply(this, arguments);
|
|
301
|
-
}
|
|
302
|
-
return loadListFromSQLite;
|
|
303
|
-
}()
|
|
304
|
-
}, {
|
|
305
|
-
key: "saveListToSQLite",
|
|
306
|
-
value: function () {
|
|
307
|
-
var _saveListToSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(list) {
|
|
308
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
309
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
310
|
-
case 0:
|
|
311
|
-
if (this.dbManager) {
|
|
312
|
-
_context4.next = 2;
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
315
|
-
return _context4.abrupt("return");
|
|
316
|
-
case 2:
|
|
317
|
-
_context4.prev = 2;
|
|
318
|
-
_context4.next = 5;
|
|
319
|
-
return this.dbManager.clear(FLOOR_PLAN_STORE_NAME);
|
|
320
|
-
case 5:
|
|
321
|
-
if (!(list.length > 0)) {
|
|
322
|
-
_context4.next = 8;
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
_context4.next = 8;
|
|
326
|
-
return this.dbManager.bulkAdd(FLOOR_PLAN_STORE_NAME, list);
|
|
327
|
-
case 8:
|
|
328
|
-
_context4.next = 13;
|
|
329
|
-
break;
|
|
330
|
-
case 10:
|
|
331
|
-
_context4.prev = 10;
|
|
332
|
-
_context4.t0 = _context4["catch"](2);
|
|
333
|
-
this.logWarning('保存平面图到 SQLite 失败', {
|
|
334
|
-
count: list.length,
|
|
335
|
-
error: _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0)
|
|
336
|
-
});
|
|
337
|
-
case 13:
|
|
338
|
-
case "end":
|
|
339
|
-
return _context4.stop();
|
|
340
|
-
}
|
|
341
|
-
}, _callee4, this, [[2, 10]]);
|
|
342
|
-
}));
|
|
343
|
-
function saveListToSQLite(_x3) {
|
|
344
|
-
return _saveListToSQLite.apply(this, arguments);
|
|
345
|
-
}
|
|
346
|
-
return saveListToSQLite;
|
|
347
|
-
}()
|
|
348
|
-
}, {
|
|
349
|
-
key: "refreshListFromServer",
|
|
350
|
-
value: function () {
|
|
351
|
-
var _refreshListFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
352
|
-
var list;
|
|
353
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
354
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
355
|
-
case 0:
|
|
356
|
-
_context5.next = 2;
|
|
357
|
-
return this.loadListFromServer();
|
|
358
|
-
case 2:
|
|
359
|
-
list = _context5.sent;
|
|
360
|
-
if (!(list.length === 0)) {
|
|
361
|
-
_context5.next = 6;
|
|
362
|
-
break;
|
|
363
|
-
}
|
|
364
|
-
this.logWarning('远端平面图刷新完成但列表为空');
|
|
365
|
-
return _context5.abrupt("return");
|
|
366
|
-
case 6:
|
|
367
|
-
this.replaceStore(list);
|
|
368
|
-
_context5.next = 9;
|
|
369
|
-
return this.saveListToSQLite(list);
|
|
370
|
-
case 9:
|
|
371
|
-
this.core.effects.emit(FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
|
|
372
|
-
this.logInfo('远端平面图刷新完成', {
|
|
373
|
-
count: list.length
|
|
374
|
-
});
|
|
375
|
-
case 11:
|
|
376
|
-
case "end":
|
|
377
|
-
return _context5.stop();
|
|
378
|
-
}
|
|
379
|
-
}, _callee5, this);
|
|
380
|
-
}));
|
|
381
|
-
function refreshListFromServer() {
|
|
382
|
-
return _refreshListFromServer.apply(this, arguments);
|
|
383
|
-
}
|
|
384
|
-
return refreshListFromServer;
|
|
385
|
-
}()
|
|
386
263
|
}, {
|
|
387
264
|
key: "fetchByIdFromServer",
|
|
388
265
|
value: function () {
|
|
389
|
-
var _fetchByIdFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
266
|
+
var _fetchByIdFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(id) {
|
|
390
267
|
var res, body, data;
|
|
391
|
-
return _regeneratorRuntime().wrap(function
|
|
392
|
-
while (1) switch (
|
|
268
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
269
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
393
270
|
case 0:
|
|
394
|
-
|
|
395
|
-
|
|
271
|
+
_context3.prev = 0;
|
|
272
|
+
_context3.next = 3;
|
|
396
273
|
return this.request.get("/schedule/floor-plan/".concat(id), {}, {
|
|
397
274
|
isShopApi: true
|
|
398
275
|
});
|
|
399
276
|
case 3:
|
|
400
|
-
res =
|
|
277
|
+
res = _context3.sent;
|
|
401
278
|
body = res;
|
|
402
279
|
data = (body === null || body === void 0 ? void 0 : body.data) !== undefined ? body.data : body;
|
|
403
|
-
return
|
|
280
|
+
return _context3.abrupt("return", data && _typeof(data) === 'object' ? data : null);
|
|
404
281
|
case 9:
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return
|
|
282
|
+
_context3.prev = 9;
|
|
283
|
+
_context3.t0 = _context3["catch"](0);
|
|
284
|
+
return _context3.abrupt("return", null);
|
|
408
285
|
case 12:
|
|
409
286
|
case "end":
|
|
410
|
-
return
|
|
287
|
+
return _context3.stop();
|
|
411
288
|
}
|
|
412
|
-
},
|
|
289
|
+
}, _callee3, this, [[0, 9]]);
|
|
413
290
|
}));
|
|
414
|
-
function fetchByIdFromServer(
|
|
291
|
+
function fetchByIdFromServer(_x3) {
|
|
415
292
|
return _fetchByIdFromServer.apply(this, arguments);
|
|
416
293
|
}
|
|
417
294
|
return fetchByIdFromServer;
|
|
@@ -419,33 +296,33 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
419
296
|
}, {
|
|
420
297
|
key: "fetchByCodeFromServer",
|
|
421
298
|
value: function () {
|
|
422
|
-
var _fetchByCodeFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
299
|
+
var _fetchByCodeFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(code) {
|
|
423
300
|
var enc, res, body, data;
|
|
424
|
-
return _regeneratorRuntime().wrap(function
|
|
425
|
-
while (1) switch (
|
|
301
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
302
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
426
303
|
case 0:
|
|
427
|
-
|
|
304
|
+
_context4.prev = 0;
|
|
428
305
|
enc = encodeURIComponent(code);
|
|
429
|
-
|
|
306
|
+
_context4.next = 4;
|
|
430
307
|
return this.request.get("/schedule/floor-plan/code/".concat(enc), {}, {
|
|
431
308
|
isShopApi: true
|
|
432
309
|
});
|
|
433
310
|
case 4:
|
|
434
|
-
res =
|
|
311
|
+
res = _context4.sent;
|
|
435
312
|
body = res;
|
|
436
313
|
data = (body === null || body === void 0 ? void 0 : body.data) !== undefined ? body.data : body;
|
|
437
|
-
return
|
|
314
|
+
return _context4.abrupt("return", data && _typeof(data) === 'object' ? data : null);
|
|
438
315
|
case 10:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
return
|
|
316
|
+
_context4.prev = 10;
|
|
317
|
+
_context4.t0 = _context4["catch"](0);
|
|
318
|
+
return _context4.abrupt("return", null);
|
|
442
319
|
case 13:
|
|
443
320
|
case "end":
|
|
444
|
-
return
|
|
321
|
+
return _context4.stop();
|
|
445
322
|
}
|
|
446
|
-
},
|
|
323
|
+
}, _callee4, this, [[0, 10]]);
|
|
447
324
|
}));
|
|
448
|
-
function fetchByCodeFromServer(
|
|
325
|
+
function fetchByCodeFromServer(_x4) {
|
|
449
326
|
return _fetchByCodeFromServer.apply(this, arguments);
|
|
450
327
|
}
|
|
451
328
|
return fetchByCodeFromServer;
|
|
@@ -453,42 +330,30 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
453
330
|
}, {
|
|
454
331
|
key: "preload",
|
|
455
332
|
value: function () {
|
|
456
|
-
var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
457
|
-
var
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
333
|
+
var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
334
|
+
var list;
|
|
335
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
336
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
461
337
|
case 0:
|
|
462
338
|
this.logInfo('开始预加载平面图列表');
|
|
463
|
-
|
|
464
|
-
return this.
|
|
339
|
+
_context5.next = 3;
|
|
340
|
+
return this.loadListFromServer();
|
|
465
341
|
case 3:
|
|
466
|
-
|
|
467
|
-
if (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.core.effects.emit(FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
|
|
473
|
-
this.logInfo('预加载完成(SQLite)', {
|
|
474
|
-
count: cachedList.length
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
// 二次启动立即使用本地平面图,远端刷新完成后自动更新 store 与订阅者。
|
|
478
|
-
void this.refreshListFromServer().catch(function (error) {
|
|
479
|
-
_this3.logWarning('后台刷新平面图失败,继续使用本地数据', {
|
|
480
|
-
error: error instanceof Error ? error.message : String(error)
|
|
342
|
+
list = _context5.sent;
|
|
343
|
+
if (list.length > 0) {
|
|
344
|
+
this.replaceStore(list);
|
|
345
|
+
this.core.effects.emit(FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
|
|
346
|
+
this.logInfo('预加载完成', {
|
|
347
|
+
count: list.length
|
|
481
348
|
});
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return this.refreshListFromServer();
|
|
487
|
-
case 12:
|
|
349
|
+
} else {
|
|
350
|
+
this.logWarning('预加载完成但列表为空');
|
|
351
|
+
}
|
|
352
|
+
case 5:
|
|
488
353
|
case "end":
|
|
489
|
-
return
|
|
354
|
+
return _context5.stop();
|
|
490
355
|
}
|
|
491
|
-
},
|
|
356
|
+
}, _callee5, this);
|
|
492
357
|
}));
|
|
493
358
|
function preload() {
|
|
494
359
|
return _preload.apply(this, arguments);
|
|
@@ -510,12 +375,12 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
510
375
|
}, {
|
|
511
376
|
key: "setupFloorPlanSync",
|
|
512
377
|
value: function setupFloorPlanSync() {
|
|
513
|
-
var
|
|
378
|
+
var _this3 = this;
|
|
514
379
|
if (!this.floorPlanDataSource) return;
|
|
515
380
|
var flush = function flush() {
|
|
516
|
-
if (
|
|
517
|
-
|
|
518
|
-
|
|
381
|
+
if (_this3.syncTimer) clearTimeout(_this3.syncTimer);
|
|
382
|
+
_this3.syncTimer = setTimeout(function () {
|
|
383
|
+
_this3.processFloorPlanSyncMessages();
|
|
519
384
|
}, FLOOR_PLAN_SYNC_DEBOUNCE_MS);
|
|
520
385
|
};
|
|
521
386
|
this.floorPlanDataSource.run({
|
|
@@ -523,12 +388,12 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
523
388
|
callback: function callback(res) {
|
|
524
389
|
var data = (res === null || res === void 0 ? void 0 : res.data) || res;
|
|
525
390
|
if (!data || data.module !== 'floor_plan') return;
|
|
526
|
-
|
|
391
|
+
_this3.pendingSyncMessages.push(_objectSpread({}, data));
|
|
527
392
|
flush();
|
|
528
393
|
}
|
|
529
394
|
}
|
|
530
395
|
}).catch(function (err) {
|
|
531
|
-
|
|
396
|
+
_this3.logError('setupFloorPlanSync: DataSource run 出错', {
|
|
532
397
|
error: err instanceof Error ? err.message : String(err)
|
|
533
398
|
});
|
|
534
399
|
});
|
|
@@ -537,18 +402,18 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
537
402
|
}, {
|
|
538
403
|
key: "processFloorPlanSyncMessages",
|
|
539
404
|
value: function () {
|
|
540
|
-
var _processFloorPlanSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
405
|
+
var _processFloorPlanSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
541
406
|
var messages, changed, deleteIds, bodyItems, needFullList, partialIds, _iterator3, _step3, _msg$ids2, msg, _msg$ids, body, hasBody, uniqueDeletes, list, fetched, _iterator4, _step4, id, one;
|
|
542
|
-
return _regeneratorRuntime().wrap(function
|
|
543
|
-
while (1) switch (
|
|
407
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
408
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
544
409
|
case 0:
|
|
545
410
|
messages = _toConsumableArray(this.pendingSyncMessages);
|
|
546
411
|
this.pendingSyncMessages = [];
|
|
547
412
|
if (!(messages.length === 0)) {
|
|
548
|
-
|
|
413
|
+
_context6.next = 4;
|
|
549
414
|
break;
|
|
550
415
|
}
|
|
551
|
-
return
|
|
416
|
+
return _context6.abrupt("return");
|
|
552
417
|
case 4:
|
|
553
418
|
this.logInfo('processFloorPlanSyncMessages 开始', {
|
|
554
419
|
count: messages.length
|
|
@@ -559,16 +424,16 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
559
424
|
needFullList = false;
|
|
560
425
|
partialIds = new Set();
|
|
561
426
|
_iterator3 = _createForOfIteratorHelper(messages);
|
|
562
|
-
|
|
427
|
+
_context6.prev = 11;
|
|
563
428
|
_iterator3.s();
|
|
564
429
|
case 13:
|
|
565
430
|
if ((_step3 = _iterator3.n()).done) {
|
|
566
|
-
|
|
431
|
+
_context6.next = 29;
|
|
567
432
|
break;
|
|
568
433
|
}
|
|
569
434
|
msg = _step3.value;
|
|
570
435
|
if (!(msg.operation === 'delete' || msg.action === 'delete')) {
|
|
571
|
-
|
|
436
|
+
_context6.next = 18;
|
|
572
437
|
break;
|
|
573
438
|
}
|
|
574
439
|
if ((_msg$ids = msg.ids) !== null && _msg$ids !== void 0 && _msg$ids.length) {
|
|
@@ -576,23 +441,23 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
576
441
|
} else if (msg.id != null) {
|
|
577
442
|
deleteIds.push(msg.id);
|
|
578
443
|
}
|
|
579
|
-
return
|
|
444
|
+
return _context6.abrupt("continue", 27);
|
|
580
445
|
case 18:
|
|
581
446
|
body = msg.body;
|
|
582
447
|
hasBody = body && _typeof(body) === 'object' && Object.keys(body).length > 0 && body.id != null;
|
|
583
448
|
if (!hasBody) {
|
|
584
|
-
|
|
449
|
+
_context6.next = 23;
|
|
585
450
|
break;
|
|
586
451
|
}
|
|
587
452
|
bodyItems.push(body);
|
|
588
|
-
return
|
|
453
|
+
return _context6.abrupt("continue", 27);
|
|
589
454
|
case 23:
|
|
590
455
|
if (!(msg.ids && msg.ids.length > 1)) {
|
|
591
|
-
|
|
456
|
+
_context6.next = 26;
|
|
592
457
|
break;
|
|
593
458
|
}
|
|
594
459
|
needFullList = true;
|
|
595
|
-
return
|
|
460
|
+
return _context6.abrupt("continue", 27);
|
|
596
461
|
case 26:
|
|
597
462
|
if (((_msg$ids2 = msg.ids) === null || _msg$ids2 === void 0 ? void 0 : _msg$ids2.length) === 1) {
|
|
598
463
|
partialIds.add(msg.ids[0]);
|
|
@@ -600,19 +465,19 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
600
465
|
partialIds.add(msg.id);
|
|
601
466
|
}
|
|
602
467
|
case 27:
|
|
603
|
-
|
|
468
|
+
_context6.next = 13;
|
|
604
469
|
break;
|
|
605
470
|
case 29:
|
|
606
|
-
|
|
471
|
+
_context6.next = 34;
|
|
607
472
|
break;
|
|
608
473
|
case 31:
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
_iterator3.e(
|
|
474
|
+
_context6.prev = 31;
|
|
475
|
+
_context6.t0 = _context6["catch"](11);
|
|
476
|
+
_iterator3.e(_context6.t0);
|
|
612
477
|
case 34:
|
|
613
|
-
|
|
478
|
+
_context6.prev = 34;
|
|
614
479
|
_iterator3.f();
|
|
615
|
-
return
|
|
480
|
+
return _context6.finish(34);
|
|
616
481
|
case 37:
|
|
617
482
|
uniqueDeletes = _toConsumableArray(new Set(deleteIds));
|
|
618
483
|
if (uniqueDeletes.length > 0) {
|
|
@@ -624,71 +489,66 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
624
489
|
changed = true;
|
|
625
490
|
}
|
|
626
491
|
if (!needFullList) {
|
|
627
|
-
|
|
492
|
+
_context6.next = 48;
|
|
628
493
|
break;
|
|
629
494
|
}
|
|
630
|
-
|
|
495
|
+
_context6.next = 43;
|
|
631
496
|
return this.loadListFromServer();
|
|
632
497
|
case 43:
|
|
633
|
-
list =
|
|
498
|
+
list = _context6.sent;
|
|
634
499
|
this.replaceStore(list);
|
|
635
500
|
changed = true;
|
|
636
|
-
|
|
501
|
+
_context6.next = 70;
|
|
637
502
|
break;
|
|
638
503
|
case 48:
|
|
639
504
|
if (!(partialIds.size > 0)) {
|
|
640
|
-
|
|
505
|
+
_context6.next = 70;
|
|
641
506
|
break;
|
|
642
507
|
}
|
|
643
508
|
fetched = [];
|
|
644
509
|
_iterator4 = _createForOfIteratorHelper(partialIds);
|
|
645
|
-
|
|
510
|
+
_context6.prev = 51;
|
|
646
511
|
_iterator4.s();
|
|
647
512
|
case 53:
|
|
648
513
|
if ((_step4 = _iterator4.n()).done) {
|
|
649
|
-
|
|
514
|
+
_context6.next = 61;
|
|
650
515
|
break;
|
|
651
516
|
}
|
|
652
517
|
id = _step4.value;
|
|
653
|
-
|
|
518
|
+
_context6.next = 57;
|
|
654
519
|
return this.fetchByIdFromServer(id);
|
|
655
520
|
case 57:
|
|
656
|
-
one =
|
|
521
|
+
one = _context6.sent;
|
|
657
522
|
if (one) fetched.push(one);
|
|
658
523
|
case 59:
|
|
659
|
-
|
|
524
|
+
_context6.next = 53;
|
|
660
525
|
break;
|
|
661
526
|
case 61:
|
|
662
|
-
|
|
527
|
+
_context6.next = 66;
|
|
663
528
|
break;
|
|
664
529
|
case 63:
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
_iterator4.e(
|
|
530
|
+
_context6.prev = 63;
|
|
531
|
+
_context6.t1 = _context6["catch"](51);
|
|
532
|
+
_iterator4.e(_context6.t1);
|
|
668
533
|
case 66:
|
|
669
|
-
|
|
534
|
+
_context6.prev = 66;
|
|
670
535
|
_iterator4.f();
|
|
671
|
-
return
|
|
536
|
+
return _context6.finish(66);
|
|
672
537
|
case 69:
|
|
673
538
|
if (fetched.length > 0) {
|
|
674
539
|
this.mergeItems(fetched);
|
|
675
540
|
changed = true;
|
|
676
541
|
}
|
|
677
542
|
case 70:
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
543
|
+
if (changed) {
|
|
544
|
+
this.core.effects.emit(FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
|
|
545
|
+
this.core.effects.emit(FloorPlanHooks.onFloorPlanSyncCompleted, null);
|
|
681
546
|
}
|
|
682
|
-
|
|
683
|
-
return this.saveListToSQLite(this.store.list);
|
|
684
|
-
case 73:
|
|
685
|
-
this.core.effects.emit(FloorPlanHooks.onFloorPlansChanged, this.getSortedList());
|
|
686
|
-
this.core.effects.emit(FloorPlanHooks.onFloorPlanSyncCompleted, null);
|
|
687
|
-
case 75:
|
|
547
|
+
case 71:
|
|
688
548
|
case "end":
|
|
689
|
-
return
|
|
549
|
+
return _context6.stop();
|
|
690
550
|
}
|
|
691
|
-
},
|
|
551
|
+
}, _callee6, this, [[11, 31, 34, 37], [51, 63, 66, 69]]);
|
|
692
552
|
}));
|
|
693
553
|
function processFloorPlanSyncMessages() {
|
|
694
554
|
return _processFloorPlanSyncMessages.apply(this, arguments);
|
|
@@ -698,20 +558,18 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
698
558
|
}, {
|
|
699
559
|
key: "clear",
|
|
700
560
|
value: function () {
|
|
701
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
702
|
-
return _regeneratorRuntime().wrap(function
|
|
703
|
-
while (1) switch (
|
|
561
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
562
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
563
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
704
564
|
case 0:
|
|
705
565
|
this.store.list = [];
|
|
706
566
|
this.store.map.clear();
|
|
707
567
|
this.store.codeMap.clear();
|
|
708
|
-
|
|
709
|
-
return this.saveListToSQLite([]);
|
|
710
|
-
case 5:
|
|
568
|
+
case 3:
|
|
711
569
|
case "end":
|
|
712
|
-
return
|
|
570
|
+
return _context7.stop();
|
|
713
571
|
}
|
|
714
|
-
},
|
|
572
|
+
}, _callee7, this);
|
|
715
573
|
}));
|
|
716
574
|
function clear() {
|
|
717
575
|
return _clear.apply(this, arguments);
|