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.
@@ -37348,6 +37348,8 @@
37348
37348
  install$1(window.Vue);
37349
37349
  }
37350
37350
 
37351
+ document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
37352
+
37351
37353
  /**
37352
37354
  * **多被保人,获取并缓存多个险种信息的费率信息**
37353
37355
  * @author Lizhao <lz@winbaoxian.com>
@@ -37379,10 +37381,6 @@
37379
37381
  return QS.stringify(params);
37380
37382
  });
37381
37383
 
37382
- if (document && document.cookie && document.cookie.match('LIZHAO_DEBUG_CONSOLE_FLAG=1')) {
37383
- window.DEBUG_TEMP_CONSOLE_FLAG = true;
37384
- }
37385
-
37386
37384
  function showLoading() {
37387
37385
  if (IS_CPPOC_HOST) {
37388
37386
  _Toast.loading({
@@ -943,6 +943,14 @@
943
943
  });
944
944
  }
945
945
 
946
+ var enableLizhaoDebug = document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
947
+ function consoleLogWhenEnable() {
948
+ if (enableLizhaoDebug) {
949
+ var _console;
950
+ (_console = console).log.apply(_console, arguments);
951
+ }
952
+ }
953
+
946
954
  /**
947
955
  * **将对象下的 eleOrderList 数组中的子元素下的 value,转换为 key-value 键值对**
948
956
  * @author Lizhao <lz@winbaoxian.com>
@@ -1112,6 +1120,174 @@
1112
1120
  }
1113
1121
  return age;
1114
1122
  }
1123
+ function getExpressionParamMap(personData, product, ins, options) {
1124
+ var map = {
1125
+ planbookId: null,
1126
+ // 计划书id
1127
+ productId: null,
1128
+ // 产品id
1129
+ insured: {},
1130
+ // 被保人
1131
+ insured2: {},
1132
+ // 第二被保人
1133
+ applicant: {},
1134
+ // 投保人
1135
+ recipient: {},
1136
+ // 收件人
1137
+ p: {},
1138
+ // 当前产品
1139
+ m: {},
1140
+ // 主险
1141
+ me: {},
1142
+ // 当前险种
1143
+ common: {},
1144
+ // 通用信息
1145
+ customVariable: null,
1146
+ // 自定义变量
1147
+ cv: null,
1148
+ // 简写,自定义变量
1149
+ t: {} // 事件目标
1150
+ };
1151
+ if (personData) {
1152
+ var insuredInfo = (personData.personOrderList || []).find(function (p) {
1153
+ return p.key === 'insuredInfo';
1154
+ });
1155
+ var insured2Info = (personData.personOrderList || []).find(function (p) {
1156
+ return p.key === 'insured2Info';
1157
+ });
1158
+ var applicantInfo = (personData.personOrderList || []).find(function (p) {
1159
+ return p.key === 'applicantInfo';
1160
+ });
1161
+ var recipientInfo = personData !== null && personData !== void 0 && personData.recipientInfo ? personData.recipientInfo : null;
1162
+ map.insured = insuredInfo ? convertEleOrderListToObj(insuredInfo) : {};
1163
+ map.insured2 = insured2Info ? convertEleOrderListToObj(insured2Info) : {};
1164
+ map.applicant = applicantInfo ? convertEleOrderListToObj(applicantInfo) : {};
1165
+ map.recipient = recipientInfo ? convertEleOrderListToObj(recipientInfo) : {};
1166
+ }
1167
+ if (ins) {
1168
+ map.me = ins ? convertEleOrderListToObj(ins) : {};
1169
+ map["i".concat(ins.key)] = ins;
1170
+ }
1171
+ if (product) {
1172
+ map.productId = product.key;
1173
+ Object.keys(product).filter(function (k) {
1174
+ return !['mulInsOrderList'].includes(k);
1175
+ }).forEach(function (k) {
1176
+ map.p[k] = product[k];
1177
+ });
1178
+ if (Array.isArray(product.mulInsOrderList)) {
1179
+ var common = product.mulInsOrderList.find(function (item) {
1180
+ return item.key === 'common';
1181
+ });
1182
+ var insuranceList = product.mulInsOrderList.filter(function (item) {
1183
+ return !['common'].includes(item.key);
1184
+ }).map(function (item) {
1185
+ return convertEleOrderListToObj(item);
1186
+ });
1187
+ map.m = insuranceList[0] ? insuranceList[0] : {};
1188
+ map.me = ins && ins.key ? insuranceList.find(function (e) {
1189
+ return e.key === ins.key;
1190
+ }) || {} : {};
1191
+ map.common = common ? convertEleOrderListToObj(common) : {};
1192
+ insuranceList.forEach(function (item) {
1193
+ map["i".concat(item.key)] = item;
1194
+ });
1195
+ }
1196
+ }
1197
+ if (options) {
1198
+ if (options.planbookId) {
1199
+ map.planbookId = options.planbookId;
1200
+ }
1201
+ if (options.eventTarget) {
1202
+ map.t = options.eventTarget;
1203
+ }
1204
+ }
1205
+ if (ins && ins.customVariableExp) {
1206
+ var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
1207
+ map.customVariable = eval(exp);
1208
+ map.cv = map.customVariable;
1209
+ }
1210
+ return map;
1211
+ }
1212
+ function executeElementRule(personData, product, ins, ele) {
1213
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1214
+ var paramMap = getExpressionParamMap(personData, product, ins, options);
1215
+ var newEleMap = {};
1216
+ if (paramMap) {
1217
+ if (['cmCommonTitle'].includes(ele.componentName)) {
1218
+ if (ele.underwriteExp) {
1219
+ var exp = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1220
+ var evalValue = eval(exp);
1221
+ if (Array.isArray(evalValue)) {
1222
+ if ([0, 1].includes(evalValue[0])) {
1223
+ newEleMap.value = evalValue[0] === 1;
1224
+ }
1225
+ if ([0, 1].includes(evalValue[1])) {
1226
+ newEleMap.isDisabled = evalValue[1] === 0;
1227
+ }
1228
+ }
1229
+ consoleLogWhenEnable("".concat(ele.key, ": underwriteExp"), exp, evalValue);
1230
+ }
1231
+ }
1232
+ if (['cmCommonSelect', 'cmCommonRadioBtn', 'cmCommonRadio', 'cmCommonCheckbox'].includes(ele.componentName)) {
1233
+ if (ele.defaultValueExp) {
1234
+ if (ele.value !== 0 && !ele.value && paramMap.t.elementKey !== ele.key) {
1235
+ var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1236
+ newEleMap.value = eval(_exp);
1237
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
1238
+ }
1239
+ }
1240
+ if (ele.underwriteExp) {
1241
+ var _exp2 = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1242
+ var _evalValue = eval(_exp2);
1243
+ if (Array.isArray(_evalValue) && Array.isArray(ele.opts)) {
1244
+ if (_evalValue.length === 2) {
1245
+ newEleMap.opts = (ele.opts || []).filter(function (o) {
1246
+ return o.val >= _evalValue[0] && o.val <= _evalValue[1];
1247
+ });
1248
+ } else {
1249
+ newEleMap.opts = (ele.opts || []).filter(function (o) {
1250
+ return _evalValue.includes(o.val);
1251
+ });
1252
+ }
1253
+ }
1254
+ if (Array.isArray(newEleMap.opts)) {
1255
+ if (newEleMap.opts.length && !newEleMap.opts.some(function (o) {
1256
+ return o.val === ele.value;
1257
+ })) {
1258
+ newEleMap.value = newEleMap.opts[0].val;
1259
+ }
1260
+ }
1261
+ consoleLogWhenEnable("".concat(ele.key, ": underwriteExp"), _exp2, _evalValue);
1262
+ }
1263
+ }
1264
+ if (['cmCommonInput'].includes(ele.componentName)) {
1265
+ if (ele.defaultValueExp) {
1266
+ if (ele.value !== 0 && !ele.value && paramMap.t.elementKey !== ele.key) {
1267
+ var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1268
+ newEleMap.value = eval(_exp3);
1269
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
1270
+ }
1271
+ }
1272
+ if (ele.minExp) {
1273
+ var _exp4 = ele.minExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1274
+ newEleMap.min = eval(_exp4);
1275
+ consoleLogWhenEnable("".concat(ele.key, ": minExp"), _exp4, newEleMap.min);
1276
+ }
1277
+ if (ele.maxExp) {
1278
+ var _exp5 = ele.maxExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1279
+ newEleMap.max = eval(_exp5);
1280
+ consoleLogWhenEnable("".concat(ele.key, ": maxExp"), _exp5, newEleMap.max);
1281
+ }
1282
+ if (ele.multiExp) {
1283
+ var _exp6 = ele.multiExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1284
+ newEleMap.multi = eval(_exp6);
1285
+ consoleLogWhenEnable("".concat(ele.key, ": multiExp"), _exp6, newEleMap.multi);
1286
+ }
1287
+ }
1288
+ }
1289
+ return newEleMap;
1290
+ }
1115
1291
 
1116
1292
  /**
1117
1293
  * **处理人员数据**
@@ -9567,7 +9743,7 @@
9567
9743
  */
