@pisell/private-materials 3.3.85 → 3.3.86

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.
Files changed (292) hide show
  1. package/build/lowcode/index.js +1 -1
  2. package/build/lowcode/meta.js +1 -1
  3. package/build/lowcode/preview.js +13 -13
  4. package/build/lowcode/render/default/view.css +1 -1
  5. package/build/lowcode/render/default/view.js +11 -11
  6. package/build/lowcode/view.css +1 -1
  7. package/build/lowcode/view.js +11 -11
  8. package/es/businessModel/SalesModel/Sales/index.js +37 -4
  9. package/es/components/Sales/Resource/index.js +2 -2
  10. package/es/components/Sales/Resource/serve.d.ts +7 -0
  11. package/es/components/Sales/Resource/serve.js +10 -0
  12. package/es/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  13. package/es/components/appointmentBooking/components/Content/index.less +1 -1
  14. package/es/components/appointmentBooking/components/Header/index.d.ts +3 -0
  15. package/es/components/appointmentBooking/components/Services/index.js +23 -27
  16. package/es/components/appointmentBooking/components/Voucher/index.js +1 -1
  17. package/es/components/appointmentBooking/index.js +14 -0
  18. package/es/components/appointmentBooking/index.less +1 -1
  19. package/es/components/appointmentBooking/locales.d.ts +0 -3
  20. package/es/components/appointmentBooking/locales.js +0 -3
  21. package/es/components/booking/addons/model.d.ts +10 -1
  22. package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
  23. package/es/components/booking/components/browserSelect/index.js +1 -1
  24. package/es/components/booking/components/footer/utils.d.ts +1 -0
  25. package/es/components/booking/components/footer/utils.js +1 -1
  26. package/es/components/booking/components/voucher/index.js +2 -2
  27. package/es/components/booking/editBookingModal/index.d.ts +5 -0
  28. package/es/components/booking/editBookingModal/index.js +386 -0
  29. package/es/components/booking/editBookingModal/index.less +8 -0
  30. package/es/components/booking/editBookingModal/locales.d.ts +21 -0
  31. package/es/components/booking/editBookingModal/locales.js +20 -0
  32. package/es/components/booking/editBookingModal/mock.d.ts +807 -0
  33. package/es/components/booking/editBookingModal/mock.js +2993 -0
  34. package/es/components/booking/editBookingModal/serve.d.ts +51 -0
  35. package/es/components/booking/editBookingModal/serve.js +288 -0
  36. package/es/components/booking/editBookingModal/type.d.ts +12 -0
  37. package/es/components/booking/editBookingModal/type.js +1 -0
  38. package/es/components/booking/editBookingModal/utils.d.ts +12 -0
  39. package/es/components/booking/editBookingModal/utils.js +157 -0
  40. package/es/components/booking/forms/model.d.ts +10 -1
  41. package/es/components/booking/forms/model.js +5 -5
  42. package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  43. package/es/components/booking/info/model.d.ts +10 -1
  44. package/es/components/booking/info/service/like/index.js +1 -1
  45. package/es/components/booking/info/service2/utils.d.ts +1 -1
  46. package/es/components/booking/info/service2/utils.js +3 -2
  47. package/es/components/booking/info2/service/addService/utils.d.ts +10 -0
  48. package/es/components/booking/info2/service/addService/utils.js +44 -13
  49. package/es/components/booking/info2/service/editService/Resources/index.js +22 -8
  50. package/es/components/booking/info2/service/editService/Resources/index.less +6 -0
  51. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +7 -0
  52. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +26 -0
  53. package/es/components/booking/info2/service/editService/ResourcesV2/index.d.ts +10 -0
  54. package/es/components/booking/info2/service/editService/ResourcesV2/index.js +308 -0
  55. package/es/components/booking/info2/service/editService/ResourcesV2/index.less +44 -0
  56. package/es/components/booking/info2/utilsByBooking.js +9 -0
  57. package/es/components/booking/locales.d.ts +3 -0
  58. package/es/components/booking/locales.js +3 -0
  59. package/es/components/booking/materiels/startTime/index.js +1 -1
  60. package/es/components/booking/model.d.ts +9 -1
  61. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  62. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  63. package/es/components/booking/notes/model.d.ts +10 -1
  64. package/es/components/booking/notes/model.js +5 -5
  65. package/es/components/booking/payments/model.d.ts +10 -1
  66. package/es/components/booking/payments/model.js +5 -5
  67. package/es/components/booking/utils.d.ts +2 -2
  68. package/es/components/eftposPay/const.d.ts +4 -1
  69. package/es/components/eftposPay/const.js +3 -1
  70. package/es/components/eftposPay/hooks.d.ts +1 -1
  71. package/es/components/eftposPay/hooks.js +3 -1
  72. package/es/components/eftposPay/index.js +1 -1
  73. package/es/components/eftposPay/linkly/const.d.ts +23 -0
  74. package/es/components/eftposPay/linkly/const.js +82 -0
  75. package/es/components/eftposPay/linkly/hooks/index.d.ts +2 -0
  76. package/es/components/eftposPay/linkly/hooks/index.js +2 -0
  77. package/es/components/eftposPay/linkly/hooks/normal.d.ts +30 -0
  78. package/es/components/eftposPay/linkly/hooks/normal.js +318 -0
  79. package/es/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +4 -0
  80. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +273 -0
  81. package/es/components/eftposPay/linkly/index.d.ts +2 -0
  82. package/es/components/eftposPay/linkly/index.js +197 -0
  83. package/es/components/eftposPay/linkly/service.d.ts +32 -0
  84. package/es/components/eftposPay/linkly/service.js +73 -0
  85. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  86. package/es/components/eftposPay/manufacturer.js +4 -0
  87. package/es/components/eftposPay/pay.d.ts +1 -1
  88. package/es/components/eftposPay/pay.js +6 -2
  89. package/es/components/eftposPay/store/index.d.ts +1 -1
  90. package/es/components/eventBooking/components/Provider/Event/index.js +13 -4
  91. package/es/components/eventBooking/components/bookingDetailModal/index.js +19 -3
  92. package/es/components/eventBooking/index.js +21 -7
  93. package/es/components/eventBooking/locales.js +3 -3
  94. package/es/components/index.d.ts +3 -1
  95. package/es/components/index.js +3 -1
  96. package/es/components/listComponent/index.js +5 -5
  97. package/es/components/pay/toC/PaymentMethods/index.js +5 -4
  98. package/es/components/pay/toC/model.d.ts +9 -1
  99. package/es/components/productExtension/card/index.js +3 -3
  100. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  101. package/es/components/productExtension/fields/Forms/index.js +12 -12
  102. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  103. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  104. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  105. package/es/components/productExtension/server.js +2 -2
  106. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  107. package/es/components/schedules/calendar/index.js +4 -4
  108. package/es/components/schedules/calendar/serve.js +2 -2
  109. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  110. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  111. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  112. package/es/components/schedules/components/ResourceList/index.js +1 -1
  113. package/es/components/schedules/components/Search/index.js +5 -5
  114. package/es/components/schedules/model.d.ts +9 -1
  115. package/es/components/schedules/model.js +5 -5
  116. package/es/components/schedules/openHours/index.js +1 -1
  117. package/es/components/schedules/openHours/serve.js +2 -2
  118. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  119. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  120. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  121. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  122. package/es/components/schedules/products/serve.js +2 -2
  123. package/es/components/schedules/products/utils.js +5 -5
  124. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  125. package/es/components/schedules/resources/detail/index.js +10 -10
  126. package/es/components/schedules/resources/list/index.js +2 -2
  127. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  128. package/es/components/schedules/resources/serve.js +2 -2
  129. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  130. package/es/components/schedules/utils.d.ts +1 -1
  131. package/es/components/schedules/utils.js +4 -4
  132. package/es/components/selectModal/index.js +2 -2
  133. package/es/components/stepController/components/Content/index.d.ts +7 -0
  134. package/es/components/stepController/components/Content/index.js +9 -0
  135. package/es/components/stepController/components/Content/index.less +8 -0
  136. package/es/components/stepController/components/Footer/index.d.ts +8 -0
  137. package/es/components/stepController/components/Footer/index.js +15 -0
  138. package/es/components/stepController/components/Footer/index.less +39 -0
  139. package/es/components/stepController/components/Header/index.d.ts +20 -0
  140. package/es/components/stepController/components/Header/index.js +97 -0
  141. package/es/components/stepController/components/Header/index.less +21 -0
  142. package/es/components/stepController/index.d.ts +5 -0
  143. package/es/components/stepController/index.js +64 -0
  144. package/es/components/stepController/index.less +11 -0
  145. package/es/components/stepController/locales.d.ts +27 -0
  146. package/es/components/stepController/locales.js +32 -0
  147. package/es/components/stepController/types.d.ts +23 -0
  148. package/es/components/stepController/types.js +1 -0
  149. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  150. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  151. package/es/components/ticketBooking/components/ticketBooking/index.js +257 -138
  152. package/es/components/ticketBooking/locales.d.ts +164 -146
  153. package/es/components/ticketBooking/locales.js +195 -147
  154. package/es/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
  155. package/es/components/ticketBooking/utils/formatProductMessage.js +62 -0
  156. package/es/components/ticketBooking/utils/formatTime.d.ts +31 -0
  157. package/es/components/ticketBooking/utils/formatTime.js +144 -0
  158. package/es/components/wallet/Detail/model.d.ts +13 -1
  159. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  160. package/es/components/wallet/PointCard/model.d.ts +13 -1
  161. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  162. package/es/components/wallet/Voucher/model.d.ts +13 -1
  163. package/es/components/wallet/model.d.ts +9 -1
  164. package/es/hooks/useComponents.js +1 -1
  165. package/es/hooks/useWindowSize.d.ts +5 -0
  166. package/es/hooks/useWindowSize.js +26 -0
  167. package/es/index.d.ts +2 -0
  168. package/es/index.js +3 -1
  169. package/es/utils/index.d.ts +1 -1
  170. package/lib/businessModel/SalesModel/Sales/index.js +22 -8
  171. package/lib/components/Sales/Resource/index.js +1 -1
  172. package/lib/components/Sales/Resource/serve.d.ts +7 -0
  173. package/lib/components/Sales/Resource/serve.js +9 -2
  174. package/lib/components/appointmentBooking/components/Cart/Item/index.less +3 -3
  175. package/lib/components/appointmentBooking/components/Content/index.less +1 -1
  176. package/lib/components/appointmentBooking/components/Header/index.d.ts +3 -0
  177. package/lib/components/appointmentBooking/components/Services/index.js +6 -11
  178. package/lib/components/appointmentBooking/components/Voucher/index.js +1 -1
  179. package/lib/components/appointmentBooking/index.js +11 -0
  180. package/lib/components/appointmentBooking/index.less +1 -1
  181. package/lib/components/appointmentBooking/locales.d.ts +0 -3
  182. package/lib/components/appointmentBooking/locales.js +0 -3
  183. package/lib/components/booking/addons/model.d.ts +10 -1
  184. package/lib/components/booking/components/footer/utils.d.ts +1 -0
  185. package/lib/components/booking/components/footer/utils.js +2 -0
  186. package/lib/components/booking/components/voucher/index.js +11 -23
  187. package/lib/components/booking/editBookingModal/index.d.ts +5 -0
  188. package/lib/components/booking/editBookingModal/index.js +363 -0
  189. package/lib/components/booking/editBookingModal/index.less +8 -0
  190. package/lib/components/booking/editBookingModal/locales.d.ts +21 -0
  191. package/lib/components/booking/editBookingModal/locales.js +44 -0
  192. package/lib/components/booking/editBookingModal/mock.d.ts +807 -0
  193. package/lib/components/booking/editBookingModal/mock.js +3314 -0
  194. package/lib/components/booking/editBookingModal/serve.d.ts +51 -0
  195. package/lib/components/booking/editBookingModal/serve.js +178 -0
  196. package/lib/components/booking/editBookingModal/type.d.ts +12 -0
  197. package/lib/components/booking/editBookingModal/type.js +17 -0
  198. package/lib/components/booking/editBookingModal/utils.d.ts +12 -0
  199. package/lib/components/booking/editBookingModal/utils.js +158 -0
  200. package/lib/components/booking/forms/model.d.ts +10 -1
  201. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
  202. package/lib/components/booking/info/model.d.ts +10 -1
  203. package/lib/components/booking/info/service2/utils.d.ts +1 -1
  204. package/lib/components/booking/info/service2/utils.js +2 -2
  205. package/lib/components/booking/info2/service/addService/utils.d.ts +10 -0
  206. package/lib/components/booking/info2/service/addService/utils.js +27 -4
  207. package/lib/components/booking/info2/service/editService/Resources/index.js +54 -10
  208. package/lib/components/booking/info2/service/editService/Resources/index.less +6 -0
  209. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +7 -0
  210. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +53 -0
  211. package/lib/components/booking/info2/service/editService/ResourcesV2/index.d.ts +10 -0
  212. package/lib/components/booking/info2/service/editService/ResourcesV2/index.js +311 -0
  213. package/lib/components/booking/info2/service/editService/ResourcesV2/index.less +44 -0
  214. package/lib/components/booking/info2/utilsByBooking.js +6 -0
  215. package/lib/components/booking/locales.d.ts +3 -0
  216. package/lib/components/booking/locales.js +3 -0
  217. package/lib/components/booking/model.d.ts +9 -1
  218. package/lib/components/booking/notes/model.d.ts +10 -1
  219. package/lib/components/booking/payments/model.d.ts +10 -1
  220. package/lib/components/booking/utils.d.ts +2 -2
  221. package/lib/components/eftposPay/const.d.ts +4 -1
  222. package/lib/components/eftposPay/const.js +2 -0
  223. package/lib/components/eftposPay/hooks.d.ts +1 -1
  224. package/lib/components/eftposPay/hooks.js +11 -4
  225. package/lib/components/eftposPay/index.js +1 -1
  226. package/lib/components/eftposPay/linkly/const.d.ts +23 -0
  227. package/lib/components/eftposPay/linkly/const.js +102 -0
  228. package/lib/components/eftposPay/linkly/hooks/index.d.ts +2 -0
  229. package/lib/components/eftposPay/linkly/hooks/index.js +25 -0
  230. package/lib/components/eftposPay/linkly/hooks/normal.d.ts +30 -0
  231. package/lib/components/eftposPay/linkly/hooks/normal.js +239 -0
  232. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.d.ts +4 -0
  233. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +222 -0
  234. package/lib/components/eftposPay/linkly/index.d.ts +2 -0
  235. package/lib/components/eftposPay/linkly/index.js +208 -0
  236. package/lib/components/eftposPay/linkly/service.d.ts +32 -0
  237. package/lib/components/eftposPay/linkly/service.js +55 -0
  238. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  239. package/lib/components/eftposPay/manufacturer.js +6 -0
  240. package/lib/components/eftposPay/pay.d.ts +1 -1
  241. package/lib/components/eftposPay/pay.js +13 -2
  242. package/lib/components/eftposPay/store/index.d.ts +1 -1
  243. package/lib/components/eventBooking/components/Provider/Event/index.js +10 -3
  244. package/lib/components/eventBooking/components/bookingDetailModal/index.js +9 -3
  245. package/lib/components/eventBooking/index.js +11 -7
  246. package/lib/components/eventBooking/locales.js +3 -3
  247. package/lib/components/index.d.ts +3 -1
  248. package/lib/components/index.js +6 -0
  249. package/lib/components/pay/toC/PaymentMethods/index.js +10 -9
  250. package/lib/components/pay/toC/model.d.ts +9 -1
  251. package/lib/components/schedules/model.d.ts +9 -1
  252. package/lib/components/schedules/utils.d.ts +1 -1
  253. package/lib/components/schedules/utils.js +1 -1
  254. package/lib/components/stepController/components/Content/index.d.ts +7 -0
  255. package/lib/components/stepController/components/Content/index.js +40 -0
  256. package/lib/components/stepController/components/Content/index.less +8 -0
  257. package/lib/components/stepController/components/Footer/index.d.ts +8 -0
  258. package/lib/components/stepController/components/Footer/index.js +49 -0
  259. package/lib/components/stepController/components/Footer/index.less +39 -0
  260. package/lib/components/stepController/components/Header/index.d.ts +20 -0
  261. package/lib/components/stepController/components/Header/index.js +104 -0
  262. package/lib/components/stepController/components/Header/index.less +21 -0
  263. package/lib/components/stepController/index.d.ts +5 -0
  264. package/lib/components/stepController/index.js +89 -0
  265. package/lib/components/stepController/index.less +11 -0
  266. package/lib/components/stepController/locales.d.ts +27 -0
  267. package/lib/components/stepController/locales.js +50 -0
  268. package/lib/components/stepController/types.d.ts +23 -0
  269. package/lib/components/stepController/types.js +17 -0
  270. package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -1
  271. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  272. package/lib/components/ticketBooking/components/ticketBooking/index.js +263 -139
  273. package/lib/components/ticketBooking/locales.d.ts +164 -146
  274. package/lib/components/ticketBooking/locales.js +22 -4
  275. package/lib/components/ticketBooking/utils/formatProductMessage.d.ts +2 -0
  276. package/lib/components/ticketBooking/utils/formatProductMessage.js +84 -0
  277. package/lib/components/ticketBooking/utils/formatTime.d.ts +31 -0
  278. package/lib/components/ticketBooking/utils/formatTime.js +139 -0
  279. package/lib/components/wallet/Detail/model.d.ts +13 -1
  280. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  281. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  282. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  283. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  284. package/lib/components/wallet/model.d.ts +9 -1
  285. package/lib/hooks/useWindowSize.d.ts +5 -0
  286. package/lib/hooks/useWindowSize.js +51 -0
  287. package/lib/index.d.ts +2 -0
  288. package/lib/index.js +6 -0
  289. package/lib/utils/index.d.ts +1 -1
  290. package/lowcode/edit-booking-modal/meta.ts +53 -0
  291. package/lowcode/step-controller/meta.ts +88 -0
  292. package/package.json +4 -4
