@pisell/private-materials 3.0.42 → 3.0.44

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 (43) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +3 -3
  7. package/build/lowcode/render/default/view.js +6 -6
  8. package/build/lowcode/view.js +4 -4
  9. package/es/components/booking/addons/index.js +9 -1
  10. package/es/components/booking/components/TabProduct/productItem/index.js +11 -3
  11. package/es/components/booking/components/customSelect/index.d.ts +1 -0
  12. package/es/components/booking/components/customSelect/index.js +12 -3
  13. package/es/components/booking/forms/index.js +19 -12
  14. package/es/components/booking/info/client/index.js +3 -0
  15. package/es/components/booking/info/index.js +13 -5
  16. package/es/components/booking/info/notes/index.d.ts +1 -1
  17. package/es/components/booking/info/notes/index.js +5 -4
  18. package/es/components/booking/info/pet/index.js +16 -34
  19. package/es/components/booking/info/service/addService/index.js +89 -21
  20. package/es/components/booking/info/service/editService/index.js +28 -18
  21. package/es/components/booking/locales.d.ts +3 -0
  22. package/es/components/booking/locales.js +9 -6
  23. package/es/components/booking/model.d.ts +4 -2
  24. package/es/components/booking/notes/index.js +10 -8
  25. package/es/components/booking/utils.js +3 -3
  26. package/lib/components/booking/addons/index.js +8 -0
  27. package/lib/components/booking/components/TabProduct/productItem/index.js +7 -1
  28. package/lib/components/booking/components/customSelect/index.d.ts +1 -0
  29. package/lib/components/booking/components/customSelect/index.js +11 -2
  30. package/lib/components/booking/forms/index.js +10 -4
  31. package/lib/components/booking/info/client/index.js +3 -0
  32. package/lib/components/booking/info/index.js +4 -2
  33. package/lib/components/booking/info/notes/index.d.ts +1 -1
  34. package/lib/components/booking/info/notes/index.js +2 -1
  35. package/lib/components/booking/info/pet/index.js +10 -9
  36. package/lib/components/booking/info/service/addService/index.js +35 -9
  37. package/lib/components/booking/info/service/editService/index.js +20 -8
  38. package/lib/components/booking/locales.d.ts +3 -0
  39. package/lib/components/booking/locales.js +9 -6
  40. package/lib/components/booking/model.d.ts +4 -2
  41. package/lib/components/booking/notes/index.js +3 -2
  42. package/lib/components/booking/utils.js +3 -3
  43. package/package.json +3 -3
@@ -25,7 +25,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
25
25
  * @Date: 2024-01-30 16:33
26
26
  */
27
27
 
28
- import React, { useContext, useEffect, useMemo, useState } from "react";
28
+ import React, { useContext, useEffect, useMemo, useState, useRef } from "react";
29
29
  import SearchLg from "@pisell/icon/es/SearchLg";
30
30
  import { Input, Button, Skeleton } from "antd";
31
31
  import Drawer from "../components/drawer";