9568
9744
  function _productDataHandler() {
9569
9745
  _productDataHandler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prodData, prodVerifyData, personData, parmas) {
9570
- var productVerifyData, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9746
+ var productVerifyData, _parmas$eventTarget, insuranceKey, elementKey, groupInsurance, groupInsuranceIdEle, subInsurances, hasProduct, hasVerifyData, hasPersonData, personOrderList, _prodData$mulInsOrder3;
9571
9747
  return _regeneratorRuntime.wrap(function (_context) {
9572
9748
  while (1) switch (_context.prev = _context.next) {
9573
9749
  case 0:
@@ -9594,6 +9770,29 @@
9594
9770
  case 3:
9595
9771
  productVerifyData = prodVerifyData;
9596
9772
  case 4:
9773
+ // 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
9774
+ if (parmas && parmas.eventTarget) {
9775
+ _parmas$eventTarget = parmas.eventTarget, insuranceKey = _parmas$eventTarget.insuranceKey, elementKey = _parmas$eventTarget.elementKey;
9776
+ if (insuranceKey && elementKey === 'insuranceId') {
9777
+ groupInsurance = (prodData.mulInsOrderList || []).find(function (ins) {
9778
+ return ins.key === insuranceKey;
9779
+ });
9780
+ groupInsuranceIdEle = ((groupInsurance === null || groupInsurance === void 0 ? void 0 : groupInsurance.eleOrderList) || []).find(function (e) {
9781
+ return e.key === 'insuranceId';
9782
+ });
9783
+ subInsurances = (prodData.mulInsOrderList || []).filter(function (ins) {
9784
+ return ins.groupKey === insuranceKey;
9785
+ });
9786
+ subInsurances.forEach(function (ins) {
9787
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
9788
+ return e.key === 'title';
9789
+ });
9790
+ if (titleEle && groupInsuranceIdEle && !Array.isArray(titleEle.value)) {
9791
+ titleEle.value = groupInsuranceIdEle.value === ins.key;
9792
+ }
9793
+ });
9794
+ }
9795
+ }
9597
9796
  hasProduct = prodData.mulInsOrderList;
9598
9797
  hasVerifyData = productVerifyData && Object.keys(productVerifyData).length;
9599
9798
  hasPersonData = personData && personData.personOrderList;
@@ -9608,8 +9807,8 @@
9608
9807
  insuranceDataHandler(ins, prodData);
9609
9808
  var insuranceVerifyData = productVerifyData[ins.key];
9610
9809
  if (!insuranceVerifyData) {
9611
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9612
- console.log("".concat(prodData.titleName, "-").concat(prodData.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
9810
+ if (ins.key !== 'common') {
9811
+ consoleLogWhenEnable("".concat(prodData.titleName, "-").concat(prodData.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
9613
9812
  }
9614
9813
  return;
9615
9814
  }
@@ -9661,9 +9860,7 @@
9661
9860
  if (isNotAllowSelect) {
9662
9861
  eleTitle.isDisabled = true;
9663
9862
  eleTitle.value = false;
9664
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9665
- 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"));
9666
- }
9863
+ 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"));
9667
9864
  } else {
9668
9865
  // 存在费率,险种可选
9669
9866
  eleTitle.isDisabled = false;
@@ -9671,9 +9868,7 @@
9671
9868
  if (ins.required && (!ins.groupKey || ins.isCheckbox)) {
9672
9869
  eleTitle.value = true;
9673
9870
  eleTitle.isDisabled = true;
9674
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9675
- 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)"));
9676
- }
9871
+ 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)"));
9677
9872
  }
9678
9873
  }
9679
9874
  if (!curCondition) {
@@ -9692,9 +9887,7 @@
9692
9887
  });
9693
9888
  }
