@pisell/private-materials 3.0.37 → 3.0.39

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.
@@ -27,7 +27,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
27
27
 
28
28
  import React, { useContext, useEffect, useMemo, useState } from "react";
29
29
  import SearchLg from "@pisell/icon/es/SearchLg";
30
- import { Input, Button } from "antd";
30
+ import { Input, Button, Skeleton } from "antd";
31
31
  import Drawer from "../components/drawer";
32
32
  import TabPane from "../components/tabPane";
33
33
  import { Context, Provider } from "./model";
@@ -119,10 +119,14 @@ var Addons = Provider(function (props) {
119
119
  _useState2 = _slicedToArray(_useState, 2),
120
120
  loading = _useState2[0],
121
121
  setLoading = _useState2[1];
122
- var _useState3 = useState(""),
122
+ var _useState3 = useState(false),
123
123
  _useState4 = _slicedToArray(_useState3, 2),
124
- search = _useState4[0],
125
- setSearch = _useState4[1];
124
+ listLoading = _useState4[0],
125
+ setListLoading = _useState4[1];
126
+ var _useState5 = useState(""),
127
+ _useState6 = _slicedToArray(_useState5, 2),
128
+ search = _useState6[0],
129
+ setSearch = _useState6[1];
126
130
  var context = useEngineContext();
127
131
  var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
128
132
  isTerminal = _ref.isTerminal,
@@ -150,7 +154,6 @@ var Addons = Provider(function (props) {
150
154
  * @Date: 2024-01-30 16:34
151
155
  */
152
156
  var init = function init() {
153
- getProducts();
154
157
  getAddonsByOrderId();
155
158
  };
156
159
  useEffect(function () {
@@ -221,7 +224,8 @@ var Addons = Provider(function (props) {
221
224
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
222
225
  while (1) switch (_context2.prev = _context2.next) {
223
226
  case 0:
224
- _context2.next = 2;
227
+ setListLoading(true);
228
+ _context2.next = 3;
225
229
  return state.apis.getProducts({
226
230
  skip: 1,
227
231
  num: 500,
@@ -233,17 +237,21 @@ var Addons = Provider(function (props) {
233
237
  // include_variant: "no",
234
238
  open_quotation: 1,
235
239
  with_schedule: 0,
236
- with_count: ["bundleGroup", "optionGroup"]
240
+ with_count: ["bundleGroup", "optionGroup"],
241
+ _config: {
242
+ useCache: true
243
+ }
237
244
  });
238
- case 2:
245
+ case 3:
239
246
  data = _context2.sent;
247
+ setListLoading(false);
240
248
  dispatch({
241
249
  type: "setAddons",
242
250
  payload: {
243
251
  originData: (data === null || data === void 0 ? void 0 : data.list) || []
244
252
  }
245
253
  });
246
- case 4:
254
+ case 6:
247
255
  case "end":
248
256
  return _context2.stop();
249
257
  }
@@ -266,7 +274,7 @@ var Addons = Provider(function (props) {
266
274
  var _list = _toConsumableArray(state.addons.value);
267
275
 
268
276
  // 是否有单规格 组合规格 套餐, 如果没有不需要打开弹窗
269
- var isEject = type === "detail" || item.option_group_count > 0 || item.bundle_group_count > 0 || item.variant_count > 0;
277
+ var isEject = type === "detail" || item.bundle_group_count > 0;
270
278
  state.action({
271
279
  type: "pisell1.handleOpenProductModal",
272
280
  data: {
@@ -405,6 +413,7 @@ var Addons = Provider(function (props) {
405
413
  }
406
414
  });
407
415
  }
416
+ getProducts();
408
417
  setSearch("");
409
418
  dispatch({
410
419
  type: "setAddons",
@@ -543,11 +552,18 @@ var Addons = Provider(function (props) {
543
552
  }))
544
553
  }, /*#__PURE__*/React.createElement("div", {
545
554
  className: "pisell-lowcode__booking-service-body"
555
+ }, /*#__PURE__*/React.createElement(Skeleton, {
556
+ loading: listLoading,
557
+ active: true,
558
+ round: true,
559
+ style: {
560
+ padding: 20
561
+ }
546
562
  }, /*#__PURE__*/React.createElement(TabProduct, {
547
563
  scrollDom: ".booking-addons-wrap .pisell-lowcode-drawer-body",
548
564
  list: renderList,
549
565
  amountSymbol: state.amountSymbol,
550
566
  onChange: handleAddProduct
551
- }))))));
567
+ })))))));
552
568
  });
