@pisell/private-materials 3.0.194 → 3.0.196
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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +142 -150
- 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 +1 -0
- package/es/components/booking/components/customSelect/index.js +6 -2
- package/es/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.js +37 -0
- package/es/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/es/components/booking/components/footer/amount.js +45 -22
- package/es/components/booking/components/footer/index.js +84 -40
- package/es/components/booking/components/footer/utils.js +218 -32
- package/es/components/booking/info/addServiceVariant/index.js +8 -1
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +14 -13
- package/es/components/booking/info/clientVariant/vertical/index.js +33 -4
- package/es/components/booking/info/dateRange/index.d.ts +5 -0
- package/es/components/booking/info/dateRange/index.js +98 -0
- package/es/components/booking/info/dateRange/index.less +21 -0
- package/es/components/booking/info/main.js +20 -8
- package/es/components/booking/info/model.js +3 -0
- package/es/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/es/components/booking/info/pet/ChangePetModal/index.js +118 -0
- package/es/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/es/components/booking/info/pet/index.js +54 -5
- package/es/components/booking/info/service/addService/index.js +127 -20
- package/es/components/booking/info/service/addService/index.less +13 -3
- package/es/components/booking/info/service/addService/utils.d.ts +11 -2
- package/es/components/booking/info/service/addService/utils.js +49 -24
- package/es/components/booking/info/service/editService/index.js +232 -41
- package/es/components/booking/info/service/editService/index.less +18 -13
- package/es/components/booking/info/service2/Lists.d.ts +3 -0
- package/es/components/booking/info/service2/Lists.js +158 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/es/components/booking/info/service2/hooks/useSelectPet.js +54 -0
- package/es/components/booking/info/service2/index.d.ts +3 -0
- package/es/components/booking/info/service2/index.js +58 -0
- package/es/components/booking/info/service2/status.d.ts +31 -0
- package/es/components/booking/info/service2/status.js +78 -0
- package/es/components/booking/info/service2/utils.d.ts +145 -0
- package/es/components/booking/info/service2/utils.js +436 -0
- package/es/components/booking/info/utils.d.ts +9 -0
- package/es/components/booking/info/utils.js +13 -0
- package/es/components/booking/locales.d.ts +60 -0
- package/es/components/booking/locales.js +75 -3
- package/es/components/booking/materiels/holder/index.d.ts +7 -0
- package/es/components/booking/materiels/holder/index.js +51 -0
- package/es/components/booking/model.d.ts +4 -1
- package/es/components/booking/model.js +4 -2
- package/es/components/booking/utils.d.ts +12 -3
- package/es/components/booking/utils.js +126 -22
- package/es/components/eftpos/form/index.js +6 -12
- package/es/components/eftpos/group/index.d.ts +2 -1
- package/es/components/eftpos/group/index.js +2 -1
- package/es/components/eftpos/index.js +2 -2
- package/es/components/eftposPay/tyro/index.js +17 -40
- package/es/components/shoppingCart/Provider.d.ts +3 -0
- package/es/components/shoppingCart/Provider.js +86 -0
- package/es/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/Product.js +96 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Cart/index.js +72 -0
- package/es/components/shoppingCart/components/Cart/index.less +68 -0
- package/es/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Empty/index.js +14 -0
- package/es/components/shoppingCart/components/Empty/index.less +19 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/es/components/shoppingCart/components/Render/index.js +68 -0
- package/es/components/shoppingCart/components/Render/index.less +2 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.js +124 -0
- package/es/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/es/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useAddService.js +23 -0
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +54 -0
- package/es/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useContext.js +5 -0
- package/es/components/shoppingCart/index.d.ts +4 -0
- package/es/components/shoppingCart/index.js +24 -0
- package/es/components/shoppingCart/locales.d.ts +33 -0
- package/es/components/shoppingCart/locales.js +38 -0
- package/es/components/shoppingCart/mock.d.ts +40 -0
- package/es/components/shoppingCart/mock.js +40 -0
- package/es/components/shoppingCart/status.d.ts +2 -0
- package/es/components/shoppingCart/status.js +22 -0
- package/es/components/shoppingCart/type.d.ts +39 -0
- package/es/components/shoppingCart/type.js +1 -0
- package/es/components/shoppingCart/utils.d.ts +63 -0
- package/es/components/shoppingCart/utils.js +119 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/booking/components/customSelect/index.d.ts +1 -0
- package/lib/components/booking/components/customSelect/index.js +6 -2
- package/lib/components/booking/components/footer/AppointmentProductModal/index.d.ts +3 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.js +59 -0
- package/lib/components/booking/components/footer/AppointmentProductModal/index.less +0 -0
- package/lib/components/booking/components/footer/amount.js +26 -8
- package/lib/components/booking/components/footer/index.js +25 -4
- package/lib/components/booking/components/footer/utils.js +144 -31
- package/lib/components/booking/info/addServiceVariant/index.js +5 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +8 -7
- package/lib/components/booking/info/clientVariant/vertical/index.js +36 -10
- package/lib/components/booking/info/dateRange/index.d.ts +5 -0
- package/lib/components/booking/info/dateRange/index.js +111 -0
- package/lib/components/booking/info/dateRange/index.less +21 -0
- package/lib/components/booking/info/main.js +11 -4
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.d.ts +4 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.js +110 -0
- package/lib/components/booking/info/pet/ChangePetModal/index.less +4 -0
- package/lib/components/booking/info/pet/index.js +61 -25
- package/lib/components/booking/info/service/addService/index.js +95 -28
- package/lib/components/booking/info/service/addService/index.less +13 -3
- package/lib/components/booking/info/service/addService/utils.d.ts +11 -2
- package/lib/components/booking/info/service/addService/utils.js +31 -10
- package/lib/components/booking/info/service/editService/index.js +271 -122
- package/lib/components/booking/info/service/editService/index.less +18 -13
- package/lib/components/booking/info/service2/Lists.d.ts +3 -0
- package/lib/components/booking/info/service2/Lists.js +113 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.d.ts +6 -0
- package/lib/components/booking/info/service2/hooks/useSelectPet.js +50 -0
- package/lib/components/booking/info/service2/index.d.ts +3 -0
- package/lib/components/booking/info/service2/index.js +75 -0
- package/lib/components/booking/info/service2/status.d.ts +31 -0
- package/lib/components/booking/info/service2/status.js +81 -0
- package/lib/components/booking/info/service2/utils.d.ts +145 -0
- package/lib/components/booking/info/service2/utils.js +320 -0
- package/lib/components/booking/info/utils.d.ts +9 -0
- package/lib/components/booking/info/utils.js +6 -0
- package/lib/components/booking/locales.d.ts +60 -0
- package/lib/components/booking/locales.js +63 -3
- package/lib/components/booking/materiels/holder/index.d.ts +7 -0
- package/lib/components/booking/materiels/holder/index.js +65 -0
- package/lib/components/booking/model.d.ts +4 -1
- package/lib/components/booking/model.js +4 -2
- package/lib/components/booking/utils.d.ts +12 -3
- package/lib/components/booking/utils.js +79 -15
- package/lib/components/eftpos/form/index.js +6 -12
- package/lib/components/eftpos/group/index.d.ts +2 -1
- package/lib/components/eftpos/group/index.js +1 -0
- package/lib/components/eftpos/index.js +2 -2
- package/lib/components/eftposPay/tyro/index.js +5 -26
- package/lib/components/shoppingCart/Provider.d.ts +3 -0
- package/lib/components/shoppingCart/Provider.js +110 -0
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/Product.js +89 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Cart/index.js +77 -0
- package/lib/components/shoppingCart/components/Cart/index.less +68 -0
- package/lib/components/shoppingCart/components/Empty/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Empty/index.js +43 -0
- package/lib/components/shoppingCart/components/Empty/index.less +19 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/Render/index.js +79 -0
- package/lib/components/shoppingCart/components/Render/index.less +2 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.d.ts +4 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.js +116 -0
- package/lib/components/shoppingCart/components/SelectHolderModal/index.less +32 -0
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useAddService.js +55 -0
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +3 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +71 -0
- package/lib/components/shoppingCart/hooks/useContext.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useContext.js +31 -0
- package/lib/components/shoppingCart/index.d.ts +4 -0
- package/lib/components/shoppingCart/index.js +60 -0
- package/lib/components/shoppingCart/locales.d.ts +33 -0
- package/lib/components/shoppingCart/locales.js +56 -0
- package/lib/components/shoppingCart/mock.d.ts +40 -0
- package/lib/components/shoppingCart/mock.js +76 -0
- package/lib/components/shoppingCart/status.d.ts +2 -0
- package/lib/components/shoppingCart/status.js +60 -0
- package/lib/components/shoppingCart/type.d.ts +39 -0
- package/lib/components/shoppingCart/type.js +17 -0
- package/lib/components/shoppingCart/utils.d.ts +63 -0
- package/lib/components/shoppingCart/utils.js +92 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/shopping-cart/meta.ts +98 -0
- package/package.json +4 -4
- package/es/components/eftpos/receipt/index.d.ts +0 -24
- package/es/components/eftpos/receipt/index.js +0 -96
- package/lib/components/eftpos/receipt/index.d.ts +0 -24
- package/lib/components/eftpos/receipt/index.js +0 -88
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
// border-bottom: 1px solid var(--gray-300, #D0D5DD);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.pisell-lowcode__booking-service-body
|
|
7
|
-
|
|
6
|
+
.pisell-lowcode__booking-service-body,
|
|
7
|
+
.pisell-lowcode__booking-service-date-body {
|
|
8
|
+
background: var(--gray-50, #f9fafb);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.pisell-lowcode__booking-vertical-add-service-wrap {
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
.booking-category-list {
|
|
26
27
|
padding: 0 16px !important;
|
|
27
28
|
}
|
|
29
|
+
|
|
28
30
|
.pisell-lowcode__booking-service-body {
|
|
29
31
|
.booking-tab-product {
|
|
30
32
|
.booking-tabs-wrap {
|
|
@@ -32,4 +34,12 @@
|
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
|
|
38
|
+
.pisell-lowcode__booking-service-date-body {
|
|
39
|
+
.booking-tab-product {
|
|
40
|
+
.booking-tabs-wrap {
|
|
41
|
+
top: 136px !important;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -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 }: any) => any[];
|
|
51
|
+
export declare const formatResources: ({ cacheItem, resourcesOrigin, isDay }: any) => any[];
|
|
52
52
|
export declare const checkCacheItemResource: ({ cacheItem, resources }: any) => any;
|
|
53
53
|
/**
|
|
54
54
|
* @title: 预生成服务的 extend
|
|
@@ -59,3 +59,12 @@ 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,11 +10,12 @@ 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
|
|
15
|
+
import dayjs from 'dayjs';
|
|
16
|
+
import { locales } from '@pisell/utils';
|
|
17
|
+
import AlertTriangle from '@pisell/icon/es/AlertTriangle';
|
|
18
|
+
import { isDayBooking } from "../../service2/utils";
|
|
18
19
|
export var getDurationProps = function getDurationProps(_ref) {
|
|
19
20
|
var _currentResource$_ext;
|
|
20
21
|
var cacheItem = _ref.cacheItem,
|
|
@@ -23,13 +24,13 @@ export var getDurationProps = function getDurationProps(_ref) {
|
|
|
23
24
|
slice = _ref.slice;
|
|
24
25
|
var _cacheItem = cacheItem;
|
|
25
26
|
return {
|
|
26
|
-
startDate: dayjs(dayjs(_cacheItem._extend.start_date).format(
|
|
27
|
+
startDate: dayjs(dayjs(_cacheItem._extend.start_date).format('YYYY-MM-DD ') + (getServeStartTime(useStartTime) || '00:00')),
|
|
27
28
|
usableTime: currentResource === null || currentResource === void 0 ? void 0 : (_currentResource$_ext = currentResource._extend) === null || _currentResource$_ext === void 0 ? void 0 : _currentResource$_ext.usableTime,
|
|
28
29
|
duration: getDuration(_cacheItem === null || _cacheItem === void 0 ? void 0 : _cacheItem.duration),
|
|
29
30
|
locale: locales.locale,
|
|
30
31
|
slice: slice,
|
|
31
32
|
selectProps: {
|
|
32
|
-
size:
|
|
33
|
+
size: 'large'
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
};
|
|
@@ -55,14 +56,14 @@ export var getFlexibleOption = function getFlexibleOption(_ref2) {
|
|
|
55
56
|
slice: slice
|
|
56
57
|
});
|
|
57
58
|
var _duration = _durationProps.duration;
|
|
58
|
-
if (_duration ===
|
|
59
|
+
if (_duration === 'flexible') {
|
|
59
60
|
var _durationProps$usable, _durationProps$usable2;
|
|
60
61
|
// 获取结束时间
|
|
61
62
|
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);
|
|
62
63
|
// 转换为分钟
|
|
63
|
-
var timeValue = endDate.diff(_durationProps.startDate,
|
|
64
|
+
var timeValue = endDate.diff(_durationProps.startDate, 'minute');
|
|
64
65
|
return {
|
|
65
|
-
label: locales.getText(
|
|
66
|
+
label: locales.getText('pisell2.text.flexible'),
|
|
66
67
|
value: flexibleObj.create(timeValue)
|
|
67
68
|
};
|
|
68
69
|
}
|
|
@@ -91,7 +92,7 @@ export var getTimeObj = function getTimeObj(_ref3) {
|
|
|
91
92
|
state: state,
|
|
92
93
|
durationProps: durationProps
|
|
93
94
|
});
|
|
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);
|
|
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, isDayBooking(state));
|
|
95
96
|
var timeSlices = _toConsumableArray(obj.timeSlices);
|
|
96
97
|
var durationSlicesBasedOnTime = _toConsumableArray(obj.durationSlicesBasedOnTime);
|
|
97
98
|
|
|
@@ -105,26 +106,26 @@ export var getTimeObj = function getTimeObj(_ref3) {
|
|
|
105
106
|
return d.value === useDuration;
|
|
106
107
|
})) {
|
|
107
108
|
durationSlicesBasedOnTime.unshift({
|
|
108
|
-
label: getDiscountTime(useDuration),
|
|
109
|
+
label: getDiscountTime(useDuration, isDayBooking(state)),
|
|
109
110
|
value: useDuration,
|
|
110
111
|
//@ts-ignore
|
|
111
112
|
disabled: true
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
115
|
// 如果有选择时间, 但是不在列表内 则需要在列表内添加上此值
|
|
115
|
-
if (useStartTime && useStartTime !==
|
|
116
|
+
if (useStartTime && useStartTime !== 'now' && !timeSlices.some(function (d) {
|
|
116
117
|
return d.value === useStartTime;
|
|
117
118
|
})) {
|
|
118
119
|
timeSlices.unshift({
|
|
119
|
-
label: dayjs(useStartTime,
|
|
120
|
+
label: dayjs(useStartTime, 'HH:mm').format('hh:mm A'),
|
|
120
121
|
value: useStartTime
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
// 增加当前
|
|
125
126
|
timeSlices.unshift({
|
|
126
|
-
label: locales.getText(
|
|
127
|
-
value:
|
|
127
|
+
label: locales.getText('pisell2.text.now'),
|
|
128
|
+
value: 'now'
|
|
128
129
|
});
|
|
129
130
|
return _objectSpread(_objectSpread({}, obj), {}, {
|
|
130
131
|
timeSlices: timeSlices,
|
|
@@ -141,7 +142,8 @@ export var getTimeObj = function getTimeObj(_ref3) {
|
|
|
141
142
|
*/
|
|
142
143
|
export var formatResources = function formatResources(_ref4) {
|
|
143
144
|
var cacheItem = _ref4.cacheItem,
|
|
144
|
-
resourcesOrigin = _ref4.resourcesOrigin
|
|
145
|
+
resourcesOrigin = _ref4.resourcesOrigin,
|
|
146
|
+
isDay = _ref4.isDay;
|
|
145
147
|
try {
|
|
146
148
|
// 合并无资源
|
|
147
149
|
var _list = _toConsumableArray(resourcesOrigin);
|
|
@@ -156,7 +158,7 @@ export var formatResources = function formatResources(_ref4) {
|
|
|
156
158
|
}), item.labelText, !item.usable && /*#__PURE__*/React.createElement(AlertTriangle, {
|
|
157
159
|
className: "resource-option-alert-icon"
|
|
158
160
|
}));
|
|
159
|
-
});
|
|
161
|
+
}, isDay);
|
|
160
162
|
});
|
|
161
163
|
// 排序, 将可用资源放在最前面
|
|
162
164
|
_list = _list.sort(function (a, b) {
|
|
@@ -164,7 +166,7 @@ export var formatResources = function formatResources(_ref4) {
|
|
|
164
166
|
});
|
|
165
167
|
return _list;
|
|
166
168
|
} catch (err) {
|
|
167
|
-
console.log(
|
|
169
|
+
console.log('formatResourcesErr', err);
|
|
168
170
|
}
|
|
169
171
|
return [];
|
|
170
172
|
};
|
|
@@ -175,21 +177,23 @@ export var checkCacheItemResource = function checkCacheItemResource(_ref5) {
|
|
|
175
177
|
if (resourceId || resourceId === 0) {
|
|
176
178
|
// 校验, 如果当前选择的资源 在列表里没找到, 则恢复成无资源, 防止数据错乱
|
|
177
179
|
if (!resources.find(function (d) {
|
|
178
|
-
return d.form_record_id === resourceId;
|
|
180
|
+
return (d === null || d === void 0 ? void 0 : d.form_record_id) === resourceId;
|
|
179
181
|
})) {
|
|
180
182
|
resourceId = undefined;
|
|
181
183
|
}
|
|
182
184
|
} else {
|
|
183
185
|
if (cacheItem.new) {
|
|
184
186
|
if (resources.length <= 2) {
|
|
185
|
-
|
|
187
|
+
var _resources;
|
|
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;
|
|
186
189
|
}
|
|
187
190
|
if (resources.length > 2) {
|
|
188
191
|
var usableList = resources.filter(function (d) {
|
|
189
192
|
return d.usable && d.form_id !== 0;
|
|
190
193
|
});
|
|
191
194
|
if (usableList.length === 1) {
|
|
192
|
-
|
|
195
|
+
var _usableList$;
|
|
196
|
+
resourceId = usableList === null || usableList === void 0 ? void 0 : (_usableList$ = usableList[0]) === null || _usableList$ === void 0 ? void 0 : _usableList$.form_record_id;
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
}
|
|
@@ -219,12 +223,13 @@ export var getProductExtend = function getProductExtend(_ref6) {
|
|
|
219
223
|
// 编辑时,找到当前选择的资源
|
|
220
224
|
if (!cacheItem.new) {
|
|
221
225
|
// 格式化资源列表
|
|
222
|
-
var
|
|
226
|
+
var _resources2 = formatResources({
|
|
223
227
|
cacheItem: cacheItem,
|
|
224
228
|
resourcesOrigin: resourcesOrigin
|
|
225
229
|
});
|
|
226
|
-
var item =
|
|
227
|
-
|
|
230
|
+
var item = _resources2.find(function (d) {
|
|
231
|
+
var _cacheItem$_extend;
|
|
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);
|
|
228
233
|
}) || {};
|
|
229
234
|
if (item) {
|
|
230
235
|
currentResource = item;
|
|
@@ -257,4 +262,24 @@ export var getProductExtend = function getProductExtend(_ref6) {
|
|
|
257
262
|
resources: resources
|
|
258
263
|
});
|
|
259
264
|
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) || '-';
|
|
260
285
|
};
|