9694
9889
  if (!eleData) {
9695
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9696
- console.log("".concat(ins.name, " - ").concat(curCondition && curCondition.key, "\u5143\u7D20\u4E0D\u5B58\u5728\uFF1A"));
9697
- }
9890
+ consoleLogWhenEnable("".concat(ins.name, " - ").concat(curCondition && curCondition.key, "\u5143\u7D20\u4E0D\u5B58\u5728\uFF1A"));
9698
9891
  curCondition = null;
9699
9892
  return 0; // break
9700
9893
  }
@@ -9723,9 +9916,7 @@
9723
9916
  eleData.value = refEleData.value;
9724
9917
  }
9725
9918
  } else {
9726
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9727
- console.log("".concat(ins.name, "-").concat(ins.key, "\uFF1A\u5173\u8054\u9669\u79CD").concat(ins.refInsuranceId, "\u4E0D\u5B58\u5728"));
9728
- }
9919
+ consoleLogWhenEnable("".concat(ins.name, "-").concat(ins.key, "\uFF1A\u5173\u8054\u9669\u79CD").concat(ins.refInsuranceId, "\u4E0D\u5B58\u5728"));
9729
9920
  }
9730
9921
  } else {
9731
9922
  var backupOpts = eleData.opts && eleData.opts.length ? eleData.opts.slice(0) : [];
@@ -9794,9 +9985,7 @@
9794
9985
  if (!curCondition) {
9795
9986
  eleTitle.isDisabled = true;
9796
9987
  eleTitle.value = false;
9797
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9798
- console.log("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9799
- }
9988
+ consoleLogWhenEnable("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9800
9989
  }
9801
9990
 
9802
9991
  // 如果当前元素是隐藏的且不可修改,则过滤上一元素的选项,即,删除上一元素中不包含当前元素值的选项。
@@ -9833,6 +10022,15 @@
9833
10022
  _ret = _loop2();
9834
10023
  if (_ret === 0) break;
9835
10024
  } while (curCondition && curCondition.key && curCondition[curCondition.key]);
10025
+ if (Array.isArray(ins.eleOrderList)) {
10026
+ ins.eleOrderList.forEach(function (ele) {
10027
+ var newEleMap = executeElementRule(personData, prodData, ins, ele, parmas);
10028
+ for (var k in newEleMap) {
10029
+ ele[k] = newEleMap[k];
10030
+ }
10031
+ });
10032
+ insuranceDataHandler(ins, prodData);
10033
+ }
9836
10034
  });