@@ -179,14 +179,23 @@ export var formatResources = function formatResources(_ref5) {
179
179
  var _item = cloneDeep(item);
180
180
  _item.renderList = _item.renderList.map(function (d) {
181
181
  var res = formatResource(d, _cacheItem, function (newData) {
182
+ var unbound = !item.optional_resource.includes(newData.id) && !item.default_resource.includes(newData.id) && newData.id !== 0;
182
183
  return /*#__PURE__*/React.createElement("div", {
183
184
  className: "resource-option"
184
185
  }, /*#__PURE__*/React.createElement("div", {
185
186
  className: "like-wrap"
186
- }), newData.labelText, !newData.usable && /*#__PURE__*/React.createElement(AlertTriangle, {
187
+ }), /*#__PURE__*/React.createElement("span", {
188
+ className: "resource-option-label-text"
189
+ }, newData.labelText), (!newData.usable || unbound) && /*#__PURE__*/React.createElement(AlertTriangle, {
187
190
  className: "resource-option-alert-icon"
188
191
  }));
189
192
  });
193
+ // 平行资源日历拖拽需求
194
+ // 当拖入为绑定的资源中时,为了展示,会临时创建目标资源对应的resourceItem
195
+ // 但是在 item.optional_resource 中并不包含目标资源id
196
+ if (!item.optional_resource.includes(d.id) && !item.default_resource.includes(d.id) && d.id !== 0) {
197
+ res.unbound = true;
198
+ }
190
199
  renderListMaps[res.id] = res;
191
200
  return res;
192
201
  }).sort(function (a, b) {
@@ -356,10 +365,12 @@ export var setDefaultCapacitys = function setDefaultCapacitys(_ref7) {
356
365
  * @Author: zhiwei.Wang
357
366
  * @Date: 2024-09-19 20:23
358
367
  */
359
- var getResourceByIds = function getResourceByIds(resourcesOriginMap, cacheItem) {
368
+ export var getResourceByIds = function getResourceByIds(resourcesOriginMap, cacheItem, extraParams) {
360
369
  var _cacheItem$product_re;
361
370
  var _resources = _toConsumableArray((cacheItem === null || cacheItem === void 0 || (_cacheItem$product_re = cacheItem.product_resource) === null || _cacheItem$product_re === void 0 ? void 0 : _cacheItem$product_re.resources) || []);
362
-
371
+ var _ref8 = extraParams || {},
372
+ _ref8$extraResources = _ref8.extraResources,
373
+ extraResources = _ref8$extraResources === void 0 ? [] : _ref8$extraResources;
363
374
  // 过滤出开启的资源
364
375
  _resources = _resources.filter(function (d) {
365
376
  return d.status == 1;
@@ -371,6 +382,14 @@ var getResourceByIds = function getResourceByIds(resourcesOriginMap, cacheItem)
371
382
  var item = _step2.value;
372
383
  var form_id = item.id;
373
384
 
385
+ // 将未绑定的资源,也放入 SelectOption 列表,避免出现仅展示id的情况
386
+ var extraResourceIds = extraResources.filter(function (_extraItem) {
387
+ return _extraItem.form_id === form_id && !item.optional_resource.includes(_extraItem.id) && !item.default_resource.includes(_extraItem.id);
388
+ }).map(function (_extraItem) {
389
+ return _extraItem.id;
390
+ });
391
+ extraResourceIds = Array.from(new Set(extraResourceIds));
392
+
374
393
  // 去重
375
394
  item.optional_resource = (item.optional_resource || []).filter(function (d) {
376
395
  return item.default_resource.indexOf(d) == -1;
@@ -393,7 +412,7 @@ var getResourceByIds = function getResourceByIds(resourcesOriginMap, cacheItem)
393
412
  };
394
413
 
395
414
  // 可选项
396
- var optional_resource = item.optional_resource.map(function (d) {
415
+ var optional_resource = [].concat(_toConsumableArray(item.optional_resource), _toConsumableArray(extraResourceIds)).map(function (d) {
397
416
  if (!resourcesOriginMap[d]) {
398
417
  return null;
399
418
  }
@@ -454,10 +473,10 @@ var getIsAutoClose = function getIsAutoClose(cacheItem) {
454
473
  }
455
474
  }
456
475
  }
457
- return Object.entries(cacheItem._extend.resource).every(function (_ref8) {
458
- var _ref9 = _slicedToArray(_ref8, 2),
459
- key = _ref9[0],
460
- value = _ref9[1];
476
+ return Object.entries(cacheItem._extend.resource).every(function (_ref9) {
477
+ var _ref10 = _slicedToArray(_ref9, 2),
478
+ key = _ref10[0],
479
+ value = _ref10[1];
461
480
  return getAutoAllocationStorage(key) && (value === null || value === void 0 ? void 0 : value.length);
462
481
  });
463
482
  };
@@ -470,10 +489,10 @@ var getIsAutoClose = function getIsAutoClose(cacheItem) {
470
489
  * @Author: zhiwei.Wang
471
490
  * @Date: 2024-06-01 13:25
472
491
  */
473
- export var getProductExtend = function getProductExtend(_ref10) {
474
- var cacheItem = _ref10.cacheItem,
475
- state = _ref10.state,
476
- isDisabledTime = _ref10.isDisabledTime;
492
+ export var getProductExtend = function getProductExtend(_ref11) {
493
+ var cacheItem = _ref11.cacheItem,
494
+ state = _ref11.state,
495
+ isDisabledTime = _ref11.isDisabledTime;
477
496
  // 有endDate 说明是在编辑已经保存过的商品, 没有则是编辑还没保存过的商品
478
497
  var isNew = cacheItem.new || !cacheItem._extend.endDate;
479
498
  var _cacheItem = _objectSpread({}, cacheItem);
@@ -570,7 +589,19 @@ export var getProductExtend = function getProductExtend(_ref10) {
570
589
  _cacheItem._data.capacitys = cacheItem.capacity;
571
590
  }
572
591
  if (!_cacheItem._data.resourcesOrigin) {
573
- _cacheItem._data.resourcesOrigin = getResourceByIds(resourcesOriginMap, cacheItem);
592
+ var extraResources = [];
593
+ // 日历中可以将预约拖入未绑定的资源中,需要兼容未绑定资源的 selectOption展示
594
+ if (Array.isArray(_cacheItem._extend.event_resources)) {
595
+ _cacheItem._extend.event_resources.forEach(function (_item) {
596
+ extraResources.push({
597
+ form_id: _item.form_id,
598
+ id: _item.relation_id
599
+ });
600
+ });
601
+ }
602
+ _cacheItem._data.resourcesOrigin = getResourceByIds(resourcesOriginMap, cacheItem, {
603
+ extraResources: extraResources
604
+ });
574
605
  }
575
606
  if (!_cacheItem._data.resources) {
576
607
  // 资源
@@ -22,14 +22,22 @@ import { getErrorList } from "../../../utilsByBooking";
22
22
  import { isArray } from 'lodash';
23
23
  import { getAutoAllocationStorage, setAutoAllocationStorage } from "../utils";
24
24
  import { useUpdate } from 'ahooks';
25
- import { QuestionCircleOutlined } from "@ant-design/icons";
25
+ import { QuestionCircleOutlined } from '@ant-design/icons';
26
26
  var Resources = function Resources(_ref, ref) {
27
27
  var _cacheItem$_data2, _cacheItem$_data4;
28
28
  var state = _ref.state,
29
29
  cacheItem = _ref.cacheItem,
30
30
  getCurrentCacheItem = _ref.getCurrentCacheItem,
31
31
  onChange = _ref.onChange,
32
- value = _ref.value;
32
+ value = _ref.value,
33
+ _ref$config = _ref.config,
34
+ config = _ref$config === void 0 ? {
35
+ // 是否显示自动分配
36
+ autoAllocation: true,
37
+ // 是否显示资源错误图标
38
+ resourceErrorIcon: true,
39
+ disabled: false
40
+ } : _ref$config;
33
41
  var _useState = useState(false),
34
42
  _useState2 = _slicedToArray(_useState, 2),
35
43
  showError = _useState2[0],
@@ -144,7 +152,7 @@ var Resources = function Resources(_ref, ref) {
144
152
  relation_type: d.relation_type
145
153
  }), d[label]);
146
154
  });
147
- }, []);
155
+ }, [config === null || config === void 0 ? void 0 : config.resourceErrorIcon]);
148
156
 
149
157
  /**
150
158
  * @title: 检查当前资源最小选择数量
@@ -193,6 +201,7 @@ var Resources = function Resources(_ref, ref) {
193
201
  }, /*#__PURE__*/React.createElement(Form.Item, {
194
202
  label: item.title,
195
203
  required: true,
204
+ labelCol: config === null || config === void 0 ? void 0 : config.labelCol,
196
205
  extra: showError && item.select_type.min > (cur === null || cur === void 0 ? void 0 : cur.length) ? /*#__PURE__*/React.createElement("span", {
197
206
  style: {
198
207
  color: '#ff4d4f'
@@ -201,13 +210,17 @@ var Resources = function Resources(_ref, ref) {
201
210
  }, /*#__PURE__*/React.createElement("div", {
202
211
  className: "resource-col"
203
212
  }, item.select_type.type === 'multiple' ? null : /*#__PURE__*/React.createElement(Button, {
204
- className: "resource-col-like-wrap",
213
+ className: "resource-col-like-wrap ".concat(config !== null && config !== void 0 && config.disabled ? 'resource-col-like-wrap-disabled' : ''),
205
214
  onClick: function onClick() {
206
215
  var _cur$;
216
+ if (config !== null && config !== void 0 && config.disabled) {
217
+ return;
218
+ }
207
219
  setLikeStatus((cur === null || cur === void 0 || (_cur$ = cur[0]) === null || _cur$ === void 0 ? void 0 : _cur$.like_status) === 'like' ? 'common' : 'like', item.form_id, 'like_status');
208
220
  }
209
221
  }, /*#__PURE__*/React.createElement(Like, {
210
- status: cur === null || cur === void 0 || (_cur$2 = cur[0]) === null || _cur$2 === void 0 ? void 0 : _cur$2.like_status
222
+ status: cur === null || cur === void 0 || (_cur$2 = cur[0]) === null || _cur$2 === void 0 ? void 0 : _cur$2.like_status,
223
+ className: "".concat(config !== null && config !== void 0 && config.disabled ? 'like-icon-disabled' : '')
211
224
  })), /*#__PURE__*/React.createElement(MaxLengthSelect, {
212
225
  className: "resource-col-select",
213
226
  size: "large",
@@ -228,15 +241,16 @@ var Resources = function Resources(_ref, ref) {
228
241
  showSearch: true,
229
242
  filterOption: function filterOption(str, option) {
230
243
  return ((option === null || option === void 0 ? void 0 : option.labelText) || '').toLowerCase().includes((str || '').toLowerCase());
231
- }
232
- }, renderOptions(item.renderList, 'id', 'label', 'resource')), /*#__PURE__*/React.createElement(Checkbox, {
244
+ },
245
+ disabled: config === null || config === void 0 ? void 0 : config.disabled
246
+ }, renderOptions(item.renderList, 'id', config !== null && config !== void 0 && config.resourceErrorIcon ? 'label' : 'labelText', 'resource')), config !== null && config !== void 0 && config.autoAllocation ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
233
247
  checked: getIsAutoAllocation(item.form_id),
234
248
  onChange: function onChange(e) {
235
249
  handleCheckAutoAllocation(item.form_id, e.target.checked);
236
250
  }
237
251
  }), /*#__PURE__*/React.createElement(Tooltip, {
238
252
  title: locales.getText('page.booking.text.resource.check-auto-allocation-tip')
239
- }, /*#__PURE__*/React.createElement(QuestionCircleOutlined, null)))), state.renderType !== 'eventBooking' && (errors || []).map(function (d) {
253
+ }, /*#__PURE__*/React.createElement(QuestionCircleOutlined, null))) : null)), state.renderType !== 'eventBooking' && (errors || []).map(function (d) {
240
254
  return /*#__PURE__*/React.createElement(Alert, {
241
255
  key: d.type,
242
256
  message: d.label,
@@ -15,6 +15,12 @@
15
15
  .like-resource {}
16
16
  }
17
17
 
18
+ .resource-col-like-wrap-disabled,
19
+ .like-icon-disabled {
20
+ opacity: 0.5;
21
+ cursor: not-allowed;
22
+ }
23
+
18
24
  .resource-col-select {
19
25
  flex: 1;
20
26
  }
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { SelectProps } from 'antd';
3
+ interface MaxLengthSelectProps<T> extends SelectProps<T> {
4
+ maxLength: number;
5
+ }
6
+ declare const _default: import("react").ForwardRefExoticComponent<Partial<MaxLengthSelectProps<any>> & import("react").RefAttributes<unknown>>;
7
+ export default _default;
@@ -0,0 +1,26 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { forwardRef, useImperativeHandle } from 'react';
3
+ import { Select } from 'antd';
4
+ var MaxLengthSelect = function MaxLengthSelect(props, ref) {
5
+ useImperativeHandle(ref, function () {
6
+ return {
7
+ onChange: handleChange
8
+ };
9
+ });
10
+ var handleChange = function handleChange(e, _option) {
11
+ if (props.onChange) {
12
+ if ((props.mode === 'multiple' || props.mode === 'tags') && props.maxLength) {
13
+ if (props.value && props.value.length >= props.maxLength && e.length > props.value.length) {
14
+ return;
15
+ }
16
+ }
17
+ props.onChange(e, _option);
18
+ }
19
+ };
20
+ return /*#__PURE__*/React.createElement(Select, _extends({}, props, {
21
+ onChange: handleChange,
22
+ popupMatchSelectWidth: false
23
+ // getPopupContainer={() => document.querySelector('#main') || document.body}
24
+ }), props.children);
25
+ };
26
+ export default /*#__PURE__*/forwardRef(MaxLengthSelect);
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface IResourcesProps {
4
+ [key: string]: any;
5
+ /** 展示资源的变动情况 */
6
+ originCacheItem: any;
7
+ originValue: any;
8
+ }
9
+ declare const _default: React.ForwardRefExoticComponent<Omit<IResourcesProps, "ref"> & React.RefAttributes<unknown>>;
10
+ export default _default;
@@ -0,0 +1,308 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+ import React, { useState, useMemo, forwardRef, useCallback, useImperativeHandle } from 'react';
16
+ import classNames from 'classnames';
17
+ import { Col, Form, Select, Button, Alert, Checkbox, Tooltip, Row } from 'antd';
18
+ import { Iconfont } from '@pisell/materials';
19
+ import MaxLengthSelect from "./MaxLengthSelect";
20
+ import Like from "../../../../info/service/like";
21
+ import "./index.less";
22
+ import { locales } from '@pisell/utils';
23
+ import { getErrorList } from "../../../utilsByBooking";
24
+ import { isArray } from 'lodash';
25
+ import { getAutoAllocationStorage, setAutoAllocationStorage } from "../utils";
26
+ import { useUpdate } from 'ahooks';
27
+ import { QuestionCircleOutlined } from '@ant-design/icons';
28
+ var Resources = function Resources(_ref, ref) {
29
+ var _cacheItem$_data2, _originCacheItem$_dat, _cacheItem$_data5;
30
+ var state = _ref.state,
31
+ cacheItem = _ref.cacheItem,
32
+ originCacheItem = _ref.originCacheItem,
33
+ getCurrentCacheItem = _ref.getCurrentCacheItem,
34
+ onChange = _ref.onChange,
35
+ value = _ref.value,
36
+ originValue = _ref.originValue,
37
+ _ref$config = _ref.config,
38
+ config = _ref$config === void 0 ? {
39
+ // 是否显示自动分配
40
+ autoAllocation: true,
41
+ // 是否显示资源错误图标
42
+ resourceErrorIcon: true,
43
+ disabled: false,
44
+ size: 'large'
45
+ } : _ref$config;
46
+ var _useState = useState(false),
47
+ _useState2 = _slicedToArray(_useState, 2),
48
+ showError = _useState2[0],
49
+ setShowError = _useState2[1];
50
+ var update = useUpdate();
51
+
52
+ // 需要渲染的列表, 资源二级结构数据
53
+ var data = useMemo(function () {
54
+ var _cacheItem$_data;
55
+ return (cacheItem === null || cacheItem === void 0 || (_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.resources) || [];
56
+ }, [cacheItem === null || cacheItem === void 0 || (_cacheItem$_data2 = cacheItem._data) === null || _cacheItem$_data2 === void 0 ? void 0 : _cacheItem$_data2.resources]);
57
+ var originData = useMemo(function () {
58
+ var _cacheItem$_data3;
59
+ return (cacheItem === null || cacheItem === void 0 || (_cacheItem$_data3 = cacheItem._data) === null || _cacheItem$_data3 === void 0 ? void 0 : _cacheItem$_data3.resources) || [];
60
+ }, [originCacheItem === null || originCacheItem === void 0 || (_originCacheItem$_dat = originCacheItem._data) === null || _originCacheItem$_dat === void 0 ? void 0 : _originCacheItem$_dat.resource]);
61
+
62
+ // 同上, 只是map结构,方便计算
63
+ var resourceMaps = useMemo(function () {
64
+ var _cacheItem$_data4;
65
+ return (cacheItem === null || cacheItem === void 0 || (_cacheItem$_data4 = cacheItem._data) === null || _cacheItem$_data4 === void 0 ? void 0 : _cacheItem$_data4.resourceMaps) || [];
66
+ }, [cacheItem === null || cacheItem === void 0 || (_cacheItem$_data5 = cacheItem._data) === null || _cacheItem$_data5 === void 0 ? void 0 : _cacheItem$_data5.resourceMaps]);
67
+
68
+ // 默认值
69
+ var defaultValue = useMemo(function () {
70
+ return data.reduce(function (pre, cur) {
71
+ pre[cur.form_id] = [];
72
+ return pre;
73
+ }, {});
74
+ }, [data]);
75
+
76
+ // 当前的值
77
+ var _value = useMemo(function () {
78
+ return value || defaultValue;
79
+ }, [value, defaultValue]);
80
+ var handleCheckAutoAllocation = function handleCheckAutoAllocation(id, checked) {
81
+ setAutoAllocationStorage(_defineProperty({}, id, checked));
82
+ update();
83
+ };
84
+
85
+ /**
86
+ * @title: 当选择资源时
87
+ * @description:
88
+ * @param {any} val
89
+ * @param {number} form_id
90
+ * @param {string} key
91
+ * @return {*}
92
+ * @Author: zhiwei.Wang
93
+ * @Date: 2024-09-19 21:04
94
+ */
95
+ var _onChange = function _onChange(val, form_id, key) {
96
+ var _val = _objectSpread({}, _value);
97
+ // 将当前数据map化, 减少循环次数
98
+ var maps = _val[form_id] ? _val[form_id].reduce(function (pre, cur) {
99
+ pre[cur.relation_id] = cur;
100
+ return pre;
101
+ }, {}) : {};
102
+ // 重新赋值, 因为select返回的是数字列表, 需要补充额外的数据
103
+ _val[form_id] = val.map(function (d) {
104
+ var _currentForm$renderLi, _currentForm$renderLi2, _currentForm$renderLi3, _currentForm$renderLi4, _currentForm$renderLi5;
105
+ var _d = maps[d];
106
+ if (_d) {
107
+ if (key === 'like_status') {
108
+ d[key].like_status = val;
109
+ }
110
+ }
111
+ var currentForm = (resourceMaps === null || resourceMaps === void 0 ? void 0 : resourceMaps[form_id]) || {};
112
+ return (
113
+ // maps[d] 为真时, 说明是之前已选择, 否则为新增的值,补充数据
114
+ maps[d] || {
115
+ relation_type: ((_currentForm$renderLi = currentForm.renderListMaps[d]) === null || _currentForm$renderLi === void 0 || (_currentForm$renderLi = _currentForm$renderLi.usable) === null || _currentForm$renderLi === void 0 ? void 0 : _currentForm$renderLi.relation_type) || 'form',
116
+ form_id: form_id,
117
+ relation_id: d,
118
+ like_status: 'common',
119
+ children: (_currentForm$renderLi2 = currentForm.renderListMaps) === null || _currentForm$renderLi2 === void 0 || (_currentForm$renderLi2 = _currentForm$renderLi2[d]) === null || _currentForm$renderLi2 === void 0 ? void 0 : _currentForm$renderLi2.children,
120
+ // 新添加的数据补充错误信息
121
+ errors: getErrorList((_currentForm$renderLi3 = currentForm.renderListMaps) === null || _currentForm$renderLi3 === void 0 ? void 0 : _currentForm$renderLi3[d], getCurrentCacheItem()),
122
+ metadata: _objectSpread(_objectSpread({}, (_currentForm$renderLi4 = currentForm.renderListMaps) === null || _currentForm$renderLi4 === void 0 || (_currentForm$renderLi4 = _currentForm$renderLi4[d]) === null || _currentForm$renderLi4 === void 0 ? void 0 : _currentForm$renderLi4.metadata), {}, {
123
+ form_name: currentForm.title,
124
+ resource_name: (_currentForm$renderLi5 = currentForm.renderListMaps[d]) === null || _currentForm$renderLi5 === void 0 ? void 0 : _currentForm$renderLi5.main_field
125
+ })
126
+ }
127
+ );
128
+ });
129
+ setShowError(false);
130
+ onChange === null || onChange === void 0 || onChange(_val);
131
+ };
132
+ var setLikeStatus = function setLikeStatus(val, form_id, key) {
133
+ var _val$form_id;
134
+ var _val = _objectSpread({}, _value);
135
+ if (_val !== null && _val !== void 0 && (_val$form_id = _val[form_id]) !== null && _val$form_id !== void 0 && _val$form_id[0]) {
136
+ _val[form_id][0][key] = val;
137
+ onChange === null || onChange === void 0 || onChange(_val);
138
+ }
139
+ };
140
+
141
+ /**
142
+ * @title: 渲染下拉框
143
+ * @description:
144
+ * @return {*}
145
+ * @Author: zhiwei.Wang
146
+ * @Date: 2024-01-09 14:02
147
+ */
148
+ var renderOptions = useCallback(function (array) {
149
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
150
+ var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
151
+ var type = arguments.length > 3 ? arguments[3] : undefined;
152
+ return array.map(function (d) {
153
+ var props = {};
154
+ if (type === 'resource') {
155
+ props.labelText = d.labelText;
156
+ }
157
+ return /*#__PURE__*/React.createElement(Select.Option, _extends({
158
+ value: d[value],
159
+ key: d[value]
160
+ }, props, {
161
+ relation_type: d.relation_type
162
+ }), d[label]);
163
+ });
164
+ }, [config === null || config === void 0 ? void 0 : config.resourceErrorIcon]);
165
+
166
+ /**
167
+ * @title: 检查当前资源最小选择数量
168
+ * @description:
169
+ * @return {*}
170
+ * @Author: zhiwei.Wang
171
+ * @Date: 2024-09-19 21:08
172
+ */
173
+ var check = function check() {
174
+ var _iterator = _createForOfIteratorHelper(data),
175
+ _step;
176
+ try {
177
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
178
+ var _value$item$form_id;
179
+ var item = _step.value;
180
+ var _length = (_value$item$form_id = _value[item.form_id]) === null || _value$item$form_id === void 0 ? void 0 : _value$item$form_id.length;
181
+ if (item.select_type.min > _length) {
182
+ setShowError(true);
183
+ return false;
184
+ }
185
+ }
186
+ } catch (err) {
187
+ _iterator.e(err);
188
+ } finally {
189
+ _iterator.f();
190
+ }
191
+ return true;
192
+ };
193
+ useImperativeHandle(ref, function () {
194
+ return {
195
+ check: check
196
+ };
197
+ });
198
+ var getIsAutoAllocation = function getIsAutoAllocation(id) {
199
+ return getAutoAllocationStorage(id);
200
+ };
201
+ var renderItem = function renderItem(item, isOrigin) {
202
+ var _cur$2;
203
+ if (!item) return null;
204
+ var disabled = isOrigin || (config === null || config === void 0 ? void 0 : config.disabled);
205
+ var cur = isOrigin ? originValue[item.form_id] : _value[item.form_id];
206
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Col, {
207
+ flex: "1 0"
208
+ }, /*#__PURE__*/React.createElement("div", {
209
+ className: "resource-v2 resource-col"
210
+ }, item.select_type.type === 'multiple' ? null : /*#__PURE__*/React.createElement(Button, {
211
+ className: classNames('resource-col-like-wrap', {
212
+ 'resource-col-like-wrap-disabled': disabled
213
+ }, (config === null || config === void 0 ? void 0 : config.size) || 'large'),
214
+ size: config === null || config === void 0 ? void 0 : config.size,
215
+ onClick: function onClick() {
216
+ var _cur$;
217
+ if (disabled) {
218
+ return;
219
+ }
220
+ setLikeStatus((cur === null || cur === void 0 || (_cur$ = cur[0]) === null || _cur$ === void 0 ? void 0 : _cur$.like_status) === 'like' ? 'common' : 'like', item.form_id, 'like_status');
221
+ }
222
+ }, /*#__PURE__*/React.createElement(Like, {
223
+ status: cur === null || cur === void 0 || (_cur$2 = cur[0]) === null || _cur$2 === void 0 ? void 0 : _cur$2.like_status,
224
+ className: "".concat(disabled ? 'like-icon-disabled' : '')
225
+ })), /*#__PURE__*/React.createElement(MaxLengthSelect, {
226
+ className: "resource-col-select",
227
+ size: (config === null || config === void 0 ? void 0 : config.size) || 'large',
228
+ maxLength: item.select_type.max,
229
+ mode: item.select_type.type === 'multiple' ? 'multiple' : undefined,
230
+ onChange: function onChange(e) {
231
+ var val = e;
232
+ if (!isArray(e)) {
233
+ if (e || e === 0) {
234
+ val = [e];
235
+ }
236
+ }
237
+ _onChange(val, item.form_id, 'value');
238
+ },
239
+ value: cur === null || cur === void 0 ? void 0 : cur.map(function (d) {
240
+ return d.relation_id;
241
+ }),
242
+ showSearch: true,
243
+ filterOption: function filterOption(str, option) {
244
+ return ((option === null || option === void 0 ? void 0 : option.labelText) || '').toLowerCase().includes((str || '').toLowerCase());
245
+ },
246
+ disabled: disabled
247
+ }, renderOptions(item.renderList, 'id', config !== null && config !== void 0 && config.resourceErrorIcon ? 'label' : 'labelText', 'resource')), config !== null && config !== void 0 && config.autoAllocation ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
248
+ checked: getIsAutoAllocation(item.form_id),
249
+ onChange: function onChange(e) {
250
+ handleCheckAutoAllocation(item.form_id, e.target.checked);
251
+ }
252
+ }), /*#__PURE__*/React.createElement(Tooltip, {
253
+ title: locales.getText('page.booking.text.resource.check-auto-allocation-tip')
254
+ }, /*#__PURE__*/React.createElement(QuestionCircleOutlined, null))) : null)));
255
+ };
256
+ var renderErrors = function renderErrors(item) {
257
+ var cur = _value[item.form_id];
258
+ var errors = (cur || []).reduce(function (pre, d) {
259
+ return pre.concat((d === null || d === void 0 ? void 0 : d.errors) || []);
260
+ }, []);
261
+ return state.renderType !== 'eventBooking' && (errors || []).map(function (d) {
262
+ return /*#__PURE__*/React.createElement(Alert, {
263
+ key: d.type,
264
+ message: d.label,
265
+ type: "warning",
266
+ showIcon: true,
267
+ style: {
268
+ marginBottom: 12
269
+ }
270
+ });
271
+ });
272
+ };
273
+ return /*#__PURE__*/React.createElement(React.Fragment, null, data.map(function (item) {
274
+ var _cur;
275
+ // 原资源表单信息
276
+ var originItem = originData === null || originData === void 0 ? void 0 : originData.find(function (originDataItem) {
277
+ return originDataItem.form_id === item.form_id;
278
+ });
279
+ return /*#__PURE__*/React.createElement(React.Fragment, {
280
+ key: item.form_id
281
+ }, /*#__PURE__*/React.createElement(Form.Item, {
282
+ label: item.title,
283
+ required: true,
284
+ labelCol: config === null || config === void 0 ? void 0 : config.labelCol,
285
+ extra: showError && item.select_type.min > ((_cur = cur) === null || _cur === void 0 ? void 0 : _cur.length) ? /*#__PURE__*/React.createElement("span", {
286
+ style: {
287
+ color: '#ff4d4f'
288
+ }
289
+ }, locales.getText('page.booking.text.resource.min-length-error')(item.select_type.min, item.title)) : undefined
290
+ }, /*#__PURE__*/React.createElement(Row, {
291
+ gutter: [16, 16],
292
+ wrap: false
293
+ }, renderItem(originItem, true), !!originItem ? /*#__PURE__*/React.createElement(Col, {
294
+ flex: "none",
295
+ style: {
296
+ display: 'flex',
297
+ alignItems: 'center'
298
+ }
299
+ }, /*#__PURE__*/React.createElement(Iconfont, {
300
+ type: "pisell2-arrow-block-right",
301
+ style: {
302
+ fontSize: 24,
303
+ color: '#1b1b1b'
304
+ }
305
+ })) : null, renderItem(item, false))), renderErrors(item));
306
+ }));
307
+ };
308
+ export default /*#__PURE__*/forwardRef(Resources);
@@ -0,0 +1,44 @@
1
+ .resource-col.resource-v2 {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ gap: 10px;
6
+ width: 100%;
7
+ overflow: hidden;
8
+
9
+ .resource-col-like-wrap {
10
+ width: 32px;
11
+ height: 32px;
12
+
13
+ &.large {
14
+ width: 40px;
15
+ height: 40px;
16
+ }
17
+
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ padding: 0;
22
+ flex-shrink: 0;
23
+
24
+ .like-resource {
25
+ }
26
+ }
27
+
28
+ .resource-col-like-wrap-disabled,
29
+ .like-icon-disabled {
30
+ opacity: 0.5;
31
+ cursor: not-allowed;
32
+ }
33
+
34
+ .resource-col-select {
35
+ flex: 1;
36
+ overflow: hidden;
37
+
38
+ .resource-option-label-text {
39
+ display: inline-block;
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ }
43
+ }
44
+ }
@@ -260,6 +260,15 @@ export var getErrorList = function getErrorList(resource, cacheItem) {
260
260
  }
261
261
  }
262
262
  }
263
+
264
+ // 平行资源日历拖动优化需求
265
+ // 拖入到未绑定的资源中
266
+ if (resource.unbound) {
267
+ list.push({
268
+ label: locales.getText('pisell1.text.resource-error-message-unbound'),
269
+ type: "time"
270
+ });
271
+ }
263
272
  return list;
264
273
  };
265
274
 
@@ -110,6 +110,7 @@ declare const _default: {
110
110
  'pisell1.text.resource-error-message-1': (x: string, y: string) => string;
111
111
  'pisell1.text.resource-error-message-2': (x: string, y: string, z: string) => string;
112
112
  'pisell1.text.resource-error-message-3': (x: string, y: string, z: string) => string;
113
+ 'pisell1.text.resource-error-message-unbound': string;
113
114
  'pisell1.text.no-addons': string;
114
115
  'pisell1.text.no-resource': string;
115
116
  'pisell1.text.no-payments': string;
@@ -389,6 +390,7 @@ declare const _default: {
389
390
  'pisell1.text.resource-error-message-1': (x: string, y: string) => string;
390
391
  'pisell1.text.resource-error-message-2': (x: string, y: string, z: string) => string;
391
392
  'pisell1.text.resource-error-message-3': (x: string, y: string, z: string) => string;
393
+ 'pisell1.text.resource-error-message-unbound': string;
392
394
  'pisell2.text.flexible': string;
393
395
  'pisell2.text.order-discount': string;
394
396
  'pisell2.text.no-product-added': string;
@@ -660,6 +662,7 @@ declare const _default: {
660
662
  'pisell1.text.resource-error-message-1': (x: string, y: string) => string;
661
663
  'pisell1.text.resource-error-message-2': (x: string, y: string, z: string) => string;
662
664
  'pisell1.text.resource-error-message-3': (x: string, y: string, z: string) => string;
665
+ 'pisell1.text.resource-error-message-unbound': string;
663
666
  'pisell2.text.flexible': string;
664
667
  'pisell2.text.order-discount': string;
665
668
  'pisell2.text.no-product-added': string;