@pisell/pisellos 0.0.72 → 0.0.73

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.
@@ -1209,7 +1209,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1209
1209
  currentCount: recordCount + (currentCapacity || 0),
1210
1210
  resourcesUseableMap: resourcesUseableMap
1211
1211
  });
1212
- if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false) {
1212
+ // 如果仅仅是因为子资源容量不够,不应该标记子资源是被占用的情况
1213
+ if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
1213
1214
  resourcesUseableMap[m.id] = res.usable;
1214
1215
  }
1215
1216
  return res.usable;
@@ -1389,7 +1390,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1389
1390
  currentCount: recordCount + (capacity || 0),
1390
1391
  resourcesUseableMap: resourcesUseableMap
1391
1392
  });
1392
- if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[n.id]) !== false) {
1393
+ // 如果只是因为子资源容量不够,而不是子资源被预约导致没时间片,不应该标记子资源为不可用,从而影响组合资源的情况
1394
+ if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[n.id]) !== false && res.reason !== 'capacityOnly') {
1393
1395
  resourcesUseableMap[n.id] = res.usable;
1394
1396
  }
1395
1397
  return res.usable;
@@ -1860,7 +1862,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
1860
1862
  currentCount: 1,
1861
1863
  resourcesUseableMap: resourcesUseableMap
1862
1864
  });
1863
- if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false) {
1865
+ if ((resourcesUseableMap === null || resourcesUseableMap === void 0 ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== 'capacityOnly') {
1864
1866
  resourcesUseableMap[m.id] = res.usable;
1865
1867
  }
1866
1868
  if (res.usable && res.remainingCapacity >= count) {
@@ -38,6 +38,7 @@ export declare const getIsUsableByTimeItem: ({ timeSlice, time, resource, curren
38
38
  capacity: boolean;
39
39
  usable: boolean;
40
40
  remainingCapacity: number;
41
+ reason: string;
41
42
  };
42
43
  /**
43
44
  * @title: 获取商品下绑定的资源列表
@@ -113,7 +113,8 @@ var checkCapacity = function checkCapacity(_ref) {
113
113
  if (currentCount > resource.capacity) {
114
114
  return {
115
115
  status: false,
116
- capacity: resource.capacity
116
+ capacity: resource.capacity,
117
+ reason: 'capacityOnly'
117
118
  };
118
119
  }
119
120
  var conflict = (event_list || []).filter(function (d) {
@@ -179,7 +180,9 @@ export var getIsUsableByTimeItem = function getIsUsableByTimeItem(_ref2) {
179
180
  afterToDay: false,
180
181
  capacity: false,
181
182
  usable: false,
182
- remainingCapacity: 0 // 剩余容量
183
+ remainingCapacity: 0,
184
+ // 剩余容量
185
+ reason: ''
183
186
  };
184
187
  // 最早可预约时间为 当前日期之后并且提前量之后
185
188
  var earliest = dayjs();
@@ -204,6 +207,7 @@ export var getIsUsableByTimeItem = function getIsUsableByTimeItem(_ref2) {
204
207
  }
205
208
  });
206
209
  }
210
+ status.reason = checkCapacityResult.reason || '';
207
211
  if (!checkCapacityResult.status) {
208
212
  return status;
209
213
  }
@@ -661,7 +661,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
661
661
  currentCount: recordCount + (currentCapacity || 0),
662
662
  resourcesUseableMap
663
663
  });
664
- if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[m.id]) !== false) {
664
+ if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== "capacityOnly") {
665
665
  resourcesUseableMap[m.id] = res.usable;
666
666
  }
667
667
  return res.usable;
@@ -820,7 +820,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
820
820
  currentCount: recordCount + (capacity || 0),
821
821
  resourcesUseableMap
822
822
  });
823
- if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[n.id]) !== false) {
823
+ if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[n.id]) !== false && res.reason !== "capacityOnly") {
824
824
  resourcesUseableMap[n.id] = res.usable;
825
825
  }
826
826
  return res.usable;
@@ -1231,7 +1231,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
1231
1231
  currentCount: 1,
1232
1232
  resourcesUseableMap
1233
1233
  });
1234
- if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[m.id]) !== false) {
1234
+ if ((resourcesUseableMap == null ? void 0 : resourcesUseableMap[m.id]) !== false && res.reason !== "capacityOnly") {
1235
1235
  resourcesUseableMap[m.id] = res.usable;
1236
1236
  }
1237
1237
  if (res.usable && res.remainingCapacity >= count) {
@@ -38,6 +38,7 @@ export declare const getIsUsableByTimeItem: ({ timeSlice, time, resource, curren
38
38
  capacity: boolean;
39
39
  usable: boolean;
40
40
  remainingCapacity: number;
41
+ reason: string;
41
42
  };
42
43
  /**
43
44
  * @title: 获取商品下绑定的资源列表
@@ -85,7 +85,8 @@ var checkCapacity = ({
85
85
  if (currentCount > resource.capacity) {
86
86
  return {
87
87
  status: false,
88
- capacity: resource.capacity
88
+ capacity: resource.capacity,
89
+ reason: "capacityOnly"
89
90
  };
90
91
  }
91
92
  let conflict = (event_list || []).filter((d) => {
@@ -133,8 +134,9 @@ var getIsUsableByTimeItem = ({
133
134
  afterToDay: false,
134
135
  capacity: false,
135
136
  usable: false,
136
- remainingCapacity: 0
137
+ remainingCapacity: 0,
137
138
  // 剩余容量
139
+ reason: ""
138
140
  };
139
141
  let earliest = (0, import_dayjs.default)();
140
142
  if (!checkAfterToDay(timeSlice.start_at, earliest)) {
@@ -155,6 +157,7 @@ var getIsUsableByTimeItem = ({
155
157
  }
156
158
  });
157
159
  }
160
+ status.reason = checkCapacityResult.reason || "";
158
161
  if (!checkCapacityResult.status) {
159
162
  return status;
160
163
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.72",
4
+ "version": "0.0.73",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",