9837
10035
  }
9838
10036
  setGroupInsurance(prodData);
@@ -10062,40 +10260,21 @@
10062
10260
  * @returns {IPbProduct} 产品数据(单个)
10063
10261
  */
10064
10262
  function setGroupInsurance(prodData) {
10065
- if (!prodData.mulInsOrderList) {
10066
- return prodData;
10067
- }
10068
- var groupInsuranceList = prodData && prodData.mulInsOrderList && prodData.mulInsOrderList.filter(function (ins) {
10069
- return !!ins.groupKey;
10070
- });
10071
- if (!groupInsuranceList || !groupInsuranceList.length) {
10072
- return prodData;
10073
- }
10074
- var oldGroupInsList = prodData.mulInsOrderList.filter(function (ins) {
10075
- return ins.isGroup;
10076
- });
10077
- var newGroupInsMap = {};
10078
- //清空险种列表中的已有的险种组合
10079
- prodData.mulInsOrderList = prodData.mulInsOrderList.filter(function (ins) {
10263
+ var mulInsOrderList = prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : [];
10264
+ // 清空险种列表中的已有的险种组合
10265
+ prodData.mulInsOrderList = mulInsOrderList.filter(function (ins) {
10080
10266
  return !ins.isGroup;
10081
10267
  });
10082
- groupInsuranceList.forEach(function (ins) {
10083
- //多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10084
- // ins.isCheckbox = true
10085
- var oldGroupIns = oldGroupInsList.find(function (gIns) {
10086
- return gIns.key === ins.groupKey;
10087
- });
10088
- var oldTitleEle = {};
10089
- var oldInsuranceIdEle = {};
10090
- if (oldGroupIns && oldGroupIns.eleOrderList) {
10091
- oldTitleEle = oldGroupIns.eleOrderList.find(function (e) {
10092
- return e.key === 'title';
10093
- });
10094
- oldInsuranceIdEle = oldGroupIns.eleOrderList.find(function (e) {
10095
- return e.key === 'insuranceId';
10096
- });
10097
- }
10098
- if (ins.groupKey) {
10268
+
10269
+ // 多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
10270
+ var groupInsuranceList = mulInsOrderList.filter(function (ins) {
10271
+ return !!ins.groupKey;
10272
+ });
10273
+ if (groupInsuranceList.length) {
10274
+ var newGroupInsMap = {};
10275
+ groupInsuranceList.filter(function (ins) {
10276
+ return ins.groupKey;
10277
+ }).forEach(function (ins) {
10099
10278
  newGroupInsMap[ins.groupKey] = newGroupInsMap[ins.groupKey] || {
10100
10279
  key: ins.groupKey,
10101
10280
  name: ins.groupName,
@@ -10103,19 +10282,19 @@
10103
10282
  isGroup: true,
10104
10283
  eleOrderList: [{
10105
10284
  key: 'title',
10106
- value: oldTitleEle && oldTitleEle.value || false,
10285
+ value: false,
10107
10286
  isDisabled: false,
10108
10287
  componentName: 'cmCommonTitle',
10109
10288
  labelName: ins.groupName
10110
10289
  }, {
10111
10290
  key: 'insuranceId',
10112
- value: oldInsuranceIdEle && oldInsuranceIdEle.value || (ins.isCheckbox ? [] : ''),
10291
+ value: ins.isCheckbox ? [] : null,
10113
10292
  componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
10114
10293
  opts: []
10115
10294
  }]
10116
10295
  };
10117
10296
 
10118
- // 当险种转换成险种组合的选项
10297
+ // 将子险种转换成险种组合的选项
10119
10298
  var titleEle = ins.eleOrderList.find(function (e) {
10120
10299
  return e.key === 'title';
10121
10300
  });
@@ -10128,119 +10307,73 @@
10128
10307
  desc: titleEle.labelName,
10129
10308
  isDisabled: titleEle.isDisabled
10130
10309
  });
10131
- }
10132
- });
10133
-
10134
- // 处理组合险中的逻辑,并加入到产品险种列表中
10135
- var _loop = function _loop(k) {
10136
- var nGroupTitle = newGroupInsMap[k].eleOrderList.find(function (e) {
10137
- return e.key === 'title';
10138
- });
10139
- var nGroupInsuranceId = newGroupInsMap[k].eleOrderList.find(function (e) {
10140
- return e.key === 'insuranceId';
10141
10310
  });
10142
- if (nGroupTitle && nGroupInsuranceId) {
10143
- if (nGroupInsuranceId.opts && nGroupInsuranceId.opts.length) {
10144
- // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10145
- if (nGroupInsuranceId.opts.every(function (opt) {
10146
- return !!opt.isDisabled;
10147
- })) {
10148
- nGroupTitle.value = false;
10149
- nGroupTitle.isDisabled = true;
10150
- } else {
10151
- nGroupTitle.isDisabled = false;
10152
- }
10153
- }
10154
- var groupInsList = prodData.mulInsOrderList.filter(function (ins) {
10311
+
10312
+ // 处理组合险中的逻辑,并加入到产品险种列表中
10313
+ var _loop = function _loop(k) {
10314
+ var nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10315
+ return e.key === 'title';
10316
+ });
10317
+ var nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(function (e) {
10318
+ return e.key === 'insuranceId';
10319
+ });
10320
+ var groupInsList = mulInsOrderList.filter(function (ins) {
10155
10321
  return ins.groupKey == k;
10156
10322
  });
10157
- if (groupInsList && groupInsList.length) {
10158
- // 如果组合险中有一款是必选的,则整个组合险为选中状态
10159
- if (groupInsList.some(function (ins) {
10160
- var subTitle = ins.eleOrderList.find(function (e) {
10161
- return e.key === 'title';
10162
- });
10163
- return ins.required && subTitle && !subTitle.isDisabled;
10164
- })) {
10165
- nGroupTitle.value = true;
10166
- nGroupTitle.isDisabled = true;
10167
- }
10168
-
10169
- // 初始化时,设置组合险默认值
10323
+ if (nGroupTitleEle && nGroupInsuranceIdEle && groupInsList.length) {
10170
10324
  var notDisabledInsurances = groupInsList.filter(function (ins) {
10171
- var subTitle = ins.eleOrderList.find(function (e) {
10325
+ var titleEle = (ins.eleOrderList || []).find(function (e) {
10172
10326
  return e.key === 'title';
10173
10327
  });
10174
- return subTitle && !subTitle.isDisabled;
10328
+ return titleEle && !titleEle.isDisabled;
10175
10329
  });
10176
- var checkedInsurances = notDisabledInsurances.find(function (ins) {
10177
- var subTitle = ins.eleOrderList.find(function (e) {
10178
- return e.key === 'title';
10330
+ var checkedInsurances = notDisabledInsurances.filter(function (ins) {
10331
+ var titleEle = (ins.eleOrderList || []).find(function (ele) {
10332
+ return ele.key === 'title';
10179
10333
  });
10180
- return subTitle && subTitle.value;
10334
+ return titleEle && titleEle.value;
10181
10335
  });
10182
- if (!nGroupInsuranceId.value) {
10183
- if (checkedInsurances) {
10184
- nGroupInsuranceId.value = checkedInsurances.key;
10185
- nGroupTitle.value = true;
10186
- } else if (nGroupTitle.value) {
10187
- if (notDisabledInsurances[0]) {
10188
- nGroupInsuranceId.value = notDisabledInsurances[0].key;
10189
- }
10190
- }
10191
- }
10192
- }
10193
- }
10194
- if (nGroupInsuranceId) {
10195
- if (nGroupInsuranceId.value) {
10196
- if (nGroupInsuranceId.value.constructor === Array) {
10197
- if (nGroupInsuranceId.opts) {
10198
- nGroupInsuranceId.opts = nGroupInsuranceId.opts.filter(function (opt) {
10199
- return nGroupInsuranceId.value.indexOf(opt.val) !== -1 && !opt.isDisabled;
10200
- });
10201
- }
10202
- } else {
10203
- var opt = nGroupInsuranceId.opts.find(function (o) {
10204
- return o.val === nGroupInsuranceId.value;
10205
- });
10206
- if (opt && opt.isDisabled) {
10207
- nGroupInsuranceId.value = '';
10208
- }
10209
- }
10210
- }
10211
- if (nGroupInsuranceId.value) {
10212
- var checkedIns = prodData.mulInsOrderList.find(function (ins) {
10213
- return ins.key === nGroupInsuranceId.value;
10336
+ var hasRequiredIns = notDisabledInsurances.some(function (ins) {
10337
+ return ins.required;
10338
+ });
10339
+ var checkedInsurance = checkedInsurances[0];
10340
+ // hasRequiredIns:如果组合险中有一款是必选的,则整个组合险为选中状态
10341
+ // 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
10342
+ nGroupTitleEle.value = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).some(function (opt) {
10343
+ return !opt.isDisabled;
10344
+ });
10345
+ nGroupTitleEle.isDisabled = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).every(function (opt) {
10346
+ return !!opt.isDisabled;
10214
10347
  });
10215
- if (checkedIns) {
10216
- //将当前选中险种的部分数据复制到组合险中
10217
- for (var ck in checkedIns) {
10218
- if (!['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'].includes(ck)) {
10219
- // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10348
+ nGroupInsuranceIdEle.value = checkedInsurance ? checkedInsurance.key : null;
10349
+
10350
+ //将当前选中险种的部分数据复制到组合险中
10351
+ if (checkedInsurance) {
10352
+ // 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
10353
+ var keys = ['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData'];
10354
+ for (var ck in checkedInsurance) {
10355
+ if (!keys.includes(ck)) {
10220
10356
  if (ck === 'eleOrderList') {
10221
- newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedIns[ck].filter(function (ele) {
10357
+ newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat(checkedInsurance[ck].filter(function (ele) {
10222
10358
  return ele.key !== 'title';
10223
10359
  }));
10224
10360
  } else {
10225
- newGroupInsMap[k][ck] = checkedIns[ck];
10361
+ newGroupInsMap[k][ck] = checkedInsurance[ck];
10226
10362
  }
10227
10363
  }
10228
10364
  }
10229
10365
  }
10230
10366
  }
10231
- }
10232
- var index = -1;
10233
- prodData.mulInsOrderList.forEach(function (ins, i) {
10234
- if (ins.groupKey === k) {
10235
- index = i;
10367
+ var index = mulInsOrderList.findLastIndex(function (ins) {
10368
+ return ins.groupKey === k;
10369
+ });
10370
+ if (index >= 0) {
10371
+ prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10236
10372
  }
10237
- });
10238
- if (index >= 0) {
10239
- prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k]);
10373
+ };
10374
+ for (var k in newGroupInsMap) {
10375
+ _loop(k);
10240
10376
  }
10241
- };
10242
- for (var k in newGroupInsMap) {
10243
- _loop(k);
10244
10377
  }
10245
10378
  return prodData;
10246
10379
  }
@@ -10332,10 +10465,6 @@
10332
10465
  return productData;
10333
10466
  }
10334
10467
 
10335
- if (document && document.cookie && document.cookie.match('LIZHAO_DEBUG_CONSOLE_FLAG=1')) {
10336
- window.DEBUG_TEMP_CONSOLE_FLAG = true;
10337
- }
10338
-
10339
10468
  function showLoading() {
10340
10469
  if (IS_CPPOC_HOST) {
10341
10470
  _Toast.loading({
@@ -11905,6 +12034,7 @@
11905
12034
  params,
11906
12035
  allPersonsData,
11907
12036
  productGroupList,
12037
+ eventTarget,
11908
12038
  promises,
11909
12039
  _args = arguments;
11910
12040
  return _regeneratorRuntime.wrap(function (_context) {
@@ -11920,6 +12050,10 @@
11920
12050
  case 1:
11921
12051
  allPersonsData = inputData.personData;
11922
12052
  productGroupList = inputData.productGroupList || [];
12053
+ eventTarget = {
12054
+ personKey: personData.key,
12055
+ elementKey: ele.key
12056
+ };
11923
12057
  if (!allPersonsData) {
11924
12058
  _context.next = 2;
11925
12059
  break;
@@ -11937,7 +12071,8 @@
11937
12071
  g.prodOrderList.map(function (p) {
11938
12072
  clearAddAndTakeAndAdjustBaoeData(p);
11939
12073
  promises.push(productDataHandler(p, lodash.get(verifyData, "[".concat(p.key, "]")), allPersonsData, {
11940
- planbookId: lodash.get(params, 'planbookId')
12074
+ planbookId: lodash.get(params, 'planbookId'),
12075
+ eventTarget: eventTarget
11941
12076
  }));
11942
12077
  });
11943
12078
  });