bxs-tools-ui 3.1.2 → 3.2.0-0

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.
@@ -944,6 +944,14 @@ function Watch(path, options) {
944
944
  });
945
945
  }
946
946
 
947
+ var enableLizhaoDebug = document && document.cookie && document.cookie.match('ENABLE_LIZHAO_DEBUG=1');
948
+ function consoleLogWhenEnable() {
949
+ if (enableLizhaoDebug) {
950
+ var _console;
951
+ (_console = console).log.apply(_console, arguments);
952
+ }
953
+ }
954
+
947
955
  /**
948
956
  * **将对象下的 eleOrderList 数组中的子元素下的 value,转换为 key-value 键值对**
949
957
  * @author Lizhao <lz@winbaoxian.com>
@@ -1113,6 +1121,167 @@ function getAgeFromBirth(birth, cDate) {
1113
1121
  }
1114
1122
  return age;
1115
1123
  }
1124
+ function getExpressionParamMap(personData, product, ins, options) {
1125
+ var map = {
1126
+ planbookId: null,
1127
+ // 计划书id
1128
+ productId: null,
1129
+ // 产品id
1130
+ insured: {},
1131
+ // 被保人
1132
+ insured2: {},
1133
+ // 第二被保人
1134
+ applicant: {},
1135
+ // 投保人
1136
+ recipient: {},
1137
+ // 收件人
1138
+ p: {},
1139
+ // 当前产品
1140
+ m: {},
1141
+ // 主险
1142
+ me: {},
1143
+ // 当前险种
1144
+ common: {},
1145
+ // 通用信息
1146
+ customVariable: null,
1147
+ // 自定义变量
1148
+ cv: null // 简写,自定义变量
1149
+ };
1150
+ if (personData) {
1151
+ var insuredInfo = (personData.personOrderList || []).find(function (p) {
1152
+ return p.key === 'insuredInfo';
1153
+ });
1154
+ var insured2Info = (personData.personOrderList || []).find(function (p) {
1155
+ return p.key === 'insured2Info';
1156
+ });
1157
+ var applicantInfo = (personData.personOrderList || []).find(function (p) {
1158
+ return p.key === 'applicantInfo';
1159
+ });
1160
+ var recipientInfo = personData !== null && personData !== void 0 && personData.recipientInfo ? personData.recipientInfo : null;
1161
+ map.insured = insuredInfo ? convertEleOrderListToObj(insuredInfo) : {};
1162
+ map.insured2 = insured2Info ? convertEleOrderListToObj(insured2Info) : {};
1163
+ map.applicant = applicantInfo ? convertEleOrderListToObj(applicantInfo) : {};
1164
+ map.recipient = recipientInfo ? convertEleOrderListToObj(recipientInfo) : {};
1165
+ }
1166
+ if (ins) {
1167
+ map.me = ins ? convertEleOrderListToObj(ins) : {};
1168
+ map["i".concat(ins.key)] = ins;
1169
+ }
1170
+ if (product) {
1171
+ map.productId = product.key;
1172
+ Object.keys(product).filter(function (k) {
1173
+ return !['mulInsOrderList'].includes(k);
1174
+ }).forEach(function (k) {
1175
+ map.p[k] = product[k];
1176
+ });
1177
+ if (Array.isArray(product.mulInsOrderList)) {
1178
+ var common = product.mulInsOrderList.find(function (item) {
1179
+ return item.key === 'common';
1180
+ });
1181
+ var insuranceList = product.mulInsOrderList.filter(function (item) {
1182
+ return !['common'].includes(item.key);
1183
+ }).map(function (item) {
1184
+ return convertEleOrderListToObj(item);
1185
+ });
1186
+ map.m = insuranceList[0] ? insuranceList[0] : {};
1187
+ map.me = ins && ins.key ? insuranceList.find(function (e) {
1188
+ return e.key === ins.key;
1189
+ }) || {} : {};
1190
+ map.common = common ? convertEleOrderListToObj(common) : {};
1191
+ insuranceList.forEach(function (item) {
1192
+ map["i".concat(item.key)] = item;
1193
+ });
1194
+ }
1195
+ }
1196
+ if (options && options.planbookId) {
1197
+ map.planbookId = options.planbookId;
1198
+ }
1199
+ if (ins && ins.customVariableExp) {
1200
+ var exp = ins.customVariableExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'map.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'map.$2');
1201
+ map.customVariable = eval(exp);
1202
+ map.cv = map.customVariable;
1203
+ }
1204
+ return map;
1205
+ }
1206
+ function executeElementRule(personData, product, ins, ele) {
1207
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
1208
+ var paramMap = getExpressionParamMap(personData, product, ins, options);
1209
+ var newEleMap = {};
1210
+ if (paramMap) {
1211
+ if (['cmCommonTitle'].includes(ele.componentName)) {
1212
+ if (ele.underwriteExp) {
1213
+ var exp = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1214
+ var evalValue = eval(exp);
1215
+ if (Array.isArray(evalValue)) {
1216
+ if ([0, 1].includes(evalValue[0])) {
1217
+ newEleMap.value = evalValue[0] === 1;
1218
+ }
1219
+ if ([0, 1].includes(evalValue[1])) {
1220
+ newEleMap.isDisabled = evalValue[1] === 0;
1221
+ }
1222
+ }
1223
+ consoleLogWhenEnable("".concat(ele.key, ": underwriteExp"), exp, evalValue);
1224
+ }
1225
+ }
1226
+ if (['cmCommonSelect', 'cmCommonRadioBtn', 'cmCommonRadio', 'cmCommonCheckbox'].includes(ele.componentName)) {
1227
+ if (ele.defaultValueExp) {
1228
+ if (ele.value !== 0 && !ele.value) {
1229
+ var _exp = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1230
+ newEleMap.value = eval(_exp);
1231
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp, newEleMap.value);
1232
+ }
1233
+ }
1234
+ if (ele.underwriteExp) {
1235
+ var _exp2 = ele.underwriteExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1236
+ var _evalValue = eval(_exp2);
1237
+ if (Array.isArray(_evalValue) && Array.isArray(ele.opts)) {
1238
+ if (_evalValue.length === 2) {
1239
+ newEleMap.opts = (ele.opts || []).filter(function (o) {
1240
+ return o.val >= _evalValue[0] && o.val <= _evalValue[1];
1241
+ });
1242
+ } else {
1243
+ newEleMap.opts = (ele.opts || []).filter(function (o) {
1244
+ return _evalValue.includes(o.val);
1245
+ });
1246
+ }
1247
+ }
1248
+ if (Array.isArray(newEleMap.opts)) {
1249
+ if (newEleMap.opts.length && !newEleMap.opts.some(function (o) {
1250
+ return o.val === ele.value;
1251
+ })) {
1252
+ newEleMap.value = newEleMap.opts[0].val;
1253
+ }
1254
+ }
1255
+ consoleLogWhenEnable("".concat(ele.key, ": underwriteExp"), _exp2, _evalValue);
1256
+ }
1257
+ }
1258
+ if (['cmCommonInput'].includes(ele.componentName)) {
1259
+ if (ele.defaultValueExp) {
1260
+ if (!ele.value) {
1261
+ var _exp3 = ele.defaultValueExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1262
+ newEleMap.value = eval(_exp3);
1263
+ consoleLogWhenEnable("".concat(ele.key, ": defaultValueExp"), _exp3, newEleMap.value);
1264
+ }
1265
+ }
1266
+ if (ele.minExp) {
1267
+ var _exp4 = ele.minExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1268
+ newEleMap.min = eval(_exp4);
1269
+ consoleLogWhenEnable("".concat(ele.key, ": minExp"), _exp4, newEleMap.min);
1270
+ }
1271
+ if (ele.maxExp) {
1272
+ var _exp5 = ele.maxExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1273
+ newEleMap.max = eval(_exp5);
1274
+ consoleLogWhenEnable("".concat(ele.key, ": maxExp"), _exp5, newEleMap.max);
1275
+ }
1276
+ if (ele.multiExp) {
1277
+ var _exp6 = ele.multiExp.replace(/(%)(\d+)(\.*\w*)(%)/g, 'paramMap.i$2$3').replace(/(%)(\w*\.*\w*)(%)/g, 'paramMap.$2');
1278
+ newEleMap.multi = eval(_exp6);
1279
+ consoleLogWhenEnable("".concat(ele.key, ": multiExp"), _exp6, newEleMap.multi);
1280
+ }
1281
+ }
1282
+ }
1283
+ return newEleMap;
1284
+ }
1116
1285
 
1117
1286
  /**
1118
1287
  * **处理人员数据**
@@ -9609,8 +9778,8 @@ function _productDataHandler() {
9609
9778
  insuranceDataHandler(ins, prodData);
9610
9779
  var insuranceVerifyData = productVerifyData[ins.key];
9611
9780
  if (!insuranceVerifyData) {
9612
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9613
- console.log("".concat(prodData.titleName, "-").concat(prodData.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
9781
+ if (ins.key !== 'common') {
9782
+ consoleLogWhenEnable("".concat(prodData.titleName, "-").concat(prodData.key, " -> ").concat(ins.name, "-").concat(ins.key, ": \u5F53\u524D\u9669\u79CD\u6CA1\u6709\u8D39\u7387\u8868"));
9614
9783
  }
9615
9784
  return;
9616
9785
  }
@@ -9662,9 +9831,7 @@ function _productDataHandler() {
9662
9831
  if (isNotAllowSelect) {
9663
9832
  eleTitle.isDisabled = true;
9664
9833
  eleTitle.value = false;
9665
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9666
- 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"));
9667
- }
9834
+ 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"));
9668
9835
  } else {
9669
9836
  // 存在费率,险种可选
9670
9837
  eleTitle.isDisabled = false;
@@ -9672,9 +9839,7 @@ function _productDataHandler() {
9672
9839
  if (ins.required && (!ins.groupKey || ins.isCheckbox)) {
9673
9840
  eleTitle.value = true;
9674
9841
  eleTitle.isDisabled = true;
9675
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9676
- 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)"));
9677
- }
9842
+ 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)"));
9678
9843
  }
9679
9844
  }
9680
9845
  if (!curCondition) {
@@ -9693,9 +9858,7 @@ function _productDataHandler() {
9693
9858
  });
9694
9859
  }
9695
9860
  if (!eleData) {
9696
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9697
- console.log("".concat(ins.name, " - ").concat(curCondition && curCondition.key, "\u5143\u7D20\u4E0D\u5B58\u5728\uFF1A"));
9698
- }
9861
+ consoleLogWhenEnable("".concat(ins.name, " - ").concat(curCondition && curCondition.key, "\u5143\u7D20\u4E0D\u5B58\u5728\uFF1A"));
9699
9862
  curCondition = null;
9700
9863
  return 0; // break
9701
9864
  }
@@ -9724,9 +9887,7 @@ function _productDataHandler() {
9724
9887
  eleData.value = refEleData.value;
9725
9888
  }
9726
9889
  } else {
9727
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9728
- console.log("".concat(ins.name, "-").concat(ins.key, "\uFF1A\u5173\u8054\u9669\u79CD").concat(ins.refInsuranceId, "\u4E0D\u5B58\u5728"));
9729
- }
9890
+ consoleLogWhenEnable("".concat(ins.name, "-").concat(ins.key, "\uFF1A\u5173\u8054\u9669\u79CD").concat(ins.refInsuranceId, "\u4E0D\u5B58\u5728"));
9730
9891
  }
9731
9892
  } else {
9732
9893
  var backupOpts = eleData.opts && eleData.opts.length ? eleData.opts.slice(0) : [];
@@ -9795,9 +9956,7 @@ function _productDataHandler() {
9795
9956
  if (!curCondition) {
9796
9957
  eleTitle.isDisabled = true;
9797
9958
  eleTitle.value = false;
9798
- if (window.DEBUG_TEMP_CONSOLE_FLAG) {
9799
- console.log("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9800
- }
9959
+ consoleLogWhenEnable("".concat(eleTitle.labelName, "-").concat(ins.key, ": \u8D39\u7387\u4E0D\u5B58\u5728\uFF01"));
9801
9960
  }
9802
9961
 
9803
9962
  // 如果当前元素是隐藏的且不可修改,则过滤上一元素的选项,即,删除上一元素中不包含当前元素值的选项。
@@ -9834,6 +9993,15 @@ function _productDataHandler() {
9834
9993
  _ret = _loop2();
9835
9994
  if (_ret === 0) break;
9836
9995
  } while (curCondition && curCondition.key && curCondition[curCondition.key]);
9996
+ if (Array.isArray(ins.eleOrderList)) {
9997
+ ins.eleOrderList.forEach(function (ele) {
9998
+ var newEleMap = executeElementRule(personData, prodData, ins, ele, parmas);
9999
+ for (var k in newEleMap) {
10000
+ ele[k] = newEleMap[k];
10001
+ }
10002
+ });
10003
+ insuranceDataHandler(ins, prodData);
10004
+ }
9837
10005
  });
9838
10006
  }
9839
10007
  setGroupInsurance(prodData);
@@ -10333,10 +10501,6 @@ function clearAddAndTakeAndAdjustBaoeData(productData) {
10333
10501
  return productData;
10334
10502
  }
10335
10503
 
10336
- if (document && document.cookie && document.cookie.match('LIZHAO_DEBUG_CONSOLE_FLAG=1')) {
10337
- window.DEBUG_TEMP_CONSOLE_FLAG = true;
10338
- }
10339
-
10340
10504
  function showLoading() {
10341
10505
  if (IS_CPPOC_HOST) {
10342
10506
  _Toast.loading({