@pisell/private-materials 3.0.197 → 3.0.199
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/components/customSelect/index.d.ts +0 -1
- package/es/components/booking/components/customSelect/index.js +2 -6
- package/es/components/booking/components/footer/amount.js +22 -45
- package/es/components/booking/components/footer/index.js +40 -84
- package/es/components/booking/components/footer/utils.js +32 -218
- package/es/components/booking/info/addServiceVariant/index.js +1 -8
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +13 -14
- package/es/components/booking/info/clientVariant/vertical/index.js +4 -33
- package/es/components/booking/info/main.js +8 -20
- package/es/components/booking/info/model.js +0 -3
- package/es/components/booking/info/pet/index.js +5 -54
- package/es/components/booking/info/service/addService/index.js +20 -127
- package/es/components/booking/info/service/addService/index.less +3 -13
- package/es/components/booking/info/service/addService/utils.d.ts +2 -11
- package/es/components/booking/info/service/addService/utils.js +24 -49
- package/es/components/booking/info/service/editService/index.js +41 -232
- package/es/components/booking/info/service/editService/index.less +13 -18
- package/es/components/booking/info/utils.d.ts +0 -9
- package/es/components/booking/info/utils.js +0 -13
- package/es/components/booking/locales.d.ts +0 -60
- package/es/components/booking/locales.js +3 -75
- package/es/components/booking/model.d.ts +1 -4
- package/es/components/booking/model.js +2 -4
- package/es/components/booking/utils.d.ts +3 -12
- package/es/components/booking/utils.js +22 -126
- package/es/components/eftpos/form/index.js +12 -6
- package/es/components/eftpos/group/index.d.ts +1 -2
- package/es/components/eftpos/group/index.js +1 -2
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftpos/receipt/index.d.ts +24 -0
- package/es/components/eftpos/receipt/index.js +96 -0
- package/es/components/eftposPay/helper.d.ts +1 -0
- package/es/components/eftposPay/helper.js +14 -0
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/tyro/index.js +51 -20
- package/es/index.d.ts +0 -1
- package/es/index.js +1 -2
- package/lib/components/booking/components/customSelect/index.d.ts +0 -1
- package/lib/components/booking/components/customSelect/index.js +2 -6
- package/lib/components/booking/components/footer/amount.js +8 -26
- package/lib/components/booking/components/footer/index.js +4 -25
- package/lib/components/booking/components/footer/utils.js +31 -144
- package/lib/components/booking/info/addServiceVariant/index.js +0 -5
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +7 -8
- package/lib/components/booking/info/clientVariant/vertical/index.js +10 -36
- package/lib/components/booking/info/main.js +4 -11
- package/lib/components/booking/info/model.js +0 -3
- package/lib/components/booking/info/pet/index.js +25 -61
- package/lib/components/booking/info/service/addService/index.js +28 -95
- package/lib/components/booking/info/service/addService/index.less +3 -13
- package/lib/components/booking/info/service/addService/utils.d.ts +2 -11
- package/lib/components/booking/info/service/addService/utils.js +10 -31
- package/lib/components/booking/info/service/editService/index.js +122 -271
- package/lib/components/booking/info/service/editService/index.less +13 -18
- package/lib/components/booking/info/utils.d.ts +0 -9
- package/lib/components/booking/info/utils.js +0 -6
- package/lib/components/booking/locales.d.ts +0 -60
- package/lib/components/booking/locales.js +3 -63
- package/lib/components/booking/model.d.ts +1 -4
- package/lib/components/booking/model.js +2 -4
- package/lib/components/booking/utils.d.ts +3 -12
- package/lib/components/booking/utils.js +15 -79
- package/lib/components/eftpos/form/index.js +12 -6
- package/lib/components/eftpos/group/index.d.ts +1 -2
- package/lib/components/eftpos/group/index.js +0 -1
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftpos/receipt/index.d.ts +24 -0
- package/lib/components/eftpos/receipt/index.js +88 -0
- package/lib/components/eftposPay/helper.d.ts +1 -0
- package/lib/components/eftposPay/helper.js +21 -0
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/tyro/index.js +36 -7
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/package.json +3 -3
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +0 -37
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/info/dateRange/index.d.ts +0 -5
- package/es/components/booking/info/dateRange/index.js +0 -98
- package/es/components/booking/info/dateRange/index.less +0 -21
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/es/components/booking/info/pet/ChangePetModal/index.js +0 -118
- package/es/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/es/components/booking/info/service2/Lists.d.ts +0 -3
- package/es/components/booking/info/service2/Lists.js +0 -158
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/es/components/booking/info/service2/hooks/useSelectPet.js +0 -54
- package/es/components/booking/info/service2/index.d.ts +0 -3
- package/es/components/booking/info/service2/index.js +0 -58
- package/es/components/booking/info/service2/status.d.ts +0 -31
- package/es/components/booking/info/service2/status.js +0 -78
- package/es/components/booking/info/service2/utils.d.ts +0 -145
- package/es/components/booking/info/service2/utils.js +0 -436
- package/es/components/booking/materiels/holder/index.d.ts +0 -7
- package/es/components/booking/materiels/holder/index.js +0 -51
- package/es/components/shoppingCart/Provider.d.ts +0 -3
- package/es/components/shoppingCart/Provider.js +0 -86
- package/es/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/Product.js +0 -96
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Cart/index.js +0 -72
- package/es/components/shoppingCart/components/Cart/index.less +0 -68
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Empty/index.js +0 -14
- package/es/components/shoppingCart/components/Empty/index.less +0 -19
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/es/components/shoppingCart/components/Render/index.js +0 -68
- package/es/components/shoppingCart/components/Render/index.less +0 -2
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +0 -124
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useAddService.js +0 -23
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/es/components/shoppingCart/hooks/useClearCart.js +0 -54
- package/es/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useContext.js +0 -5
- package/es/components/shoppingCart/index.d.ts +0 -4
- package/es/components/shoppingCart/index.js +0 -24
- package/es/components/shoppingCart/locales.d.ts +0 -33
- package/es/components/shoppingCart/locales.js +0 -38
- package/es/components/shoppingCart/mock.d.ts +0 -40
- package/es/components/shoppingCart/mock.js +0 -40
- package/es/components/shoppingCart/status.d.ts +0 -2
- package/es/components/shoppingCart/status.js +0 -22
- package/es/components/shoppingCart/type.d.ts +0 -39
- package/es/components/shoppingCart/type.js +0 -1
- package/es/components/shoppingCart/utils.d.ts +0 -63
- package/es/components/shoppingCart/utils.js +0 -119
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +0 -3
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +0 -59
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/info/dateRange/index.d.ts +0 -5
- package/lib/components/booking/info/dateRange/index.js +0 -111
- package/lib/components/booking/info/dateRange/index.less +0 -21
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +0 -4
- package/lib/components/booking/info/pet/ChangePetModal/index.js +0 -110
- package/lib/components/booking/info/pet/ChangePetModal/index.less +0 -4
- package/lib/components/booking/info/service2/Lists.d.ts +0 -3
- package/lib/components/booking/info/service2/Lists.js +0 -113
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +0 -6
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +0 -50
- package/lib/components/booking/info/service2/index.d.ts +0 -3
- package/lib/components/booking/info/service2/index.js +0 -75
- package/lib/components/booking/info/service2/status.d.ts +0 -31
- package/lib/components/booking/info/service2/status.js +0 -81
- package/lib/components/booking/info/service2/utils.d.ts +0 -145
- package/lib/components/booking/info/service2/utils.js +0 -320
- package/lib/components/booking/materiels/holder/index.d.ts +0 -7
- package/lib/components/booking/materiels/holder/index.js +0 -65
- package/lib/components/shoppingCart/Provider.d.ts +0 -3
- package/lib/components/shoppingCart/Provider.js +0 -110
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/Product.js +0 -89
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Cart/index.js +0 -77
- package/lib/components/shoppingCart/components/Cart/index.less +0 -68
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Empty/index.js +0 -43
- package/lib/components/shoppingCart/components/Empty/index.less +0 -19
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/Render/index.js +0 -79
- package/lib/components/shoppingCart/components/Render/index.less +0 -2
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +0 -4
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +0 -116
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +0 -32
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useAddService.js +0 -55
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -3
- package/lib/components/shoppingCart/hooks/useClearCart.js +0 -71
- package/lib/components/shoppingCart/hooks/useContext.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useContext.js +0 -31
- package/lib/components/shoppingCart/index.d.ts +0 -4
- package/lib/components/shoppingCart/index.js +0 -60
- package/lib/components/shoppingCart/locales.d.ts +0 -33
- package/lib/components/shoppingCart/locales.js +0 -56
- package/lib/components/shoppingCart/mock.d.ts +0 -40
- package/lib/components/shoppingCart/mock.js +0 -76
- package/lib/components/shoppingCart/status.d.ts +0 -2
- package/lib/components/shoppingCart/status.js +0 -60
- package/lib/components/shoppingCart/type.d.ts +0 -39
- package/lib/components/shoppingCart/type.js +0 -17
- package/lib/components/shoppingCart/utils.d.ts +0 -63
- package/lib/components/shoppingCart/utils.js +0 -92
- package/lowcode/shopping-cart/meta.ts +0 -98
|
@@ -18,7 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
18
18
|
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; }
|
|
19
19
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
-
import React, { useContext, useEffect, useMemo, useState
|
|
21
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
22
22
|
import User01 from '@pisell/icon/es/User01';
|
|
23
23
|
import { Context } from "../model";
|
|
24
24
|
import { Avatar, Skeleton, Button } from 'antd';
|
|
@@ -28,9 +28,7 @@ import FormsCom from "../../forms/forms";
|
|
|
28
28
|
import { changeFormValues, sortFormValues } from "../../forms/format";
|
|
29
29
|
import { isWalkIn } from "../../utils";
|
|
30
30
|
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
31
|
-
import { useMemoizedFn } from
|
|
32
|
-
import { isDayBooking } from "../../info/service2/utils";
|
|
33
|
-
import ChangePetModal from "./ChangePetModal";
|
|
31
|
+
import { useMemoizedFn } from "ahooks";
|
|
34
32
|
var defaultParams = {
|
|
35
33
|
skip: 1,
|
|
36
34
|
num: 20,
|
|
@@ -66,7 +64,6 @@ var Pet = function Pet(props) {
|
|
|
66
64
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
65
|
params = _useState8[0],
|
|
68
66
|
setParams = _useState8[1];
|
|
69
|
-
var changePetRef = useRef(null);
|
|
70
67
|
state = state || (props === null || props === void 0 ? void 0 : props.state);
|
|
71
68
|
dispatch = dispatch || (props === null || props === void 0 ? void 0 : props.dispatch);
|
|
72
69
|
// board设置, 获取预约主体
|
|
@@ -301,19 +298,10 @@ var Pet = function Pet(props) {
|
|
|
301
298
|
var cur = _toConsumableArray(state.pet.value[petForm.form_id] || []);
|
|
302
299
|
var options = ((_state$pet3 = state.pet) === null || _state$pet3 === void 0 ? void 0 : (_state$pet3$formData = _state$pet3.formData) === null || _state$pet3$formData === void 0 ? void 0 : (_state$pet3$formData$ = _state$pet3$formData[0]) === null || _state$pet3$formData$ === void 0 ? void 0 : _state$pet3$formData$.options) || [];
|
|
303
300
|
if (res.type === 'delete') {
|
|
304
|
-
var isDay = isDayBooking(state);
|
|
305
|
-
|
|
306
|
-
// 跨日预约在不能编辑情况下不能删除
|
|
307
|
-
if (isDay && state.disabledEdit) return cur;
|
|
308
301
|
cur = cur.filter(function (d) {
|
|
309
302
|
return d.form_record_id !== item.form_record_id;
|
|
310
303
|
});
|
|
311
304
|
_addCallback();
|
|
312
|
-
|
|
313
|
-
// 跨日预约移除的时候则删除商品数据
|
|
314
|
-
if (isDay) {
|
|
315
|
-
handleDayChange(item);
|
|
316
|
-
}
|
|
317
305
|
} else {
|
|
318
306
|
var obj = {
|
|
319
307
|
customer: item === null || item === void 0 ? void 0 : item.customer,
|
|
@@ -488,41 +476,6 @@ var Pet = function Pet(props) {
|
|
|
488
476
|
}
|
|
489
477
|
}, locales.getText('pisell2.text.load-more'))) : null;
|
|
490
478
|
}, [loadLoading, params, (_state$pet9 = state.pet) === null || _state$pet9 === void 0 ? void 0 : (_state$pet9$formData = _state$pet9.formData) === null || _state$pet9$formData === void 0 ? void 0 : (_state$pet9$formData$ = _state$pet9$formData[0]) === null || _state$pet9$formData$ === void 0 ? void 0 : (_state$pet9$formData$2 = _state$pet9$formData$.options) === null || _state$pet9$formData$2 === void 0 ? void 0 : _state$pet9$formData$2.length]);
|
|
491
|
-
var handleDayChange = function handleDayChange(e) {
|
|
492
|
-
var _state$service$value;
|
|
493
|
-
var id = e === null || e === void 0 ? void 0 : e.form_record_id;
|
|
494
|
-
var service = (_state$service$value = state.service.value) === null || _state$service$value === void 0 ? void 0 : _state$service$value.filter(function (item) {
|
|
495
|
-
return item._extend.holder_id === id;
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
// 有form_id 并且购物车下有商品数据
|
|
499
|
-
if (id && service !== null && service !== void 0 && service.length) {
|
|
500
|
-
var _state$service;
|
|
501
|
-
changePetRef === null || changePetRef === void 0 ? void 0 : changePetRef.current.open({
|
|
502
|
-
ids: [id],
|
|
503
|
-
dispatch: dispatch,
|
|
504
|
-
service: ((_state$service = state.service) === null || _state$service === void 0 ? void 0 : _state$service.value) || []
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* @title: 跨日预约其他自定义方法
|
|
511
|
-
* @description:
|
|
512
|
-
* @param {*} useMemo
|
|
513
|
-
* @return {*}
|
|
514
|
-
* @Author: WangHan
|
|
515
|
-
* @Date: 2024-12-12 22:30
|
|
516
|
-
*/
|
|
517
|
-
var dayCustomSelect = useMemo(function () {
|
|
518
|
-
var isDay = isDayBooking(state);
|
|
519
|
-
if (isDay) {
|
|
520
|
-
return {
|
|
521
|
-
handleDayChange: handleDayChange
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
return {};
|
|
525
|
-
}, [state.renderType, state.service.value]);
|
|
526
479
|
return useMemo(function () {
|
|
527
480
|
var _state$client11;
|
|
528
481
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -549,7 +502,7 @@ var Pet = function Pet(props) {
|
|
|
549
502
|
value: state.pet.value,
|
|
550
503
|
onChange: onValueChange,
|
|
551
504
|
client: (_state$client11 = state.client) === null || _state$client11 === void 0 ? void 0 : _state$client11.value,
|
|
552
|
-
customSelectProps:
|
|
505
|
+
customSelectProps: {
|
|
553
506
|
loading: loading,
|
|
554
507
|
handleViewItem: handleViewItem,
|
|
555
508
|
virtualListHeight: window.innerHeight - 213 - 57 - 16,
|
|
@@ -567,7 +520,7 @@ var Pet = function Pet(props) {
|
|
|
567
520
|
},
|
|
568
521
|
handleOpenModal: handleOpenModal,
|
|
569
522
|
previewItemTitleRender: previewItemTitleRender
|
|
570
|
-
},
|
|
523
|
+
},
|
|
571
524
|
optionRender: function optionRender(item) {
|
|
572
525
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
573
526
|
className: "pisell-lowcode__booking-pet-list-item-avatar",
|
|
@@ -625,9 +578,7 @@ var Pet = function Pet(props) {
|
|
|
625
578
|
return addCallback;
|
|
626
579
|
}()
|
|
627
580
|
}, addButtonProps)
|
|
628
|
-
}))
|
|
629
|
-
ref: changePetRef
|
|
630
|
-
}));
|
|
581
|
+
})));
|
|
631
582
|
}, [valueLoading, hideTitle, state.pet.value, state.pet.formData, state.action, state.modalOpen, state.pet.value, (_state$client12 = state.client) === null || _state$client12 === void 0 ? void 0 : _state$client12.value, loading, state.disabledEdit, state.isTerminal, state.disableEventBookingEdit, params.search, loadMore, addButtonProps, state.isBookingCreatePage]);
|
|
632
583
|
};
|
|
633
584
|
export default Pet;
|
|
@@ -24,22 +24,18 @@ import Drawer from "../../../components/drawer";
|
|
|
24
24
|
import TabProduct from "../../../components/TabProduct";
|
|
25
25
|
import { Context } from "../../model";
|
|
26
26
|
import AddButton from "../../../components/addButton";
|
|
27
|
-
import { Input, Skeleton
|
|
27
|
+
import { Input, Skeleton } from 'antd';
|
|
28
28
|
import "./index.less";
|
|
29
29
|
import useEngineContext from "../../../../../hooks/useEngineContext";
|
|
30
30
|
import { getProductDetail } from "../serve";
|
|
31
31
|
import { getIsBundleOrCombination } from "../../utils";
|
|
32
|
-
import DateRange from "../../dateRange";
|
|
33
32
|
import { getProductExtend } from "./utils";
|
|
34
33
|
import { formatProductListByCategory, getProductTotalPrice, request } from "../../../utils";
|
|
35
|
-
import { isDayBooking, isAppointment, getDayProducts, holderId } from "../../service2/utils";
|
|
36
|
-
import { inputDateCol, appointmentTypes } from "../../service2/status";
|
|
37
34
|
import { locales, getUniqueId } from '@pisell/utils';
|
|
38
35
|
import { useMemoizedFn, useUpdateEffect } from 'ahooks';
|
|
39
|
-
import debounce from 'lodash/debounce';
|
|
40
36
|
var shopList = [2886, 4422, 5538, 6930, 6814, 6813, 6812, 6087, 6303, 6080, 6978, 7386, 6848, 6305];
|
|
41
37
|
var Info = function Info(props) {
|
|
42
|
-
var _state$service3,
|
|
38
|
+
var _state$service3, _state$service6, _state$service8, _state$service8$cache;
|
|
43
39
|
var onEdit = props.onEdit,
|
|
44
40
|
drawerProps = props.drawerProps,
|
|
45
41
|
renderMode = props.renderMode;
|
|
@@ -55,60 +51,11 @@ var Info = function Info(props) {
|
|
|
55
51
|
loading = _useState4[0],
|
|
56
52
|
setLoading = _useState4[1];
|
|
57
53
|
var searchRef = useRef();
|
|
58
|
-
// 头部高度
|
|
59
|
-
var headerRef = useRef(null);
|
|
60
|
-
var _useState5 = useState(0),
|
|
61
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
-
headerHeight = _useState6[0],
|
|
63
|
-
setHeaderHeight = _useState6[1];
|
|
64
54
|
var context = useEngineContext();
|
|
65
55
|
state = state || (props === null || props === void 0 ? void 0 : props.state);
|
|
66
56
|
dispatch = dispatch || (props === null || props === void 0 ? void 0 : props.dispatch);
|
|
67
57
|
request.setRequest(context.appHelper.utils.request);
|
|
68
58
|
|
|
69
|
-
/**
|
|
70
|
-
* @title: 是否是跨日预约
|
|
71
|
-
* @description:
|
|
72
|
-
* @param {*} useMemo
|
|
73
|
-
* @return {*}
|
|
74
|
-
* @Author: WangHan
|
|
75
|
-
* @Date: 2024-12-09 15:46
|
|
76
|
-
*/
|
|
77
|
-
var isDay = useMemo(function () {
|
|
78
|
-
return isDayBooking(state);
|
|
79
|
-
}, [state.renderType]);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @title: 监听元素高度变化的函数
|
|
83
|
-
* @description:
|
|
84
|
-
* @return {*}
|
|
85
|
-
* @Author: WangHan
|
|
86
|
-
* @Date: 2024-12-10 17:13
|
|
87
|
-
*/
|
|
88
|
-
var handleResize = function handleResize() {
|
|
89
|
-
if (headerRef !== null && headerRef !== void 0 && headerRef.current) {
|
|
90
|
-
var _headerRef$current;
|
|
91
|
-
setHeaderHeight((_headerRef$current = headerRef.current) === null || _headerRef$current === void 0 ? void 0 : _headerRef$current.offsetHeight);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// 使用防抖的监听函数
|
|
96
|
-
var debouncedHandleResize = debounce(handleResize, 100);
|
|
97
|
-
useEffect(function () {
|
|
98
|
-
if (isDay && state.isTerminalDayBookingPage) {
|
|
99
|
-
// 初始化时设置一次高度
|
|
100
|
-
handleResize();
|
|
101
|
-
|
|
102
|
-
// 添加窗口大小变化的监听器
|
|
103
|
-
window.addEventListener('resize', debouncedHandleResize);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// 清理函数
|
|
107
|
-
return function () {
|
|
108
|
-
window.removeEventListener('resize', debouncedHandleResize);
|
|
109
|
-
};
|
|
110
|
-
}, [debouncedHandleResize]);
|
|
111
|
-
|
|
112
59
|
/**
|
|
113
60
|
* @title: 如果商品只有一个, 则自动设置默认商品
|
|
114
61
|
* @description:
|
|
@@ -173,7 +120,7 @@ var Info = function Info(props) {
|
|
|
173
120
|
_extend: {
|
|
174
121
|
start_date: state.date.value,
|
|
175
122
|
startDate: state.date.value,
|
|
176
|
-
endDate:
|
|
123
|
+
endDate: state.date.value,
|
|
177
124
|
start_time: '00:00:00',
|
|
178
125
|
duration: 10,
|
|
179
126
|
quantity: 1,
|
|
@@ -204,7 +151,7 @@ var Info = function Info(props) {
|
|
|
204
151
|
var getServices = /*#__PURE__*/function () {
|
|
205
152
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
206
153
|
var _state$eventOtherPara, _state$eventOtherPara2, _state$eventOtherPara3;
|
|
207
|
-
var
|
|
154
|
+
var data;
|
|
208
155
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
209
156
|
while (1) switch (_context2.prev = _context2.next) {
|
|
210
157
|
case 0:
|
|
@@ -223,12 +170,8 @@ var Info = function Info(props) {
|
|
|
223
170
|
setLoading(false);
|
|
224
171
|
return _context2.abrupt("return");
|
|
225
172
|
case 5:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
dayParams.extension_type = ['normal', 'product_appointment'];
|
|
229
|
-
}
|
|
230
|
-
_context2.next = 9;
|
|
231
|
-
return state.apis.getServices(_objectSpread(_objectSpread({
|
|
173
|
+
_context2.next = 7;
|
|
174
|
+
return state.apis.getServices(_objectSpread({
|
|
232
175
|
skip: 1,
|
|
233
176
|
num: 500,
|
|
234
177
|
extension_type: state.renderType === 'eventBooking' ? undefined : ['product_appointment', 'appointment_ticket'],
|
|
@@ -245,27 +188,22 @@ var Info = function Info(props) {
|
|
|
245
188
|
_config: {
|
|
246
189
|
useCache: true
|
|
247
190
|
}
|
|
248
|
-
})
|
|
249
|
-
case
|
|
191
|
+
}));
|
|
192
|
+
case 7:
|
|
250
193
|
data = _context2.sent;
|
|
251
194
|
setLoading(false);
|
|
252
|
-
lists = (data === null || data === void 0 ? void 0 : data.list) || []; // 跨日预约过滤商品列表
|
|
253
|
-
if (isDay) {
|
|
254
|
-
id = holderId(state);
|
|
255
|
-
lists = getDayProducts(id, lists, (_state = state) === null || _state === void 0 ? void 0 : _state.isTerminalDayBookingPage);
|
|
256
|
-
}
|
|
257
195
|
|
|
258
196
|
// 只有自动获取列表的时候才设置商品, 手动点击添加按钮的时候不设置
|
|
259
197
|
if (!state.service.addModal) {
|
|
260
|
-
setDefaultService(
|
|
198
|
+
setDefaultService(data === null || data === void 0 ? void 0 : data.list);
|
|
261
199
|
}
|
|
262
200
|
dispatch({
|
|
263
201
|
type: 'setService',
|
|
264
202
|
payload: {
|
|
265
|
-
services:
|
|
203
|
+
services: (data === null || data === void 0 ? void 0 : data.list) || []
|
|
266
204
|
}
|
|
267
205
|
});
|
|
268
|
-
case
|
|
206
|
+
case 11:
|
|
269
207
|
case "end":
|
|
270
208
|
return _context2.stop();
|
|
271
209
|
}
|
|
@@ -330,13 +268,6 @@ var Info = function Info(props) {
|
|
|
330
268
|
},
|
|
331
269
|
new: 1
|
|
332
270
|
});
|
|
333
|
-
|
|
334
|
-
// 跨日预约
|
|
335
|
-
if (isDay) {
|
|
336
|
-
cacheItem._extend.holder_id = holderId(state);
|
|
337
|
-
cacheItem._extend.end_date = state.date.end_date;
|
|
338
|
-
cacheItem._extend.sub_type = 'days';
|
|
339
|
-
}
|
|
340
271
|
var _total = getProductTotalPrice(cacheItem);
|
|
341
272
|
// 用于折扣 可修改
|
|
342
273
|
cacheItem._extend.total = _total;
|
|
@@ -357,11 +288,7 @@ var Info = function Info(props) {
|
|
|
357
288
|
cacheItem: cacheItem,
|
|
358
289
|
state: state
|
|
359
290
|
});
|
|
360
|
-
|
|
361
|
-
// 普通商品
|
|
362
|
-
if (isDay && !isAppointment(item, state)) {
|
|
363
|
-
cacheItem.autoClose = !_isEdit;
|
|
364
|
-
} else if (state.renderType === 'eventBooking') {
|
|
291
|
+
if (state.renderType === 'eventBooking') {
|
|
365
292
|
cacheItem.autoClose = false;
|
|
366
293
|
} else {
|
|
367
294
|
var _state$service;
|
|
@@ -383,23 +310,13 @@ var Info = function Info(props) {
|
|
|
383
310
|
var renderList = useMemo(function () {
|
|
384
311
|
var _state$service2;
|
|
385
312
|
var _list = ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.services) || [];
|
|
386
|
-
|
|
387
|
-
// 跨日预约
|
|
388
|
-
if (isDay) {
|
|
389
|
-
// 公共购物车下过滤掉预约商品
|
|
390
|
-
if (!holderId(state)) {
|
|
391
|
-
_list = _list.filter(function (item) {
|
|
392
|
-
return !appointmentTypes.includes(item.extension_type);
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
313
|
var isIncludes = function isIncludes(str) {
|
|
397
314
|
return str.toLowerCase().indexOf(search.toLowerCase()) !== -1;
|
|
398
315
|
};
|
|
399
316
|
return formatProductListByCategory(_list, search ? function (item) {
|
|
400
317
|
return isIncludes(item.title);
|
|
401
318
|
} : undefined);
|
|
402
|
-
}, [search, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.services
|
|
319
|
+
}, [search, (_state$service3 = state.service) === null || _state$service3 === void 0 ? void 0 : _state$service3.services]);
|
|
403
320
|
console.log('state.service.renderList', renderList);
|
|
404
321
|
var isService = useMemo(function () {
|
|
405
322
|
var _state$service4, _state$service4$value;
|
|
@@ -445,10 +362,6 @@ var Info = function Info(props) {
|
|
|
445
362
|
}
|
|
446
363
|
}, [state.renderType, state.modalOpen]);
|
|
447
364
|
var addButton = useMemo(function () {
|
|
448
|
-
// 跨日预约不显示添加服务按钮
|
|
449
|
-
if (isDay) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
365
|
if (state.isBookingCreatePage) {
|
|
453
366
|
return /*#__PURE__*/React.createElement("div", {
|
|
454
367
|
style: {
|
|
@@ -483,31 +396,11 @@ var Info = function Info(props) {
|
|
|
483
396
|
var isRenderCurrent = useMemo(function () {
|
|
484
397
|
return renderMode === 'current';
|
|
485
398
|
}, [renderMode]);
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* @title: 日期宽度
|
|
489
|
-
* @description:
|
|
490
|
-
* @param {*} useMemo
|
|
491
|
-
* @return {*}
|
|
492
|
-
* @Author: WangHan
|
|
493
|
-
* @Date: 2024-12-09 15:46
|
|
494
|
-
*/
|
|
495
|
-
var colSpan = useMemo(function () {
|
|
496
|
-
var isTerminal = state.isTerminalDayBookingPage;
|
|
497
|
-
var showDate = !!(isDay && holderId(state));
|
|
498
|
-
return inputDateCol(showDate, isTerminal);
|
|
499
|
-
}, [state.isTerminalDayBookingPage, isDay, holderId(state)]);
|
|
500
399
|
return useMemo(function () {
|
|
501
400
|
var _state$service7, _state$service7$cache;
|
|
502
401
|
var header = /*#__PURE__*/React.createElement("div", {
|
|
503
|
-
className: 'pisell-lowcode__booking-service-header'
|
|
504
|
-
|
|
505
|
-
}, /*#__PURE__*/React.createElement(Row, {
|
|
506
|
-
gutter: [16, 16]
|
|
507
|
-
}, isDay && holderId(state) ? /*#__PURE__*/React.createElement(Col, colSpan.date, /*#__PURE__*/React.createElement(DateRange, {
|
|
508
|
-
state: state,
|
|
509
|
-
dispatch: dispatch
|
|
510
|
-
})) : null, /*#__PURE__*/React.createElement(Col, colSpan.input, /*#__PURE__*/React.createElement(Input, {
|
|
402
|
+
className: 'pisell-lowcode__booking-service-header'
|
|
403
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
511
404
|
ref: searchRef,
|
|
512
405
|
prefix: /*#__PURE__*/React.createElement(SearchLg, null),
|
|
513
406
|
style: {
|
|
@@ -520,9 +413,9 @@ var Info = function Info(props) {
|
|
|
520
413
|
onChange: function onChange(e) {
|
|
521
414
|
setSearch(e.target.value);
|
|
522
415
|
}
|
|
523
|
-
}))
|
|
416
|
+
}));
|
|
524
417
|
var content = /*#__PURE__*/React.createElement("div", {
|
|
525
|
-
className:
|
|
418
|
+
className: 'pisell-lowcode__booking-service-body'
|
|
526
419
|
}, /*#__PURE__*/React.createElement(TabProduct, {
|
|
527
420
|
list: renderList,
|
|
528
421
|
amountSymbol: state.amountSymbol,
|
|
@@ -545,8 +438,8 @@ var Info = function Info(props) {
|
|
|
545
438
|
round: true
|
|
546
439
|
}), addButton, /*#__PURE__*/React.createElement(Drawer, _extends({
|
|
547
440
|
titleNoWrap: true,
|
|
548
|
-
open: state.service.addModal && !state.isBookingCreatePage
|
|
549
|
-
title:
|
|
441
|
+
open: state.service.addModal && !state.isBookingCreatePage,
|
|
442
|
+
title: locales.getText('pisell2.text.select-service'),
|
|
550
443
|
rootClassName: "booking-server-wrap",
|
|
551
444
|
onClose: function onClose() {
|
|
552
445
|
dispatch({
|
|
@@ -559,6 +452,6 @@ var Info = function Info(props) {
|
|
|
559
452
|
},
|
|
560
453
|
header: header
|
|
561
454
|
}, drawerProps || {}), content));
|
|
562
|
-
}, [(_state$service8 = state.service) === null || _state$service8 === void 0 ? void 0 : (_state$service8$cache = _state$service8.cacheItem) === null || _state$service8$cache === void 0 ? void 0 : _state$service8$cache.autoClose, addButton, state.service.addModal, locales, search, renderList, state.amountSymbol
|
|
455
|
+
}, [(_state$service8 = state.service) === null || _state$service8 === void 0 ? void 0 : (_state$service8$cache = _state$service8.cacheItem) === null || _state$service8$cache === void 0 ? void 0 : _state$service8$cache.autoClose, addButton, state.service.addModal, locales, search, renderList, state.amountSymbol]);
|
|
563
456
|
};
|
|
564
457
|
export default Info;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// border-bottom: 1px solid var(--gray-300, #D0D5DD);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.pisell-lowcode__booking-service-body
|
|
7
|
-
|
|
8
|
-
background: var(--gray-50, #f9fafb);
|
|
6
|
+
.pisell-lowcode__booking-service-body {
|
|
7
|
+
background: var(--gray-50, #F9FAFB);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.pisell-lowcode__booking-vertical-add-service-wrap {
|
|
@@ -26,7 +25,6 @@
|
|
|
26
25
|
.booking-category-list {
|
|
27
26
|
padding: 0 16px !important;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
.pisell-lowcode__booking-service-body {
|
|
31
29
|
.booking-tab-product {
|
|
32
30
|
.booking-tabs-wrap {
|
|
@@ -34,12 +32,4 @@
|
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
.pisell-lowcode__booking-service-date-body {
|
|
39
|
-
.booking-tab-product {
|
|
40
|
-
.booking-tabs-wrap {
|
|
41
|
-
top: 136px !important;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
35
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import dayjs from
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
2
|
export declare const getDurationProps: ({ cacheItem, useStartTime, currentResource, slice, }: any) => {
|
|
3
3
|
startDate: dayjs.Dayjs;
|
|
4
4
|
usableTime: any;
|
|
@@ -48,7 +48,7 @@ export declare const getTimeObj: ({ cacheItem, useStartTime, currentResource, st
|
|
|
48
48
|
* @Author: zhiwei.Wang
|
|
49
49
|
* @Date: 2024-01-09 13:38
|
|
50
50
|
*/
|
|
51
|
-
export declare const formatResources: ({ cacheItem, resourcesOrigin
|
|
51
|
+
export declare const formatResources: ({ cacheItem, resourcesOrigin }: any) => any[];
|
|
52
52
|
export declare const checkCacheItemResource: ({ cacheItem, resources }: any) => any;
|
|
53
53
|
/**
|
|
54
54
|
* @title: 预生成服务的 extend
|
|
@@ -59,12 +59,3 @@ export declare const checkCacheItemResource: ({ cacheItem, resources }: any) =>
|
|
|
59
59
|
* @Date: 2024-06-01 13:25
|
|
60
60
|
*/
|
|
61
61
|
export declare const getProductExtend: ({ cacheItem, state }: any) => any;
|
|
62
|
-
/**
|
|
63
|
-
* @title: 获取资源标题
|
|
64
|
-
* @description:
|
|
65
|
-
* @param {any} param1
|
|
66
|
-
* @return {*}
|
|
67
|
-
* @Author: WangHan
|
|
68
|
-
* @Date: 2024-12-09 15:53
|
|
69
|
-
*/
|
|
70
|
-
export declare const getResourceTitle: ({ state, id }: any) => any;
|
|
@@ -10,12 +10,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
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
|
-
import React from
|
|
13
|
+
import React from "react";
|
|
14
14
|
import { getServeStartTime, getDuration, getEndDate, flexibleObj, sliceDayIntoFiveMinutes, getDiscountTime, getServerItemExtend, formatResource } from "../../../utils";
|
|
15
|
-
import dayjs from
|
|
16
|
-
import { locales } from
|
|
17
|
-
import AlertTriangle from
|
|
18
|
-
import { isDayBooking } from "../../service2/utils";
|
|
15
|
+
import dayjs from "dayjs";
|
|
16
|
+
import { locales } from "@pisell/utils";
|
|
17
|
+
import AlertTriangle from "@pisell/icon/es/AlertTriangle";
|
|
19
18
|
export var getDurationProps = function getDurationProps(_ref) {
|
|
20
19
|
var _currentResource$_ext;
|
|
21
20
|
var cacheItem = _ref.cacheItem,
|
|
@@ -24,13 +23,13 @@ export var getDurationProps = function getDurationProps(_ref) {
|
|
|
24
23
|
slice = _ref.slice;
|
|
25
24
|
var _cacheItem = cacheItem;
|
|
26
25
|
return {
|
|
27
|
-
startDate: dayjs(dayjs(_cacheItem._extend.start_date).format(
|
|
26
|
+
startDate: dayjs(dayjs(_cacheItem._extend.start_date).format("YYYY-MM-DD ") + (getServeStartTime(useStartTime) || "00:00")),
|
|
28
27
|
usableTime: currentResource === null || currentResource === void 0 ? void 0 : (_currentResource$_ext = currentResource._extend) === null || _currentResource$_ext === void 0 ? void 0 : _currentResource$_ext.usableTime,
|
|
29
28
|
duration: getDuration(_cacheItem === null || _cacheItem === void 0 ? void 0 : _cacheItem.duration),
|
|
30
29
|
locale: locales.locale,
|
|
31
30
|
slice: slice,
|
|
32
31
|
selectProps: {
|
|
33
|
-
size:
|
|
32
|
+
size: "large"
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
35
|
};
|
|
@@ -56,14 +55,14 @@ export var getFlexibleOption = function getFlexibleOption(_ref2) {
|
|
|
56
55
|
slice: slice
|
|
57
56
|
});
|
|
58
57
|
var _duration = _durationProps.duration;
|
|
59
|
-
if (_duration ===
|
|
58
|
+
if (_duration === "flexible") {
|
|
60
59
|
var _durationProps$usable, _durationProps$usable2;
|
|
61
60
|
// 获取结束时间
|
|
62
61
|
var endDate = getEndDate(_durationProps.startDate, _duration, (_durationProps$usable = _durationProps.usableTime) !== null && _durationProps$usable !== void 0 && _durationProps$usable.end_at ? dayjs((_durationProps$usable2 = _durationProps.usableTime) === null || _durationProps$usable2 === void 0 ? void 0 : _durationProps$usable2.end_at) : null);
|
|
63
62
|
// 转换为分钟
|
|
64
|
-
var timeValue = endDate.diff(_durationProps.startDate,
|
|
63
|
+
var timeValue = endDate.diff(_durationProps.startDate, "minute");
|
|
65
64
|
return {
|
|
66
|
-
label: locales.getText(
|
|
65
|
+
label: locales.getText("pisell2.text.flexible"),
|
|
67
66
|
value: flexibleObj.create(timeValue)
|
|
68
67
|
};
|
|
69
68
|
}
|
|
@@ -92,7 +91,7 @@ export var getTimeObj = function getTimeObj(_ref3) {
|
|
|
92
91
|
state: state,
|
|
93
92
|
durationProps: durationProps
|
|
94
93
|
});
|
|
95
|
-
var obj = sliceDayIntoFiveMinutes((_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.service_time, locales.locale
|
|
94
|
+
var obj = sliceDayIntoFiveMinutes((_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.basic) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.service_time, locales.locale);
|
|
96
95
|
var timeSlices = _toConsumableArray(obj.timeSlices);
|
|
97
96
|
var durationSlicesBasedOnTime = _toConsumableArray(obj.durationSlicesBasedOnTime);
|
|
98
97
|
|
|
@@ -106,26 +105,26 @@ export var getTimeObj = function getTimeObj(_ref3) {
|
|
|
106
105
|
return d.value === useDuration;
|
|
107
106
|
})) {
|
|
108
107
|
durationSlicesBasedOnTime.unshift({
|
|
109
|
-
label: getDiscountTime(useDuration
|
|
108
|
+
label: getDiscountTime(useDuration),
|
|
110
109
|
value: useDuration,
|
|
111
110
|
//@ts-ignore
|
|
112
111
|
disabled: true
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
114
|
// 如果有选择时间, 但是不在列表内 则需要在列表内添加上此值
|
|
116
|
-
if (useStartTime && useStartTime !==
|
|
115
|
+
if (useStartTime && useStartTime !== "now" && !timeSlices.some(function (d) {
|
|
117
116
|
return d.value === useStartTime;
|
|
118
117
|
})) {
|
|
119
118
|
timeSlices.unshift({
|
|
120
|
-
label: dayjs(useStartTime,
|
|
119
|
+
label: dayjs(useStartTime, "HH:mm").format("hh:mm A"),
|
|
121
120
|
value: useStartTime
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
// 增加当前
|
|
126
125
|
timeSlices.unshift({
|
|
127
|
-
label: locales.getText(
|
|
128
|
-
value:
|
|
126
|
+
label: locales.getText("pisell2.text.now"),
|
|
127
|
+
value: "now"
|
|
129
128
|
});
|
|
130
129
|
return _objectSpread(_objectSpread({}, obj), {}, {
|
|
131
130
|
timeSlices: timeSlices,
|
|
@@ -142,8 +141,7 @@ export var getTimeObj = function getTimeObj(_ref3) {
|
|
|
142
141
|
*/
|
|
143
142
|
export var formatResources = function formatResources(_ref4) {
|
|
144
143
|
var cacheItem = _ref4.cacheItem,
|
|
145
|
-
resourcesOrigin = _ref4.resourcesOrigin
|
|
146
|
-
isDay = _ref4.isDay;
|
|
144
|
+
resourcesOrigin = _ref4.resourcesOrigin;
|
|
147
145
|
try {
|
|
148
146
|
// 合并无资源
|
|
149
147
|
var _list = _toConsumableArray(resourcesOrigin);
|
|
@@ -158,7 +156,7 @@ export var formatResources = function formatResources(_ref4) {
|
|
|
158
156
|
}), item.labelText, !item.usable && /*#__PURE__*/React.createElement(AlertTriangle, {
|
|
159
157
|
className: "resource-option-alert-icon"
|
|
160
158
|
}));
|
|
161
|
-
}
|
|
159
|
+
});
|
|
162
160
|
});
|
|
163
161
|
// 排序, 将可用资源放在最前面
|
|
164
162
|
_list = _list.sort(function (a, b) {
|
|
@@ -166,7 +164,7 @@ export var formatResources = function formatResources(_ref4) {
|
|
|
166
164
|
});
|
|
167
165
|
return _list;
|
|
168
166
|
} catch (err) {
|
|
169
|
-
console.log(
|
|
167
|
+
console.log("formatResourcesErr", err);
|
|
170
168
|
}
|
|
171
169
|
return [];
|
|
172
170
|
};
|
|
@@ -177,23 +175,21 @@ export var checkCacheItemResource = function checkCacheItemResource(_ref5) {
|
|
|
177
175
|
if (resourceId || resourceId === 0) {
|
|
178
176
|
// 校验, 如果当前选择的资源 在列表里没找到, 则恢复成无资源, 防止数据错乱
|
|
179
177
|
if (!resources.find(function (d) {
|
|
180
|
-
return
|
|
178
|
+
return d.form_record_id === resourceId;
|
|
181
179
|
})) {
|
|
182
180
|
resourceId = undefined;
|
|
183
181
|
}
|
|
184
182
|
} else {
|
|
185
183
|
if (cacheItem.new) {
|
|
186
184
|
if (resources.length <= 2) {
|
|
187
|
-
|
|
188
|
-
resourceId = resources === null || resources === void 0 ? void 0 : (_resources = resources[(resources === null || resources === void 0 ? void 0 : resources.length) - 1]) === null || _resources === void 0 ? void 0 : _resources.form_record_id;
|
|
185
|
+
resourceId = resources[resources.length - 1].form_record_id;
|
|
189
186
|
}
|
|
190
187
|
if (resources.length > 2) {
|
|
191
188
|
var usableList = resources.filter(function (d) {
|
|
192
189
|
return d.usable && d.form_id !== 0;
|
|
193
190
|
});
|
|
194
191
|
if (usableList.length === 1) {
|
|
195
|
-
|
|
196
|
-
resourceId = usableList === null || usableList === void 0 ? void 0 : (_usableList$ = usableList[0]) === null || _usableList$ === void 0 ? void 0 : _usableList$.form_record_id;
|
|
192
|
+
resourceId = usableList[0].form_record_id;
|
|
197
193
|
}
|
|
198
194
|
}
|
|
199
195
|
}
|
|
@@ -223,13 +219,12 @@ export var getProductExtend = function getProductExtend(_ref6) {
|
|
|
223
219
|
// 编辑时,找到当前选择的资源
|
|
224
220
|
if (!cacheItem.new) {
|
|
225
221
|
// 格式化资源列表
|
|
226
|
-
var
|
|
222
|
+
var _resources = formatResources({
|
|
227
223
|
cacheItem: cacheItem,
|
|
228
224
|
resourcesOrigin: resourcesOrigin
|
|
229
225
|
});
|
|
230
|
-
var item =
|
|
231
|
-
|
|
232
|
-
return (d === null || d === void 0 ? void 0 : d.form_record_id) == ((_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.resource);
|
|
226
|
+
var item = _resources.find(function (d) {
|
|
227
|
+
return d.form_record_id == cacheItem._extend.resource;
|
|
233
228
|
}) || {};
|
|
234
229
|
if (item) {
|
|
235
230
|
currentResource = item;
|
|
@@ -262,24 +257,4 @@ export var getProductExtend = function getProductExtend(_ref6) {
|
|
|
262
257
|
resources: resources
|
|
263
258
|
});
|
|
264
259
|
return _extend;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* @title: 获取资源标题
|
|
269
|
-
* @description:
|
|
270
|
-
* @param {any} param1
|
|
271
|
-
* @return {*}
|
|
272
|
-
* @Author: WangHan
|
|
273
|
-
* @Date: 2024-12-09 15:53
|
|
274
|
-
*/
|
|
275
|
-
export var getResourceTitle = function getResourceTitle(_ref7) {
|
|
276
|
-
var _state$client;
|
|
277
|
-
var state = _ref7.state,
|
|
278
|
-
id = _ref7.id;
|
|
279
|
-
var resources = (state === null || state === void 0 ? void 0 : (_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.value) || [];
|
|
280
|
-
if (!resources.length) return '';
|
|
281
|
-
var resource = resources.find(function (d) {
|
|
282
|
-
return d.id === id;
|
|
283
|
-
});
|
|
284
|
-
return (resource === null || resource === void 0 ? void 0 : resource.main_field) || '-';
|
|
285
260
|
};
|