bxs-tools-ui 3.2.0-0 → 3.2.0-2

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 (34) hide show
  1. package/es/add-and-take/index.js +13 -3
  2. package/es/adjust-baoe/index.js +3 -2
  3. package/es/index.js +171 -161
  4. package/es/insure-calculate/index.js +1 -0
  5. package/es/person-info/index.js +122 -146
  6. package/es/product-info/index.js +136 -152
  7. package/es/share-sheet/index.js +16 -4
  8. package/es/utils/index.js +144 -154
  9. package/lib/add-and-take/index.js +13 -3
  10. package/lib/adjust-baoe/index.js +3 -2
  11. package/lib/index.js +171 -161
  12. package/lib/insure-calculate/index.js +1 -0
  13. package/lib/person-info/index.js +122 -146
  14. package/lib/product-info/index.js +136 -152
  15. package/lib/share-sheet/index.js +16 -4
  16. package/lib/utils/index.js +144 -154
  17. package/package.json +1 -4
  18. package/packages/add-and-take/readme.md +162 -256
  19. package/packages/adjust-baoe/readme.md +118 -83
  20. package/packages/business-card/readme.md +91 -28
  21. package/packages/bxs-utils/planbook/common.ts +48 -20
  22. package/packages/bxs-utils/planbook/person.ts +1 -1
  23. package/packages/bxs-utils/planbook/product.ts +70 -124
  24. package/packages/bxs-utils/readme.md +407 -425
  25. package/packages/canvas-poster/readme.md +123 -83
  26. package/packages/index.ts +1 -1
  27. package/packages/insure-calculate/readme.md +185 -129
  28. package/packages/person-info/index.vue +6 -1
  29. package/packages/person-info/readme.md +149 -134
  30. package/packages/planbook-input/helper.js +9 -4
  31. package/packages/planbook-input/index.vue +5 -1
  32. package/packages/planbook-input/readme.md +143 -84
  33. package/packages/product-info/index.vue +12 -3
  34. package/packages/product-info/readme.md +130 -69
