bxs-tools-ui 3.1.3 → 3.2.0-1

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.
@@ -44,6 +44,8 @@ function _defineProperty(e, r, t) {
44
44
  }) : e[r] = t, e;
45
45
  }
46
46
 
47
+ document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
48
+
47
49
  /**
48
50
  * 截取指定字数字符串
49
51
  * @param str
@@ -8526,10 +8528,6 @@ memoize(function (params) {
8526
8528
  return QS.stringify(params);
8527
8529
  });
8528
8530
 
8529
- if (document && document.cookie && document.cookie.match('LIZHAO_DEBUG_CONSOLE_FLAG=1')) {
8530
- window.DEBUG_TEMP_CONSOLE_FLAG = true;
8531
- }
8532
-
8533
8531
  var oneDayMillisecond = 24 * 3600 * 1000;
8534
8532
  var EXPIRE_ENUM = [{
8535
8533
  value: 'NEVER',
package/es/utils/index.js CHANGED
@@ -14,6 +14,14 @@ function _typeof$1(o) {
14
14
  }, _typeof$1(o);
15
15
  }
16
16
 
17
+ var enableLizhaoDebug = document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
18
+ function consoleLogWhenEnable() {
19
+ if (enableLizhaoDebug) {
20
+ var _console;
21
+ (_console = console).log.apply(_console, arguments);
22
+ }
23
+ }
24
+
17
25
  /**
18
26
  * **将对象下的 eleOrderList 数组中的子元素下的 value,转换为 key-value 键值对**
19
27
  * @author Lizhao <lz@winbaoxian.com>
@@ -276,6 +284,174 @@ function textOverflowEllipsis(str, n) {
276
284
  }
277
285
  return text;
278
286
  }
287
+ function getExpressionParamMap(personData, product, ins, options) {
288
+ var map = {
289
+ planbookId: null,
290
+ // 计划书id
291
+ productId: null,
292
+ // 产品id
293
+ insured: {},
294
+ // 被保人
295
+ insured2: {},
296
+ // 第二被保人
297
+ applicant: {},
298
+ // 投保人
299
+ recipient: {},
300
+ // 收件人
301
+ p: {},
302
+ // 当前产品
303
+ m: {},
304
+ // 主险
305
+ me: {},
306
+ // 当前险种
307
+ common: {},
308
+ // 通用信息
309
+ customVariable: null,
310
+ // 自定义变量
311
+ cv: null,
312
+ // 简写,自定义变量
313
+ t: {} // 事件目标
314
+ };
315
+ if (personData) {
316
+ var insuredInfo = (personData.personOrderList || []).find(function (p) {
317
+ return p.key === 'insuredInfo';
318
+ });
319
+ var insured2Info = (personData.personOrderList || []).find(function (p) {
320
+ return p.key === 'insured2Info';
321
+ });
322
+ var applicantInfo = (personData.personOrderList || []).find(function (p) {
323
+ return p.key === 'applicantInfo';
324
+ });
325
+ var recipientInfo = personData !== null && personData !== void 0 && personData.recipientInfo ? personData.recipientInfo : null;
326
+ map.insured = insuredInfo ? convertEleOrderListToObj(insuredInfo) : {};
327
+ map.insured2 = insured2Info ? convertEleOrderListToObj(insured2Info) : {};
328
+ map.applicant = applicantInfo ? convertEleOrderListToObj(applicantInfo) : {};
329
+ map.recipient = recipientInfo ? convertEleOrderListToObj(recipientInfo) : {};
330
+ }
331
+ if (ins) {
332
+ map.me = ins ? convertEleOrderListToObj(ins) : {};
333
+ map["i".concat(ins.key)] = ins;
334
+ }
335
+ if (product) {
336
+ map.productId = product.key;
337
+ Object.keys(product).filter(function (k) {
338
+ return !['mulInsOrderList'].includes(k);
339
+ }).forEach(function (k) {
340
+ map.p[k] = product[k];
341
+ });
342
+ if (Array.isArray(product.mulInsOrderList)) {
343
+ var common = product.mulInsOrderList.find(function (item) {
344
+ return item.key === 'common';
345
+ });
346
+ var insuranceList = product.mulInsOrderList.filter(function (item) {
347
+ return !['common'].includes(item.key);
348
+ }).map(function (item) {
349
+ return convertEleOrderListToObj(item);
350
+ });
351
+ map.m = insuranceList[0] ? insuranceList[0] : {};
352
+ map.me = ins && ins.key ? insuranceList.find(function (e) {
353
+ return e.key === ins.key;
354
+ }) || {} : {};
355
+ map.common = common ? convertEleOrderListToObj(common) : {};
356
+ insuranceList.forEach(function (item) {
357
+ map["i".concat(item.key)] = item;
358
+ });
359
+ }
360
+ }
361
+ if (options) {
362
+ if (options.planbookId) {
363
+ map.planbookId = options.planbookId;
364
+ }
365
+ if (options.eventTarget) {
366
+ map.t = options.eventTarget;
367
+ }
368
+ }
369
+ if (ins && ins.customVariableExp) {
370
+ var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
371
+ map.customVariable = eval(exp);
372
+ map.cv = map.customVariable;
373
+ }
374
+ return map;
375
+ }
376
+ function executeElementRule(personData, product, ins, ele) {
377
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
378
+ var paramMap = getExpressionParamMap(personData, product, ins, options);
379
+ var newEleMap = {};
380
+ if (paramMap) {
381
+ if (['cmCommonTitle'].includes(ele.componentName)) {
382
+ if (ele.underwriteExp) {
383
+ var exp = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
384
+ var evalValue = eval(exp);
385
+ if (Array.isArray(evalValue)) {
386
+ if ([0, 1].includes(evalValue[0])) {
387
+ newEleMap.value = evalValue[0] === 1;
388
+ }
389
+ if ([0, 1].includes(evalValue[1])) {
390
+ newEleMap.isDisabled = evalValue[1] === 0;
391
+ }
392
+ }
393
+ consoleLogWhenEnable("".concat(ele.key, ": underwriteExp"), exp, evalValue);
394
+ }
395
+ }
396
+ if (['cmCommonSelect', 'cmCommonRadioBtn', 'cmCommonRadio', 'cmCommonCheckbox'].includes(ele.componentName)) {
397
+ if (ele.defaultValueExp) {
398
+ if (ele.value !== 0 && !ele.value && paramMap.t.elementKey !== ele.key) {
399
+ var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
400
+ newEleMap.value = eval(_exp);
401
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
402
+ }
403
+ }
404
+ if (ele.underwriteExp) {
405
+ var _exp2 = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
406
+ var _evalValue = eval(_exp2);
407
+ if (Array.isArray(_evalValue) && Array.isArray(ele.opts)) {
408
+ if (_evalValue.length === 2) {
409
+ newEleMap.opts = (ele.opts || []).filter(function (o) {
410
+ return o.val >= _evalValue[0] && o.val <= _evalValue[1];
411
+ });
412
+ } else {
413
+ newEleMap.opts = (ele.opts || []).filter(function (o) {
414
+ return _evalValue.includes(o.val);
415
+ });
416
+ }
417
+ }
418
+ if (Array.isArray(newEleMap.opts)) {
419
+ if (newEleMap.opts.length && !newEleMap.opts.some(function (o) {
420
+ return o.val === ele.value;
421
+ })) {
422
+ newEleMap.value = newEleMap.opts[0].val;
423
+ }
424
+ }
425
+ consoleLogWhenEnable("".concat(ele.key, ": underwriteExp"), _exp2, _evalValue);
426
+ }
427
+ }
428
+ if (['cmCommonInput'].includes(ele.componentName)) {
429
+ if (ele.defaultValueExp) {
430
+ if (ele.value !== 0 && !ele.value && paramMap.t.elementKey !== ele.key) {
431
+ var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
432
+ newEleMap.value = eval(_exp3);
433
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
434
+ }
435
+ }
436
+ if (ele.minExp) {
437
+ var _exp4 = ele.minExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
438
+ newEleMap.min = eval(_exp4);
439
+ consoleLogWhenEnable("".concat(ele.key, ": minExp"), _exp4, newEleMap.min);
440
+ }
441
+ if (ele.maxExp) {
442
+ var _exp5 = ele.maxExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
443
+ newEleMap.max = eval(_exp5);
444
+ consoleLogWhenEnable("".concat(ele.key, ": maxExp"), _exp5, newEleMap.max);
445
+ }
446
+ if (ele.multiExp) {
447
+ var _exp6 = ele.multiExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
448
+ newEleMap.multi = eval(_exp6);
449
+ consoleLogWhenEnable("".concat(ele.key, ": multiExp"), _exp6, newEleMap.multi);
450
+ }
451
+ }
452
+ }
453
+ return newEleMap;
454
+ }
279
455
 
280
456
  /**
281
457
  * **初始化人员数据**
@@ -579,9 +755,7 @@ function getInsuredAgeRange(inputData, verifyData) {
579
755
  prod.mulInsOrderList.forEach(function (ins) {
580
756
  // 险种是否有费率
581
757
  if (!verifyData[prod.key][ins.key]) {
582
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
583
- console.log("".concat(prod.titleName, "-").concat(prod.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
584
- }
758
+ consoleLogWhenEnable("".concat(prod.titleName, "-").concat(prod.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
585
759
  return;
586
760
  }
587
761
  // 产品中是否有必选险种
@@ -9677,7 +9851,7 @@ function productDataHandler(_x, _x2, _x3, _x4) {
9677
9851
  */
