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
@@ -8624,11 +8624,20 @@ var PURPOSE_OPTIONS = [{
8624
8624
  document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
8625
8625
 
8626
8626
  /**
8627
- * 将数值转换为千分位
8627
+ * **将数值转换为千分位格式的字符串**
8628
8628
  * @author Lizhao <lz@winbaoxian.com>
8629
8629
  * @date 2024-09-10
8630
- * @param {*} n 数值
8631
- * @returns 千分位字符串
8630
+ * @param {number|string} n 必传。需要转换的数值
8631
+ * @returns {string} 千分位字符串;空值返回空字符串;非数值返回原值
8632
+ * @example
8633
+ * formatNumberToThousand(1234567)
8634
+ * // returns '1,234,567'
8635
+ *
8636
+ * formatNumberToThousand(0)
8637
+ * // returns '0'
8638
+ *
8639
+ * formatNumberToThousand(null)
8640
+ * // returns ''
8632
8641
  */
8633
8642
  function formatNumberToThousand(n) {
8634
8643
  if (n !== 0 && !n) {
@@ -8643,6 +8652,7 @@ function formatNumberToThousand(n) {
8643
8652
 
8644
8653
  /**
8645
8654
  * **多被保人,获取并缓存多个险种信息的费率信息**
8655
+ * @ignore
8646
8656
  * @author Lizhao <lz@winbaoxian.com>
8647
8657
  * @date 2023-12-28
8648
8658
  * @param { any } params 必传。接口请求信息
@@ -565,7 +565,7 @@ function deepCopy(obj) {
565
565
  * @author Lizhao <lz@winbaoxian.com>
566
566
  * @date 2022-04-26
567
567
  * @param {IPbPersons} allPersonsData 必传。所有人员数据
568
- * @param {null|string} type 可不传。
568
+ * @param {null|string|string[]} type 可不传。
569
569
  * 不传,人员数据按原结构返回;
570
570
  * 字符串,返回指定的人员数据;
571
571
  * 数组,以数组形式,返回多个人员数据。
@@ -9047,6 +9047,7 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t
9047
9047
 
9048
9048
  /**
9049
9049
  * **多被保人,获取并缓存多个险种信息的费率信息**
9050
+ * @ignore
9050
9051
  * @author Lizhao <lz@winbaoxian.com>
9051
9052
  * @date 2023-12-28
9052
9053
  * @param { any } params 必传。接口请求信息
@@ -9106,7 +9107,7 @@ function convertProductData(prodData) {
9106
9107
  if (insuranceData.title && !insuranceData.groupKey) {
9107
9108
  if (insuranceData.isGroup) {
9108
9109
  //组合险,则遍历其所选中的险种,并转换数据
9109
- var insuranceId = insuranceData.insuranceId.constructor == Array ? insuranceData.insuranceId : [insuranceData.insuranceId];
9110
+ var insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId];
9110
9111
  insuranceId.forEach(function (insId) {
9111
9112
  var checkedIns = prodData.mulInsOrderList.find(function (p) {
9112
9113
  return p.key === insId;
package/es/index.js CHANGED
@@ -8754,7 +8754,7 @@ function getHuomianPeriodValue() {
8754
8754
  * **将交费期间或者保险期间的值,转换成数值**
8755
8755
  * @author Lizhao <lz@winbaoxian.com>
8756
8756
  * @date 2022-04-25
8757
- * @param {string} value 必传。需要转换的值
8757
+ * @param {string|number} value 必传。需要转换的值
8758
8758
  * @param {number} age 0 可不传。被保人年龄
8759
8759
  * @returns {number} 数值
8760
8760
  * @example
@@ -8786,7 +8786,7 @@ function getNumberFromYear(value) {
8786
8786
  * @author Lizhao <lz@winbaoxian.com>
8787
8787
  * @date 2022-04-25
8788
8788
  * @param {number} value 必传
8789
- * @returns {string} 单位为万的字符串
8789
+ * @returns {number|string} 满足条件时返回单位为万的字符串,否则返回原数值
8790
8790
  * @example
8791
8791
  * converUnit10000(1000)
8792
8792
  * // returns 1000
@@ -8844,7 +8844,7 @@ function deepCopy(obj) {
8844
8844
  * **根据生日算年龄**
8845
8845
  * @author Lizhao <lz@winbaoxian.com>
8846
8846
  * @date 2022-04-25
8847
- * @param {Date|timestamp|dateStr} birth 必传。时间字符串或时间翟
8847
+ * @param {Date|timestamp|dateStr} birth 必传。时间字符串或时间戳
8848
8848
  * @param {Date|timestamp|dateStr} cDate 可不传。指定时间,不传默认为当前时间
8849
8849
  * @returns {number} 年龄
8850
8850
  * @example
@@ -8868,11 +8868,20 @@ function getAgeFromBirth(birth, cDate) {
8868
8868
  }
8869
8869
 
8870
8870
  /**
8871
- * 将数值转换为千分位
8871
+ * **将数值转换为千分位格式的字符串**
8872
8872
  * @author Lizhao <lz@winbaoxian.com>
8873
8873
  * @date 2024-09-10
8874
- * @param {*} n 数值
8875
- * @returns 千分位字符串
8874
+ * @param {number|string} n 必传。需要转换的数值
8875
+ * @returns {string} 千分位字符串;空值返回空字符串;非数值返回原值
8876
+ * @example
8877
+ * formatNumberToThousand(1234567)
8878
+ * // returns '1,234,567'
8879
+ *
8880
+ * formatNumberToThousand(0)
8881
+ * // returns '0'
8882
+ *
8883
+ * formatNumberToThousand(null)
8884
+ * // returns ''
8876
8885
  */
8877
8886
  function formatNumberToThousand(n) {
8878
8887
  if (n !== 0 && !n) {
@@ -8886,10 +8895,21 @@ function formatNumberToThousand(n) {
8886
8895
  }
8887
8896
 
8888
8897
  /**
8889
- * 截取指定字数字符串
8890
- * @param str
8891
- * @param n
8892
- * @returns
8898
+ * **截取字符串到指定字数**
8899
+ * - 中文字符(及非 `[0-9a-z.()]` 的字符)计为 1 个字符
8900
+ * - 数字、小写字母及 `.()` 计为 0.5 个字符
8901
+ * - 超出长度时,截取前 n-2 个字符并追加 `...`
8902
+ * @author Lizhao <lz@winbaoxian.com>
8903
+ * @date 2024-09-10
8904
+ * @param {string} str 必传。需要截取的字符串
8905
+ * @param {number} n 必传。最大字符数(需大于 2)
8906
+ * @returns {string} 截取后的字符串
8907
+ * @example
8908
+ * textOverflowEllipsis('你好world', 4)
8909
+ * // returns 你好...
8910
+ *
8911
+ * textOverflowEllipsis('hello world', 4)
8912
+ * // returns hello world
8893
8913
  */
8894
8914
  function textOverflowEllipsis(str, n) {
8895
8915
  var text = String(str);
@@ -8927,7 +8947,9 @@ function getExpressionParamMap(personData, product, ins, options) {
8927
8947
  // 通用信息
8928
8948
  customVariable: null,
8929
8949
  // 自定义变量
8930
- cv: null // 简写,自定义变量
8950
+ cv: null,
8951
+ // 简写,自定义变量
8952
+ t: {} // 事件目标
8931
8953
  };
8932
8954
  if (personData) {
8933
8955
  var insuredInfo = (personData.personOrderList || []).find(function (p) {
@@ -8975,8 +8997,13 @@ function getExpressionParamMap(personData, product, ins, options) {
8975
8997
  });
8976
8998
  }
8977
8999
  }
8978
- if (options && options.planbookId) {
8979
- map.planbookId = options.planbookId;
9000
+ if (options) {
9001
+ if (options.planbookId) {
9002
+ map.planbookId = options.planbookId;
9003
+ }
9004
+ if (options.eventTarget) {
9005
+ map.t = options.eventTarget;
9006
+ }
8980
9007
  }
8981
9008
  if (ins && ins.customVariableExp) {
8982
9009
  var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
@@ -9007,11 +9034,12 @@ function executeElementRule(personData, product, ins, ele) {
9007
9034
  }
9008
9035
  if (['cmCommonSelect', 'cmCommonRadioBtn', 'cmCommonRadio', 'cmCommonCheckbox'].includes(ele.componentName)) {
9009
9036
  if (ele.defaultValueExp) {
9010
- if (ele.value !== 0 && !ele.value) {
9011
- var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
9012
- newEleMap.value = eval(_exp);
9013
- consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
9037
+ var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
9038
+ var expValue = eval(_exp);
9039
+ if (!['', null, undefined].includes(expValue)) {
9040
+ newEleMap.value = expValue;
9014
9041
  }
9042
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
9015
9043
  }
9016
9044
  if (ele.underwriteExp) {
9017
9045
  var _exp2 = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
@@ -9039,11 +9067,12 @@ function executeElementRule(personData, product, ins, ele) {
9039
9067
  }
9040
9068
  if (['cmCommonInput'].includes(ele.componentName)) {
9041
9069
  if (ele.defaultValueExp) {
9042
- if (!ele.value) {
9043
- var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
9044
- newEleMap.value = eval(_exp3);
9045
- consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
9070
+ var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
9071
+ var _expValue = eval(_exp3);
9072
+ if (!['', null, undefined].includes(_expValue)) {
9073
+ newEleMap.value = _expValue;
9046
9074
  }
9075
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
9047
9076
  }
9048
9077
  if (ele.minExp) {
9049
9078
  var _exp4 = ele.minExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
@@ -9440,7 +9469,7 @@ function setPersonAgeOptions(personData) {
9440
9469
  * @author Lizhao <lz@winbaoxian.com>
9441
9470
  * @date 2022-04-26
9442
9471
  * @param {IPbPersons} allPersonsData 必传。所有人员数据
9443
- * @param {null|string} type 可不传。
9472
+ * @param {null|string|string[]} type 可不传。
9444
9473
  * 不传,人员数据按原结构返回;
9445
9474
  * 字符串,返回指定的人员数据;
9446
9475
  * 数组,以数组形式,返回多个人员数据。
@@ -9961,10 +9990,10 @@ function initProductData(prodData) {
9961
9990
  * @author Lizhao <lz@winbaoxian.com>
9962
9991
  * @date 2022-04-26
9963
9992
  * @param {IPbProduct} prodData 必传。产品数据(单个)
9964
- * @param {object} productVerifyData 必传。产品校验条件(单个)
9993
+ * @param {object} prodVerifyData 必传。产品校验条件(单个)
9965
9994
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
9966
- * @param {object} parmas 补充参数,目前只有 planbookId
9967
- * @returns {IPbProduct} 产品数据(单个)
9995
+ * @param {object} [parmas] 可不传。补充参数,目前只有 planbookId
9996
+ * @returns {Promise<IPbProduct>} 产品数据(单个)
9968
9997
  */
9969
9998
  function productDataHandler(_x, _x2, _x3, _x4) {
9970
9999
  return _productDataHandler.apply(this, arguments);
@@ -9972,6 +10001,7 @@ function productDataHandler(_x, _x2, _x3, _x4) {
9972
10001
 
9973
10002
  /**
9974
10003
  * **处理多被保人**
10004
+ * @ignore
9975
10005
  * @author Lizhao <lz@winbaoxian.com>
9976
10006
  * @date 2024-02-28
9977
10007
  * @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
@@ -9979,7 +10009,7 @@ function productDataHandler(_x, _x2, _x3, _x4) {
9979
10009
  */
9980
10010
  function _productDataHandler() {
9981
10011
  _productDataHandler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prodData, prodVerifyData, personData, parmas) {
9982
- var productVerifyData, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
10012
+ var productVerifyData, _parmas$eventTarget, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9983
10013
  return _regeneratorRuntime.wrap(function (_context) {
9984
10014
  while (1) switch (_context.prev = _context.next) {
9985
10015
  case 0:
@@ -10006,6 +10036,29 @@ function _productDataHandler() {
10006
10036
  case 3:
10007
10037
  productVerifyData = prodVerifyData;
10008
10038
  case 4:
10039
+ // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
10040
+ if (parmas && parmas.eventTarget) {
10041
+ _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
10042
+ if (insuranceKey && elementKey === 'insuranceId') {
10043
+ groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
10044
+ return ins.key === insuranceKey;
10045
+ });
10046
+ groupInsuranceIdEle = ((groupInsurance === null || groupInsurance === void 0 ? void 0 : groupInsurance.eleOrderList) || []).find(function (e) {
10047
+ return e.key === 'insuranceId';
10048
+ });
10049
+ subInsurances = (prodData.mulInsOrderList || []).filter(function (ins) {
10050
+ return ins.groupKey === insuranceKey;
10051
+ });
10052
+ subInsurances.forEach(function (ins) {
10053
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
10054
+ return e.key === 'title';
10055
+ });
10056
+ if (titleEle && groupInsuranceIdEle && !Array.isArray(titleEle.value)) {
10057
+ titleEle.value = groupInsuranceIdEle.value === ins.key;
10058
+ }
10059
+ });
10060
+ }
10061
+ }
10009
10062
  hasProduct = prodData.mulInsOrderList;
10010
10063
  hasVerifyData = productVerifyData && Object.keys(productVerifyData).length;
10011
10064
  hasPersonData = personData && personData.personOrderList;
@@ -10290,6 +10343,7 @@ function multipleInsuredHandler(personData) {
10290
10343
 
10291
10344
  /**
10292
10345
  * 请求返回当前产品、当前条件的费率数据
10346
+ * @ignore
10293
10347
  * @author Lizhao <lz@winbaoxian.com>
10294
10348
  * @date 2024-02-28
10295
10349
  * @param {IPbProduct} prodData 必传。产品数据(单个)
@@ -10357,6 +10411,7 @@ function getSingleInsurancesVerifyData(prodData, personData) {
10357
10411
 
10358
10412
  /**
10359
10413
  * **多被保人,获取并缓存多个险种信息的费率信息**
10414
+ * @ignore
10360
10415
  * @author Lizhao <lz@winbaoxian.com>
10361
10416
  * @date 2023-12-28
10362
10417
  * @param { any } params 必传。接口请求信息
@@ -10473,40 +10528,21 @@ function setCommonInfo(prodData) {
10473
10528
  * @returns {IPbProduct} 产品数据(单个)
10474
10529
  */
10475
10530
  function setGroupInsurance(prodData) {
10476
- if (!prodData.mulInsOrderList) {
10477
- return prodData;
10478
- }
10479
- var groupInsuranceList = prodData && prodData.mulInsOrderList && prodData.mulInsOrderList.filter(function (ins) {
10480
- return !!ins.groupKey;
10481
- });
10482
- if (!groupInsuranceList || !groupInsuranceList.length) {
10483
- return prodData;
10484
- }
10485
- var oldGroupInsList = prodData.mulInsOrderList.filter(function (ins) {
10486
- return ins.isGroup;
10487
- });
10488
- var newGroupInsMap = {};
10489
- //清空险种列表中的已有的险种组合
10490
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(function (ins) {
10531
+ var mulInsOrderList = prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : [];
10532
+ // 清空险种列表中的已有的险种组合
10533
+ prodData.mulInsOrderList = mulInsOrderList.filter(function (ins) {
10491
10534
  return !ins.isGroup;
10492
10535
  });
10493
- groupInsuranceList.forEach(function (ins) {
10494
- //多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10495
- // ins.isCheckbox = true
10496
- var oldGroupIns = oldGroupInsList.find(function (gIns) {
10497
- return gIns.key === ins.groupKey;
10498
- });
10499
- var oldTitleEle = {};
10500
- var oldInsuranceIdEle = {};
10501
- if (oldGroupIns && oldGroupIns.eleOrderList) {
10502
- oldTitleEle = oldGroupIns.eleOrderList.find(function (e) {
10503
- return e.key === 'title';
10504
- });
10505
- oldInsuranceIdEle = oldGroupIns.eleOrderList.find(function (e) {
10506
- return e.key === 'insuranceId';
10507
- });
10508
- }
10509
- if (ins.groupKey) {
10536
+
10537
+ // 多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10538
+ var groupInsuranceList = mulInsOrderList.filter(function (ins) {
10539
+ return !!ins.groupKey;
10540
+ });
10541
+ if (groupInsuranceList.length) {
10542
+ var newGroupInsMap = {};
10543
+ groupInsuranceList.filter(function (ins) {
10544
+ return ins.groupKey;
10545
+ }).forEach(function (ins) {
10510
10546
  newGroupInsMap[ins.groupKey] = newGroupInsMap[ins.groupKey] || {
10511
10547
  key: ins.groupKey,
10512
10548
  name: ins.groupName,
@@ -10514,19 +10550,19 @@ function setGroupInsurance(prodData) {
10514
10550
  isGroup: true,
10515
10551
  eleOrderList: [{
10516
10552
  key: 'title',
10517
- value: oldTitleEle && oldTitleEle.value || false,
10553
+ value: false,
10518
10554
  isDisabled: false,
10519
10555
  componentName: 'cmCommonTitle',
10520
10556
  labelName: ins.groupName
10521
10557
  }, {
10522
10558
  key: 'insuranceId',
10523
- value: oldInsuranceIdEle && oldInsuranceIdEle.value || (ins.isCheckbox ? [] : ''),
10559
+ value: ins.isCheckbox ? [] : null,
10524
10560
  componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
10525
10561
  opts: []
10526
10562
  }]
10527
10563
  };
10528
10564
 
10529
- // 当险种转换成险种组合的选项
10565
+ // 将子险种转换成险种组合的选项
10530
10566
  var titleEle = ins.eleOrderList.find(function (e) {
10531
10567
  return e.key === 'title';
10532
10568
  });
@@ -10539,119 +10575,73 @@ function setGroupInsurance(prodData) {
10539
10575
  desc: titleEle.labelName,
10540
10576
  isDisabled: titleEle.isDisabled
10541
10577
  });
10542
- }
10543
- });
10544
-
10545
- // 处理组合险中的逻辑,并加入到产品险种列表中
10546
- var _loop = function _loop(k) {
10547
- var nGroupTitle = newGroupInsMap[k].eleOrderList.find(function (e) {
10548
- return e.key === 'title';
10549
10578
  });
10550
- var nGroupInsuranceId = newGroupInsMap[k].eleOrderList.find(function (e) {
10551
- return e.key === 'insuranceId';
10552
- });
10553
- if (nGroupTitle && nGroupInsuranceId) {
10554
- if (nGroupInsuranceId.opts && nGroupInsuranceId.opts.length) {
10555
- // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10556
- if (nGroupInsuranceId.opts.every(function (opt) {
10557
- return !!opt.isDisabled;
10558
- })) {
10559
- nGroupTitle.value = false;
10560
- nGroupTitle.isDisabled = true;
10561
- } else {
10562
- nGroupTitle.isDisabled = false;
10563
- }
10564
- }
10565
- var groupInsList = prodData.mulInsOrderList.filter(function (ins) {
10579
+
10580
+ // 处理组合险中的逻辑,并加入到产品险种列表中
10581
+ var _loop = function _loop(k) {
10582
+ var nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10583
+ return e.key === 'title';
10584
+ });
10585
+ var nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10586
+ return e.key === 'insuranceId';
10587
+ });
10588
+ var groupInsList = mulInsOrderList.filter(function (ins) {
10566
10589
  return ins.groupKey == k;
10567
10590
  });
10568
- if (groupInsList && groupInsList.length) {
10569
- // 如果组合险中有一款是必选的,则整个组合险为选中状态
10570
- if (groupInsList.some(function (ins) {
10571
- var subTitle = ins.eleOrderList.find(function (e) {
10572
- return e.key === 'title';
10573
- });
10574
- return ins.required && subTitle && !subTitle.isDisabled;
10575
- })) {
10576
- nGroupTitle.value = true;
10577
- nGroupTitle.isDisabled = true;
10578
- }
10579
-
10580
- // 初始化时,设置组合险默认值
10591
+ if (nGroupTitleEle && nGroupInsuranceIdEle && groupInsList.length) {
10581
10592
  var notDisabledInsurances = groupInsList.filter(function (ins) {
10582
- var subTitle = ins.eleOrderList.find(function (e) {
10593
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
10583
10594
  return e.key === 'title';
10584
10595
  });
10585
- return subTitle && !subTitle.isDisabled;
10596
+ return titleEle && !titleEle.isDisabled;
10586
10597
  });
10587
- var checkedInsurances = notDisabledInsurances.find(function (ins) {
10588
- var subTitle = ins.eleOrderList.find(function (e) {
10589
- return e.key === 'title';
10598
+ var checkedInsurances = notDisabledInsurances.filter(function (ins) {
10599
+ var titleEle = (ins.eleOrderList || []).find(function (ele) {
10600
+ return ele.key === 'title';
10590
10601
  });
10591
- return subTitle && subTitle.value;
10602
+ return titleEle && titleEle.value;
10592
10603
  });
10593
- if (!nGroupInsuranceId.value) {
10594
- if (checkedInsurances) {
10595
- nGroupInsuranceId.value = checkedInsurances.key;
10596
- nGroupTitle.value = true;
10597
- } else if (nGroupTitle.value) {
10598
- if (notDisabledInsurances[0]) {
10599
- nGroupInsuranceId.value = notDisabledInsurances[0].key;
10600
- }
10601
- }
10602
- }
10603
- }
10604
- }
10605
- if (nGroupInsuranceId) {
10606
- if (nGroupInsuranceId.value) {
10607
- if (nGroupInsuranceId.value.constructor === Array) {
10608
- if (nGroupInsuranceId.opts) {
10609
- nGroupInsuranceId.opts = nGroupInsuranceId.opts.filter(function (opt) {
10610
- return nGroupInsuranceId.value.indexOf(opt.val) !== -1 && !opt.isDisabled;
10611
- });
10612
- }
10613
- } else {
10614
- var opt = nGroupInsuranceId.opts.find(function (o) {
10615
- return o.val === nGroupInsuranceId.value;
10616
- });
10617
- if (opt && opt.isDisabled) {
10618
- nGroupInsuranceId.value = '';
10619
- }
10620
- }
10621
- }
10622
- if (nGroupInsuranceId.value) {
10623
- var checkedIns = prodData.mulInsOrderList.find(function (ins) {
10624
- return ins.key === nGroupInsuranceId.value;
10604
+ var hasRequiredIns = notDisabledInsurances.some(function (ins) {
10605
+ return ins.required;
10625
10606
  });
10626
- if (checkedIns) {
10627
- //将当前选中险种的部分数据复制到组合险中
10628
- for (var ck in checkedIns) {
10629
- if (!['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'].includes(ck)) {
10630
- // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10607
+ var checkedInsurance = checkedInsurances[0];
10608
+ // hasRequiredIns:如果组合险中有一款是必选的,则整个组合险为选中状态
10609
+ // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10610
+ nGroupTitleEle.value = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).some(function (opt) {
10611
+ return !opt.isDisabled;
10612
+ });
10613
+ nGroupTitleEle.isDisabled = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).every(function (opt) {
10614
+ return !!opt.isDisabled;
10615
+ });
10616
+ nGroupInsuranceIdEle.value = checkedInsurance ? checkedInsurance.key : null;
10617
+
10618
+ //将当前选中险种的部分数据复制到组合险中
10619
+ if (checkedInsurance) {
10620
+ // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10621
+ var keys = ['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'];
10622
+ for (var ck in checkedInsurance) {
10623
+ if (!keys.includes(ck)) {
10631
10624
  if (ck === 'eleOrderList') {
10632
- newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedIns[ck].filter(function (ele) {
10625
+ newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedInsurance[ck].filter(function (ele) {
10633
10626
  return ele.key !== 'title';
10634
10627
  }));
10635
10628
  } else {
10636
- newGroupInsMap[k][ck] = checkedIns[ck];
10629
+ newGroupInsMap[k][ck] = checkedInsurance[ck];
10637
10630
  }
10638
10631
  }
10639
10632
  }
10640
10633
  }
10641
10634
  }
10642
- }
10643
- var index = -1;
10644
- prodData.mulInsOrderList.forEach(function (ins, i) {
10645
- if (ins.groupKey === k) {
10646
- index = i;
10635
+ var index = mulInsOrderList.findLastIndex(function (ins) {
10636
+ return ins.groupKey === k;
10637
+ });
10638
+ if (index >= 0) {
10639
+ prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10647
10640
  }
10648
- });
10649
- if (index >= 0) {
10650
- prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10641
+ };
10642
+ for (var k in newGroupInsMap) {
10643
+ _loop(k);
10651
10644
  }
10652
- };
10653
- for (var k in newGroupInsMap) {
10654
- _loop(k);
10655
10645
  }
10656
10646
  return prodData;
10657
10647
  }
@@ -10926,7 +10916,7 @@ function convertProductData(prodData) {
10926
10916
  if (insuranceData.title && !insuranceData.groupKey) {
10927
10917
  if (insuranceData.isGroup) {
10928
10918
  //组合险,则遍历其所选中的险种,并转换数据
10929
- var insuranceId = insuranceData.insuranceId.constructor == Array ? insuranceData.insuranceId : [insuranceData.insuranceId];
10919
+ var insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId];
10930
10920
  insuranceId.forEach(function (insId) {
10931
10921
  var checkedIns = prodData.mulInsOrderList.find(function (p) {
10932
10922
  return p.key === insId;
@@ -46318,6 +46308,7 @@ var BxtPersonInfo = (_dec$1 = Component({
46318
46308
  params,
46319
46309
  allPersonsData,
46320
46310
  productGroupList,
46311
+ eventTarget,
46321
46312
  promises,
46322
46313
  _args = arguments;
46323
46314
  return _regeneratorRuntime.wrap(function (_context) {
@@ -46333,6 +46324,10 @@ var BxtPersonInfo = (_dec$1 = Component({
46333
46324
  case 1:
46334
46325
  allPersonsData = inputData.personData;
46335
46326
  productGroupList = inputData.productGroupList || [];
46327
+ eventTarget = {
46328
+ personKey: personData.key,
46329
+ elementKey: ele.key
46330
+ };
46336
46331
  if (!allPersonsData) {
46337
46332
  _context.next = 2;
46338
46333
  break;
@@ -46350,7 +46345,8 @@ var BxtPersonInfo = (_dec$1 = Component({
46350
46345
  g.prodOrderList.map(function (p) {
46351
46346
  clearAddAndTakeAndAdjustBaoeData(p);
46352
46347
  promises.push(productDataHandler(p, get$3(verifyData, "[".concat(p.key, "]")), allPersonsData, {
46353
- planbookId: get$3(params, 'planbookId')
46348
+ planbookId: get$3(params, 'planbookId'),
46349
+ eventTarget: eventTarget
46354
46350
  }));
46355
46351
  });
46356
46352
  });
@@ -46756,7 +46752,7 @@ function createdProductDataToCalc(inputData) {
46756
46752
  productForm.mulInsOrderList = productForm.mulInsOrderList.map(function (ins) {
46757
46753
  var tempIns = {};
46758
46754
  for (var _k2 in ins) {
46759
- if (!['isFollowing', 'pPeriodDesc', 'baoeDesc', 'baofDesc', 'iDurationDesc', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData', 'isCheckbox', 'groupKey', 'groupName'].includes(_k2)) {
46755
+ if (!['isFollowing', 'pPeriodDesc', 'baoeDesc', 'baofDesc', 'iDurationDesc', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData', 'isCheckbox', 'groupKey', 'groupName', 'customVariableExp', 'calcResultExp', 'revalidateFlag'].includes(_k2)) {
46760
46756
  tempIns[_k2] = ins[_k2];
46761
46757
  }
46762
46758
  }
@@ -47018,7 +47014,7 @@ var BxtProductInfo = (_dec = Component({
47018
47014
  value: function () {
47019
47015
  var _changeProduct = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(productData, options) {
47020
47016
  var _this5 = this;
47021
- var $listeners, inputData, verifyData, personData, groupKey, productKey, params, type, insData, eleData, planbookId, publicPbUuid, productVerifyData, errorMsg, hasRevalidateFlag;
47017
+ var $listeners, inputData, verifyData, personData, groupKey, productKey, params, type, insData, eleData, planbookId, publicPbUuid, productVerifyData, eventTarget, errorMsg, hasRevalidateFlag;
47022
47018
  return _regeneratorRuntime.wrap(function (_context3) {
47023
47019
  while (1) switch (_context3.prev = _context3.next) {
47024
47020
  case 0:
@@ -47027,12 +47023,18 @@ var BxtProductInfo = (_dec = Component({
47027
47023
  planbookId = get$3(params, 'planbookId');
47028
47024
  publicPbUuid = get$3(params, 'publicPbUuid');
47029
47025
  productVerifyData = get$3(verifyData, "[".concat(productKey, "]"));
47026
+ eventTarget = {
47027
+ insuranceKey: get$3(insData, 'key') || null,
47028
+ insuranceCode: get$3(insData, 'code') || null,
47029
+ elementKey: get$3(eleData, 'key') || null
47030
+ };
47030
47031
  if (type === 'change') {
47031
47032
  clearAddAndTakeAndAdjustBaoeData(productData);
47032
47033
  }
47033
47034
  _context3.next = 1;
47034
47035
  return productDataHandler(productData, productVerifyData, personData, {
47035
- planbookId: planbookId
47036
+ planbookId: planbookId,
47037
+ eventTarget: eventTarget
47036
47038
  });
47037
47039
  case 1:
47038
47040
  if (type === 'change') {
@@ -47064,7 +47066,8 @@ var BxtProductInfo = (_dec = Component({
47064
47066
  publicPbUuid: publicPbUuid,
47065
47067
  groupKey: groupKey,
47066
47068
  productKey: productKey,
47067
- isIgnoreError: true
47069
+ isIgnoreError: true,
47070
+ eventTarget: eventTarget
47068
47071
  }, resolve, reject);
47069
47072
  }).catch(function (err) {
47070
47073
  errorMsg = get$3(err, '[0].message') || get$3(err, 'message');
@@ -47072,7 +47075,8 @@ var BxtProductInfo = (_dec = Component({
47072
47075
  case 2:
47073
47076
  _context3.next = 3;
47074
47077
  return productDataHandler(productData, productVerifyData, personData, {
47075
- planbookId: planbookId
47078
+ planbookId: planbookId,
47079
+ eventTarget: eventTarget
47076
47080
  });
47077
47081
  case 3:
47078
47082
  return _context3.abrupt("return", errorMsg);
@@ -47641,6 +47645,12 @@ var __vue_render__$1 = function __vue_render__() {
47641
47645
  insData: ins,
47642
47646
  eleData: ele
47643
47647
  });
47648
+ },
47649
+ "clear": function clear($event) {
47650
+ return _vm.onChange({
47651
+ insData: ins,
47652
+ eleData: ele
47653
+ });
47644
47654
  }
47645
47655
  },
47646
47656
  scopedSlots: _vm._u([!ele.isDisabled ? {
@@ -48325,7 +48335,7 @@ if (typeof window !== 'undefined' && window.Vue) {
48325
48335
  install(window.Vue);
48326
48336
  }
48327
48337
  const index = {
48328
- version: '3.2.0-0',
48338
+ version: '3.2.0-2',
48329
48339
  install: install
48330
48340
  };
48331
48341
 
@@ -37353,6 +37353,7 @@ document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
37353
37353
 
37354
37354
  /**
37355
37355
  * **多被保人,获取并缓存多个险种信息的费率信息**
37356
+ * @ignore
37356
37357
  * @author Lizhao <lz@winbaoxian.com>
37357
37358
  * @date 2023-12-28
37358
37359
  * @param { any } params 必传。接口请求信息