@pisell/pisellos 3.0.4 → 3.0.6
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/modules/Account/index.d.ts +2 -6
- package/dist/modules/Account/index.js +21 -103
- package/dist/modules/Account/types.d.ts +12 -1
- package/dist/modules/AccountList/index.d.ts +20 -1
- package/dist/modules/AccountList/index.js +243 -75
- package/dist/modules/AccountList/types.d.ts +33 -1
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/AccountList/utils.d.ts +9 -0
- package/dist/modules/AccountList/utils.js +25 -0
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +1 -1
- package/dist/modules/Cart/index.d.ts +8 -5
- package/dist/modules/Cart/index.js +101 -25
- package/dist/modules/Cart/types.d.ts +82 -5
- package/dist/modules/Cart/types.js +22 -0
- package/dist/modules/Cart/utils.d.ts +106 -13
- package/dist/modules/Cart/utils.js +289 -76
- package/dist/modules/Date/index.d.ts +6 -6
- package/dist/modules/Date/index.js +41 -58
- package/dist/modules/Date/types.d.ts +22 -6
- package/dist/modules/Date/utils.d.ts +4 -3
- package/dist/modules/Date/utils.js +81 -30
- package/dist/modules/Discount/index.d.ts +4 -4
- package/dist/modules/Discount/index.js +11 -11
- package/dist/modules/Order/index.d.ts +11 -5
- package/dist/modules/Order/index.js +47 -18
- package/dist/modules/Order/types.d.ts +10 -3
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +15 -0
- package/dist/modules/Product/index.d.ts +14 -1
- package/dist/modules/Product/index.js +35 -0
- package/dist/modules/Product/types.d.ts +27 -3
- package/dist/modules/ProductList/index.js +11 -5
- package/dist/modules/Resource/types.d.ts +1 -0
- package/dist/modules/Resource/utils.js +1 -1
- package/dist/modules/Rules/index.d.ts +3 -3
- package/dist/modules/Rules/index.js +121 -53
- package/dist/modules/Rules/types.d.ts +5 -1
- package/dist/modules/Schedule/index.d.ts +18 -0
- package/dist/modules/Schedule/index.js +111 -0
- package/dist/modules/Schedule/type.d.ts +157 -0
- package/dist/modules/Schedule/type.js +1 -0
- package/dist/modules/Schedule/types.d.ts +182 -0
- package/dist/modules/Schedule/types.js +1 -0
- package/dist/modules/Schedule/utils.d.ts +67 -0
- package/dist/modules/Schedule/utils.js +729 -0
- package/dist/modules/Step/index.d.ts +14 -3
- package/dist/modules/Step/index.js +54 -2
- package/dist/modules/Summary/index.d.ts +12 -5
- package/dist/modules/Summary/index.js +33 -7
- package/dist/modules/Summary/types.d.ts +23 -2
- package/dist/modules/Summary/utils.d.ts +14 -4
- package/dist/modules/Summary/utils.js +46 -4
- package/dist/modules/index.d.ts +10 -0
- package/dist/modules/index.js +11 -1
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/request.d.ts +3 -3
- package/dist/plugins/request.js +30 -30
- package/dist/plugins/shopStore.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +97 -24
- package/dist/solution/BookingByStep/index.js +1024 -322
- package/dist/solution/BookingByStep/types.d.ts +3 -10
- package/dist/solution/BookingByStep/types.js +11 -15
- package/dist/solution/BookingByStep/utils/products.d.ts +1 -1
- package/dist/solution/BookingByStep/utils/products.js +3 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts +60 -6
- package/dist/solution/BookingByStep/utils/resources.js +293 -52
- package/dist/solution/ShopDiscount/index.d.ts +4 -4
- package/dist/solution/ShopDiscount/index.js +16 -16
- package/dist/solution/ShopDiscount/types.d.ts +2 -2
- package/dist/solution/ShopDiscount/utils.js +1 -1
- package/lib/core/index.js +7 -2
- package/lib/modules/Account/index.d.ts +2 -6
- package/lib/modules/Account/index.js +15 -30
- package/lib/modules/Account/types.d.ts +12 -1
- package/lib/modules/AccountList/index.d.ts +20 -1
- package/lib/modules/AccountList/index.js +122 -13
- package/lib/modules/AccountList/types.d.ts +33 -1
- package/lib/modules/AccountList/utils.d.ts +9 -0
- package/lib/modules/AccountList/utils.js +39 -0
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +14 -3
- package/lib/modules/Cart/index.d.ts +8 -5
- package/lib/modules/Cart/index.js +81 -8
- package/lib/modules/Cart/types.d.ts +82 -5
- package/lib/modules/Cart/types.js +20 -2
- package/lib/modules/Cart/utils.d.ts +106 -13
- package/lib/modules/Cart/utils.js +188 -45
- package/lib/modules/Date/index.d.ts +6 -6
- package/lib/modules/Date/index.js +13 -28
- package/lib/modules/Date/types.d.ts +22 -6
- package/lib/modules/Date/utils.d.ts +4 -3
- package/lib/modules/Date/utils.js +47 -13
- package/lib/modules/Discount/index.d.ts +4 -4
- package/lib/modules/Discount/index.js +9 -2
- package/lib/modules/Guests/index.js +4 -1
- package/lib/modules/Order/index.d.ts +11 -5
- package/lib/modules/Order/index.js +24 -3
- package/lib/modules/Order/types.d.ts +10 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +45 -0
- package/lib/modules/Payment/index.js +1 -6
- package/lib/modules/Product/index.d.ts +14 -1
- package/lib/modules/Product/index.js +19 -0
- package/lib/modules/Product/types.d.ts +27 -3
- package/lib/modules/ProductList/index.js +21 -7
- package/lib/modules/Resource/index.js +4 -1
- package/lib/modules/Resource/types.d.ts +1 -0
- package/lib/modules/Resource/utils.js +7 -4
- package/lib/modules/Rules/index.d.ts +3 -3
- package/lib/modules/Rules/index.js +118 -43
- package/lib/modules/Rules/types.d.ts +5 -1
- package/lib/modules/Schedule/index.d.ts +18 -0
- package/lib/modules/Schedule/index.js +81 -0
- package/lib/modules/Schedule/type.d.ts +157 -0
- package/lib/modules/Schedule/type.js +17 -0
- package/lib/modules/Schedule/types.d.ts +182 -0
- package/lib/modules/Schedule/types.js +17 -0
- package/lib/modules/Schedule/utils.d.ts +67 -0
- package/lib/modules/Schedule/utils.js +600 -0
- package/lib/modules/Step/index.d.ts +14 -3
- package/lib/modules/Step/index.js +38 -1
- package/lib/modules/Summary/index.d.ts +12 -5
- package/lib/modules/Summary/index.js +15 -1
- package/lib/modules/Summary/types.d.ts +23 -2
- package/lib/modules/Summary/utils.d.ts +14 -4
- package/lib/modules/Summary/utils.js +30 -1
- package/lib/modules/index.d.ts +10 -0
- package/lib/modules/index.js +21 -1
- package/lib/plugins/index.d.ts +3 -3
- package/lib/plugins/request.d.ts +3 -3
- package/lib/plugins/request.js +48 -11
- package/lib/plugins/shopStore.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +97 -24
- package/lib/solution/BookingByStep/index.js +693 -145
- package/lib/solution/BookingByStep/types.d.ts +3 -10
- package/lib/solution/BookingByStep/types.js +37 -14
- package/lib/solution/BookingByStep/utils/products.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/products.js +3 -0
- package/lib/solution/BookingByStep/utils/resources.d.ts +60 -6
- package/lib/solution/BookingByStep/utils/resources.js +286 -54
- package/lib/solution/BuyTickets/index.js +34 -20
- package/lib/solution/ShopDiscount/index.d.ts +4 -4
- package/lib/solution/ShopDiscount/index.js +10 -2
- package/lib/solution/ShopDiscount/types.d.ts +2 -2
- package/package.json +4 -2
- package/dist/core/index.d.ts.map +0 -1
- package/dist/effects/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/modules/Account/index.d.ts.map +0 -1
- package/dist/modules/Account/types.d.ts.map +0 -1
- package/dist/modules/AccountList/types.d.ts.map +0 -1
- package/dist/modules/Cart/index.d.ts.map +0 -1
- package/dist/modules/Cart/types.d.ts.map +0 -1
- package/dist/modules/Date/types.d.ts.map +0 -1
- package/dist/modules/Date/utils.d.ts.map +0 -1
- package/dist/modules/Guests/index.d.ts.map +0 -1
- package/dist/modules/Guests/types.d.ts.map +0 -1
- package/dist/modules/Order/index.d.ts.map +0 -1
- package/dist/modules/Order/types.d.ts.map +0 -1
- package/dist/modules/Payment/index.d.ts.map +0 -1
- package/dist/modules/Payment/types.d.ts.map +0 -1
- package/dist/modules/Product/index.d.ts.map +0 -1
- package/dist/modules/Product/types.d.ts.map +0 -1
- package/dist/modules/ProductList/types.d.ts.map +0 -1
- package/dist/modules/Resource/index.d.ts.map +0 -1
- package/dist/modules/Resource/types.d.ts.map +0 -1
- package/dist/modules/Resource/utils.d.ts.map +0 -1
- package/dist/modules/Rules/types.d.ts.map +0 -1
- package/dist/modules/Step/index.d.ts.map +0 -1
- package/dist/modules/Step/tyeps.d.ts.map +0 -1
- package/dist/modules/Summary/index.d.ts.map +0 -1
- package/dist/modules/Summary/types.d.ts.map +0 -1
- package/dist/modules/Summary/utils.d.ts.map +0 -1
- package/dist/modules/index.d.ts.map +0 -1
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/request.d.ts.map +0 -1
- package/dist/plugins/shopStore.d.ts.map +0 -1
- package/dist/plugins/window.d.ts.map +0 -1
- package/dist/solution/BookingByStep/types.d.ts.map +0 -1
- package/dist/solution/BookingByStep/utils/products.d.ts.map +0 -1
- package/dist/solution/BuyTickets/index.d.ts.map +0 -1
- package/dist/solution/BuyTickets/types.d.ts.map +0 -1
- package/dist/solution/PlaceOrder/index.d.ts.map +0 -1
- package/dist/solution/ShopDiscount/types.d.ts.map +0 -1
- package/dist/solution/ShopDiscount/utils.d.ts.map +0 -1
- package/dist/solution/index.d.ts.map +0 -1
- package/dist/store/createStore.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Discount } from
|
|
1
|
+
import { Discount } from '../Discount/types';
|
|
2
2
|
export declare enum RulesHooks {
|
|
3
3
|
OnRulesListChange = "rules:onRulesListChange",
|
|
4
4
|
OnDestroy = "rules:onDestroy"
|
|
@@ -25,6 +25,7 @@ export interface RulesModuleAPI {
|
|
|
25
25
|
}) => DiscountResult;
|
|
26
26
|
}
|
|
27
27
|
type ProductDetail = {
|
|
28
|
+
isClient?: boolean;
|
|
28
29
|
isManualDiscount?: boolean;
|
|
29
30
|
booking_id: any;
|
|
30
31
|
id: number;
|
|
@@ -33,6 +34,9 @@ type ProductDetail = {
|
|
|
33
34
|
discount_list: Discount[];
|
|
34
35
|
origin_total: number;
|
|
35
36
|
_id: string;
|
|
37
|
+
options?: any[];
|
|
38
|
+
bundle?: any[];
|
|
39
|
+
original_price?: number | string;
|
|
36
40
|
};
|
|
37
41
|
export interface RulesParamsHooks {
|
|
38
42
|
getProduct: (product: Record<string, any>) => ProductDetail;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { ScheduleModuleAPI, ScheduleAvailabilityDateItem, ScheduleItem } from './types';
|
|
4
|
+
export declare class ScheduleModule extends BaseModule implements Module, ScheduleModuleAPI {
|
|
5
|
+
protected defaultName: string;
|
|
6
|
+
protected defaultVersion: string;
|
|
7
|
+
private store;
|
|
8
|
+
private cacheId;
|
|
9
|
+
private openCache;
|
|
10
|
+
private fatherModule;
|
|
11
|
+
constructor(name?: string, version?: string);
|
|
12
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
13
|
+
setScheduleList(list: ScheduleItem[]): void;
|
|
14
|
+
getScheduleListByIds(ids: number[]): ScheduleItem[];
|
|
15
|
+
setAvailabilityScheduleDateList(list: ScheduleAvailabilityDateItem[]): void;
|
|
16
|
+
getAvailabilityScheduleDateList(): ScheduleAvailabilityDateItem[];
|
|
17
|
+
storeChange(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/Schedule/index.ts
|
|
20
|
+
var Schedule_exports = {};
|
|
21
|
+
__export(Schedule_exports, {
|
|
22
|
+
ScheduleModule: () => ScheduleModule
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Schedule_exports);
|
|
25
|
+
var import_lodash_es = require("lodash-es");
|
|
26
|
+
var import_BaseModule = require("../BaseModule");
|
|
27
|
+
var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
28
|
+
constructor(name, version) {
|
|
29
|
+
super(name, version);
|
|
30
|
+
this.defaultName = "schedule";
|
|
31
|
+
this.defaultVersion = "1.0.0";
|
|
32
|
+
this.store = {};
|
|
33
|
+
this.openCache = false;
|
|
34
|
+
}
|
|
35
|
+
async initialize(core, options) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
this.core = core;
|
|
38
|
+
this.store = options == null ? void 0 : options.store;
|
|
39
|
+
if (options.initialState) {
|
|
40
|
+
this.store.scheduleList = options.initialState.scheduleList;
|
|
41
|
+
this.store.availabilityDateList = options.initialState.availabilityDateList;
|
|
42
|
+
} else {
|
|
43
|
+
this.store.scheduleList = [];
|
|
44
|
+
this.store.availabilityDateList = [];
|
|
45
|
+
}
|
|
46
|
+
if ((_a = options.otherParams) == null ? void 0 : _a.cacheId) {
|
|
47
|
+
this.openCache = options.otherParams.openCache;
|
|
48
|
+
this.cacheId = options.otherParams.cacheId;
|
|
49
|
+
}
|
|
50
|
+
if ((_b = options.otherParams) == null ? void 0 : _b.fatherModule) {
|
|
51
|
+
this.fatherModule = options.otherParams.fatherModule;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
setScheduleList(list) {
|
|
55
|
+
this.store.scheduleList = list;
|
|
56
|
+
}
|
|
57
|
+
getScheduleListByIds(ids) {
|
|
58
|
+
return this.store.scheduleList.filter((n) => ids.includes(n.id));
|
|
59
|
+
}
|
|
60
|
+
setAvailabilityScheduleDateList(list) {
|
|
61
|
+
this.store.availabilityDateList = list;
|
|
62
|
+
}
|
|
63
|
+
getAvailabilityScheduleDateList() {
|
|
64
|
+
return this.store.availabilityDateList;
|
|
65
|
+
}
|
|
66
|
+
storeChange() {
|
|
67
|
+
if (this.openCache) {
|
|
68
|
+
const store = (0, import_lodash_es.cloneDeep)(this.store);
|
|
69
|
+
this.checkSaveCache({
|
|
70
|
+
cacheId: this.cacheId,
|
|
71
|
+
fatherModule: this.fatherModule,
|
|
72
|
+
store,
|
|
73
|
+
cacheKey: ["scheduleList", "availabilityDateList"]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
ScheduleModule
|
|
81
|
+
});
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export type ScheduleItem = {
|
|
2
|
+
/** 颜色 */
|
|
3
|
+
color: string;
|
|
4
|
+
/** 创建时间 */
|
|
5
|
+
created_at: string;
|
|
6
|
+
/** 更新时间 */
|
|
7
|
+
updated_at: string;
|
|
8
|
+
/** 开始时间 */
|
|
9
|
+
start_time: string;
|
|
10
|
+
/** 结束时间 */
|
|
11
|
+
end_time: string;
|
|
12
|
+
/** 日程名称 */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 关联订单 */
|
|
15
|
+
order_count: number;
|
|
16
|
+
/** 关联项目数据*/
|
|
17
|
+
relation_count: number;
|
|
18
|
+
repeat_rule: {
|
|
19
|
+
end: {
|
|
20
|
+
/** 截止类型 */
|
|
21
|
+
type: 'date' | 'never';
|
|
22
|
+
/** 结束时间 */
|
|
23
|
+
end_date: string | null;
|
|
24
|
+
occurrence: any | null;
|
|
25
|
+
};
|
|
26
|
+
frequency: number;
|
|
27
|
+
excluded_date: ExcIncDate[];
|
|
28
|
+
included_date: ExcIncDate[];
|
|
29
|
+
frequency_date: number[];
|
|
30
|
+
};
|
|
31
|
+
repeat_type: 'daily' | 'none' | 'weekly';
|
|
32
|
+
/** 日程类型
|
|
33
|
+
* standard: 标准日程
|
|
34
|
+
* time-slots: 时间段日程
|
|
35
|
+
* designation: 指定日期日程
|
|
36
|
+
* */
|
|
37
|
+
type: 'standard' | 'time-slots' | 'designation';
|
|
38
|
+
conflict?: boolean;
|
|
39
|
+
time_slot: {
|
|
40
|
+
start_time: string;
|
|
41
|
+
end_time: string;
|
|
42
|
+
id: number;
|
|
43
|
+
}[];
|
|
44
|
+
id: number;
|
|
45
|
+
/** 指定的开始时间结束时间 */
|
|
46
|
+
designation: {
|
|
47
|
+
start_date: string;
|
|
48
|
+
end_date: string;
|
|
49
|
+
start_time: string;
|
|
50
|
+
end_time: string;
|
|
51
|
+
} | {
|
|
52
|
+
start_date: string;
|
|
53
|
+
end_date: string;
|
|
54
|
+
start_time: string;
|
|
55
|
+
end_time: string;
|
|
56
|
+
}[];
|
|
57
|
+
/** 是否全天 */
|
|
58
|
+
is_all: 1 | 0;
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
relation?: {
|
|
61
|
+
id: number;
|
|
62
|
+
item_id: number;
|
|
63
|
+
item_type: string;
|
|
64
|
+
relation_table_type: string;
|
|
65
|
+
schedule_id: number;
|
|
66
|
+
}[];
|
|
67
|
+
};
|
|
68
|
+
export type ScheduleFormOtherValue = {
|
|
69
|
+
/** 截止模式
|
|
70
|
+
* 1: 永不截止
|
|
71
|
+
* 2: 按日期截止
|
|
72
|
+
* */
|
|
73
|
+
endRadio: 1 | 2;
|
|
74
|
+
/** 是否为全天 */
|
|
75
|
+
isAllDay: boolean;
|
|
76
|
+
/** 是否开启排除日期 */
|
|
77
|
+
excludedStatus: boolean;
|
|
78
|
+
/** 是否包含排除日期 */
|
|
79
|
+
includeStatus: boolean;
|
|
80
|
+
type: 'standard' | 'time-slots' | 'designation';
|
|
81
|
+
};
|
|
82
|
+
export type ExcIncDate = {
|
|
83
|
+
start: string;
|
|
84
|
+
end: string;
|
|
85
|
+
};
|
|
86
|
+
export type ScheduleFormData = {
|
|
87
|
+
/** 颜色 */
|
|
88
|
+
color: string;
|
|
89
|
+
/** 日程名称 */
|
|
90
|
+
name: {
|
|
91
|
+
en: string;
|
|
92
|
+
'zh-CN': string;
|
|
93
|
+
'zh-HK': string;
|
|
94
|
+
original: string;
|
|
95
|
+
} | string;
|
|
96
|
+
/** 重复模式
|
|
97
|
+
* 0:不重复
|
|
98
|
+
* 1:按天重复
|
|
99
|
+
* 2:按周重复 */
|
|
100
|
+
repeat_type: '0' | '1' | '2';
|
|
101
|
+
/** 备注 */
|
|
102
|
+
note: string;
|
|
103
|
+
/** 指定的开始时间结束时间 */
|
|
104
|
+
designation: {
|
|
105
|
+
start_date: string;
|
|
106
|
+
end_date: string;
|
|
107
|
+
start_time: string;
|
|
108
|
+
end_time: string;
|
|
109
|
+
} | {
|
|
110
|
+
start_date: string;
|
|
111
|
+
end_date: string;
|
|
112
|
+
start_time: string;
|
|
113
|
+
end_time: string;
|
|
114
|
+
}[];
|
|
115
|
+
time_slot: {
|
|
116
|
+
start_time: string;
|
|
117
|
+
end_time: string;
|
|
118
|
+
id: number;
|
|
119
|
+
}[];
|
|
120
|
+
/** 重复频率 */
|
|
121
|
+
frequency: number;
|
|
122
|
+
/** 按周重复时选择的周数据 */
|
|
123
|
+
frequency_date: number[];
|
|
124
|
+
/** 截止日期 */
|
|
125
|
+
end_date: string;
|
|
126
|
+
/** 排除的日期范围 */
|
|
127
|
+
excluded_date: ExcIncDate[];
|
|
128
|
+
/** 包含的日期范围 */
|
|
129
|
+
included_date: ExcIncDate[];
|
|
130
|
+
/** 多时间段的开始时间 */
|
|
131
|
+
start_time: any;
|
|
132
|
+
end_time: any;
|
|
133
|
+
};
|
|
134
|
+
export type CalendarDataItem = {
|
|
135
|
+
date: string;
|
|
136
|
+
color: string[];
|
|
137
|
+
isExcluded: boolean;
|
|
138
|
+
schedule_ids?: number[];
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
};
|
|
141
|
+
export type RequestData<Data> = {
|
|
142
|
+
data: Data;
|
|
143
|
+
status: boolean;
|
|
144
|
+
message: string;
|
|
145
|
+
code: number;
|
|
146
|
+
};
|
|
147
|
+
export type ResponseListData<Data> = {
|
|
148
|
+
status: boolean;
|
|
149
|
+
message: string;
|
|
150
|
+
code: number;
|
|
151
|
+
data: {
|
|
152
|
+
list: Data;
|
|
153
|
+
count: number;
|
|
154
|
+
size: number;
|
|
155
|
+
skip: number;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/modules/Schedule/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
export interface ScheduleState {
|
|
3
|
+
scheduleList: ScheduleItem[];
|
|
4
|
+
availabilityDateList: ScheduleAvailabilityDateItem[];
|
|
5
|
+
}
|
|
6
|
+
export type ScheduleAvailabilityDateItem = {
|
|
7
|
+
date: string;
|
|
8
|
+
schedule_id: number[];
|
|
9
|
+
};
|
|
10
|
+
export interface ScheduleModuleAPI {
|
|
11
|
+
}
|
|
12
|
+
export type ScheduleItem = {
|
|
13
|
+
/** 颜色 */
|
|
14
|
+
color: string;
|
|
15
|
+
/** 创建时间 */
|
|
16
|
+
created_at: string;
|
|
17
|
+
/** 更新时间 */
|
|
18
|
+
updated_at: string;
|
|
19
|
+
/** 开始时间 */
|
|
20
|
+
start_time: string;
|
|
21
|
+
/** 结束时间 */
|
|
22
|
+
end_time: string;
|
|
23
|
+
/** 日程名称 */
|
|
24
|
+
name: string;
|
|
25
|
+
/** 关联订单 */
|
|
26
|
+
order_count: number;
|
|
27
|
+
/** 关联项目数据*/
|
|
28
|
+
relation_count: number;
|
|
29
|
+
repeat_rule: {
|
|
30
|
+
end: {
|
|
31
|
+
/** 截止类型 */
|
|
32
|
+
type: 'date' | 'never';
|
|
33
|
+
/** 结束时间 */
|
|
34
|
+
end_date: string | null;
|
|
35
|
+
occurrence: any | null;
|
|
36
|
+
};
|
|
37
|
+
frequency: number;
|
|
38
|
+
excluded_date: ExcIncDate[];
|
|
39
|
+
included_date: ExcIncDate[];
|
|
40
|
+
frequency_date: number[];
|
|
41
|
+
};
|
|
42
|
+
repeat_type: 'daily' | 'none' | 'weekly';
|
|
43
|
+
/** 日程类型
|
|
44
|
+
* standard: 标准日程
|
|
45
|
+
* time-slots: 时间段日程
|
|
46
|
+
* designation: 指定日期日程
|
|
47
|
+
* */
|
|
48
|
+
type: 'standard' | 'time-slots' | 'designation';
|
|
49
|
+
conflict?: boolean;
|
|
50
|
+
time_slot: {
|
|
51
|
+
start_time: string;
|
|
52
|
+
end_time: string;
|
|
53
|
+
id: number;
|
|
54
|
+
}[];
|
|
55
|
+
id: number;
|
|
56
|
+
/** 指定的开始时间结束时间 */
|
|
57
|
+
designation: {
|
|
58
|
+
start_date: string;
|
|
59
|
+
end_date: string;
|
|
60
|
+
start_time: string;
|
|
61
|
+
end_time: string;
|
|
62
|
+
} | {
|
|
63
|
+
start_date: string;
|
|
64
|
+
end_date: string;
|
|
65
|
+
start_time: string;
|
|
66
|
+
end_time: string;
|
|
67
|
+
}[];
|
|
68
|
+
/** 是否全天 */
|
|
69
|
+
is_all: 1 | 0;
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
relation?: {
|
|
72
|
+
id: number;
|
|
73
|
+
item_id: number;
|
|
74
|
+
item_type: string;
|
|
75
|
+
relation_table_type: string;
|
|
76
|
+
schedule_id: number;
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
export type ScheduleFormOtherValue = {
|
|
80
|
+
/** 截止模式
|
|
81
|
+
* 1: 永不截止
|
|
82
|
+
* 2: 按日期截止
|
|
83
|
+
* */
|
|
84
|
+
endRadio: 1 | 2;
|
|
85
|
+
/** 是否为全天 */
|
|
86
|
+
isAllDay: boolean;
|
|
87
|
+
/** 是否开启排除日期 */
|
|
88
|
+
excludedStatus: boolean;
|
|
89
|
+
/** 是否包含排除日期 */
|
|
90
|
+
includeStatus: boolean;
|
|
91
|
+
type: 'standard' | 'time-slots' | 'designation';
|
|
92
|
+
};
|
|
93
|
+
export type ExcIncDate = {
|
|
94
|
+
start: string;
|
|
95
|
+
end: string;
|
|
96
|
+
};
|
|
97
|
+
export type ScheduleFormData = {
|
|
98
|
+
/** 颜色 */
|
|
99
|
+
color: string;
|
|
100
|
+
/** 日程名称 */
|
|
101
|
+
name: {
|
|
102
|
+
en: string;
|
|
103
|
+
'zh-CN': string;
|
|
104
|
+
'zh-HK': string;
|
|
105
|
+
original: string;
|
|
106
|
+
} | string;
|
|
107
|
+
/** 重复模式
|
|
108
|
+
* 0:不重复
|
|
109
|
+
* 1:按天重复
|
|
110
|
+
* 2:按周重复 */
|
|
111
|
+
repeat_type: '0' | '1' | '2';
|
|
112
|
+
/** 备注 */
|
|
113
|
+
note: string;
|
|
114
|
+
/** 指定的开始时间结束时间 */
|
|
115
|
+
designation: {
|
|
116
|
+
start_date: string;
|
|
117
|
+
end_date: string;
|
|
118
|
+
start_time: string;
|
|
119
|
+
end_time: string;
|
|
120
|
+
} | {
|
|
121
|
+
start_date: string;
|
|
122
|
+
end_date: string;
|
|
123
|
+
start_time: string;
|
|
124
|
+
end_time: string;
|
|
125
|
+
}[];
|
|
126
|
+
time_slot: {
|
|
127
|
+
start_time: string;
|
|
128
|
+
end_time: string;
|
|
129
|
+
id: number;
|
|
130
|
+
}[];
|
|
131
|
+
/** 重复频率 */
|
|
132
|
+
frequency: number;
|
|
133
|
+
/** 按周重复时选择的周数据 */
|
|
134
|
+
frequency_date: number[];
|
|
135
|
+
/** 截止日期 */
|
|
136
|
+
end_date: string;
|
|
137
|
+
/** 排除的日期范围 */
|
|
138
|
+
excluded_date: ExcIncDate[];
|
|
139
|
+
/** 包含的日期范围 */
|
|
140
|
+
included_date: ExcIncDate[];
|
|
141
|
+
/** 多时间段的开始时间 */
|
|
142
|
+
start_time: any;
|
|
143
|
+
end_time: any;
|
|
144
|
+
};
|
|
145
|
+
export type CalendarDataItem = {
|
|
146
|
+
date: string;
|
|
147
|
+
color: string[];
|
|
148
|
+
isExcluded: boolean;
|
|
149
|
+
schedule_ids?: number[];
|
|
150
|
+
[key: string]: any;
|
|
151
|
+
};
|
|
152
|
+
export type RequestData<Data> = {
|
|
153
|
+
data: Data;
|
|
154
|
+
status: boolean;
|
|
155
|
+
message: string;
|
|
156
|
+
code: number;
|
|
157
|
+
};
|
|
158
|
+
export type ResponseListData<Data> = {
|
|
159
|
+
status: boolean;
|
|
160
|
+
message: string;
|
|
161
|
+
code: number;
|
|
162
|
+
data: {
|
|
163
|
+
list: Data;
|
|
164
|
+
count: number;
|
|
165
|
+
size: number;
|
|
166
|
+
skip: number;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
export type ScheduleAllMap = Record<string, {
|
|
170
|
+
minTime: dayjs.Dayjs | null;
|
|
171
|
+
maxTime: dayjs.Dayjs | null;
|
|
172
|
+
minTimeStr: string | null;
|
|
173
|
+
maxTimeStr: string | null;
|
|
174
|
+
dateRange: {
|
|
175
|
+
start: string;
|
|
176
|
+
end: string;
|
|
177
|
+
}[];
|
|
178
|
+
dateRangeFormat: {
|
|
179
|
+
start: string;
|
|
180
|
+
end: string;
|
|
181
|
+
}[];
|
|
182
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/modules/Schedule/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ScheduleFormData, ScheduleFormOtherValue, ScheduleItem, ScheduleAllMap } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 根据日程配置生成日历数据
|
|
4
|
+
* @param values
|
|
5
|
+
* @param others
|
|
6
|
+
* @param type
|
|
7
|
+
*/
|
|
8
|
+
export declare const calcCalendarDataBySchedule: (values: ScheduleFormData, others: ScheduleFormOtherValue, type?: 'standard' | 'time-slots' | 'designation') => any[];
|
|
9
|
+
/**
|
|
10
|
+
* 获取开始时间和结束时间之间的所有日期
|
|
11
|
+
* @param startDate
|
|
12
|
+
* @param endDate
|
|
13
|
+
*/
|
|
14
|
+
export declare const getDaysByStartEnd: (startDate: any, endDate: any) => string[];
|
|
15
|
+
/**
|
|
16
|
+
* 根据标准日程计算日历数据
|
|
17
|
+
* @param values
|
|
18
|
+
* @param others
|
|
19
|
+
*/
|
|
20
|
+
export declare const calcCalendarDataByStandard: (values: ScheduleFormData, others: ScheduleFormOtherValue, isGetRange?: boolean) => any[];
|
|
21
|
+
/**
|
|
22
|
+
* 根据多时间段计算日历数据
|
|
23
|
+
* @param values
|
|
24
|
+
* @param others
|
|
25
|
+
*/
|
|
26
|
+
export declare const calcCalendarDataByTimeSlots: (values: ScheduleFormData, others: ScheduleFormOtherValue, isGetRange?: boolean) => any[];
|
|
27
|
+
/**
|
|
28
|
+
* 根据指定日期计算日历数据
|
|
29
|
+
* @param values
|
|
30
|
+
* @param others
|
|
31
|
+
*/
|
|
32
|
+
export declare const calcCalendarDataByDesignation: (values: ScheduleFormData, others: ScheduleFormOtherValue, isGetRange?: boolean) => any[];
|
|
33
|
+
export declare const isAllDay: (value: ScheduleItem) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 根据接口返回的Schedule计算日历数据
|
|
36
|
+
* @param schedule
|
|
37
|
+
*/
|
|
38
|
+
export declare const calcCalendarDataByScheduleResult: (schedule: ScheduleItem) => any[];
|
|
39
|
+
/**
|
|
40
|
+
* 接口返回schedule转换格式
|
|
41
|
+
* @param schedule
|
|
42
|
+
*/
|
|
43
|
+
export declare const formatScheduleResult: (schedule: ScheduleItem) => {
|
|
44
|
+
scheduleFormData: Partial<ScheduleFormData>;
|
|
45
|
+
scheduleFormOtherValue: ScheduleFormOtherValue;
|
|
46
|
+
};
|
|
47
|
+
export declare const calcScheduleDateRange: (schedule: ScheduleItem) => any[];
|
|
48
|
+
export declare const calcCalendarDataBySchedules: (schedules: ScheduleItem[]) => unknown[];
|
|
49
|
+
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => {};
|
|
50
|
+
/**
|
|
51
|
+
* @title: 格式化日程数据
|
|
52
|
+
* @description:
|
|
53
|
+
* @param {Array} relation 资源列表
|
|
54
|
+
* @param {string} table_type 关联表类型
|
|
55
|
+
* @param {string} item_type 资源类型
|
|
56
|
+
* @param {boolean} isExcluded 是否排除
|
|
57
|
+
* @return {*}
|
|
58
|
+
* @Author: WangHan
|
|
59
|
+
* @Date: 2024-09-04 11:54
|
|
60
|
+
*/
|
|
61
|
+
export declare const formatScheduleData: (relation: Array<any>, table_type?: string, item_type?: string, isExcluded?: boolean) => any;
|
|
62
|
+
export interface TimeRange {
|
|
63
|
+
start: string;
|
|
64
|
+
end: string;
|
|
65
|
+
count?: number;
|
|
66
|
+
}
|
|
67
|
+
export declare function getAllSortedDateRanges(schedules: Record<string, any>): TimeRange[];
|