@@ -127,6 +127,7 @@ var Addons = Provider(function (props) {
127
127
  _useState6 = _slicedToArray(_useState5, 2),
128
128
  search = _useState6[0],
129
129
  setSearch = _useState6[1];
130
+ var searchRef = useRef();
130
131
  var context = useEngineContext();
131
132
  var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
132
133
  isTerminal = _ref.isTerminal,
@@ -421,6 +422,12 @@ var Addons = Provider(function (props) {
421
422
  showModal: true
422
423
  }
423
424
  });
425
+ if (!state.isTerminal) {
426
+ setTimeout(function () {
427
+ var _searchRef$current, _searchRef$current$fo;
428
+ (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : (_searchRef$current$fo = _searchRef$current.focus) === null || _searchRef$current$fo === void 0 ? void 0 : _searchRef$current$fo.call(_searchRef$current);
429
+ }, 100);
430
+ }
424
431
  };
425
432
 
426
433
  /**
@@ -545,6 +552,7 @@ var Addons = Provider(function (props) {
545
552
  header: /*#__PURE__*/React.createElement("div", {
546
553
  className: "pisell-lowcode__booking-service-header"
547
554
  }, /*#__PURE__*/React.createElement(Input, {
555
+ ref: searchRef,
548
556
  prefix: /*#__PURE__*/React.createElement(SearchLg, null),
549
557
  style: {
550
558
  marginTop: 16,
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { formatAmount, image } from "@pisell/utils";
1
+ import React, { useMemo } from "react";
2
+ import { formatAmount, image, locales } from "@pisell/utils";
3
3
  import classNames from "classnames";
4
4
  import { getDiscountTime } from "../../../utils";
5
5
  import "./index.less";
@@ -9,6 +9,12 @@ var ProductItem = function ProductItem(_ref) {
9
9
  amountSymbol = _ref.amountSymbol,
10
10
  style = _ref.style,
11
11
  className = _ref.className;
12
+ var stockText = useMemo(function () {
13
+ if (item.is_track === 0) {
14
+ return false;
15
+ }
16
+ return "".concat(item.stock_quantity, " ").concat(locales.getText("pisell2.text.stock"));
17
+ }, [item.stock_quantity, item.is_track]);
12
18
  return /*#__PURE__*/React.createElement("div", {
13
19
  style: style,
14
20
  className: classNames("server-product", className),
@@ -34,7 +40,9 @@ var ProductItem = function ProductItem(_ref) {
34
40
  // }}
35
41
  }, item.title), /*#__PURE__*/React.createElement("div", {
36
42
  className: "server-product-time"
37
- }, getDiscountTime(item.service_times)), /*#__PURE__*/React.createElement("div", {
43
+ }, getDiscountTime(item.service_times)), stockText && /*#__PURE__*/React.createElement("div", {
44
+ className: "server-product-time"
45
+ }, stockText), /*#__PURE__*/React.createElement("div", {
38
46
  className: "server-product-price"
39
47
  }, formatAmount(item.price, 2, amountSymbol))));
40
48
  };
@@ -28,6 +28,7 @@ interface CustomSelectProps {
28
28
  onVirtualListScroll?: any;
29
29
  modalOpen?: boolean;
30
30
  closeCallback?: () => any;
31
+ autoFocus?: boolean;
31
32
  }
32
33
  declare const _default: React.ForwardRefExoticComponent<CustomSelectProps & React.RefAttributes<unknown>>;
33
34
  export default _default;
@@ -9,7 +9,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
9
9
  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; }
10
10
  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; } }
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
- import React, { useEffect, useMemo, useState, useImperativeHandle, forwardRef } from "react";
12
+ import React, { useEffect, useMemo, useState, useImperativeHandle, forwardRef, useRef } from "react";
13
13
  import PlusCircle from "@pisell/icon/es/PlusCircle";
14
14
  import SearchLg from "@pisell/icon/es/SearchLg";
15
15
  import DotsVertical from "@pisell/icon/es/DotsVertical";
@@ -63,7 +63,9 @@ var CustomSelect = function CustomSelect(props, ref) {
63
63
  onVirtualListScroll = props.onVirtualListScroll,
64
64
  loadMore = props.loadMore,
65
65
  modalOpen = props.modalOpen,
66
- closeCallback = props.closeCallback;
66
+ closeCallback = props.closeCallback,
67
+ autoFocus = props.autoFocus;
68
+ var searchRef = useRef();
67
69
 
68
70
  // 当前选择的值
69
71
  var _useState = useState([]),
@@ -144,6 +146,12 @@ var CustomSelect = function CustomSelect(props, ref) {
144
146
  setOpen(true);
145
147
  // 初始化value
146
148
  initValue();
149
+ if (autoFocus) {
150
+ setTimeout(function () {
151
+ var _searchRef$current, _searchRef$current$fo;
152
+ (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : (_searchRef$current$fo = _searchRef$current.focus) === null || _searchRef$current$fo === void 0 ? void 0 : _searchRef$current$fo.call(_searchRef$current);
153
+ }, 100);
154
+ }
147
155
  };
148
156
 
149
157
  /**
@@ -229,7 +237,7 @@ var CustomSelect = function CustomSelect(props, ref) {
229
237
  if (filterItem) {
230
238
  return filterItem(d, search);
231
239
  }
232
- return isIncludes(d.key_name || "");
240
+ return isIncludes(d.main_field || "");
233
241
  });
234
242
  }
235
243
  return _list;
@@ -351,6 +359,7 @@ var CustomSelect = function CustomSelect(props, ref) {
351
359
  open: open,
352
360
  onClose: closeDrawer,
353
361
  header: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
362
+ ref: searchRef,
354
363
  prefix: /*#__PURE__*/React.createElement(SearchLg, null),
355
364
  style: {
356
365
  marginTop: 16,
@@ -27,9 +27,10 @@ import "./index.less";
27
27
  import { locales } from "@pisell/utils";
28
28
  import FormsCom from "./forms";
29
29
  import { isWalkIn } from "../utils";
30
+ import useEngineContext from "../../../hooks/useEngineContext";
30
31
  var relation_type = "appointment_booking";
31
32
  var Forms = Provider(function (props) {
32
- var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingDetail2, _state$bookingDetail3, _state$client, _state$client$value;
33
+ var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$bookingDetail2, _state$bookingDetail3, _state$client, _state$client$value;
33
34
  var globalState = props.globalState;
34
35
  var _useState = useState(true),
35
36
  _useState2 = _slicedToArray(_useState, 2),
@@ -38,6 +39,9 @@ var Forms = Provider(function (props) {
38
39
  var _useContext = useContext(Context),
39
40
  state = _useContext.state,
40
41
  dispatch = _useContext.dispatch;
42
+ var context = useEngineContext();
43
+ var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
44
+ isTerminal = _ref.isTerminal;
41
45
  var params = useMemo(function () {
42
46
  var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
43
47
  return state === null || state === void 0 ? void 0 : (_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.appointment_subject;
@@ -49,7 +53,7 @@ var Forms = Provider(function (props) {
49
53
  }
50
54
  }, [(_state$bookingDetail2 = state.bookingDetail) === null || _state$bookingDetail2 === void 0 ? void 0 : (_state$bookingDetail3 = _state$bookingDetail2.bookings) === null || _state$bookingDetail3 === void 0 ? void 0 : _state$bookingDetail3.id, (_state$client = state.client) === null || _state$client === void 0 ? void 0 : (_state$client$value = _state$client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id]);
51
55
  var getFormDataById = /*#__PURE__*/function () {
52
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item) {
56
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(item) {
53
57
  var _state$client2, _state$client2$value;
54
58
  var _params, options, isCustomerForm, data;
55
59
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -85,11 +89,11 @@ var Forms = Provider(function (props) {
85
89
  }, _callee);
86
90
  }));
87
91
  return function getFormDataById(_x2) {
88
- return _ref.apply(this, arguments);
92
+ return _ref2.apply(this, arguments);
89
93
  };
90
94
  }();
91
95
  var getFormData = /*#__PURE__*/function () {
92
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
96
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
93
97
  var formList,
94
98
  all,
95
99
  _args2 = arguments;
@@ -109,7 +113,7 @@ var Forms = Provider(function (props) {
109
113
  }, _callee2);
110
114
  }));
111
115
  return function getFormData() {
112
- return _ref2.apply(this, arguments);
116
+ return _ref3.apply(this, arguments);
113
117
  };
114
118
  }();
115
119
  var getFormValues = function getFormValues(data) {
@@ -129,7 +133,7 @@ var Forms = Provider(function (props) {
129
133
  return _values;
130
134
  };
131
135
  var geForms = /*#__PURE__*/function () {
132
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
136
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
133
137
  var data, formData;
134
138
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
135
139
  while (1) switch (_context3.prev = _context3.next) {
@@ -177,7 +181,7 @@ var Forms = Provider(function (props) {
177
181
  }, _callee3, null, [[1, 14]]);
178
182
  }));
179
183
  return function geForms() {
180
- return _ref3.apply(this, arguments);
184
+ return _ref4.apply(this, arguments);
181
185
  };
182
186
  }();
183
187
  useEffect(function () {
@@ -202,7 +206,7 @@ var Forms = Provider(function (props) {
202
206
  // type: single table multiple form
203
207
 
204
208
  var saveBookingFormData = /*#__PURE__*/function () {
205
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
209
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
206
210
  var data;
207
211
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
208
212
  while (1) switch (_context4.prev = _context4.next) {
@@ -229,7 +233,7 @@ var Forms = Provider(function (props) {
229
233
  }, _callee4, null, [[0, 8]]);
230
234
  }));
231
235
  return function saveBookingFormData(_x3) {
232
- return _ref4.apply(this, arguments);
236
+ return _ref5.apply(this, arguments);
233
237
  };
234
238
  }();
235
239
  var onValueChange = function onValueChange(data) {
@@ -252,7 +256,7 @@ var Forms = Provider(function (props) {
252
256
  });
253
257
  };
254
258
  var addCallback = /*#__PURE__*/function () {
255
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(form) {
259
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(form) {
256
260
  var _data, data;
257
261
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
258
262
  while (1) switch (_context5.prev = _context5.next) {
@@ -278,7 +282,7 @@ var Forms = Provider(function (props) {
278
282
  }, _callee5);
279
283
  }));
280
284
  return function addCallback(_x4) {
281
- return _ref5.apply(this, arguments);
285
+ return _ref6.apply(this, arguments);
282
286
  };
283
287
  }();
284
288
  return /*#__PURE__*/React.createElement(React.Fragment, null, !!state.setGlobalState ? /*#__PURE__*/React.createElement(TabPane, {
@@ -292,7 +296,10 @@ var Forms = Provider(function (props) {
292
296
  value: state.form.value,
293
297
  onChange: onValueChange,
294
298
  addCallback: addCallback,
295
- client: state.client.value
299
+ client: state.client.value,
300
+ customSelectProps: {
301
+ autoFocus: !state.isTerminal
302
+ }
296
303
  })) : null);
297
304
  });
298
305
  export default Forms;
@@ -30,6 +30,7 @@ import CustomSelect from "../../components/customSelect";
30
30
  import "./index.less";
31
31
  import { image, locales } from "@pisell/utils";
32
32
  import { isWalkIn as getIsWalkIn } from "../../utils";
33
+ import useEngineContext from "../../../../hooks/useEngineContext";
33
34
  var Info = function Info() {
34
35
  var _state$client$value2, _state$client$value3, _state$client$value4, _state$client$value5, _state$client$value6, _state$client$value7;
35
36
  var modalRef = useRef();
@@ -53,6 +54,7 @@ var Info = function Info() {
53
54
  _useState6 = _slicedToArray(_useState5, 2),
54
55
  params = _useState6[0],
55
56
  setParams = _useState6[1];
57
+ var context = useEngineContext();
56
58
  var menus = useMemo(function () {
57
59
  var list = [{
58
60
  key: "view",
@@ -314,6 +316,7 @@ var Info = function Info() {
314
316
  }, /*#__PURE__*/React.createElement(DotsVertical, {
315
317
  className: "pisell-lowcode__booking-client-menu-icon"
316
318
  })))))), /*#__PURE__*/React.createElement(CustomSelect, {
319
+ autoFocus: !state.isTerminal,
317
320
  modalOpen: state.modalOpen,
318
321
  ref: modalRef,
319
322
  rowKey: "id",
@@ -30,7 +30,7 @@ var defaultModules = {
30
30
  };
31
31
  locales.init(localeTexts, localStorage.getItem("umi_locale") || "en");
32
32
  var Info = Provider(function (props) {
33
- var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state4, _modal$state4$notes, _context$appHelper, _context$appHelper$ut, _modal$state5, _React$createElement;
33
+ var _modal$state2, _modal$state2$booking, _modal$state2$booking2, _modal$state2$booking3, _modal$state4, _modal$state4$notes, _context$appHelper2, _context$appHelper2$u, _modal$state5, _React$createElement;
34
34
  // return <Payments {...props} />;
35
35
  var style = props.style,
36
36
  globalState = props.globalState,
@@ -60,11 +60,14 @@ var Info = Provider(function (props) {
60
60
  }
61
61
  }, []);
62
62
  useEffect(function () {
63
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2;
63
64
  modal.dispatch({
64
65
  type: "setState",
65
- payload: _objectSpread({
66
+ payload: _objectSpread(_objectSpread({
66
67
  setGlobalState: props.setGlobalState
67
- }, globalState)
68
+ }, globalState), {}, {
69
+ isTerminal: context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.isTerminal) === null || _context$appHelper$ut2 === void 0 ? void 0 : _context$appHelper$ut2.call(_context$appHelper$ut)
70
+ })
68
71
  });
69
72
  }, [globalState]);
70
73
  var addNote = function addNote(e) {
@@ -83,7 +86,12 @@ var Info = Provider(function (props) {
83
86
  return globalState !== null && globalState !== void 0 && globalState.bookingId ? /*#__PURE__*/React.createElement(Header, {
84
87
  state: modal.state,
85
88
  dispatch: modal.dispatch
86
- }) : locales.getText("pisell2.text.new-appointment");
89
+ }) : /*#__PURE__*/React.createElement("div", {
90
+ className: "",
91
+ style: {
92
+ height: 20
93
+ }
94
+ });
87
95
  }, [globalState === null || globalState === void 0 ? void 0 : globalState.bookingId, modal.state, modal.dispatch, globalState === null || globalState === void 0 ? void 0 : globalState.renderType]);
88
96
  var notes = useMemo(function () {
89
97
  var _modal$state3, _modal$state3$notes;
@@ -104,7 +112,7 @@ var Info = Provider(function (props) {
104
112
  source: "info"
105
113
  })
106
114
  }, _defineProperty(_React$createElement, "style", {
107
- height: context !== null && context !== void 0 && (_context$appHelper = context.appHelper) !== null && _context$appHelper !== void 0 && (_context$appHelper$ut = _context$appHelper.utils) !== null && _context$appHelper$ut !== void 0 && _context$appHelper$ut.isMobile ? "100%" : "100vh"
115
+ height: context !== null && context !== void 0 && (_context$appHelper2 = context.appHelper) !== null && _context$appHelper2 !== void 0 && (_context$appHelper2$u = _context$appHelper2.utils) !== null && _context$appHelper2$u !== void 0 && _context$appHelper2$u.isMobile ? "100%" : "100vh"
108
116
  }), _defineProperty(_React$createElement, "bodyClassName", "booking-info-warp"), _React$createElement), /*#__PURE__*/React.createElement("div", {
109
117
  className: "booking-info"
110
118
  }, modules.client ? /*#__PURE__*/React.createElement(Client, null) : null, modules.holder && !((_modal$state5 = modal.state) !== null && _modal$state5 !== void 0 && _modal$state5.disabledEdit) ? /*#__PURE__*/React.createElement(React.Fragment, null, params.type === "form" ? /*#__PURE__*/React.createElement(Pet, null) : null) : null, modules.date ? /*#__PURE__*/React.createElement(DateCom, null) : null, modules.service ? /*#__PURE__*/React.createElement(React.Fragment, null, modal.state.date.value ? /*#__PURE__*/React.createElement(Service, null) : null) : null, notes, slot ? slot : null)) : null);
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  declare const Notes: () => React.JSX.Element;
3
3
  export default Notes;
@@ -4,12 +4,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
5
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
6
  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; }
7
- import React, { useContext, useMemo } from 'react';
7
+ import React, { useContext, useMemo } from "react";
8
8
  import { Context } from "../model";
9
9
  import { locales } from "@pisell/utils";
10
10
  import NoteBlock from "../../notes/NoteBlock";
11
11
  var Notes = function Notes() {
12
- var _modal$state3, _modal$state3$notes, _modal$state5;
12
+ var _modal$state3, _modal$state3$notes, _modal$state6;
13
13
  var modal = useContext(Context);
14
14
  var orderNote = useMemo(function () {
15
15
  var _modal$state, _modal$state$notes, _modal$state2, _modal$state2$notes;
@@ -26,7 +26,7 @@ var Notes = function Notes() {
26
26
  status = _ref.status,
27
27
  noteType = _ref.noteType;
28
28
  if (noteType === "internal") {
29
- var _modal$state4;
29
+ var _modal$state4, _modal$state5, _modal$state5$refresh;
30
30
  var _list = _toConsumableArray((_modal$state4 = modal.state) === null || _modal$state4 === void 0 ? void 0 : _modal$state4.notes.internalNotes);
31
31
  if (status == "add") {
32
32
  _list.push(note);
@@ -50,6 +50,7 @@ var Notes = function Notes() {
50
50
  internalNotes: _list
51
51
  }
52
52
  });
53
+ (_modal$state5 = modal.state) === null || _modal$state5 === void 0 ? void 0 : (_modal$state5$refresh = _modal$state5.refreshData) === null || _modal$state5$refresh === void 0 ? void 0 : _modal$state5$refresh.call(_modal$state5, {});
53
54
  return;
54
55
  }
55
56
  if (noteType === "order") {
@@ -68,7 +69,7 @@ var Notes = function Notes() {
68
69
  title: "".concat(locales.getText("pisell2.text.order-notes"), ":"),
69
70
  describe: "",
70
71
  notes: orderNote,
71
- apis: modal === null || modal === void 0 ? void 0 : (_modal$state5 = modal.state) === null || _modal$state5 === void 0 ? void 0 : _modal$state5.apis,
72
+ apis: modal === null || modal === void 0 ? void 0 : (_modal$state6 = modal.state) === null || _modal$state6 === void 0 ? void 0 : _modal$state6.apis,
72
73
  placeholder: locales.getText("pisell2.text.add-order-notes"),
73
74
  isEdit: true,
74
75
  onChange: function onChange(e, type, noteType) {
@@ -27,8 +27,9 @@ import { locales } from "@pisell/utils";
27
27
  import FormsCom from "../../forms/forms";
28
28
  import { changeFormValues } from "../../forms/format";
29
29
  import { isWalkIn } from "../../utils";
30
+ import useEngineContext from "../../../../hooks/useEngineContext";
30
31
  var Pet = function Pet() {
31
- var _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$client$value2, _state$client8, _state$client8$value, _state$client9;
32
+ var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig4, _state$client$value2, _state$client8, _state$client8$value, _state$client9;
32
33
  var _useState = useState(false),
33
34
  _useState2 = _slicedToArray(_useState, 2),
34
35
  loading = _useState2[0],
@@ -40,31 +41,15 @@ var Pet = function Pet() {
40
41
  _useState4 = _slicedToArray(_useState3, 2),
41
42
  valueLoading = _useState4[0],
42
43
  setValueLoading = _useState4[1];
43
-
44
+ var context = useEngineContext();
45
+ var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
46
+ isTerminal = _ref.isTerminal;
44
47
  // board设置, 获取预约主体
45
48
  var params = useMemo(function () {
46
49
  var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
47
50
  return (state === null || state === void 0 ? void 0 : (_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.appointment_subject) || {};
48
51
  }, [state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : (_state$bookingConfig4 = _state$bookingConfig3.basic) === null || _state$bookingConfig4 === void 0 ? void 0 : _state$bookingConfig4.appointment_subject]);
49
52
 
50
- // useEffect(() => {
51
- // if (state.pet.originValue && state.pet.pets.length) {
52
- // let _val = {
53
- // [state.pet.originValue.form_id]: (state.pet.pets || []).filter((d) =>
54
- // (state.pet.originValue?.form_record || []).includes(d.form_record_id)
55
- // ),
56
- // };
57
- // console.log("_val", state.pet.originValue, state.pet.pets);
58
- // dispatch({
59
- // type: "setPet",
60
- // payload: {
61
- // value: _val,
62
- // originValue: null,
63
- // },
64
- // });
65
- // }
66
- // }, [state.pet.originValue, state.pet.pets]);
67
-
68
53
  /**
69
54
  * @title: 预约主体
70
55
  * @description:
@@ -86,13 +71,13 @@ var Pet = function Pet() {
86
71
  * @Date: 2024-01-27 14:22
87
72
  */
88
73
  var getFormData = /*#__PURE__*/function () {
89
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
74
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
90
75
  var _state$client, _state$client$value;
91
76
  var formData, _list, noClient, _params, _state$client2, _state$client2$value, data;
92
77
  return _regeneratorRuntime().wrap(function _callee$(_context) {
93
78
  while (1) switch (_context.prev = _context.next) {
94
79
  case 0:
95
- formData = _ref.formData;
80
+ formData = _ref2.formData;
96
81
  setLoading(true);
97
82
  _list = []; // 只要不是 客户表单并且没选择客户, 都获取数据
98
83
  noClient = formData.data_range === "customer" && isWalkIn((_state$client = state.client) === null || _state$client === void 0 ? void 0 : (_state$client$value = _state$client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id);
@@ -118,12 +103,8 @@ var Pet = function Pet() {
118
103
  type: "setPet",
119
104
  payload: {
120
105
  formData: [_objectSpread(_objectSpread({}, formData), {}, {
121
- // ...formData.form,
122
- // form_id: formData.form.id,
123
106
  options: _list
124
- // type: formData.type,
125
107
  })],
126
-
127
108
  pets: _list
128
109
  }
129
110
  });
@@ -135,7 +116,7 @@ var Pet = function Pet() {
135
116
  }, _callee);
136
117
  }));
137
118
  return function getFormData(_x2) {
138
- return _ref2.apply(this, arguments);
119
+ return _ref3.apply(this, arguments);
139
120
  };
140
121
  }();
141
122
 
@@ -147,7 +128,7 @@ var Pet = function Pet() {
147
128
  * @Date: 2024-01-27 14:20
148
129
  */
149
130
  var getForms = /*#__PURE__*/function () {
150
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
131
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
151
132
  var isUpdateValue,
152
133
  values,
153
134
  isSetValue,
@@ -212,7 +193,7 @@ var Pet = function Pet() {
212
193
  }, _callee2, null, [[4, 14]]);
213
194
  }));
214
195
  return function getForms() {
215
- return _ref3.apply(this, arguments);
196
+ return _ref4.apply(this, arguments);
216
197
  };
217
198
  }();
218
199
  var handleViewItem = function handleViewItem(item) {
@@ -286,10 +267,10 @@ var Pet = function Pet() {
286
267
  * @Author: zhiwei.Wang
287
268
  * @Date: 2024-01-27 14:16
288
269
  */
289
- var onValueChange = function onValueChange(_ref4) {
290
- var values = _ref4.values,
291
- _ref4$edit = _ref4.edit,
292
- edit = _ref4$edit === void 0 ? true : _ref4$edit;
270
+ var onValueChange = function onValueChange(_ref5) {
271
+ var values = _ref5.values,
272
+ _ref5$edit = _ref5.edit,
273
+ edit = _ref5$edit === void 0 ? true : _ref5$edit;
293
274
  dispatch({
294
275
  type: "setPet",
295
276
  payload: {
@@ -361,7 +342,8 @@ var Pet = function Pet() {
361
342
  loading: loading,
362
343
  handleViewItem: handleViewItem,
363
344
  virtualListHeight: window.innerHeight - 213 - 57 - 16,
364
- disabled: state.disabledEdit
345
+ disabled: state.disabledEdit,
346
+ autoFocus: !state.isTerminal
365
347
  },
366
348
  optionRender: function optionRender(item) {
367
349
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Avatar, {