553
569
  export default Addons;
@@ -17,21 +17,21 @@ var ProductItem = function ProductItem(_ref) {
17
17
  }
18
18
  }, item.cover ? /*#__PURE__*/React.createElement("img", {
19
19
  src: image.ali(item.cover, 100),
20
- className: "server-product-cover",
21
- onClick: function onClick(e) {
22
- e.preventDefault();
23
- e.stopPropagation();
24
- _onClick(item, "detail");
25
- }
20
+ className: "server-product-cover"
21
+ // onClick={(e) => {
22
+ // e.preventDefault();
23
+ // e.stopPropagation();
24
+ // onClick(item, "detail");
25
+ // }}
26
26
  }) : null, /*#__PURE__*/React.createElement("div", {
27
27
  className: "server-product-content"
28
28
  }, /*#__PURE__*/React.createElement("span", {
29
- className: "server-product-title",
30
- onClick: function onClick(e) {
31
- e.preventDefault();
32
- e.stopPropagation();
33
- _onClick(item, "detail");
34
- }
29
+ className: "server-product-title"
30
+ // onClick={(e) => {
31
+ // e.preventDefault();
32
+ // e.stopPropagation();
33
+ // onClick(item, "detail");
34
+ // }}
35
35
  }, item.title), /*#__PURE__*/React.createElement("div", {
36
36
  className: "server-product-time"
37
37
  }, getDiscountTime(item.service_times)), /*#__PURE__*/React.createElement("div", {
@@ -331,9 +331,19 @@ var CustomSelect = function CustomSelect(props, ref) {
331
331
  className: "pisell-lowcode__custom-select-card-menu-icon"
332
332
  })))));