9678
9852
  function _productDataHandler() {
9679
9853
  _productDataHandler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prodData, prodVerifyData, personData, parmas) {
9680
- var productVerifyData, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9854
+ var productVerifyData, _parmas$eventTarget, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9681
9855
  return _regeneratorRuntime.wrap(function (_context) {
9682
9856
  while (1) switch (_context.prev = _context.next) {
9683
9857
  case 0:
@@ -9704,6 +9878,29 @@ function _productDataHandler() {
9704
9878
  case 3:
9705
9879
  productVerifyData = prodVerifyData;
9706
9880
  case 4:
9881
+ // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
9882
+ if (parmas && parmas.eventTarget) {
9883
+ _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
9884
+ if (insuranceKey && elementKey === 'insuranceId') {
9885
+ groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
9886
+ return ins.key === insuranceKey;
9887
+ });
9888
+ groupInsuranceIdEle = ((groupInsurance === null || groupInsurance === void 0 ? void 0 : groupInsurance.eleOrderList) || []).find(function (e) {
9889
+ return e.key === 'insuranceId';
9890
+ });
9891
+ subInsurances = (prodData.mulInsOrderList || []).filter(function (ins) {
9892
+ return ins.groupKey === insuranceKey;
9893
+ });
9894
+ subInsurances.forEach(function (ins) {
9895
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
9896
+ return e.key === 'title';
9897
+ });
9898
+ if (titleEle && groupInsuranceIdEle && !Array.isArray(titleEle.value)) {
9899
+ titleEle.value = groupInsuranceIdEle.value === ins.key;
9900
+ }
9901
+ });
9902
+ }
9903
+ }
9707
9904
  hasProduct = prodData.mulInsOrderList;
9708
9905
  hasVerifyData = productVerifyData && Object.keys(productVerifyData).length;
9709
9906
  hasPersonData = personData && personData.personOrderList;
@@ -9718,8 +9915,8 @@ function _productDataHandler() {
9718
9915
  insuranceDataHandler(ins, prodData);
9719
9916
  var insuranceVerifyData = productVerifyData[ins.key];
9720
9917
  if (!insuranceVerifyData) {
9721
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9722
- console.log("".concat(prodData.titleName, "-").concat(prodData.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
9918
+ if (ins.key !== 'common') {
9919
+ consoleLogWhenEnable("".concat(prodData.titleName, "-").concat(prodData.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
9723
9920
  }
9724
9921
  return;
9725
9922
  }
@@ -9771,9 +9968,7 @@ function _productDataHandler() {
9771
9968
  if (isNotAllowSelect) {
9772
9969
  eleTitle.isDisabled = true;
9773
9970
  eleTitle.value = false;
9774
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9775
- console.log(curCondition ? "".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u5B58\u5728\uFF01\u4F46\u6295\u4FDD\u4EBA\u672A\u9009\u4E2D\u6216\u6295\u88AB\u4FDD\u4EBA\u4E3A\u540C\u4E00\u4EBA\uFF0C\u8BE5\u8C41\u514D\u9669\uFF08\u4E0D\u80FD\u9644\u52A0\u5230\u88AB\u4FDD\u4EBA\uFF09\u4E0D\u53EF\u9009") : "".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9776
- }
9971
+ consoleLogWhenEnable(curCondition ? "".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u5B58\u5728\uFF01\u4F46\u6295\u4FDD\u4EBA\u672A\u9009\u4E2D\u6216\u6295\u88AB\u4FDD\u4EBA\u4E3A\u540C\u4E00\u4EBA\uFF0C\u8BE5\u8C41\u514D\u9669\uFF08\u4E0D\u80FD\u9644\u52A0\u5230\u88AB\u4FDD\u4EBA\uFF09\u4E0D\u53EF\u9009") : "".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9777
9972
  } else {
9778
9973
  // 存在费率,险种可选
9779
9974
  eleTitle.isDisabled = false;
@@ -9781,9 +9976,7 @@ function _productDataHandler() {
9781
9976
  if (ins.required && (!ins.groupKey || ins.isCheckbox)) {
9782
9977
  eleTitle.value = true;
9783
9978
  eleTitle.isDisabled = true;
9784
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9785
- console.log("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u5B58\u5728\uFF0C\u9669\u79CD\u4E3A\u5FC5\u9009\u9669\u4E14(\u4E3A\u975E\u7EC4\u5408\u9669\u6216\u4E3A\u591A\u9009\u4E00\u9669\u79CD)"));
9786
- }
9979
+ consoleLogWhenEnable("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u5B58\u5728\uFF0C\u9669\u79CD\u4E3A\u5FC5\u9009\u9669\u4E14(\u4E3A\u975E\u7EC4\u5408\u9669\u6216\u4E3A\u591A\u9009\u4E00\u9669\u79CD)"));
9787
9980
  }
9788
9981
  }
9789
9982
  if (!curCondition) {
@@ -9802,9 +9995,7 @@ function _productDataHandler() {
9802
9995
  });
9803
9996
  }
9804
9997
  if (!eleData) {
9805
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9806
- console.log("".concat(ins.name, " - ").concat(curCondition && curCondition.key, "\u5143\u7D20\u4E0D\u5B58\u5728\uFF1A"));
9807
- }
9998
+ consoleLogWhenEnable("".concat(ins.name, " - ").concat(curCondition && curCondition.key, "\u5143\u7D20\u4E0D\u5B58\u5728\uFF1A"));
9808
9999
  curCondition = null;
9809
10000
  return 0; // break
9810
10001
  }
@@ -9833,9 +10024,7 @@ function _productDataHandler() {
9833
10024
  eleData.value = refEleData.value;
9834
10025
  }
9835
10026
  } else {
9836
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9837
- console.log("".concat(ins.name, "-").concat(ins.key, "\uFF1A\u5173\u8054\u9669\u79CD").concat(ins.refInsuranceId, "\u4E0D\u5B58\u5728"));
9838
- }
10027
+ consoleLogWhenEnable("".concat(ins.name, "-").concat(ins.key, "\uFF1A\u5173\u8054\u9669\u79CD").concat(ins.refInsuranceId, "\u4E0D\u5B58\u5728"));
9839
10028
  }
9840
10029
  } else {
9841
10030
  var backupOpts = eleData.opts && eleData.opts.length ? eleData.opts.slice(0) : [];
@@ -9904,9 +10093,7 @@ function _productDataHandler() {
9904
10093
  if (!curCondition) {
9905
10094
  eleTitle.isDisabled = true;
9906
10095
  eleTitle.value = false;
9907
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9908
- console.log("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9909
- }
10096
+ consoleLogWhenEnable("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9910
10097
  }
9911
10098
 
9912
10099
  // 如果当前元素是隐藏的且不可修改,则过滤上一元素的选项,即,删除上一元素中不包含当前元素值的选项。
@@ -9943,6 +10130,15 @@ function _productDataHandler() {
9943
10130
  _ret = _loop2();
9944
10131
  if (_ret === 0) break;
9945
10132
  } while (curCondition && curCondition.key && curCondition[curCondition.key]);
10133
+ if (Array.isArray(ins.eleOrderList)) {
10134
+ ins.eleOrderList.forEach(function (ele) {
10135
+ var newEleMap = executeElementRule(personData, prodData, ins, ele, parmas);
10136
+ for (var k in newEleMap) {
10137
+ ele[k] = newEleMap[k];
10138
+ }
10139
+ });
10140
+ insuranceDataHandler(ins, prodData);
10141
+ }
9946
10142
  });
9947
10143
  }
9948
10144
  setGroupInsurance(prodData);
@@ -10172,40 +10368,21 @@ function setCommonInfo(prodData) {
10172
10368
  * @returns {IPbProduct} 产品数据(单个)
10173
10369
  */
10174
10370
  function setGroupInsurance(prodData) {
10175
- if (!prodData.mulInsOrderList) {
10176
- return prodData;
10177
- }
10178
- var groupInsuranceList = prodData && prodData.mulInsOrderList && prodData.mulInsOrderList.filter(function (ins) {
10179
- return !!ins.groupKey;
10180
- });
10181
- if (!groupInsuranceList || !groupInsuranceList.length) {
10182
- return prodData;
10183
- }
10184
- var oldGroupInsList = prodData.mulInsOrderList.filter(function (ins) {
10185
- return ins.isGroup;
10186
- });
10187
- var newGroupInsMap = {};
10188
- //清空险种列表中的已有的险种组合
10189
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(function (ins) {
10371
+ var mulInsOrderList = prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : [];
10372
+ // 清空险种列表中的已有的险种组合
10373
+ prodData.mulInsOrderList = mulInsOrderList.filter(function (ins) {
10190
10374
  return !ins.isGroup;
10191
10375
  });
10192
- groupInsuranceList.forEach(function (ins) {
10193
- //多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10194
- // ins.isCheckbox = true
10195
- var oldGroupIns = oldGroupInsList.find(function (gIns) {
10196
- return gIns.key === ins.groupKey;
10197
- });
10198
- var oldTitleEle = {};
10199
- var oldInsuranceIdEle = {};
10200
- if (oldGroupIns && oldGroupIns.eleOrderList) {
10201
- oldTitleEle = oldGroupIns.eleOrderList.find(function (e) {
10202
- return e.key === 'title';
10203
- });
10204
- oldInsuranceIdEle = oldGroupIns.eleOrderList.find(function (e) {
10205
- return e.key === 'insuranceId';
10206
- });
10207
- }
10208
- if (ins.groupKey) {
10376
+
10377
+ // 多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10378
+ var groupInsuranceList = mulInsOrderList.filter(function (ins) {
10379
+ return !!ins.groupKey;
10380
+ });
10381
+ if (groupInsuranceList.length) {
10382
+ var newGroupInsMap = {};
10383
+ groupInsuranceList.filter(function (ins) {
10384
+ return ins.groupKey;
10385
+ }).forEach(function (ins) {
10209
10386
  newGroupInsMap[ins.groupKey] = newGroupInsMap[ins.groupKey] || {
10210
10387
  key: ins.groupKey,
10211
10388
  name: ins.groupName,
@@ -10213,19 +10390,19 @@ function setGroupInsurance(prodData) {
10213
10390
  isGroup: true,
10214
10391
  eleOrderList: [{
10215
10392
  key: 'title',
10216
- value: oldTitleEle && oldTitleEle.value || false,
10393
+ value: false,
10217
10394
  isDisabled: false,
10218
10395
  componentName: 'cmCommonTitle',
10219
10396
  labelName: ins.groupName
10220
10397
  }, {
10221
10398
  key: 'insuranceId',
10222
- value: oldInsuranceIdEle && oldInsuranceIdEle.value || (ins.isCheckbox ? [] : ''),
10399
+ value: ins.isCheckbox ? [] : null,
10223
10400
  componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
10224
10401
  opts: []
10225
10402
  }]
10226
10403
  };
10227
10404
 
10228
- // 当险种转换成险种组合的选项
10405
+ // 将子险种转换成险种组合的选项
10229
10406
  var titleEle = ins.eleOrderList.find(function (e) {
10230
10407
  return e.key === 'title';
10231
10408
  });
@@ -10238,119 +10415,73 @@ function setGroupInsurance(prodData) {
10238
10415
  desc: titleEle.labelName,
10239
10416
  isDisabled: titleEle.isDisabled
10240
10417
  });
10241
- }
10242
- });
10243
-
10244
- // 处理组合险中的逻辑,并加入到产品险种列表中
10245
- var _loop = function _loop(k) {
10246
- var nGroupTitle = newGroupInsMap[k].eleOrderList.find(function (e) {
10247
- return e.key === 'title';
10248
- });
10249
- var nGroupInsuranceId = newGroupInsMap[k].eleOrderList.find(function (e) {
10250
- return e.key === 'insuranceId';
10251
10418
  });
10252
- if (nGroupTitle && nGroupInsuranceId) {
10253
- if (nGroupInsuranceId.opts && nGroupInsuranceId.opts.length) {
10254
- // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10255
- if (nGroupInsuranceId.opts.every(function (opt) {
10256
- return !!opt.isDisabled;
10257
- })) {
10258
- nGroupTitle.value = false;
10259
- nGroupTitle.isDisabled = true;
10260
- } else {
10261
- nGroupTitle.isDisabled = false;
10262
- }
10263
- }
10264
- var groupInsList = prodData.mulInsOrderList.filter(function (ins) {
10419
+
10420
+ // 处理组合险中的逻辑,并加入到产品险种列表中
10421
+ var _loop = function _loop(k) {
10422
+ var nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10423
+ return e.key === 'title';
10424
+ });
10425
+ var nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10426
+ return e.key === 'insuranceId';
10427
+ });
10428
+ var groupInsList = mulInsOrderList.filter(function (ins) {
10265
10429
  return ins.groupKey == k;
10266
10430
  });
10267
- if (groupInsList && groupInsList.length) {
10268
- // 如果组合险中有一款是必选的,则整个组合险为选中状态
10269
- if (groupInsList.some(function (ins) {
10270
- var subTitle = ins.eleOrderList.find(function (e) {
10271
- return e.key === 'title';
10272
- });
10273
- return ins.required && subTitle && !subTitle.isDisabled;
10274
- })) {
10275
- nGroupTitle.value = true;
10276
- nGroupTitle.isDisabled = true;
10277
- }
10278
-
10279
- // 初始化时,设置组合险默认值
10431
+ if (nGroupTitleEle && nGroupInsuranceIdEle && groupInsList.length) {
10280
10432
  var notDisabledInsurances = groupInsList.filter(function (ins) {
10281
- var subTitle = ins.eleOrderList.find(function (e) {
10433
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
10282
10434
  return e.key === 'title';
10283
10435
  });
10284
- return subTitle && !subTitle.isDisabled;
10436
+ return titleEle && !titleEle.isDisabled;
10285
10437
  });
10286
- var checkedInsurances = notDisabledInsurances.find(function (ins) {
10287
- var subTitle = ins.eleOrderList.find(function (e) {
10288
- return e.key === 'title';
10438
+ var checkedInsurances = notDisabledInsurances.filter(function (ins) {
10439
+ var titleEle = (ins.eleOrderList || []).find(function (ele) {
10440
+ return ele.key === 'title';
10289
10441
  });
10290
- return subTitle && subTitle.value;
10442
+ return titleEle && titleEle.value;
10291
10443
  });
10292
- if (!nGroupInsuranceId.value) {
10293
- if (checkedInsurances) {
10294
- nGroupInsuranceId.value = checkedInsurances.key;
10295
- nGroupTitle.value = true;
10296
- } else if (nGroupTitle.value) {
10297
- if (notDisabledInsurances[0]) {
10298
- nGroupInsuranceId.value = notDisabledInsurances[0].key;
10299
- }
10300
- }
10301
- }
10302
- }
10303
- }
10304
- if (nGroupInsuranceId) {
10305
- if (nGroupInsuranceId.value) {
10306
- if (nGroupInsuranceId.value.constructor === Array) {
10307
- if (nGroupInsuranceId.opts) {
10308
- nGroupInsuranceId.opts = nGroupInsuranceId.opts.filter(function (opt) {
10309
- return nGroupInsuranceId.value.indexOf(opt.val) !== -1 && !opt.isDisabled;
10310
- });
10311
- }
10312
- } else {
10313
- var opt = nGroupInsuranceId.opts.find(function (o) {
10314
- return o.val === nGroupInsuranceId.value;
10315
- });
10316
- if (opt && opt.isDisabled) {
10317
- nGroupInsuranceId.value = '';
10318
- }
10319
- }
10320
- }
10321
- if (nGroupInsuranceId.value) {
10322
- var checkedIns = prodData.mulInsOrderList.find(function (ins) {
10323
- return ins.key === nGroupInsuranceId.value;
10444
+ var hasRequiredIns = notDisabledInsurances.some(function (ins) {
10445
+ return ins.required;
10446
+ });
10447
+ var checkedInsurance = checkedInsurances[0];
10448
+ // hasRequiredIns:如果组合险中有一款是必选的,则整个组合险为选中状态
10449
+ // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10450
+ nGroupTitleEle.value = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).some(function (opt) {
10451
+ return !opt.isDisabled;
10452
+ });
10453
+ nGroupTitleEle.isDisabled = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).every(function (opt) {
10454
+ return !!opt.isDisabled;
10324
10455
  });
10325
- if (checkedIns) {
10326
- //将当前选中险种的部分数据复制到组合险中
10327
- for (var ck in checkedIns) {
10328
- if (!['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'].includes(ck)) {
10329
- // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10456
+ nGroupInsuranceIdEle.value = checkedInsurance ? checkedInsurance.key : null;
10457
+
10458
+ //将当前选中险种的部分数据复制到组合险中
10459
+ if (checkedInsurance) {
10460
+ // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10461
+ var keys = ['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'];
10462
+ for (var ck in checkedInsurance) {
10463
+ if (!keys.includes(ck)) {
10330
10464
  if (ck === 'eleOrderList') {
10331
- newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedIns[ck].filter(function (ele) {
10465
+ newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedInsurance[ck].filter(function (ele) {
10332
10466
  return ele.key !== 'title';
10333
10467
  }));
10334
10468
  } else {
10335
- newGroupInsMap[k][ck] = checkedIns[ck];
10469
+ newGroupInsMap[k][ck] = checkedInsurance[ck];
10336
10470
  }
10337
10471
  }
10338
10472
  }
10339
10473
  }
10340
10474
  }
10341
- }
10342
- var index = -1;
10343
- prodData.mulInsOrderList.forEach(function (ins, i) {
10344
- if (ins.groupKey === k) {
10345
- index = i;
10475
+ var index = mulInsOrderList.findLastIndex(function (ins) {
10476
+ return ins.groupKey === k;
10477
+ });
10478
+ if (index >= 0) {
10479
+ prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10346
10480
  }
10347
- });
10348
- if (index >= 0) {
10349
- prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10481
+ };
10482
+ for (var k in newGroupInsMap) {
10483
+ _loop(k);
10350
10484
  }
10351
- };
10352
- for (var k in newGroupInsMap) {
10353
- _loop(k);
10354
10485
  }
10355
10486
  return prodData;
10356
10487
  }
@@ -10625,7 +10756,7 @@ function convertProductData(prodData) {
10625
10756
  if (insuranceData.title && !insuranceData.groupKey) {
10626
10757
  if (insuranceData.isGroup) {
10627
10758
  //组合险,则遍历其所选中的险种,并转换数据
10628
- var insuranceId = insuranceData.insuranceId.constructor == Array ? insuranceData.insuranceId : [insuranceData.insuranceId];
10759
+ var insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId];
10629
10760
  insuranceId.forEach(function (insId) {
10630
10761
  var checkedIns = prodData.mulInsOrderList.find(function (p) {
10631
10762
  return p.key === insId;
@@ -10686,22 +10817,22 @@ function clearAddAndTakeAndAdjustBaoeData(productData) {
10686
10817
  return productData;
10687
10818
  }
10688
10819
 
10689
- if (document && document.cookie && document.cookie.match('LIZHAO_DEBUG_CONSOLE_FLAG=1')) {
10690
- window.DEBUG_TEMP_CONSOLE_FLAG = true;
10691
- }
10692
-
10693
10820
  const planbook = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10694
10821
  __proto__: null,
10695
10822
  calcTotalBaof,
10696
10823
  clearAddAndTakeAndAdjustBaoeData,
10824
+ consoleLogWhenEnable,
10697
10825
  converUnit10000,
10698
10826
  convertEleOrderListToObj,
10699
10827
  convertPersonData,
10700
10828
  convertProductData,
10701
10829
  deepCopy,
10830
+ enableLizhaoDebug,
10831
+ executeElementRule,
10702
10832
  formatNumberToThousand,
10703
10833
  getAgeFromBirth,
10704
10834
  getElementVerifyFromProductVerify,
10835
+ getExpressionParamMap,
10705
10836
  getHuomianPeriodValue,
10706
10837
  getInsuredAgeRange,
10707
10838
  getNumberFromYear,
@@ -11249,4 +11380,4 @@ const index = {
11249
11380
  trade: trade
11250
11381
  };
11251
11382
 
11252
- export { calcTotalBaof, checkInsureCalculate, checkInsureCalculateIn, clearAddAndTakeAndAdjustBaoeData, converUnit10000, convertEleOrderListToObj, convertPersonData, convertProductData, deepCopy, index as default, formatNumberToThousand, getAddress, getAgeFromBirth, getElementVerifyFromProductVerify, getHuomianPeriodValue, getInsuredAgeRange, getNumberFromYear, getUuid, hasPlanParams, initElementValidateRules, initInsuranceData, initPersonData, initProductData, insuranceDataHandler, insureCalculate, isHideProduct, personDataHandler, productDataHandler, restrictElementsInInsurance, restrictInsurancesInProduct, setCommonInfo, setGroupInsurance, setPersonAgeOptions, textOverflowEllipsis, verifyProductRules };
11383
+ export { calcTotalBaof, checkInsureCalculate, checkInsureCalculateIn, clearAddAndTakeAndAdjustBaoeData, consoleLogWhenEnable, converUnit10000, convertEleOrderListToObj, convertPersonData, convertProductData, deepCopy, index as default, enableLizhaoDebug, executeElementRule, formatNumberToThousand, getAddress, getAgeFromBirth, getElementVerifyFromProductVerify, getExpressionParamMap, getHuomianPeriodValue, getInsuredAgeRange, getNumberFromYear, getUuid, hasPlanParams, initElementValidateRules, initInsuranceData, initPersonData, initProductData, insuranceDataHandler, insureCalculate, isHideProduct, personDataHandler, productDataHandler, restrictElementsInInsurance, restrictInsurancesInProduct, setCommonInfo, setGroupInsurance, setPersonAgeOptions, textOverflowEllipsis, verifyProductRules };
@@ -8615,6 +8615,8 @@
8615
8615
  desc: '自定义'
8616
8616
  }];
8617
8617
 
8618
+ document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
8619
+
8618
8620
  /**
8619
8621
  * 将数值转换为千分位
8620
8622
  * @author Lizhao <lz@winbaoxian.com>
@@ -8664,10 +8666,6 @@
8664
8666
  return QS.stringify(params);
8665
8667
  });
8666
8668
 
8667
- if (document && document.cookie && document.cookie.match('LIZHAO_DEBUG_CONSOLE_FLAG=1')) {
8668
- window.DEBUG_TEMP_CONSOLE_FLAG = true;
8669
- }
8670
-
8671
8669
  //
8672
8670
  //
8673
8671
  //