package/es/utils/index.js CHANGED
@@ -135,7 +135,7 @@ function getHuomianPeriodValue() {
135
135
  * **将交费期间或者保险期间的值,转换成数值**
136
136
  * @author Lizhao <lz@winbaoxian.com>
137
137
  * @date 2022-04-25
138
- * @param {string} value 必传。需要转换的值
138
+ * @param {string|number} value 必传。需要转换的值
139
139
  * @param {number} age 0 可不传。被保人年龄
140
140
  * @returns {number} 数值
141
141
  * @example
@@ -167,7 +167,7 @@ function getNumberFromYear(value) {
167
167
  * @author Lizhao <lz@winbaoxian.com>
168
168
  * @date 2022-04-25
169
169
  * @param {number} value 必传
170
- * @returns {string} 单位为万的字符串
170
+ * @returns {number|string} 满足条件时返回单位为万的字符串,否则返回原数值
171
171
  * @example
172
172
  * converUnit10000(1000)
173
173
  * // returns 1000
@@ -225,7 +225,7 @@ function deepCopy(obj) {
225
225
  * **根据生日算年龄**
226
226
  * @author Lizhao <lz@winbaoxian.com>
227
227
  * @date 2022-04-25
228
- * @param {Date|timestamp|dateStr} birth 必传。时间字符串或时间翟
228
+ * @param {Date|timestamp|dateStr} birth 必传。时间字符串或时间戳
229
229
  * @param {Date|timestamp|dateStr} cDate 可不传。指定时间,不传默认为当前时间
230
230
  * @returns {number} 年龄
231
231
  * @example
@@ -249,11 +249,20 @@ function getAgeFromBirth(birth, cDate) {
249
249
  }
250
250
 
251
251
  /**
252
- * 将数值转换为千分位
252
+ * **将数值转换为千分位格式的字符串**
253
253
  * @author Lizhao <lz@winbaoxian.com>
254
254
  * @date 2024-09-10
255
- * @param {*} n 数值
256
- * @returns 千分位字符串
255
+ * @param {number|string} n 必传。需要转换的数值
256
+ * @returns {string} 千分位字符串;空值返回空字符串;非数值返回原值
257
+ * @example
258
+ * formatNumberToThousand(1234567)
259
+ * // returns '1,234,567'
260
+ *
261
+ * formatNumberToThousand(0)
262
+ * // returns '0'
263
+ *
264
+ * formatNumberToThousand(null)
265
+ * // returns ''
257
266
  */
258
267
  function formatNumberToThousand(n) {
259
268
  if (n !== 0 && !n) {
@@ -267,10 +276,21 @@ function formatNumberToThousand(n) {
267
276
  }
268
277
 
269
278
  /**
270
- * 截取指定字数字符串
271
- * @param str
272
- * @param n
273
- * @returns
279
+ * **截取字符串到指定字数**
280
+ * - 中文字符(及非 `[0-9a-z.()]` 的字符)计为 1 个字符
281
+ * - 数字、小写字母及 `.()` 计为 0.5 个字符
282
+ * - 超出长度时,截取前 n-2 个字符并追加 `...`
283
+ * @author Lizhao <lz@winbaoxian.com>
284
+ * @date 2024-09-10
285
+ * @param {string} str 必传。需要截取的字符串
286
+ * @param {number} n 必传。最大字符数(需大于 2)
287
+ * @returns {string} 截取后的字符串
288
+ * @example
289
+ * textOverflowEllipsis('你好world', 4)
290
+ * // returns 你好...
291
+ *
292
+ * textOverflowEllipsis('hello world', 4)
293
+ * // returns hello world
274
294
  */
275
295
  function textOverflowEllipsis(str, n) {
276
296
  var text = String(str);
@@ -308,7 +328,9 @@ function getExpressionParamMap(personData, product, ins, options) {
308
328
  // 通用信息
309
329
  customVariable: null,
310
330
  // 自定义变量
311
- cv: null // 简写,自定义变量
331
+ cv: null,
332
+ // 简写,自定义变量
333
+ t: {} // 事件目标
312
334
  };
313
335
  if (personData) {
314
336
  var insuredInfo = (personData.personOrderList || []).find(function (p) {
@@ -356,8 +378,13 @@ function getExpressionParamMap(personData, product, ins, options) {
356
378
  });
357
379
  }
358
380
  }
359
- if (options && options.planbookId) {
360
- map.planbookId = options.planbookId;
381
+ if (options) {
382
+ if (options.planbookId) {
383
+ map.planbookId = options.planbookId;
384
+ }
385
+ if (options.eventTarget) {
386
+ map.t = options.eventTarget;
387
+ }
361
388
  }
362
389
  if (ins && ins.customVariableExp) {
363
390
  var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
@@ -388,11 +415,12 @@ function executeElementRule(personData, product, ins, ele) {
388
415
  }
389
416
  if (['cmCommonSelect', 'cmCommonRadioBtn', 'cmCommonRadio', 'cmCommonCheckbox'].includes(ele.componentName)) {
390
417
  if (ele.defaultValueExp) {
391
- if (ele.value !== 0 && !ele.value) {
392
- var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
393
- newEleMap.value = eval(_exp);
394
- consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
418
+ var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
419
+ var expValue = eval(_exp);
420
+ if (!['', null, undefined].includes(expValue)) {
421
+ newEleMap.value = expValue;
395
422
  }
423
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
396
424
  }
397
425
  if (ele.underwriteExp) {
398
426
  var _exp2 = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
@@ -420,11 +448,12 @@ function executeElementRule(personData, product, ins, ele) {
420
448
  }
421
449
  if (['cmCommonInput'].includes(ele.componentName)) {
422
450
  if (ele.defaultValueExp) {
423
- if (!ele.value) {
424
- var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
425
- newEleMap.value = eval(_exp3);
426
- consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
451
+ var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
452
+ var _expValue = eval(_exp3);
453
+ if (!['', null, undefined].includes(_expValue)) {
454
+ newEleMap.value = _expValue;
427
455
  }
456
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
428
457
  }
429
458
  if (ele.minExp) {
430
459
  var _exp4 = ele.minExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
@@ -821,7 +850,7 @@ function setPersonAgeOptions(personData) {
821
850
  * @author Lizhao <lz@winbaoxian.com>
822
851
  * @date 2022-04-26
823
852
  * @param {IPbPersons} allPersonsData 必传。所有人员数据
824
- * @param {null|string} type 可不传。
853
+ * @param {null|string|string[]} type 可不传。
825
854
  * 不传,人员数据按原结构返回;
826
855
  * 字符串,返回指定的人员数据;
827
856
  * 数组,以数组形式,返回多个人员数据。
@@ -9826,10 +9855,10 @@ function initProductData(prodData) {
9826
9855
  * @author Lizhao <lz@winbaoxian.com>
9827
9856
  * @date 2022-04-26
9828
9857
  * @param {IPbProduct} prodData 必传。产品数据(单个)
9829
- * @param {object} productVerifyData 必传。产品校验条件(单个)
9858
+ * @param {object} prodVerifyData 必传。产品校验条件(单个)
9830
9859
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
9831
- * @param {object} parmas 补充参数,目前只有 planbookId
9832
- * @returns {IPbProduct} 产品数据(单个)
9860
+ * @param {object} [parmas] 可不传。补充参数,目前只有 planbookId
9861
+ * @returns {Promise<IPbProduct>} 产品数据(单个)
9833
9862
  */
9834
9863
  function productDataHandler(_x, _x2, _x3, _x4) {
9835
9864
  return _productDataHandler.apply(this, arguments);
@@ -9837,6 +9866,7 @@ function productDataHandler(_x, _x2, _x3, _x4) {
9837
9866
 
9838
9867
  /**
9839
9868
  * **处理多被保人**
9869
+ * @ignore
9840
9870
  * @author Lizhao <lz@winbaoxian.com>
9841
9871
  * @date 2024-02-28
9842
9872
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
@@ -9844,7 +9874,7 @@ function productDataHandler(_x, _x2, _x3, _x4) {
9844
9874
  */
9845
9875
  function _productDataHandler() {
9846
9876
  _productDataHandler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prodData, prodVerifyData, personData, parmas) {
9847
- var productVerifyData, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9877
+ var productVerifyData, _parmas$eventTarget, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9848
9878
  return _regeneratorRuntime.wrap(function (_context) {
9849
9879
  while (1) switch (_context.prev = _context.next) {
9850
9880
  case 0:
@@ -9871,6 +9901,29 @@ function _productDataHandler() {
9871
9901
  case 3:
9872
9902
  productVerifyData = prodVerifyData;
9873
9903
  case 4:
9904
+ // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
9905
+ if (parmas && parmas.eventTarget) {
9906
+ _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
9907
+ if (insuranceKey && elementKey === 'insuranceId') {
9908
+ groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
9909
+ return ins.key === insuranceKey;
9910
+ });
9911
+ groupInsuranceIdEle = ((groupInsurance === null || groupInsurance === void 0 ? void 0 : groupInsurance.eleOrderList) || []).find(function (e) {
9912
+ return e.key === 'insuranceId';
9913
+ });
9914
+ subInsurances = (prodData.mulInsOrderList || []).filter(function (ins) {
9915
+ return ins.groupKey === insuranceKey;
9916
+ });
9917
+ subInsurances.forEach(function (ins) {
9918
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
9919
+ return e.key === 'title';
9920
+ });
9921
+ if (titleEle && groupInsuranceIdEle && !Array.isArray(titleEle.value)) {
9922
+ titleEle.value = groupInsuranceIdEle.value === ins.key;
9923
+ }
9924
+ });
9925
+ }
9926
+ }
9874
9927
  hasProduct = prodData.mulInsOrderList;
9875
9928
  hasVerifyData = productVerifyData && Object.keys(productVerifyData).length;
9876
9929
  hasPersonData = personData && personData.personOrderList;
@@ -10155,6 +10208,7 @@ function multipleInsuredHandler(personData) {
10155
10208
 
10156
10209
  /**
10157
10210
  * 请求返回当前产品、当前条件的费率数据
10211
+ * @ignore
10158
10212
  * @author Lizhao <lz@winbaoxian.com>
10159
10213
  * @date 2024-02-28
10160
10214
  * @param {IPbProduct} prodData 必传。产品数据(单个)
@@ -10222,6 +10276,7 @@ function getSingleInsurancesVerifyData(prodData, personData) {
10222
10276
 
10223
10277
  /**
10224
10278
  * **多被保人,获取并缓存多个险种信息的费率信息**
10279
+ * @ignore
10225
10280
  * @author Lizhao <lz@winbaoxian.com>
10226
10281
  * @date 2023-12-28
10227
10282
  * @param { any } params 必传。接口请求信息
@@ -10338,40 +10393,21 @@ function setCommonInfo(prodData) {
10338
10393
  * @returns {IPbProduct} 产品数据(单个)
10339
10394
  */
10340
10395
  function setGroupInsurance(prodData) {
10341
- if (!prodData.mulInsOrderList) {
10342
- return prodData;
10343
- }
10344
- var groupInsuranceList = prodData && prodData.mulInsOrderList && prodData.mulInsOrderList.filter(function (ins) {
10345
- return !!ins.groupKey;
10346
- });
10347
- if (!groupInsuranceList || !groupInsuranceList.length) {
10348
- return prodData;
10349
- }
10350
- var oldGroupInsList = prodData.mulInsOrderList.filter(function (ins) {
10351
- return ins.isGroup;
10352
- });
10353
- var newGroupInsMap = {};
10354
- //清空险种列表中的已有的险种组合
10355
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(function (ins) {
10396
+ var mulInsOrderList = prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : [];
10397
+ // 清空险种列表中的已有的险种组合
10398
+ prodData.mulInsOrderList = mulInsOrderList.filter(function (ins) {
10356
10399
  return !ins.isGroup;
10357
10400
  });
10358
- groupInsuranceList.forEach(function (ins) {
10359
- //多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10360
- // ins.isCheckbox = true
10361
- var oldGroupIns = oldGroupInsList.find(function (gIns) {
10362
- return gIns.key === ins.groupKey;
10363
- });
10364
- var oldTitleEle = {};
10365
- var oldInsuranceIdEle = {};
10366
- if (oldGroupIns && oldGroupIns.eleOrderList) {
10367
- oldTitleEle = oldGroupIns.eleOrderList.find(function (e) {
10368
- return e.key === 'title';
10369
- });
10370
- oldInsuranceIdEle = oldGroupIns.eleOrderList.find(function (e) {
10371
- return e.key === 'insuranceId';
10372
- });
10373
- }
10374
- if (ins.groupKey) {
10401
+
10402
+ // 多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10403
+ var groupInsuranceList = mulInsOrderList.filter(function (ins) {
10404
+ return !!ins.groupKey;
10405
+ });
10406
+ if (groupInsuranceList.length) {
10407
+ var newGroupInsMap = {};
10408
+ groupInsuranceList.filter(function (ins) {
10409
+ return ins.groupKey;
10410
+ }).forEach(function (ins) {
10375
10411
  newGroupInsMap[ins.groupKey] = newGroupInsMap[ins.groupKey] || {
10376
10412
  key: ins.groupKey,
10377
10413
  name: ins.groupName,
@@ -10379,19 +10415,19 @@ function setGroupInsurance(prodData) {
10379
10415
  isGroup: true,
10380
10416
  eleOrderList: [{
10381
10417
  key: 'title',
10382
- value: oldTitleEle && oldTitleEle.value || false,
10418
+ value: false,
10383
10419
  isDisabled: false,
10384
10420
  componentName: 'cmCommonTitle',
10385
10421
  labelName: ins.groupName
10386
10422
  }, {
10387
10423
  key: 'insuranceId',
10388
- value: oldInsuranceIdEle && oldInsuranceIdEle.value || (ins.isCheckbox ? [] : ''),
10424
+ value: ins.isCheckbox ? [] : null,
10389
10425
  componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
10390
10426
  opts: []
10391
10427
  }]
10392
10428
  };
10393
10429
 
10394
- // 当险种转换成险种组合的选项
10430
+ // 将子险种转换成险种组合的选项
10395
10431
  var titleEle = ins.eleOrderList.find(function (e) {
10396
10432
  return e.key === 'title';
10397
10433
  });
@@ -10404,119 +10440,73 @@ function setGroupInsurance(prodData) {
10404
10440
  desc: titleEle.labelName,
10405
10441
  isDisabled: titleEle.isDisabled
10406
10442
  });
10407
- }
10408
- });
10409
-
10410
- // 处理组合险中的逻辑,并加入到产品险种列表中
10411
- var _loop = function _loop(k) {
10412
- var nGroupTitle = newGroupInsMap[k].eleOrderList.find(function (e) {
10413
- return e.key === 'title';
10414
10443
  });
10415
- var nGroupInsuranceId = newGroupInsMap[k].eleOrderList.find(function (e) {
10416
- return e.key === 'insuranceId';
10417
- });
10418
- if (nGroupTitle && nGroupInsuranceId) {
10419
- if (nGroupInsuranceId.opts && nGroupInsuranceId.opts.length) {
10420
- // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10421
- if (nGroupInsuranceId.opts.every(function (opt) {
10422
- return !!opt.isDisabled;
10423
- })) {
10424
- nGroupTitle.value = false;
10425
- nGroupTitle.isDisabled = true;
10426
- } else {
10427
- nGroupTitle.isDisabled = false;
10428
- }
10429
- }
10430
- var groupInsList = prodData.mulInsOrderList.filter(function (ins) {
10444
+
10445
+ // 处理组合险中的逻辑,并加入到产品险种列表中
10446
+ var _loop = function _loop(k) {
10447
+ var nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10448
+ return e.key === 'title';
10449
+ });
10450
+ var nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10451
+ return e.key === 'insuranceId';
10452
+ });
10453
+ var groupInsList = mulInsOrderList.filter(function (ins) {
10431
10454
  return ins.groupKey == k;
10432
10455
  });
10433
- if (groupInsList && groupInsList.length) {
10434
- // 如果组合险中有一款是必选的,则整个组合险为选中状态
10435
- if (groupInsList.some(function (ins) {
10436
- var subTitle = ins.eleOrderList.find(function (e) {
10437
- return e.key === 'title';
10438
- });
10439
- return ins.required && subTitle && !subTitle.isDisabled;
10440
- })) {
10441
- nGroupTitle.value = true;
10442
- nGroupTitle.isDisabled = true;
10443
- }
10444
-
10445
- // 初始化时,设置组合险默认值
10456
+ if (nGroupTitleEle && nGroupInsuranceIdEle && groupInsList.length) {
10446
10457
  var notDisabledInsurances = groupInsList.filter(function (ins) {
10447
- var subTitle = ins.eleOrderList.find(function (e) {
10458
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
10448
10459
  return e.key === 'title';
10449
10460
  });
10450
- return subTitle && !subTitle.isDisabled;
10461
+ return titleEle && !titleEle.isDisabled;
10451
10462
  });
10452
- var checkedInsurances = notDisabledInsurances.find(function (ins) {
10453
- var subTitle = ins.eleOrderList.find(function (e) {
10454
- return e.key === 'title';
10463
+ var checkedInsurances = notDisabledInsurances.filter(function (ins) {
10464
+ var titleEle = (ins.eleOrderList || []).find(function (ele) {
10465
+ return ele.key === 'title';
10455
10466
  });
10456
- return subTitle && subTitle.value;
10467
+ return titleEle && titleEle.value;
10457
10468
  });
10458
- if (!nGroupInsuranceId.value) {
10459
- if (checkedInsurances) {
10460
- nGroupInsuranceId.value = checkedInsurances.key;
10461
- nGroupTitle.value = true;
10462
- } else if (nGroupTitle.value) {
10463
- if (notDisabledInsurances[0]) {
10464
- nGroupInsuranceId.value = notDisabledInsurances[0].key;
10465
- }
10466
- }
10467
- }
10468
- }
10469
- }
10470
- if (nGroupInsuranceId) {
10471
- if (nGroupInsuranceId.value) {
10472
- if (nGroupInsuranceId.value.constructor === Array) {
10473
- if (nGroupInsuranceId.opts) {
10474
- nGroupInsuranceId.opts = nGroupInsuranceId.opts.filter(function (opt) {
10475
- return nGroupInsuranceId.value.indexOf(opt.val) !== -1 && !opt.isDisabled;
10476
- });
10477
- }
10478
- } else {
10479
- var opt = nGroupInsuranceId.opts.find(function (o) {
10480
- return o.val === nGroupInsuranceId.value;
10481
- });
10482
- if (opt && opt.isDisabled) {
10483
- nGroupInsuranceId.value = '';
10484
- }
10485
- }
10486
- }
10487
- if (nGroupInsuranceId.value) {
10488
- var checkedIns = prodData.mulInsOrderList.find(function (ins) {
10489
- return ins.key === nGroupInsuranceId.value;
10469
+ var hasRequiredIns = notDisabledInsurances.some(function (ins) {
10470
+ return ins.required;
10490
10471
  });
10491
- if (checkedIns) {
10492
- //将当前选中险种的部分数据复制到组合险中
10493
- for (var ck in checkedIns) {
10494
- if (!['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'].includes(ck)) {
10495
- // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10472
+ var checkedInsurance = checkedInsurances[0];
10473
+ // hasRequiredIns:如果组合险中有一款是必选的,则整个组合险为选中状态
10474
+ // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10475
+ nGroupTitleEle.value = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).some(function (opt) {
10476
+ return !opt.isDisabled;
10477
+ });
10478
+ nGroupTitleEle.isDisabled = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).every(function (opt) {
10479
+ return !!opt.isDisabled;
10480
+ });
10481
+ nGroupInsuranceIdEle.value = checkedInsurance ? checkedInsurance.key : null;
10482
+
10483
+ //将当前选中险种的部分数据复制到组合险中
10484
+ if (checkedInsurance) {
10485
+ // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10486
+ var keys = ['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'];
10487
+ for (var ck in checkedInsurance) {
10488
+ if (!keys.includes(ck)) {
10496
10489
  if (ck === 'eleOrderList') {
10497
- newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedIns[ck].filter(function (ele) {
10490
+ newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedInsurance[ck].filter(function (ele) {
10498
10491
  return ele.key !== 'title';
10499
10492
  }));
10500
10493
  } else {
10501
- newGroupInsMap[k][ck] = checkedIns[ck];
10494
+ newGroupInsMap[k][ck] = checkedInsurance[ck];
10502
10495
  }
10503
10496
  }
10504
10497
  }
10505
10498
  }
10506
10499
  }
10507
- }
10508
- var index = -1;
10509
- prodData.mulInsOrderList.forEach(function (ins, i) {
10510
- if (ins.groupKey === k) {
10511
- index = i;
10500
+ var index = mulInsOrderList.findLastIndex(function (ins) {
10501
+ return ins.groupKey === k;
10502
+ });
10503
+ if (index >= 0) {
10504
+ prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10512
10505
  }
10513
- });
10514
- if (index >= 0) {
10515
- prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10506
+ };
10507
+ for (var k in newGroupInsMap) {
10508
+ _loop(k);
10516
10509
  }
10517
- };
10518
- for (var k in newGroupInsMap) {
10519
- _loop(k);
10520
10510
  }
10521
10511
  return prodData;
10522
10512
  }
@@ -10791,7 +10781,7 @@ function convertProductData(prodData) {
10791
10781
  if (insuranceData.title && !insuranceData.groupKey) {
10792
10782
  if (insuranceData.isGroup) {
10793
10783
  //组合险,则遍历其所选中的险种,并转换数据
10794
- var insuranceId = insuranceData.insuranceId.constructor == Array ? insuranceData.insuranceId : [insuranceData.insuranceId];
10784
+ var insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId];
10795
10785
  insuranceId.forEach(function (insId) {
10796
10786
  var checkedIns = prodData.mulInsOrderList.find(function (p) {
10797
10787
  return p.key === insId;
@@ -8618,11 +8618,20 @@
8618
8618
  document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
8619
8619
 
8620
8620
  /**
8621
- * 将数值转换为千分位
8621
+ * **将数值转换为千分位格式的字符串**
8622
8622
  * @author Lizhao <lz@winbaoxian.com>
8623
8623
  * @date 2024-09-10
8624
- * @param {*} n 数值
8625
- * @returns 千分位字符串
8624
+ * @param {number|string} n 必传。需要转换的数值
8625
+ * @returns {string} 千分位字符串;空值返回空字符串;非数值返回原值
8626
+ * @example
8627
+ * formatNumberToThousand(1234567)
8628
+ * // returns '1,234,567'
8629
+ *
8630
+ * formatNumberToThousand(0)
8631
+ * // returns '0'
8632
+ *
8633
+ * formatNumberToThousand(null)
8634
+ * // returns ''
8626
8635
  */
8627
8636
  function formatNumberToThousand(n) {
8628
8637
  if (n !== 0 && !n) {
@@ -8637,6 +8646,7 @@
8637
8646
 
8638
8647
  /**
8639
8648
  * **多被保人,获取并缓存多个险种信息的费率信息**
8649
+ * @ignore
8640
8650
  * @author Lizhao <lz@winbaoxian.com>
8641
8651
  * @date 2023-12-28
8642
8652
  * @param { any } params 必传。接口请求信息
@@ -564,7 +564,7 @@
564
564
  * @author Lizhao <lz@winbaoxian.com>
565
565
  * @date 2022-04-26
566
566
  * @param {IPbPersons} allPersonsData 必传。所有人员数据
567
- * @param {null|string} type 可不传。
567
+ * @param {null|string|string[]} type 可不传。
568
568
  * 不传,人员数据按原结构返回;
569
569
  * 字符串,返回指定的人员数据;
570
570
  * 数组,以数组形式,返回多个人员数据。
@@ -9046,6 +9046,7 @@
9046
9046
 
9047
9047
  /**
9048
9048
  * **多被保人,获取并缓存多个险种信息的费率信息**
9049
+ * @ignore
9049
9050
  * @author Lizhao <lz@winbaoxian.com>
9050
9051
  * @date 2023-12-28
9051
9052
  * @param { any } params 必传。接口请求信息
@@ -9105,7 +9106,7 @@
9105
9106
  if (insuranceData.title && !insuranceData.groupKey) {
9106
9107
  if (insuranceData.isGroup) {
9107
9108
  //组合险,则遍历其所选中的险种,并转换数据
9108
- var insuranceId = insuranceData.insuranceId.constructor == Array ? insuranceData.insuranceId : [insuranceData.insuranceId];
9109
+ var insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId];
9109
9110
  insuranceId.forEach(function (insId) {
9110
9111
  var checkedIns = prodData.mulInsOrderList.find(function (p) {
9111
9112
  return p.key === insId;