333
333
  })), isShowAddButton ? addButtonRender ? addButtonRender() : /*#__PURE__*/React.createElement(AddButton, _extends({
334
- showSub: isMore,
335
- onClick: handleOpenModal
336
- }, addButtonProps)) : disabled ? /*#__PURE__*/React.createElement("div", {
334
+ showSub: isMore
335
+ }, addButtonProps, {
336
+ onClick: function onClick() {
337
+ if (addButtonProps.addCallback) {
338
+ addButtonProps === null || addButtonProps === void 0 ? void 0 : addButtonProps.addCallback();
339
+ }
340
+ if (addButtonProps.onClick) {
341
+ addButtonProps.onClick();
342
+ return;
343
+ }
344
+ handleOpenModal();
345
+ }
346
+ })) : disabled ? /*#__PURE__*/React.createElement("div", {
337
347
  style: {
338
348
  height: 20
339
349
  }
@@ -132,6 +132,10 @@ var Info = function Info() {
132
132
  if (state.disabledEdit) {
133
133
  return;
134
134
  }
135
+ getClients(_objectSpread(_objectSpread({}, params), {}, {
136
+ search: "",
137
+ skip: 1
138
+ }));
135
139
  (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.open();
136
140
  };
137
141
  var getNickname = useCallback(function (item) {
@@ -210,12 +214,7 @@ var Info = function Info() {
210
214
  var _state$client$value;
211
215
  return getIsWalkIn((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id);
212
216
  }, [(_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.id]);
213
- useEffect(function () {
214
- getClients(_objectSpread(_objectSpread({}, params), {}, {
215
- search: "",
216
- skip: 1
217
- }));
218
- }, []);
217
+ useEffect(function () {}, []);
219
218
  useEffect(function () {
220
219
  if (state.action) {
221
220
  state.action({
@@ -117,11 +117,13 @@ var Pet = function Pet() {
117
117
  dispatch({
118
118
  type: "setPet",
119
119
  payload: {
120
- formData: [_objectSpread(_objectSpread(_objectSpread({}, formData), formData.form), {}, {
121
- form_id: formData.form.id,
122
- options: _list,
123
- type: formData.type
120
+ formData: [_objectSpread(_objectSpread({}, formData), {}, {
121
+ // ...formData.form,
122
+ // form_id: formData.form.id,
123
+ options: _list
124
+ // type: formData.type,
124
125
  })],
126
+
125
127
  pets: _list
126
128
  }
127
129
  });
@@ -152,25 +154,26 @@ var Pet = function Pet() {
152
154
  _state$bookingDetail,
153
155
  _state$bookingDetail$,
154
156
  formData,
157
+ payload,
155
158
  _args2 = arguments;
156
159
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
157
160
  while (1) switch (_context2.prev = _context2.next) {
158
161
  case 0:
159
162
  isUpdateValue = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : true;
160
- setLoading(true);
163
+ // setLoading(true);
161
164
  values = _objectSpread({}, state.pet.value);
162
165
  isSetValue = isUpdateValue && values[params === null || params === void 0 ? void 0 : params.form_id] === undefined;
163
166
  if (isSetValue) {
164
167
  setValueLoading(true);
165
168
  }
166
- _context2.prev = 5;
167
- _context2.next = 8;
169
+ _context2.prev = 4;
170
+ _context2.next = 7;
168
171
  return state.apis.getForms({
169
- relation_type: state.renderType === 'eventBooking' ? "event_booking_v2" : "appointment_booking",
172
+ relation_type: state.renderType === "eventBooking" ? "event_booking_v2" : "appointment_booking",
170
173
  relation_id: ((_state$bookingDetail = state.bookingDetail) === null || _state$bookingDetail === void 0 ? void 0 : (_state$bookingDetail$ = _state$bookingDetail.bookings) === null || _state$bookingDetail$ === void 0 ? void 0 : _state$bookingDetail$.id) || 0
171
174
  // _config: { useCache: true },
172
175
  });
173
- case 8:
176
+ case 7:
174
177
  formData = _context2.sent;
175
178
  // 只要预约主体
176
179
  formData = (formData || []).filter(function (d) {
@@ -178,36 +181,35 @@ var Pet = function Pet() {
178
181
  })[0];
179
182
 
180
183
  // 获取当前预约中填写的值, 只在第一次执行
184
+ payload = {
185
+ formData: [_objectSpread(_objectSpread(_objectSpread({}, formData), formData.form), {}, {
186
+ form_id: formData.form.id,
187
+ options: [],
188
+ type: formData.type
189
+ })]
190
+ };
181
191
  if (isSetValue) {
182
192
  values[params === null || params === void 0 ? void 0 : params.form_id] = formData.form_record;
193
+ payload.value = values;
183
194
  setValueLoading(false);
184
- dispatch({
185
- type: "setPet",
186
- payload: {
187
- value: values
188
- }
189
- });
190
195
  }
191
-
192
- // 获取表单下的数据
193
- _context2.next = 13;
194
- return getFormData({
195
- formData: formData
196
+ dispatch({
197
+ type: "setPet",
198
+ payload: payload
196
199
  });
197
- case 13:
198
- _context2.next = 20;
200
+ _context2.next = 19;
199
201
  break;
200
- case 15:
201
- _context2.prev = 15;
202
- _context2.t0 = _context2["catch"](5);
202
+ case 14:
203
+ _context2.prev = 14;
204
+ _context2.t0 = _context2["catch"](4);
203
205
  setValueLoading(false);
204
206
  setLoading(false);
205
207
  console.log("form_error", _context2.t0);
206
- case 20:
208
+ case 19:
207
209
  case "end":
208
210
  return _context2.stop();
209
211
  }
210
- }, _callee2, null, [[5, 15]]);
212
+ }, _callee2, null, [[4, 14]]);
211
213
  }));
212
214
  return function getForms() {
213
215
  return _ref3.apply(this, arguments);
@@ -325,10 +327,19 @@ var Pet = function Pet() {
325
327
  getForms(true);
326
328
  }
327
329
  }, [state.bookingId, state.bookingDetail, params.form_id, params.type, (_state$client8 = state.client) === null || _state$client8 === void 0 ? void 0 : (_state$client8$value = _state$client8.value) === null || _state$client8$value === void 0 ? void 0 : _state$client8$value.id]);
330
+ var _addCallback = function addCallback() {
331
+ var _state$pet3, _state$pet3$formData;
332
+ var _formData = (_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[0];
333
+ if ((_formData === null || _formData === void 0 ? void 0 : _formData.type) === "multiple" || (_formData === null || _formData === void 0 ? void 0 : _formData.type) === "single") {
334
+ getFormData({
335
+ formData: _formData
336
+ });
337
+ }
338
+ };
328
339
  return /*#__PURE__*/React.createElement("div", {
329
340
  className: "pisell-lowcode__booking-pet-wraps"
330
341
  }, /*#__PURE__*/React.createElement(Skeleton, {
331
- loading: loading,
342
+ loading: valueLoading,
332
343
  active: true,
333
344
  round: true
334
345
  }, /*#__PURE__*/React.createElement(FormsCom, {
@@ -337,7 +348,7 @@ var Pet = function Pet() {
337
348
  value: state.pet.value
338
349
  },
339
350
  addCallback: function addCallback() {
340
- getForms(false);
351
+ _addCallback();
341
352
  },
342
353
  loading: valueLoading,
343
354
  forms: state.pet.formData,
@@ -347,7 +358,7 @@ var Pet = function Pet() {
347
358
  onChange: onValueChange,
348
359
  client: (_state$client9 = state.client) === null || _state$client9 === void 0 ? void 0 : _state$client9.value,
349
360
  customSelectProps: {
350
- // loading: loading,
361
+ loading: loading,
351
362
  handleViewItem: handleViewItem,
352
363
  virtualListHeight: window.innerHeight - 213 - 57 - 16,
353
364
  disabled: state.disabledEdit
@@ -388,7 +399,24 @@ var Pet = function Pet() {
388
399
  addButtonProps: {
389
400
  style: {
390
401
  margin: 0
391
- }
402
+ },
403
+ addCallback: function () {
404
+ var _addCallback2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
405
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
406
+ while (1) switch (_context3.prev = _context3.next) {
407
+ case 0:
408
+ _addCallback();
409
+ case 1:
410
+ case "end":
411
+ return _context3.stop();
412
+ }
413
+ }, _callee3);
414
+ }));
415
+ function addCallback() {
416
+ return _addCallback2.apply(this, arguments);
417
+ }
418
+ return addCallback;
419
+ }()
392
420
  }
393
421
  })));
394
422
  };
@@ -150,7 +150,10 @@ var Info = function Info() {
150
150
  ids: state.renderType === "eventBooking" ? (_state$eventOtherPara = state.eventOtherParams) === null || _state$eventOtherPara === void 0 ? void 0 : _state$eventOtherPara.productIds : undefined,
151
151
  open_quotation: 1,
152
152
  with_schedule: 1,
153
- with_count: ["bundleGroup", "optionGroup"]
153
+ with_count: ["bundleGroup", "optionGroup"],
154
+ _config: {
155
+ useCache: true
156
+ }
154
157
  });
155
158
  case 3:
156
159
  data = _context2.sent;
@@ -173,6 +176,7 @@ var Info = function Info() {
173
176
  };
174
177
  }();
175
178
  var handleSelectService = function handleSelectService() {
179
+ getServices();
176
180
  setSearch("");
177
181
  dispatch({
178
182
  type: "setService",
@@ -183,7 +187,7 @@ var Info = function Info() {
183
187
  };
184
188
  var handleSelectProduct = function handleSelectProduct(item, type) {
185
189
  // 是否有单规格 组合规格 套餐, 如果没有不需要打开弹窗
186
- var isEject = type === "detail" || item.option_group_count > 0 || item.bundle_group_count > 0 || item.variant_count > 0;
190
+ var isEject = type === "detail" || item.bundle_group_count > 0;
187
191
  state.action({
188
192
  type: "pisell1.handleOpenProductModal",
189
193
  data: {
@@ -246,16 +250,9 @@ var Info = function Info() {
246
250
  var isService = useMemo(function () {
247
251
  return state.service.value.length > 0;
248
252
  }, [state.service.value]);
249
-
250
- /**
251
- * 页面加完完毕 和 弹窗打开时 均调用下接口 更新数据
252
- */
253
- useEffect(function () {
254
- getServices();
255
- }, []);
256
253
  useEffect(function () {
257
254
  if (state.modalOpen) {
258
- getServices();
255
+ // getServices();
259
256
  }
260
257
  }, [state.modalOpen]);
261
258
  var showAddButton = useMemo(function () {
@@ -123,6 +123,7 @@ var Addons = (0, import_model.Provider)((props) => {
123
123
  const { globalState } = props;
124
124
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
125
125
  const [loading, setLoading] = (0, import_react.useState)(false);
126
+ const [listLoading, setListLoading] = (0, import_react.useState)(false);
126
127
  const [search, setSearch] = (0, import_react.useState)("");
127
128
  const context = (0, import_useEngineContext.default)();
128
129
  const { isTerminal, interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
@@ -143,7 +144,6 @@ var Addons = (0, import_model.Provider)((props) => {
143
144
  });
144
145
  }, [globalState]);
145
146
  const init = () => {
146
- getProducts();
147
147
  getAddonsByOrderId();
148
148
  };
149
149
  (0, import_react.useEffect)(() => {
@@ -177,6 +177,7 @@ var Addons = (0, import_model.Provider)((props) => {
177
177
  setLoading(false);
178
178
  };
179
179
  const getProducts = async () => {
180
+ setListLoading(true);
180
181
  let data = await state.apis.getProducts({
181
182
  skip: 1,
182
183
  num: 500,
@@ -193,8 +194,12 @@ var Addons = (0, import_model.Provider)((props) => {
193
194
  // include_variant: "no",
194
195
  open_quotation: 1,
195
196
  with_schedule: 0,
196
- with_count: ["bundleGroup", "optionGroup"]
197
+ with_count: ["bundleGroup", "optionGroup"],
198
+ _config: {
199
+ useCache: true
200
+ }
197
201
  });
202
+ setListLoading(false);
198
203
  dispatch({
199
204
  type: "setAddons",
200
205
  payload: {
@@ -204,7 +209,7 @@ var Addons = (0, import_model.Provider)((props) => {
204
209
  };
205
210
  const handleAddProduct = (item, type) => {
206
211
  let _list = [...state.addons.value];
207
- const isEject = type === "detail" || item.option_group_count > 0 || item.bundle_group_count > 0 || item.variant_count > 0;
212
+ const isEject = type === "detail" || item.bundle_group_count > 0;
208
213
  state.action({
209
214
  type: "pisell1.handleOpenProductModal",
210
215
  data: {
@@ -306,6 +311,7 @@ var Addons = (0, import_model.Provider)((props) => {
306
311
  }
307
312
  });
308
313
  }
314
+ getProducts();
309
315
  setSearch("");
310
316
  dispatch({
311
317
  type: "setAddons",
@@ -439,13 +445,22 @@ var Addons = (0, import_model.Provider)((props) => {
439
445
  ))
440
446
  },
441
447
  /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body" }, /* @__PURE__ */ import_react.default.createElement(
442
- import_TabProduct.default,
448
+ import_antd.Skeleton,
443
449
  {
444
- scrollDom: ".booking-addons-wrap .pisell-lowcode-drawer-body",
445
- list: renderList,
446
- amountSymbol: state.amountSymbol,
447
- onChange: handleAddProduct
448
- }
450
+ loading: listLoading,
451
+ active: true,
452
+ round: true,
453
+ style: { padding: 20 }
454
+ },
455
+ /* @__PURE__ */ import_react.default.createElement(
456
+ import_TabProduct.default,
457
+ {
458
+ scrollDom: ".booking-addons-wrap .pisell-lowcode-drawer-body",
459
+ list: renderList,
460
+ amountSymbol: state.amountSymbol,
461
+ onChange: handleAddProduct
462
+ }
463
+ )
449
464
  ))
450
465
  ))
451
466
  ));
@@ -57,23 +57,13 @@ var ProductItem = ({
57
57
  "img",
58
58
  {
59
59
  src: import_utils.image.ali(item.cover, 100),
60
- className: "server-product-cover",
61
- onClick: (e) => {
62
- e.preventDefault();
63
- e.stopPropagation();
64
- onClick(item, "detail");
65
- }
60
+ className: "server-product-cover"
66
61
  }
67
62
  ) : null,
68
63
  /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-content" }, /* @__PURE__ */ import_react.default.createElement(
69
64
  "span",
70
65
  {
71
- className: "server-product-title",
72
- onClick: (e) => {
73
- e.preventDefault();
74
- e.stopPropagation();
75
- onClick(item, "detail");
76
- }
66
+ className: "server-product-title"
77
67
  },
78
68
  item.title
79
69
  ), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-time" }, (0, import_utils2.getDiscountTime)(item.service_times)), /* @__PURE__ */ import_react.default.createElement("div", { className: "server-product-price" }, (0, import_utils.formatAmount)(item.price, 2, amountSymbol)))
@@ -222,8 +222,17 @@ var CustomSelect = (props, ref) => {
222
222
  import_addButton.default,
223
223
  {
224
224
  showSub: isMore,
225
- onClick: handleOpenModal,
226
- ...addButtonProps
225
+ ...addButtonProps,
226
+ onClick: () => {
227
+ if (addButtonProps.addCallback) {
228
+ addButtonProps == null ? void 0 : addButtonProps.addCallback();
229
+ }
230
+ if (addButtonProps.onClick) {
231
+ addButtonProps.onClick();
232
+ return;
233
+ }
234
+ handleOpenModal();
235
+ }
227
236
  }
228
237
  ) : disabled ? /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 20 } }) : null) : null, /* @__PURE__ */ import_react.default.createElement(
229
238
  import_drawer.default,
@@ -110,6 +110,7 @@ var Info = () => {
110
110
  if (state.disabledEdit) {
111
111
  return;
112
112
  }
113
+ getClients({ ...params, search: "", skip: 1 });
113
114
  (_a2 = modalRef.current) == null ? void 0 : _a2.open();
114
115
  };
115
116
  const getNickname = (0, import_react.useCallback)(
@@ -193,7 +194,6 @@ var Info = () => {
193
194
  return (0, import_utils2.isWalkIn)((_a2 = state.client.value) == null ? void 0 : _a2.id);
194
195
  }, [(_a = state.client.value) == null ? void 0 : _a.id]);
195
196
  (0, import_react.useEffect)(() => {
196
- getClients({ ...params, search: "", skip: 1 });
197
197
  }, []);
198
198
  (0, import_react.useEffect)(() => {
199
199
  if (state.action) {
@@ -76,10 +76,10 @@ var Pet = () => {
76
76
  formData: [
77
77
  {
78
78
  ...formData,
79
- ...formData.form,
80
- form_id: formData.form.id,
81
- options: _list,
82
- type: formData.type
79
+ // ...formData.form,
80
+ // form_id: formData.form.id,
81
+ options: _list
82
+ // type: formData.type,
83
83
  }
84
84
  ],
85
85
  pets: _list
@@ -89,7 +89,6 @@ var Pet = () => {
89
89
  };
90
90
  const getForms = async (isUpdateValue = true) => {
91
91
  var _a2, _b2;
92
- setLoading(true);
93
92
  let values = {
94
93
  ...state.pet.value
95
94
  };
@@ -106,17 +105,26 @@ var Pet = () => {
106
105
  formData = (formData || []).filter(
107
106
  (d) => d.form_id === (params == null ? void 0 : params.form_id)
108
107
  )[0];
108
+ let payload = {
109
+ formData: [
110
+ {
111
+ ...formData,
112
+ ...formData.form,
113
+ form_id: formData.form.id,
114
+ options: [],
115
+ type: formData.type
116
+ }
117
+ ]
118
+ };
109
119
  if (isSetValue) {
110
120
  values[params == null ? void 0 : params.form_id] = formData.form_record;
121
+ payload.value = values;
111
122
  setValueLoading(false);
112
- dispatch({
113
- type: "setPet",
114
- payload: {
115
- value: values
116
- }
117
- });
118
123
  }
119
- await getFormData({ formData });
124
+ dispatch({
125
+ type: "setPet",
126
+ payload
127
+ });
120
128
  } catch (err) {
121
129
  setValueLoading(false);
122
130
  setLoading(false);
@@ -213,13 +221,20 @@ var Pet = () => {
213
221
  params.type,
214
222
  (_f = (_e = state.client) == null ? void 0 : _e.value) == null ? void 0 : _f.id
215
223
  ]);
216
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-pet-wraps" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading, active: true, round: true }, /* @__PURE__ */ import_react.default.createElement(
224
+ const addCallback = () => {
225
+ var _a2, _b2;
226
+ let _formData = (_b2 = (_a2 = state.pet) == null ? void 0 : _a2.formData) == null ? void 0 : _b2[0];
227
+ if ((_formData == null ? void 0 : _formData.type) === "multiple" || (_formData == null ? void 0 : _formData.type) === "single") {
228
+ getFormData({ formData: _formData });
229
+ }
230
+ };
231
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-pet-wraps" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: valueLoading, active: true, round: true }, /* @__PURE__ */ import_react.default.createElement(
217
232
  import_forms.default,
218
233
  {
219
234
  hideTitle: true,
220
235
  watch: { value: state.pet.value },
221
236
  addCallback: () => {
222
- getForms(false);
237
+ addCallback();
223
238
  },
224
239
  loading: valueLoading,
225
240
  forms: state.pet.formData,
@@ -229,7 +244,7 @@ var Pet = () => {
229
244
  onChange: onValueChange,
230
245
  client: (_g = state.client) == null ? void 0 : _g.value,
231
246
  customSelectProps: {
232
- // loading: loading,
247
+ loading,
233
248
  handleViewItem,
234
249
  virtualListHeight: window.innerHeight - 213 - 57 - 16,
235
250
  disabled: state.disabledEdit
@@ -266,7 +281,12 @@ var Pet = () => {
266
281
  import_utils.locales.getText("pisell2.text.edit")
267
282
  )));
268
283
  },
269
- addButtonProps: { style: { margin: 0 } }
284
+ addButtonProps: {
285
+ style: { margin: 0 },
286
+ addCallback: async () => {
287
+ addCallback();
288
+ }
289
+ }
270
290
  }
271
291
  )));
272
292
  };