bxs-tools-ui 3.2.0 → 3.3.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.
- package/README.md +20 -20
- package/es/add-and-take/index.css +1 -1
- package/es/add-and-take/index.js +283 -64
- package/es/adjust-baoe/index.css +1 -1
- package/es/adjust-baoe/index.js +444 -195
- package/es/business-card/index.css +1 -1
- package/es/business-card/index.js +1 -0
- package/es/canvas-poster/index.css +1 -1
- package/es/canvas-poster/index.js +1 -0
- package/es/index.css +1 -1
- package/es/index.js +936 -824
- package/es/insure-calculate/index.css +1 -1
- package/es/insure-calculate/index.js +438 -265
- package/es/person-info/index.css +1 -1
- package/es/person-info/index.js +296 -1370
- package/es/product-info/index.css +1 -1
- package/es/product-info/index.js +644 -548
- package/es/share-sheet/index.css +1 -1
- package/es/share-sheet/index.js +313 -21
- package/es/utils/index.js +530 -429
- package/lib/add-and-take/index.css +1 -1
- package/lib/add-and-take/index.js +283 -64
- package/lib/adjust-baoe/index.css +1 -1
- package/lib/adjust-baoe/index.js +441 -194
- package/lib/business-card/index.css +1 -1
- package/lib/business-card/index.js +1 -0
- package/lib/canvas-poster/index.css +1 -1
- package/lib/canvas-poster/index.js +1 -0
- package/lib/index.css +1 -1
- package/lib/index.js +939 -826
- package/lib/insure-calculate/index.css +1 -1
- package/lib/insure-calculate/index.js +438 -268
- package/lib/person-info/index.css +1 -1
- package/lib/person-info/index.js +295 -1372
- package/lib/product-info/index.css +1 -1
- package/lib/product-info/index.js +645 -550
- package/lib/share-sheet/index.css +1 -1
- package/lib/share-sheet/index.js +313 -25
- package/lib/utils/index.js +531 -433
- package/package.json +9 -7
- package/packages/add-and-take/components/interest-form.less +144 -0
- package/packages/add-and-take/components/interest-form.vue +179 -179
- package/packages/add-and-take/components/interest-items.less +87 -0
- package/packages/add-and-take/components/interest-items.vue +67 -80
- package/packages/add-and-take/components/interest-table.less +111 -0
- package/packages/add-and-take/components/interest-table.vue +31 -31
- package/packages/add-and-take/constant.ts +2 -2
- package/packages/add-and-take/demo/index.vue +89 -86
- package/packages/add-and-take/handler.ts +52 -57
- package/packages/add-and-take/index.less +69 -0
- package/packages/add-and-take/index.vue +156 -156
- package/packages/add-and-take/readme.md +87 -98
- package/packages/adjust-baoe/demo/index.vue +37 -47
- package/packages/adjust-baoe/index.less +125 -0
- package/packages/adjust-baoe/index.vue +134 -147
- package/packages/adjust-baoe/readme.md +35 -45
- package/packages/business-card/demo/index.vue +7 -7
- package/packages/business-card/index.less +100 -0
- package/packages/business-card/index.vue +18 -21
- package/packages/business-card/readme.md +46 -53
- package/packages/bxs-utils/demo/index.vue +2 -2
- package/packages/bxs-utils/index.ts +5 -5
- package/packages/bxs-utils/planbook/common.ts +56 -92
- package/packages/bxs-utils/planbook/index.ts +4 -4
- package/packages/bxs-utils/planbook/insurance.ts +137 -127
- package/packages/bxs-utils/planbook/person.ts +143 -147
- package/packages/bxs-utils/planbook/product.ts +473 -509
- package/packages/bxs-utils/readme.md +94 -84
- package/packages/bxs-utils/trade/index.js +1 -1
- package/packages/bxs-utils/trade/insureCalculate.js +91 -204
- package/packages/canvas-poster/demo/index.vue +9 -13
- package/packages/canvas-poster/index.less +5 -0
- package/packages/canvas-poster/index.vue +68 -79
- package/packages/canvas-poster/readme.md +106 -109
- package/packages/index.ts +1 -1
- package/packages/insure-calculate/demo/index.vue +20 -20
- package/packages/insure-calculate/index.less +366 -0
- package/packages/insure-calculate/index.vue +305 -329
- package/packages/insure-calculate/readme.md +99 -106
- package/packages/person-info/crm-popup.vue +81 -80
- package/packages/person-info/demo/index.vue +25 -37
- package/packages/person-info/index-inline.less +11 -0
- package/packages/person-info/index.vue +53 -83
- package/packages/person-info/readme.md +109 -115
- package/packages/planbook-input/components/footer.less +54 -0
- package/packages/planbook-input/components/footer.vue +8 -64
- package/packages/planbook-input/components/handler.js +33 -44
- package/packages/planbook-input/components/product-table.less +235 -0
- package/packages/planbook-input/components/product-table.vue +114 -108
- package/packages/planbook-input/demo/index.vue +3 -3
- package/packages/planbook-input/helper.js +852 -465
- package/packages/planbook-input/index.less +30 -0
- package/packages/planbook-input/index.vue +86 -103
- package/packages/planbook-input/readme.md +72 -90
- package/packages/product-info/demo/constant.js +1 -1
- package/packages/product-info/demo/index.vue +31 -43
- package/packages/product-info/index.less +271 -0
- package/packages/product-info/index.vue +198 -210
- package/packages/product-info/readme.md +72 -75
- package/packages/share-sheet/constant.js +4 -4
- package/packages/share-sheet/demo/index.vue +10 -10
- package/packages/share-sheet/handler.js +14 -14
- package/packages/share-sheet/index.less +201 -0
- package/packages/share-sheet/index.vue +39 -39
- package/packages/share-sheet/readme.md +121 -127
- package/src/api/add-and-take.js +45 -0
- package/src/api/adjust-baoe.js +16 -0
- package/src/api/index.js +6 -0
- package/src/api/planbook.js +93 -0
- package/src/api/request.js +211 -0
- package/src/api/trade.js +56 -0
- package/src/api/user.js +18 -0
- package/src/components/common/common-age-birthday.less +66 -0
- package/src/components/common/common-age-birthday.vue +27 -95
- package/src/components/common/common-popup.less +81 -0
- package/src/components/common/common-popup.vue +12 -96
- package/src/components/common/common-radio.less +75 -0
- package/src/components/common/common-radio.vue +13 -91
- package/src/components/common/common-select.less +13 -0
- package/src/components/common/common-select.vue +21 -38
- package/src/components/common/common-title.less +115 -0
- package/src/components/common/common-title.vue +24 -24
- package/src/js/loading.js +6 -6
- package/src/js/md5Token.js +38 -44
- package/src/js/utils.js +45 -53
- package/src/js/variables.js +47 -25
- package/src/style/base.less +18 -0
- package/src/style/color.less +40 -0
- package/src/style/variables.less +21 -42
- package/packages/add-and-take/api.ts +0 -70
- package/packages/add-and-take/components/interest-form.css +0 -146
- package/packages/add-and-take/components/interest-items.css +0 -87
- package/packages/add-and-take/components/interest-table.css +0 -113
- package/packages/add-and-take/index.css +0 -70
- package/packages/adjust-baoe/index.css +0 -123
- package/packages/business-card/index.css +0 -101
- package/packages/canvas-poster/index.css +0 -5
- package/packages/insure-calculate/index.css +0 -368
- package/packages/planbook-input/api.js +0 -29
- package/packages/planbook-input/components/product-table.css +0 -236
- package/packages/planbook-input/index.css +0 -31
- package/packages/product-info/index.css +0 -264
- package/packages/share-sheet/index.css +0 -203
- package/src/components/common/common-title.css +0 -116
- package/src/js/request.js +0 -64
- package/src/style/apply.css +0 -25
- package/src/style/base.css +0 -36
- package/src/style/color.css +0 -74
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import QS from 'qs'
|
|
2
|
-
import { memoize, cloneDeep } from 'lodash'
|
|
3
|
-
import {
|
|
1
|
+
import QS from 'qs'
|
|
2
|
+
import { memoize, cloneDeep, findLastIndex } from 'lodash'
|
|
3
|
+
import { getPlanbookInsuranceVerifyData } from '../../../src/api/planbook.js'
|
|
4
4
|
import {
|
|
5
5
|
consoleLogWhenEnable,
|
|
6
6
|
convertEleOrderListToObj,
|
|
7
7
|
converUnit10000,
|
|
8
8
|
getHuomianPeriodValue,
|
|
9
9
|
getNumberFromYear,
|
|
10
|
-
deepCopy,
|
|
11
10
|
executeElementRule
|
|
12
|
-
} from './common'
|
|
13
|
-
import { convertPersonData } from './person'
|
|
14
|
-
import { initInsuranceData, insuranceDataHandler, restrictElementsInInsurance } from './insurance'
|
|
11
|
+
} from './common'
|
|
12
|
+
import { convertPersonData } from './person'
|
|
13
|
+
import { initInsuranceData, insuranceDataHandler, restrictElementsInInsurance } from './insurance'
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* **初始化产品数据(单个)**
|
|
@@ -22,21 +21,22 @@ import { initInsuranceData, insuranceDataHandler, restrictElementsInInsurance }
|
|
|
22
21
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
23
22
|
* @returns {IPbProduct} 产品数据
|
|
24
23
|
*/
|
|
25
|
-
export function initProductData(prodData
|
|
26
|
-
prodData.hadChoice = false
|
|
27
|
-
prodData.insShowArr = null
|
|
28
|
-
prodData.totalBaof = null
|
|
24
|
+
export function initProductData(prodData: IPbProduct): IPbProduct {
|
|
25
|
+
prodData.hadChoice = false
|
|
26
|
+
prodData.insShowArr = null
|
|
27
|
+
prodData.totalBaof = null
|
|
29
28
|
if (!prodData.mulInsOrderList) {
|
|
30
|
-
return prodData
|
|
29
|
+
return prodData
|
|
31
30
|
}
|
|
32
31
|
// 初始化调整保额的数据
|
|
33
32
|
if (prodData.mulInsOrderList.some(ins => !!ins.adjustBaoe)) {
|
|
34
|
-
prodData.adjustBaoeData = prodData.adjustBaoeData || null
|
|
33
|
+
prodData.adjustBaoeData = prodData.adjustBaoeData || null
|
|
35
34
|
}
|
|
36
35
|
prodData.mulInsOrderList.forEach((ins: IProdInsurance) => {
|
|
37
|
-
initInsuranceData(ins)
|
|
38
|
-
})
|
|
39
|
-
|
|
36
|
+
initInsuranceData(ins)
|
|
37
|
+
})
|
|
38
|
+
setCommonInfo(prodData)
|
|
39
|
+
return prodData
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -55,242 +55,225 @@ export function initProductData(prodData : IPbProduct) : IPbProduct {
|
|
|
55
55
|
* @param {object} [parmas] 可不传。补充参数,目前只有 planbookId
|
|
56
56
|
* @returns {Promise<IPbProduct>} 产品数据(单个)
|
|
57
57
|
*/
|
|
58
|
-
export async function productDataHandler(prodData
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (parmas && parmas.eventTarget) {
|
|
74
|
-
const { insuranceKey, elementKey } = parmas.eventTarget
|
|
75
|
-
if (insuranceKey && elementKey === 'insuranceId') {
|
|
76
|
-
const groupInsurance = (prodData.mulInsOrderList || []).find(ins => ins.key === insuranceKey)
|
|
77
|
-
const groupInsuranceIdEle = (groupInsurance?.eleOrderList || []).find(e => e.key === 'insuranceId')
|
|
78
|
-
const subInsurances = (prodData.mulInsOrderList || []).filter(ins => ins.groupKey === insuranceKey)
|
|
79
|
-
subInsurances.forEach(ins => {
|
|
80
|
-
const titleEle = (ins.eleOrderList || []).find(e => e.key === 'title')
|
|
81
|
-
if (titleEle && groupInsuranceIdEle && !Array.isArray(groupInsuranceIdEle.value)) {
|
|
82
|
-
titleEle.value = groupInsuranceIdEle.value === ins.key
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const hasProduct = prodData.mulInsOrderList
|
|
89
|
-
const hasVerifyData = productVerifyData && Object.keys(productVerifyData).length
|
|
90
|
-
const hasPersonData = personData && personData.personOrderList
|
|
91
|
-
let personOrderList : any = null;
|
|
92
|
-
if (hasProduct && hasVerifyData && hasPersonData) {
|
|
93
|
-
personOrderList = convertPersonData(
|
|
94
|
-
personData,
|
|
95
|
-
personData.personOrderList.map(p => p.key)
|
|
96
|
-
);
|
|
97
|
-
setCommonInfo(prodData);
|
|
98
|
-
prodData.mulInsOrderList?.forEach((ins, ii, insList) => {
|
|
99
|
-
insuranceDataHandler(ins, prodData);
|
|
100
|
-
const insuranceVerifyData = productVerifyData[ins.key];
|
|
101
|
-
if (!insuranceVerifyData) {
|
|
102
|
-
if (ins.key !== 'common') {
|
|
103
|
-
consoleLogWhenEnable(`${prodData.titleName}-${prodData.key} -> ${ins.name}-${ins.key}: 当前险种没有费率表`);
|
|
104
|
-
}
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// 双豁免是种特殊的投保人豁免。双豁免包含投保人豁免和投保人配偶豁免。如果没有选中配偶信息,则认为是投保人豁免,选中则认为投保人豁免和配偶豁免都选中
|
|
108
|
-
const isTouHuomianIns = ins.huomian === 'touHuomian' || ins.huomian === 'shuangHuomian';
|
|
109
|
-
const insuredInfo = personOrderList.find(p => p.key === 'insuredInfo');
|
|
110
|
-
const applicantInfo = personOrderList.find(p => p.key === 'applicantInfo');
|
|
111
|
-
// 如果豁免险种可以附加被保人,也可以附加投保人。选中投保人,则附加到投保人
|
|
112
|
-
let personType = isTouHuomianIns ? 'applicantInfo' : 'insuredInfo';
|
|
113
|
-
if (isTouHuomianIns && ins.allowSamePerson) {
|
|
114
|
-
personType = applicantInfo && applicantInfo.title ? 'applicantInfo' : 'insuredInfo';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// 取当前性别、年龄下的费率条件
|
|
118
|
-
const targetPerson = personOrderList.find(p => p.key === personType);
|
|
119
|
-
let personCondition : any = null;
|
|
120
|
-
if (targetPerson) {
|
|
121
|
-
// 对应性别、年龄下的限制条件
|
|
122
|
-
personCondition = insuranceVerifyData.find(
|
|
123
|
-
v =>
|
|
124
|
-
targetPerson.sex === v.sex && targetPerson.age >= v.minAge && targetPerson.age <= v.maxAge
|
|
125
|
-
);
|
|
126
|
-
if (personCondition) {
|
|
127
|
-
// 当前险种的限制条件
|
|
128
|
-
personCondition = personCondition.conditionData;
|
|
129
|
-
//如果险种可以附加被保人,也可以附加投保人。选中投保人,则附加到投保人
|
|
130
|
-
const isSamePerson = isTouHuomianIns && ins.allowSamePerson && personCondition.key === 'samePerson'
|
|
131
|
-
if (isSamePerson) {
|
|
132
|
-
personCondition = personCondition.samePerson.find(c => c.value == (applicantInfo.title ? 0 : 1));
|
|
58
|
+
export async function productDataHandler(prodData: IPbProduct, prodVerifyData: any, personData: IPbPersons, parmas?: any): Promise<IPbProduct> {
|
|
59
|
+
if (prodData) {
|
|
60
|
+
const { eventTarget } = parmas || {}
|
|
61
|
+
const productVerifyData: any = await getSingleInsurancesVerifyData(prodVerifyData, prodData, personData, parmas).catch(() => {})
|
|
62
|
+
// 组合险种特殊处理:当用户点击组合险种的子险种选项时,将其他子险种的标题设置为未选中状态
|
|
63
|
+
if (eventTarget) {
|
|
64
|
+
const { insuranceKey, elementKey } = eventTarget
|
|
65
|
+
if (insuranceKey && elementKey === 'insuranceId') {
|
|
66
|
+
const groupInsurance = (prodData.mulInsOrderList || []).find(ins => ins.key === insuranceKey)
|
|
67
|
+
const groupInsuranceIdEle = (groupInsurance?.eleOrderList || []).find(e => e.key === 'insuranceId')
|
|
68
|
+
const subInsurances = (prodData.mulInsOrderList || []).filter(ins => ins.groupKey === insuranceKey)
|
|
69
|
+
subInsurances.forEach(ins => {
|
|
70
|
+
const titleEle = (ins.eleOrderList || []).find(e => e.key === 'title')
|
|
71
|
+
if (titleEle && groupInsuranceIdEle && !Array.isArray(groupInsuranceIdEle.value)) {
|
|
72
|
+
titleEle.value = groupInsuranceIdEle.value === ins.key
|
|
133
73
|
}
|
|
134
|
-
}
|
|
74
|
+
})
|
|
135
75
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (ins.required && (!ins.groupKey || ins.isCheckbox)) {
|
|
154
|
-
eleTitle.value = true;
|
|
155
|
-
eleTitle.isDisabled = true;
|
|
156
|
-
consoleLogWhenEnable(`${eleTitle.labelName}-${ins.key}: 费率存在,险种为必选险且(为非组合险或为多选一险种)`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const hasProduct = prodData.mulInsOrderList
|
|
79
|
+
const hasVerifyData = productVerifyData && Object.keys(productVerifyData).length
|
|
80
|
+
const hasPersonData = personData && personData.personOrderList
|
|
81
|
+
let personOrderList: any = null
|
|
82
|
+
if (hasProduct && hasVerifyData && hasPersonData) {
|
|
83
|
+
personOrderList = convertPersonData(
|
|
84
|
+
personData,
|
|
85
|
+
personData.personOrderList.map(p => p.key)
|
|
86
|
+
)
|
|
87
|
+
prodData.mulInsOrderList?.forEach((ins, ii, insList) => {
|
|
88
|
+
insuranceDataHandler(ins, prodData)
|
|
89
|
+
const insuranceVerifyData = productVerifyData[ins.key]
|
|
90
|
+
if (!insuranceVerifyData) {
|
|
91
|
+
if (ins.key !== 'common') {
|
|
92
|
+
consoleLogWhenEnable(`${prodData.titleName}-${prodData.key} -> ${ins.name}-${ins.key}: 当前险种没有费率表`)
|
|
157
93
|
}
|
|
94
|
+
return
|
|
158
95
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
|
|
96
|
+
// 双豁免是种特殊的投保人豁免。双豁免包含投保人豁免和投保人配偶豁免。如果没有选中配偶信息,则认为是投保人豁免,选中则认为投保人豁免和配偶豁免都选中
|
|
97
|
+
const isTouHuomianIns = ins.huomian === 'touHuomian' || ins.huomian === 'shuangHuomian'
|
|
98
|
+
const insuredInfo = personOrderList.find(p => p.key === 'insuredInfo')
|
|
99
|
+
const applicantInfo = personOrderList.find(p => p.key === 'applicantInfo')
|
|
100
|
+
// 如果豁免险种可以附加被保人,也可以附加投保人。选中投保人,则附加到投保人
|
|
101
|
+
let personType = isTouHuomianIns ? 'applicantInfo' : 'insuredInfo'
|
|
102
|
+
if (isTouHuomianIns && ins.allowSamePerson) {
|
|
103
|
+
personType = applicantInfo && applicantInfo.title ? 'applicantInfo' : 'insuredInfo'
|
|
167
104
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
105
|
+
|
|
106
|
+
// 取当前性别、年龄下的费率条件
|
|
107
|
+
const targetPerson = personOrderList.find(p => p.key === personType)
|
|
108
|
+
let personCondition: any = null
|
|
109
|
+
if (targetPerson) {
|
|
110
|
+
// 对应性别、年龄下的限制条件
|
|
111
|
+
personCondition = insuranceVerifyData.find(v => targetPerson.sex === v.sex && targetPerson.age >= v.minAge && targetPerson.age <= v.maxAge)
|
|
112
|
+
if (personCondition) {
|
|
113
|
+
// 当前险种的限制条件
|
|
114
|
+
personCondition = personCondition.conditionData
|
|
115
|
+
//如果险种可以附加被保人,也可以附加投保人。选中投保人,则附加到投保人
|
|
116
|
+
const isSamePerson = isTouHuomianIns && ins.allowSamePerson && personCondition.key === 'samePerson'
|
|
117
|
+
if (isSamePerson) {
|
|
118
|
+
personCondition = personCondition.samePerson.find(c => c.value == (applicantInfo.title ? 0 : 1))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
172
121
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
122
|
+
|
|
123
|
+
let curCondition: any = personCondition
|
|
124
|
+
const eleTitle = ins.eleOrderList?.find((e: IInsElement) => e.key === 'title') as IInsElement
|
|
125
|
+
// 遍历当前险种的限制条件
|
|
126
|
+
do {
|
|
127
|
+
// 如果险种不存在费率限制条件或者投保人豁免在没有选中投保人信息的条件下,险种不可选
|
|
128
|
+
const isNotAllowSelect = !curCondition || (isTouHuomianIns && !ins.allowSamePerson && (!targetPerson.title || targetPerson.applicantAndInsuredSame))
|
|
129
|
+
if (isNotAllowSelect) {
|
|
130
|
+
eleTitle.isDisabled = true
|
|
131
|
+
eleTitle.value = false
|
|
132
|
+
consoleLogWhenEnable(
|
|
133
|
+
curCondition
|
|
134
|
+
? `${eleTitle.labelName}-${ins.key}: 费率存在!但投保人未选中或投被保人为同一人,该豁免险(不能附加到被保人)不可选`
|
|
135
|
+
: `${eleTitle.labelName}-${ins.key}: 费率不存在!`
|
|
136
|
+
)
|
|
181
137
|
} else {
|
|
182
|
-
|
|
138
|
+
// 存在费率,险种可选
|
|
139
|
+
eleTitle.isDisabled = false
|
|
140
|
+
// 如果是必选险种,险种一定选中
|
|
141
|
+
if (ins.required && (!ins.groupKey || ins.isCheckbox)) {
|
|
142
|
+
eleTitle.value = true
|
|
143
|
+
eleTitle.isDisabled = true
|
|
144
|
+
consoleLogWhenEnable(`${eleTitle.labelName}-${ins.key}: 费率存在,险种为必选险且(为非组合险或为多选一险种)`)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (!curCondition) {
|
|
148
|
+
break
|
|
149
|
+
}
|
|
150
|
+
// 判断是否为通用元素
|
|
151
|
+
let eleData = ins.eleOrderList?.find((e: IInsElement) => e.key === curCondition.key) as IInsElement
|
|
152
|
+
const commonData = insList.find((ins: IProdInsurance) => ins.key === 'common')
|
|
153
|
+
if (!eleData && commonData && commonData.eleOrderList) {
|
|
154
|
+
eleData = commonData.eleOrderList.find((e: IInsElement) => e.key === curCondition.key) as IInsElement
|
|
183
155
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
156
|
+
if (!eleData) {
|
|
157
|
+
consoleLogWhenEnable(`${ins.name} - ${curCondition && curCondition.key}元素不存在:`)
|
|
158
|
+
curCondition = null
|
|
159
|
+
break
|
|
160
|
+
}
|
|
161
|
+
const eleCondi = curCondition[curCondition.key]
|
|
162
|
+
// 元素隐藏且非不可修改状态,取对应关联的险种的值
|
|
163
|
+
const isBeGovernedEle = eleData.isHide && !eleData.isDisabled && ins.refInsuranceId && Number(ins.refInsuranceId) !== -2
|
|
164
|
+
if (isBeGovernedEle) {
|
|
165
|
+
let refInsData: any = null
|
|
166
|
+
// -1: 关联主险。即险种中key值为非 「common」的第一个险种
|
|
167
|
+
if (Number(ins.refInsuranceId) === -1) {
|
|
168
|
+
refInsData = insList[0].key === 'common' ? insList[1] : insList[0]
|
|
194
169
|
} else {
|
|
195
|
-
|
|
170
|
+
refInsData = insList.find(ins => ins.key == ins.refInsuranceId)
|
|
196
171
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
val: c.value,
|
|
206
|
-
desc: c.desc || c.value,
|
|
207
|
-
isHide: (option && option.isHide) || null,
|
|
208
|
-
isDisabled: (option && option.isDisabled) || null,
|
|
209
|
-
isInvalid: null
|
|
210
|
-
};
|
|
211
|
-
});
|
|
212
|
-
// 交费期间,默认取最后一个元素的值;其他元素,默认取第一个元素。By Lizh 2020.4.10, From hyw
|
|
213
|
-
const isNoOption = eleData.opts && eleData.opts.length && eleData.opts.every(ele => ele.val != eleData.value)
|
|
214
|
-
if (isNoOption) {
|
|
215
|
-
if (eleData.key === 'pPeriod') {
|
|
216
|
-
const filterOpts = eleData.opts?.filter(opt => !opt.isHide && !opt.isDisabled);
|
|
217
|
-
if (filterOpts && filterOpts.length) {
|
|
218
|
-
eleData.value = filterOpts[filterOpts.length - 1].val;
|
|
172
|
+
// 数据取值来源的元素
|
|
173
|
+
const refEleData = refInsData && refInsData.eleOrderList && refInsData.eleOrderList.find(e => e.key === eleData.key)
|
|
174
|
+
if (refEleData) {
|
|
175
|
+
// 豁免险,缴费期间需要减去某个值
|
|
176
|
+
if (ins.huomian && eleData.key == 'pPeriod') {
|
|
177
|
+
eleData.value = getHuomianPeriodValue(refEleData.value, ins.pMinus, ins.huomian === 'touHuomian' ? insuredInfo.age : targetPerson.age)
|
|
178
|
+
} else {
|
|
179
|
+
eleData.value = refEleData.value
|
|
219
180
|
}
|
|
220
181
|
} else {
|
|
221
|
-
|
|
222
|
-
eleData.value = eleData.opts[0].val;
|
|
223
|
-
}
|
|
182
|
+
consoleLogWhenEnable(`${ins.name}-${ins.key}:关联险种${ins.refInsuranceId}不存在`)
|
|
224
183
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
)
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
|
|
184
|
+
} else {
|
|
185
|
+
const backupOpts: any[] = eleData.opts && eleData.opts.length ? eleData.opts.slice(0) : []
|
|
186
|
+
eleData.opts = eleCondi
|
|
187
|
+
.filter(c => c.value !== undefined && c.desc !== undefined)
|
|
188
|
+
.map(c => {
|
|
189
|
+
const option = backupOpts.find(o => o.val == c.value)
|
|
190
|
+
return {
|
|
191
|
+
val: c.value,
|
|
192
|
+
desc: c.desc || c.value,
|
|
193
|
+
isHide: (option && option.isHide) || null,
|
|
194
|
+
isDisabled: (option && option.isDisabled) || null,
|
|
195
|
+
isInvalid: null
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
// 交费期间,默认取最后一个元素的值;其他元素,默认取第一个元素。By Lizh 2020.4.10, From hyw
|
|
199
|
+
const isNoOption = eleData.opts && eleData.opts.length && eleData.opts.every(ele => ele.val != eleData.value)
|
|
200
|
+
if (isNoOption) {
|
|
201
|
+
if (eleData.key === 'pPeriod') {
|
|
202
|
+
const filterOpts = eleData.opts?.filter(opt => !opt.isHide && !opt.isDisabled)
|
|
203
|
+
if (filterOpts && filterOpts.length) {
|
|
204
|
+
eleData.value = filterOpts[filterOpts.length - 1].val
|
|
205
|
+
}
|
|
206
|
+
} else {
|
|
207
|
+
if (eleData.opts && eleData.opts.length) {
|
|
208
|
+
eleData.value = eleData.opts[0].val
|
|
209
|
+
}
|
|
210
|
+
}
|
|
244
211
|
}
|
|
245
212
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
213
|
+
// 提定下一个元素的限制条件
|
|
214
|
+
curCondition = eleCondi.find(eleCondi => eleCondi.value == eleData.value)
|
|
215
|
+
const eleIndex = (<IInsElement[]>ins.eleOrderList).findIndex(ele => ele.key === eleData.key)
|
|
216
|
+
let prevElement
|
|
217
|
+
if (eleIndex >= 1) {
|
|
218
|
+
prevElement = (<IInsElement[]>ins.eleOrderList)[eleIndex - 1] as IInsElement
|
|
250
219
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
220
|
+
if (prevElement) {
|
|
221
|
+
// 如果下一个元素的 value 不存在限制条件。则遍历上一个元素,重新设置上一元素的值,并取对应的限制条件。
|
|
222
|
+
if (!curCondition) {
|
|
223
|
+
const prevEleVerify = getElementVerifyFromProductVerify(personCondition, insList, { insuranceKey: ins.key, elementKey: prevElement.key })
|
|
224
|
+
const onePrevEleVerify = prevEleVerify?.find(v => v[eleData.key] && v[eleData.key].some(condi => condi.value === eleData.value))
|
|
225
|
+
if (onePrevEleVerify) {
|
|
226
|
+
prevElement.value = onePrevEleVerify.value
|
|
227
|
+
curCondition = onePrevEleVerify[eleData.key]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (!curCondition) {
|
|
231
|
+
eleTitle.isDisabled = true
|
|
232
|
+
eleTitle.value = false
|
|
233
|
+
consoleLogWhenEnable(`${eleTitle.labelName}-${ins.key}: 费率不存在!`)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// 如果当前元素是隐藏的且不可修改,则过滤上一元素的选项,即,删除上一元素中不包含当前元素值的选项。
|
|
237
|
+
const isNeedReverseFilter = eleData.isHide && !eleData.isDisabled && prevElement.opts && prevElement.opts.length
|
|
238
|
+
if (isNeedReverseFilter) {
|
|
239
|
+
const prevEleVerify = getElementVerifyFromProductVerify(personCondition, insList, { insuranceKey: ins.key, elementKey: prevElement.key })
|
|
240
|
+
if (prevEleVerify) {
|
|
241
|
+
prevElement.opts = prevEleVerify
|
|
242
|
+
.filter(v => {
|
|
243
|
+
const elementVerify = getElementVerifyFromProductVerify(personCondition, insList, {
|
|
244
|
+
insuranceKey: ins.key,
|
|
245
|
+
elementKey: eleData.key,
|
|
246
|
+
[prevElement.key]: v.value
|
|
247
|
+
})
|
|
248
|
+
return elementVerify && elementVerify.some(c => c.value == eleData.value)
|
|
249
|
+
})
|
|
250
|
+
.map(v => ({
|
|
251
|
+
val: v.value,
|
|
252
|
+
desc: v.desc || v.value,
|
|
253
|
+
isHide: null,
|
|
254
|
+
isDisabled: null,
|
|
255
|
+
isInvalid: null
|
|
256
|
+
}))
|
|
257
|
+
}
|
|
275
258
|
}
|
|
276
259
|
}
|
|
260
|
+
} while (curCondition && curCondition.key && curCondition[curCondition.key])
|
|
261
|
+
|
|
262
|
+
if (Array.isArray(ins.eleOrderList)) {
|
|
263
|
+
ins.eleOrderList.forEach((ele: IInsElement) => {
|
|
264
|
+
const newEleMap = executeElementRule(personData, prodData, ins, ele, parmas)
|
|
265
|
+
for (const k in newEleMap) {
|
|
266
|
+
ele[k] = newEleMap[k]
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
insuranceDataHandler(ins, prodData)
|
|
277
270
|
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const newEleMap = executeElementRule(personData, prodData, ins, ele, parmas)
|
|
283
|
-
for (const k in newEleMap) {
|
|
284
|
-
ele[k] = newEleMap[k]
|
|
285
|
-
}
|
|
286
|
-
})
|
|
287
|
-
insuranceDataHandler(ins, prodData);
|
|
288
|
-
}
|
|
289
|
-
});
|
|
271
|
+
})
|
|
272
|
+
}
|
|
273
|
+
setGroupInsurance(prodData)
|
|
274
|
+
isHideProduct(prodData, productVerifyData, personOrderList)
|
|
290
275
|
}
|
|
291
|
-
|
|
292
|
-
isHideProduct(prodData, productVerifyData, personOrderList);
|
|
293
|
-
return prodData;
|
|
276
|
+
return prodData
|
|
294
277
|
}
|
|
295
278
|
|
|
296
279
|
/**
|
|
@@ -301,26 +284,28 @@ export async function productDataHandler(prodData : IPbProduct, prodVerifyData :
|
|
|
301
284
|
* @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
|
|
302
285
|
* @returns 人员信息
|
|
303
286
|
*/
|
|
304
|
-
function multipleInsuredHandler
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
e.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
287
|
+
export function multipleInsuredHandler(prodData: IPbProduct, personData: IPbPersons) {
|
|
288
|
+
if (prodData && prodData.multipleInsured) {
|
|
289
|
+
const personOrderList: IPbPerson[] = personData.personOrderList
|
|
290
|
+
if (!(personOrderList && personOrderList.length)) {
|
|
291
|
+
return null
|
|
292
|
+
}
|
|
293
|
+
const insured2Info = personOrderList.find((p: IPbPerson) => p.key === 'insured2Info')
|
|
294
|
+
if (!insured2Info) {
|
|
295
|
+
const insuredInfo = personOrderList.find((p: IPbPerson) => p.key === 'insuredInfo')
|
|
296
|
+
const insuredIndex = personOrderList.findIndex((p: IPbPerson) => p.key === 'insuredInfo')
|
|
297
|
+
if (insuredIndex >= 0) {
|
|
298
|
+
const person: any = cloneDeep(insuredInfo)
|
|
299
|
+
person.key = 'insured2Info'
|
|
300
|
+
person.eleOrderList.forEach(e => {
|
|
301
|
+
if (e.key === 'title') {
|
|
302
|
+
e.isDisabled = false
|
|
303
|
+
e.value = true
|
|
304
|
+
e.label = '第二被保人信息'
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
personOrderList.splice(insuredIndex + 1, 0, person)
|
|
308
|
+
}
|
|
324
309
|
}
|
|
325
310
|
}
|
|
326
311
|
return personData
|
|
@@ -335,53 +320,57 @@ function multipleInsuredHandler (personData : IPbPersons) {
|
|
|
335
320
|
* @param {IPbPersons} personData 必传。人员信息,包括被保人、投保人、投保人配偶
|
|
336
321
|
* @returns 请求函数的 Promise
|
|
337
322
|
*/
|
|
338
|
-
function getSingleInsurancesVerifyData
|
|
339
|
-
const
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
323
|
+
function getSingleInsurancesVerifyData(verifyData: any, prodData: IPbProduct, personData: IPbPersons, parmas: any = {}) {
|
|
324
|
+
const isSingleFeeValidateMode = (prodData && prodData.feeValidateMode === 'single') || (verifyData && verifyData.feeValidateMode === 'single')
|
|
325
|
+
if (isSingleFeeValidateMode) {
|
|
326
|
+
const personOrderList: IPbPerson[] = personData.personOrderList
|
|
327
|
+
if (!(personOrderList && personOrderList.length)) {
|
|
328
|
+
return null
|
|
329
|
+
}
|
|
330
|
+
const pbId = prodData.isTemp || prodData.policyType === 'single_insurance' ? null : parmas.planbookId
|
|
331
|
+
let productId = prodData.policyType === 'single_insurance' ? null : prodData.key
|
|
332
|
+
// 险种对比,prodData 没有 feeValidateMode 字段。因此需要特殊处理。
|
|
333
|
+
// 险种对比,以险种为维度,其 prodData.key 就是险种id,不能当成正常产品id。因此需要特殊处理。
|
|
334
|
+
if (prodData.feeValidateMode !== 'single') {
|
|
335
|
+
productId = null
|
|
336
|
+
}
|
|
337
|
+
const insuredList = personOrderList
|
|
338
|
+
.filter((p: IPbPerson) => ['insuredInfo', 'insured2Info'].includes(p.key))
|
|
339
|
+
.filter((p: IPbPerson) => {
|
|
340
|
+
const title = p.eleOrderList?.find((e: IPersonElement) => e.key === 'title')
|
|
341
|
+
return (title && title.value) || p.title
|
|
342
|
+
})
|
|
343
|
+
.map((p: IPbPerson) => {
|
|
344
|
+
const person = convertEleOrderListToObj(p)
|
|
345
|
+
return {
|
|
346
|
+
key: person.key,
|
|
347
|
+
sex: person.sex,
|
|
348
|
+
age: person.age
|
|
349
|
+
}
|
|
350
|
+
})
|
|
351
|
+
let applicant: any = null
|
|
352
|
+
const applicantItem = personData.personOrderList.find((p: IPbPerson) => p.key === 'applicantInfo')
|
|
353
|
+
if (applicantItem) {
|
|
354
|
+
const person = convertEleOrderListToObj(applicantItem)
|
|
355
|
+
applicant = {
|
|
359
356
|
key: person.key,
|
|
360
357
|
sex: person.sex,
|
|
361
358
|
age: person.age
|
|
362
359
|
}
|
|
363
|
-
})
|
|
364
|
-
let applicant : any = null;
|
|
365
|
-
const applicantItem = personData.personOrderList.find((p : IPbPerson) => p.key === 'applicantInfo');
|
|
366
|
-
if (applicantItem) {
|
|
367
|
-
const person = convertEleOrderListToObj(applicantItem)
|
|
368
|
-
applicant = {
|
|
369
|
-
key: person.key,
|
|
370
|
-
sex: person.sex,
|
|
371
|
-
age: person.age
|
|
372
360
|
}
|
|
361
|
+
const insuranceIdList = prodData?.mulInsOrderList?.map(ins => ins.key).filter((k: any) => !['common'].includes(k))
|
|
362
|
+
prodData?.mulInsOrderList?.reduce((list: any, ins: IProdInsurance) => {
|
|
363
|
+
return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key)
|
|
364
|
+
}, [])
|
|
365
|
+
return getAndCacheInsurancesVerifyData({
|
|
366
|
+
pbId,
|
|
367
|
+
productId,
|
|
368
|
+
insuredList,
|
|
369
|
+
applicant,
|
|
370
|
+
insuranceIdList
|
|
371
|
+
})
|
|
373
372
|
}
|
|
374
|
-
|
|
375
|
-
prodData?.mulInsOrderList?.reduce((list : any, ins : IProdInsurance) => {
|
|
376
|
-
return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key)
|
|
377
|
-
}, []);
|
|
378
|
-
return getAndCacheInsurancesVerifyData({
|
|
379
|
-
pbId,
|
|
380
|
-
productId,
|
|
381
|
-
insuredList,
|
|
382
|
-
applicant,
|
|
383
|
-
insuranceIdList
|
|
384
|
-
})
|
|
373
|
+
return Promise.resolve(verifyData)
|
|
385
374
|
}
|
|
386
375
|
|
|
387
376
|
/**
|
|
@@ -392,28 +381,14 @@ function getSingleInsurancesVerifyData (prodData : IPbProduct, personData : IPbP
|
|
|
392
381
|
* @param { any } params 必传。接口请求信息
|
|
393
382
|
* @returns {Promise<any>} 产品下所有险种的费率
|
|
394
383
|
*/
|
|
395
|
-
const getAndCacheInsurancesVerifyData = memoize(
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
Accept: 'application/json, text/plain, */*',
|
|
402
|
-
'Content-Type': 'application/json;'
|
|
403
|
-
},
|
|
404
|
-
body: JSON.stringify(params)
|
|
405
|
-
})
|
|
406
|
-
.then(response => response.json())
|
|
407
|
-
.then(({ success, data }: any) => {
|
|
408
|
-
if (!success || !data) {
|
|
409
|
-
return Promise.reject();
|
|
410
|
-
}
|
|
411
|
-
return Promise.resolve(data);
|
|
412
|
-
})
|
|
413
|
-
.catch(() => {});
|
|
414
|
-
}, (params) => QS.stringify(params))
|
|
384
|
+
const getAndCacheInsurancesVerifyData = memoize(
|
|
385
|
+
params => {
|
|
386
|
+
return getPlanbookInsuranceVerifyData(params).catch(() => {})
|
|
387
|
+
},
|
|
388
|
+
params => QS.stringify(params)
|
|
389
|
+
)
|
|
415
390
|
|
|
416
|
-
export function getElementVerifyFromProductVerify(verify, insurances
|
|
391
|
+
export function getElementVerifyFromProductVerify(verify, insurances: IProdInsurance[], option) {
|
|
417
392
|
if (!verify || !verify.key || !verify[verify.key] || !insurances || !option) {
|
|
418
393
|
return verify
|
|
419
394
|
}
|
|
@@ -432,8 +407,8 @@ export function getElementVerifyFromProductVerify(verify, insurances : IProdInsu
|
|
|
432
407
|
}
|
|
433
408
|
let temp = verify
|
|
434
409
|
let hasElementKey = verify.key === option.elementKey
|
|
435
|
-
while(temp && temp.key && temp.key !== option.elementKey) {
|
|
436
|
-
temp = temp[temp.key].find(v =>
|
|
410
|
+
while (temp && temp.key && temp.key !== option.elementKey) {
|
|
411
|
+
temp = temp[temp.key].find(v => v.value == insuranceInfo[temp.key])
|
|
437
412
|
if (temp && temp.key === option.elementKey) {
|
|
438
413
|
hasElementKey = true
|
|
439
414
|
}
|
|
@@ -456,36 +431,36 @@ export function getElementVerifyFromProductVerify(verify, insurances : IProdInsu
|
|
|
456
431
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
457
432
|
* @returns {IPbProduct} 产品数据(单个)
|
|
458
433
|
*/
|
|
459
|
-
export function setCommonInfo(prodData
|
|
434
|
+
export function setCommonInfo(prodData: IPbProduct): IPbProduct {
|
|
460
435
|
if (!prodData || !prodData.mulInsOrderList) {
|
|
461
|
-
return prodData
|
|
436
|
+
return prodData
|
|
462
437
|
}
|
|
463
|
-
const common
|
|
438
|
+
const common: any = {
|
|
464
439
|
key: 'common',
|
|
465
440
|
eleOrderList: []
|
|
466
|
-
}
|
|
467
|
-
prodData.mulInsOrderList.forEach((ins
|
|
441
|
+
}
|
|
442
|
+
prodData.mulInsOrderList.forEach((ins: IProdInsurance) => {
|
|
468
443
|
if (!ins.eleOrderList) {
|
|
469
|
-
return
|
|
444
|
+
return
|
|
470
445
|
}
|
|
471
|
-
ins.eleOrderList.forEach((ele
|
|
472
|
-
if (ele.common && common.eleOrderList.every((e
|
|
473
|
-
common.eleOrderList.push(ele)
|
|
446
|
+
ins.eleOrderList.forEach((ele: IInsElement) => {
|
|
447
|
+
if (ele.common && common.eleOrderList.every((e: IInsElement) => e.key !== ele.key)) {
|
|
448
|
+
common.eleOrderList.push(ele)
|
|
474
449
|
}
|
|
475
|
-
})
|
|
476
|
-
ins.eleOrderList = ins.eleOrderList.filter((ele
|
|
477
|
-
})
|
|
450
|
+
})
|
|
451
|
+
ins.eleOrderList = ins.eleOrderList.filter((ele: IInsElement) => !ele.common)
|
|
452
|
+
})
|
|
478
453
|
// 把通用信息当作一个险种,做为产品险种列表的第一个险种
|
|
479
454
|
if (!common.eleOrderList.length) {
|
|
480
|
-
return prodData
|
|
455
|
+
return prodData
|
|
481
456
|
}
|
|
482
|
-
prodData.mulInsOrderList = prodData.mulInsOrderList.filter((ins
|
|
483
|
-
prodData.mulInsOrderList.unshift(common)
|
|
457
|
+
prodData.mulInsOrderList = prodData.mulInsOrderList.filter((ins: IProdInsurance) => ins.key !== 'common')
|
|
458
|
+
prodData.mulInsOrderList.unshift(common)
|
|
484
459
|
// 通用信息,与跟随其后的险种不留间距
|
|
485
460
|
if (prodData.mulInsOrderList[1]) {
|
|
486
|
-
prodData.mulInsOrderList[1].isFollowing = true
|
|
461
|
+
prodData.mulInsOrderList[1].isFollowing = true
|
|
487
462
|
}
|
|
488
|
-
return prodData
|
|
463
|
+
return prodData
|
|
489
464
|
}
|
|
490
465
|
|
|
491
466
|
/**
|
|
@@ -498,59 +473,61 @@ export function setCommonInfo(prodData : IPbProduct) : IPbProduct {
|
|
|
498
473
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
499
474
|
* @returns {IPbProduct} 产品数据(单个)
|
|
500
475
|
*/
|
|
501
|
-
export function setGroupInsurance(prodData
|
|
502
|
-
const mulInsOrderList = (prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : []) as IProdInsurance
|
|
476
|
+
export function setGroupInsurance(prodData: IPbProduct): IPbProduct {
|
|
477
|
+
const mulInsOrderList = (prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : []) as IProdInsurance[]
|
|
503
478
|
// 清空险种列表中的已有的险种组合
|
|
504
|
-
prodData.mulInsOrderList = mulInsOrderList.filter(ins => !ins.isGroup)
|
|
479
|
+
prodData.mulInsOrderList = mulInsOrderList.filter(ins => !ins.isGroup)
|
|
505
480
|
|
|
506
481
|
// 多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
|
|
507
|
-
const groupInsuranceList = mulInsOrderList.filter(ins => !!ins.groupKey)
|
|
482
|
+
const groupInsuranceList = mulInsOrderList.filter(ins => !!ins.groupKey)
|
|
508
483
|
if (groupInsuranceList.length) {
|
|
509
|
-
const newGroupInsMap = {}
|
|
510
|
-
groupInsuranceList
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
484
|
+
const newGroupInsMap = {}
|
|
485
|
+
groupInsuranceList
|
|
486
|
+
.filter(ins => ins.groupKey)
|
|
487
|
+
.forEach(ins => {
|
|
488
|
+
newGroupInsMap[ins.groupKey!] = newGroupInsMap[ins.groupKey!] || {
|
|
489
|
+
key: ins.groupKey,
|
|
490
|
+
name: ins.groupName,
|
|
491
|
+
huomian: ins.huomian,
|
|
492
|
+
isGroup: true,
|
|
493
|
+
eleOrderList: [
|
|
494
|
+
{
|
|
495
|
+
key: 'title',
|
|
496
|
+
value: false,
|
|
497
|
+
isDisabled: false,
|
|
498
|
+
componentName: 'cmCommonTitle',
|
|
499
|
+
labelName: ins.groupName
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
key: 'insuranceId',
|
|
503
|
+
value: ins.isCheckbox ? [] : null,
|
|
504
|
+
componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
|
|
505
|
+
opts: []
|
|
506
|
+
}
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// 将子险种转换成险种组合的选项
|
|
511
|
+
const titleEle = (<IInsElement[]>ins.eleOrderList).find(e => e.key === 'title') as IInsElement
|
|
512
|
+
const insuranceIdEle = newGroupInsMap[ins.groupKey!].eleOrderList.find(e => e.key === 'insuranceId')
|
|
513
|
+
insuranceIdEle.opts.push({
|
|
514
|
+
val: ins.key,
|
|
515
|
+
code: ins.code,
|
|
516
|
+
desc: titleEle.labelName,
|
|
517
|
+
isDisabled: titleEle.isDisabled
|
|
518
|
+
})
|
|
519
|
+
})
|
|
532
520
|
|
|
533
|
-
// 将子险种转换成险种组合的选项
|
|
534
|
-
const titleEle = (<IInsElement []>ins.eleOrderList).find(e => e.key === 'title') as IInsElement;
|
|
535
|
-
const insuranceIdEle = newGroupInsMap[ins.groupKey!].eleOrderList.find(e => e.key === 'insuranceId');
|
|
536
|
-
insuranceIdEle.opts.push({
|
|
537
|
-
val: ins.key,
|
|
538
|
-
code: ins.code,
|
|
539
|
-
desc: titleEle.labelName,
|
|
540
|
-
isDisabled: titleEle.isDisabled
|
|
541
|
-
});
|
|
542
|
-
});
|
|
543
|
-
|
|
544
521
|
// 处理组合险中的逻辑,并加入到产品险种列表中
|
|
545
522
|
for (let k in newGroupInsMap) {
|
|
546
523
|
const oldGroupInsurance = mulInsOrderList.find(ins => ins.key === k)
|
|
547
524
|
const oldGroupTitleElement = oldGroupInsurance ? oldGroupInsurance.eleOrderList?.find(e => e.key === 'title') : null
|
|
548
525
|
const oldGroupTitleValue = oldGroupTitleElement ? oldGroupTitleElement.value : null
|
|
549
|
-
const nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(e => e.key === 'title')
|
|
550
|
-
const nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(e => e.key === 'insuranceId')
|
|
551
|
-
const groupInsList = mulInsOrderList.filter((ins
|
|
526
|
+
const nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(e => e.key === 'title')
|
|
527
|
+
const nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(e => e.key === 'insuranceId')
|
|
528
|
+
const groupInsList = mulInsOrderList.filter((ins: IProdInsurance) => ins.groupKey == k)
|
|
552
529
|
if (nGroupTitleEle && nGroupInsuranceIdEle && groupInsList.length) {
|
|
553
|
-
const notDisabledInsurances
|
|
530
|
+
const notDisabledInsurances: any[] = groupInsList.filter(ins => {
|
|
554
531
|
const titleEle = (ins.eleOrderList || []).find(e => e.key === 'title')
|
|
555
532
|
return titleEle && !titleEle.isDisabled
|
|
556
533
|
})
|
|
@@ -558,7 +535,7 @@ export function setGroupInsurance(prodData : IPbProduct) : IPbProduct {
|
|
|
558
535
|
const titleEle = (ins.eleOrderList || []).find(ele => ele.key === 'title')
|
|
559
536
|
return titleEle && titleEle.value
|
|
560
537
|
})
|
|
561
|
-
const hasRequiredIns = notDisabledInsurances.some(ins => ins.required)
|
|
538
|
+
const hasRequiredIns = notDisabledInsurances.some(ins => ins.required)
|
|
562
539
|
const checkedInsurance = checkedInsurances[0]
|
|
563
540
|
// hasRequiredIns:如果组合险中有一款是必选的,则整个组合险为选中状态
|
|
564
541
|
// 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
|
|
@@ -568,7 +545,7 @@ export function setGroupInsurance(prodData : IPbProduct) : IPbProduct {
|
|
|
568
545
|
}
|
|
569
546
|
nGroupTitleEle.isDisabled = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).every(opt => !!opt.isDisabled)
|
|
570
547
|
nGroupInsuranceIdEle.value = checkedInsurance ? checkedInsurance.key : null
|
|
571
|
-
|
|
548
|
+
|
|
572
549
|
//将当前选中险种的部分数据复制到组合险中
|
|
573
550
|
if (checkedInsurance) {
|
|
574
551
|
// 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
|
|
@@ -576,21 +553,21 @@ export function setGroupInsurance(prodData : IPbProduct) : IPbProduct {
|
|
|
576
553
|
for (let ck in checkedInsurance) {
|
|
577
554
|
if (!keys.includes(ck)) {
|
|
578
555
|
if (ck === 'eleOrderList') {
|
|
579
|
-
newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat((<IInsElement
|
|
556
|
+
newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat((<IInsElement[]>checkedInsurance[ck]).filter(ele => ele.key !== 'title'))
|
|
580
557
|
} else {
|
|
581
|
-
newGroupInsMap[k][ck] = checkedInsurance[ck]
|
|
558
|
+
newGroupInsMap[k][ck] = checkedInsurance[ck]
|
|
582
559
|
}
|
|
583
560
|
}
|
|
584
561
|
}
|
|
585
562
|
}
|
|
586
563
|
}
|
|
587
|
-
const index =
|
|
564
|
+
const index = findLastIndex(mulInsOrderList, ins => ins.groupKey === k)
|
|
588
565
|
if (index >= 0) {
|
|
589
566
|
prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k])
|
|
590
567
|
}
|
|
591
568
|
}
|
|
592
569
|
}
|
|
593
|
-
return prodData
|
|
570
|
+
return prodData
|
|
594
571
|
}
|
|
595
572
|
|
|
596
573
|
/**
|
|
@@ -601,50 +578,44 @@ export function setGroupInsurance(prodData : IPbProduct) : IPbProduct {
|
|
|
601
578
|
* @author Lizhao <lz@winbaoxian.com>
|
|
602
579
|
* @date 2022-04-26
|
|
603
580
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
604
|
-
* @param {object}
|
|
581
|
+
* @param {object} prodVerifyData 必传。产品限制条件(单个)
|
|
605
582
|
* @param {IPbPerson} personOrderList 必传。转换后的人员信息,包括被保人、投保人、投保人配偶
|
|
606
583
|
* @returns {object} 产品数据(单个)
|
|
607
584
|
*/
|
|
608
|
-
export function isHideProduct(prodData
|
|
609
|
-
let ageRangeProd
|
|
610
|
-
if (prodData &&
|
|
585
|
+
export function isHideProduct(prodData: IPbProduct, prodVerifyData: any, personOrderList: IPbPerson[]): any {
|
|
586
|
+
let ageRangeProd: any = {}
|
|
587
|
+
if (prodData && prodVerifyData && Object.keys(prodVerifyData).length && personOrderList) {
|
|
611
588
|
if (prodData.mulInsOrderList) {
|
|
612
589
|
// 产品中是否有必选险种且有费率
|
|
613
|
-
let hasRequiredIns = prodData.mulInsOrderList.some(ins => !!ins.required &&
|
|
590
|
+
let hasRequiredIns = prodData.mulInsOrderList.some(ins => !!ins.required && prodVerifyData[ins.key])
|
|
614
591
|
prodData.mulInsOrderList.forEach(ins => {
|
|
615
592
|
// 当前险种的限制条件
|
|
616
|
-
let insuranceVerifyData =
|
|
593
|
+
let insuranceVerifyData = prodVerifyData[ins.key]
|
|
617
594
|
if (insuranceVerifyData) {
|
|
618
595
|
// 产品年龄范围取各险种最大范围
|
|
619
596
|
if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || (hasRequiredIns && ins.required))) {
|
|
620
597
|
insuranceVerifyData.forEach(verify => {
|
|
621
|
-
ageRangeProd[verify.sex] = ageRangeProd[verify.sex] || []
|
|
598
|
+
ageRangeProd[verify.sex] = ageRangeProd[verify.sex] || []
|
|
622
599
|
ageRangeProd[verify.sex] = [
|
|
623
|
-
Math.min(
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
Math.max(
|
|
628
|
-
ageRangeProd[verify.sex][1] === undefined ? verify.maxAge : ageRangeProd[verify.sex][1],
|
|
629
|
-
verify.maxAge
|
|
630
|
-
)
|
|
631
|
-
];
|
|
632
|
-
});
|
|
600
|
+
Math.min(ageRangeProd[verify.sex][0] === undefined ? verify.minAge : ageRangeProd[verify.sex][0], verify.minAge),
|
|
601
|
+
Math.max(ageRangeProd[verify.sex][1] === undefined ? verify.maxAge : ageRangeProd[verify.sex][1], verify.maxAge)
|
|
602
|
+
]
|
|
603
|
+
})
|
|
633
604
|
}
|
|
634
605
|
}
|
|
635
|
-
})
|
|
606
|
+
})
|
|
636
607
|
}
|
|
637
608
|
|
|
638
|
-
let { sex, age } = personOrderList.find(p => p.key === 'insuredInfo') as IPbPerson
|
|
609
|
+
let { sex, age } = personOrderList.find(p => p.key === 'insuredInfo') as IPbPerson
|
|
639
610
|
if (ageRangeProd[sex] && age >= ageRangeProd[sex][0] && age <= ageRangeProd[sex][1]) {
|
|
640
|
-
prodData.hide = false
|
|
611
|
+
prodData.hide = false
|
|
641
612
|
} else {
|
|
642
|
-
prodData.hadChoice = false
|
|
643
|
-
prodData.hide = true
|
|
644
|
-
prodData.totalBaof = null
|
|
613
|
+
prodData.hadChoice = false
|
|
614
|
+
prodData.hide = true
|
|
615
|
+
prodData.totalBaof = null
|
|
645
616
|
}
|
|
646
617
|
}
|
|
647
|
-
return ageRangeProd
|
|
618
|
+
return ageRangeProd
|
|
648
619
|
}
|
|
649
620
|
|
|
650
621
|
/**
|
|
@@ -666,17 +637,17 @@ export function verifyProductRules({
|
|
|
666
637
|
productData,
|
|
667
638
|
insData,
|
|
668
639
|
eleData
|
|
669
|
-
}
|
|
670
|
-
personData: IPbPersons
|
|
671
|
-
productData: IPbProduct
|
|
672
|
-
insData: IProdInsurance
|
|
673
|
-
eleData: IInsElement
|
|
674
|
-
})
|
|
675
|
-
let errorMsg = ''
|
|
640
|
+
}: {
|
|
641
|
+
personData: IPbPersons;
|
|
642
|
+
productData: IPbProduct;
|
|
643
|
+
insData: IProdInsurance;
|
|
644
|
+
eleData: IInsElement;
|
|
645
|
+
}): string {
|
|
646
|
+
let errorMsg = ''
|
|
676
647
|
const personOrderList = convertPersonData(
|
|
677
648
|
personData,
|
|
678
649
|
personData.personOrderList.map(p => p.key)
|
|
679
|
-
)
|
|
650
|
+
)
|
|
680
651
|
// 验证同一产品中各险种的限制
|
|
681
652
|
if (productData.restrictList && productData.restrictList.length) {
|
|
682
653
|
errorMsg = restrictInsurancesInProduct({
|
|
@@ -684,7 +655,7 @@ export function verifyProductRules({
|
|
|
684
655
|
productData,
|
|
685
656
|
insData,
|
|
686
657
|
eleData
|
|
687
|
-
})
|
|
658
|
+
})
|
|
688
659
|
}
|
|
689
660
|
|
|
690
661
|
if (!errorMsg && productData.mulInsOrderList) {
|
|
@@ -698,12 +669,12 @@ export function verifyProductRules({
|
|
|
698
669
|
personOrderList,
|
|
699
670
|
insData: ins,
|
|
700
671
|
eleData: ele
|
|
701
|
-
})
|
|
702
|
-
})
|
|
672
|
+
})
|
|
673
|
+
})
|
|
703
674
|
}
|
|
704
|
-
})
|
|
675
|
+
})
|
|
705
676
|
}
|
|
706
|
-
return errorMsg
|
|
677
|
+
return errorMsg
|
|
707
678
|
}
|
|
708
679
|
|
|
709
680
|
/**
|
|
@@ -726,33 +697,33 @@ export function restrictInsurancesInProduct({
|
|
|
726
697
|
productData,
|
|
727
698
|
insData,
|
|
728
699
|
eleData
|
|
729
|
-
}
|
|
730
|
-
personOrderList: IPbPerson
|
|
731
|
-
productData: IPbProduct
|
|
732
|
-
insData: IProdInsurance
|
|
733
|
-
eleData: IInsElement
|
|
734
|
-
})
|
|
735
|
-
let errorMsg = ''
|
|
736
|
-
let restrictList
|
|
700
|
+
}: {
|
|
701
|
+
personOrderList: IPbPerson[];
|
|
702
|
+
productData: IPbProduct;
|
|
703
|
+
insData: IProdInsurance;
|
|
704
|
+
eleData: IInsElement;
|
|
705
|
+
}): string {
|
|
706
|
+
let errorMsg = ''
|
|
707
|
+
let restrictList: any = productData.restrictList
|
|
737
708
|
if (restrictList && restrictList.length) {
|
|
738
709
|
restrictList.forEach(restrict => {
|
|
739
|
-
const insuredInfo = personOrderList.find(p => p.key === 'insuredInfo') as IPbPerson
|
|
740
|
-
const productInfo = convertProductData(productData)
|
|
741
|
-
const
|
|
710
|
+
const insuredInfo = personOrderList.find(p => p.key === 'insuredInfo') as IPbPerson
|
|
711
|
+
const productInfo = convertProductData(productData)
|
|
712
|
+
const evalVerifyMap = {
|
|
742
713
|
age: insuredInfo.age,
|
|
743
714
|
sex: insuredInfo.sex,
|
|
744
715
|
common: productInfo.common
|
|
745
716
|
};
|
|
746
|
-
(<IProdInsurance
|
|
747
|
-
|
|
748
|
-
})
|
|
749
|
-
restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, '
|
|
750
|
-
restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, '
|
|
717
|
+
(<IProdInsurance[]>productInfo.mulInsOrderList).forEach(ins => {
|
|
718
|
+
evalVerifyMap['i' + ins.key] = ins
|
|
719
|
+
})
|
|
720
|
+
restrict.rCondition = restrict.rCondition.replace(/(%)(\d+)(\.*\w*)(%)/g, 'evalVerifyMap.i$2$3')
|
|
721
|
+
restrict.rCondition = restrict.rCondition.replace(/(%)(\w*\.*\w*)(%)/g, 'evalVerifyMap.$2')
|
|
751
722
|
|
|
752
|
-
const curIns = (<IProdInsurance
|
|
753
|
-
let curEle
|
|
723
|
+
const curIns = (<IProdInsurance[]>productData.mulInsOrderList).find(ins => ins.key === restrict.rInsKey) as IProdInsurance
|
|
724
|
+
let curEle: any = curIns ? {} : null
|
|
754
725
|
if (curIns) {
|
|
755
|
-
curEle = (<IInsElement
|
|
726
|
+
curEle = (<IInsElement[]>curIns.eleOrderList).find(e => e.key === restrict.rEleKey)
|
|
756
727
|
}
|
|
757
728
|
if (curEle) {
|
|
758
729
|
switch (restrict.rType) {
|
|
@@ -761,21 +732,21 @@ export function restrictInsurancesInProduct({
|
|
|
761
732
|
let isDisabled = curEle.isDisabled
|
|
762
733
|
let value = curEle.value
|
|
763
734
|
if (eval(restrict.rCondition)) {
|
|
764
|
-
isDisabled = false
|
|
735
|
+
isDisabled = false
|
|
765
736
|
// 约束条件为真时,目标元素是必选的,即选中且不可修改
|
|
766
737
|
if (restrict.other && restrict.other.includes('required')) {
|
|
767
|
-
value = true
|
|
768
|
-
isDisabled = true
|
|
738
|
+
value = true
|
|
739
|
+
isDisabled = true
|
|
769
740
|
}
|
|
770
741
|
} else {
|
|
771
|
-
isDisabled = true
|
|
742
|
+
isDisabled = true
|
|
772
743
|
// 约束条件为假时,目标元素允许用户手动选择
|
|
773
744
|
if (restrict.other && restrict.other.includes('optional')) {
|
|
774
|
-
isDisabled = false
|
|
745
|
+
isDisabled = false
|
|
775
746
|
}
|
|
776
747
|
// 目标元素不可选,则改成不选中状态
|
|
777
748
|
if (isDisabled) {
|
|
778
|
-
value = false
|
|
749
|
+
value = false
|
|
779
750
|
}
|
|
780
751
|
// 如果限制条件元素改变,使目标元素不可选,则改成不选中状态。
|
|
781
752
|
// 比如:产品限制,两个险种二选一。
|
|
@@ -785,31 +756,30 @@ export function restrictInsurancesInProduct({
|
|
|
785
756
|
}
|
|
786
757
|
curEle.isDisabled = isDisabled
|
|
787
758
|
curEle.value = value
|
|
788
|
-
break
|
|
759
|
+
break
|
|
789
760
|
}
|
|
790
761
|
// 下拉框的选项范围
|
|
791
762
|
case 2: {
|
|
792
|
-
let rangeSelect = eval(restrict.rCondition)
|
|
763
|
+
let rangeSelect = eval(restrict.rCondition)
|
|
793
764
|
if (rangeSelect !== undefined && rangeSelect !== null) {
|
|
794
|
-
(<any
|
|
795
|
-
let optNum = getNumberFromYear(opt.val,
|
|
765
|
+
(<any[]>curEle.opts).forEach(function(opt) {
|
|
766
|
+
let optNum = getNumberFromYear(opt.val, evalVerifyMap.age)
|
|
796
767
|
let rangeSelectNum =
|
|
797
768
|
rangeSelect.constructor === Array
|
|
798
769
|
? [
|
|
799
|
-
rangeSelect[0] && getNumberFromYear(rangeSelect[0],
|
|
800
|
-
rangeSelect[1] && getNumberFromYear(rangeSelect[1],
|
|
770
|
+
rangeSelect[0] && getNumberFromYear(rangeSelect[0], evalVerifyMap.age),
|
|
771
|
+
rangeSelect[1] && getNumberFromYear(rangeSelect[1], evalVerifyMap.age)
|
|
801
772
|
]
|
|
802
|
-
: getNumberFromYear(rangeSelect,
|
|
773
|
+
: getNumberFromYear(rangeSelect, evalVerifyMap.age)
|
|
803
774
|
|
|
804
775
|
if (rangeSelect) {
|
|
805
776
|
if (rangeSelect.constructor === Array) {
|
|
806
|
-
opt.isHide =
|
|
807
|
-
(rangeSelect[0] && optNum < rangeSelectNum[0]) || (rangeSelect[1] && optNum > rangeSelectNum[1]);
|
|
777
|
+
opt.isHide = (rangeSelect[0] && optNum < rangeSelectNum[0]) || (rangeSelect[1] && optNum > rangeSelectNum[1])
|
|
808
778
|
} else {
|
|
809
|
-
opt.isHide = optNum > rangeSelectNum
|
|
779
|
+
opt.isHide = optNum > rangeSelectNum
|
|
810
780
|
}
|
|
811
781
|
}
|
|
812
|
-
})
|
|
782
|
+
})
|
|
813
783
|
if (!(curEle.isHide && !curEle.isDisabled) && curEle.opts) {
|
|
814
784
|
const validOptions = curEle.opts.filter(o => !o.isDisabled && !o.isHide && !o.isInvalid)
|
|
815
785
|
const activeOption = validOptions.find(o => o.val === curEle.value)
|
|
@@ -818,7 +788,7 @@ export function restrictInsurancesInProduct({
|
|
|
818
788
|
}
|
|
819
789
|
}
|
|
820
790
|
}
|
|
821
|
-
break
|
|
791
|
+
break
|
|
822
792
|
}
|
|
823
793
|
//输入框的取值范围
|
|
824
794
|
case 3: {
|
|
@@ -826,33 +796,31 @@ export function restrictInsurancesInProduct({
|
|
|
826
796
|
if (
|
|
827
797
|
(!insData && !eleData) ||
|
|
828
798
|
(restrict.rInsKey === insData.key && restrict.rEleKey === eleData.key) ||
|
|
829
|
-
restrict.rCondition.search(`
|
|
799
|
+
restrict.rCondition.search(`evalVerifyMap.i${insData.key}.${eleData.key}`) !== -1
|
|
830
800
|
) {
|
|
831
|
-
let rangeVal = eval(restrict.rCondition)
|
|
801
|
+
let rangeVal = eval(restrict.rCondition)
|
|
832
802
|
if (rangeVal !== undefined && rangeVal !== null) {
|
|
833
803
|
if (rangeVal.constructor === Array) {
|
|
834
804
|
if (rangeVal[0] && curEle.value && curEle.value < rangeVal[0]) {
|
|
835
|
-
errorMsg =
|
|
836
|
-
restrict.rMsg || `${curIns.name}的${curEle.labelName}不得小于${converUnit10000(rangeVal[0])}`;
|
|
805
|
+
errorMsg = restrict.rMsg || `${curIns.name}的${curEle.labelName}不得小于${converUnit10000(rangeVal[0])}`
|
|
837
806
|
}
|
|
838
807
|
if (rangeVal[1] && curEle.value && curEle.value > rangeVal[1]) {
|
|
839
|
-
errorMsg =
|
|
840
|
-
restrict.rMsg || `${curIns.name}的${curEle.labelName}不得大于${converUnit10000(rangeVal[1])}`;
|
|
808
|
+
errorMsg = restrict.rMsg || `${curIns.name}的${curEle.labelName}不得大于${converUnit10000(rangeVal[1])}`
|
|
841
809
|
}
|
|
842
810
|
} else if (rangeVal.constructor === String || rangeVal.constructor === Number) {
|
|
843
811
|
if (rangeVal) {
|
|
844
|
-
curEle.value = rangeVal
|
|
812
|
+
curEle.value = rangeVal
|
|
845
813
|
}
|
|
846
814
|
}
|
|
847
815
|
}
|
|
848
816
|
}
|
|
849
|
-
break
|
|
817
|
+
break
|
|
850
818
|
}
|
|
851
819
|
}
|
|
852
820
|
}
|
|
853
|
-
})
|
|
821
|
+
})
|
|
854
822
|
}
|
|
855
|
-
return errorMsg
|
|
823
|
+
return errorMsg
|
|
856
824
|
}
|
|
857
825
|
|
|
858
826
|
/**
|
|
@@ -865,49 +833,49 @@ export function restrictInsurancesInProduct({
|
|
|
865
833
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
866
834
|
* @returns {IPbProduct} 产品数据(单个)
|
|
867
835
|
*/
|
|
868
|
-
export function convertProductData(prodData
|
|
836
|
+
export function convertProductData(prodData: IPbProduct): IPbProduct {
|
|
869
837
|
if (!prodData) {
|
|
870
|
-
return prodData
|
|
838
|
+
return prodData
|
|
871
839
|
}
|
|
872
840
|
if (!prodData.mulInsOrderList) {
|
|
873
|
-
return prodData
|
|
841
|
+
return prodData
|
|
874
842
|
}
|
|
875
|
-
let productData
|
|
843
|
+
let productData: IPbProduct = {
|
|
876
844
|
//转换后的产品数据
|
|
877
845
|
...prodData,
|
|
878
846
|
common: {} as IProdInsurance,
|
|
879
847
|
mulInsOrderList: []
|
|
880
|
-
}
|
|
848
|
+
}
|
|
881
849
|
prodData.mulInsOrderList.forEach(insurance => {
|
|
882
|
-
let insuranceData = convertEleOrderListToObj(insurance)
|
|
850
|
+
let insuranceData = convertEleOrderListToObj(insurance)
|
|
883
851
|
if (insuranceData.key == 'common') {
|
|
884
|
-
productData.common = insuranceData
|
|
885
|
-
return
|
|
852
|
+
productData.common = insuranceData
|
|
853
|
+
return
|
|
886
854
|
}
|
|
887
855
|
if (insuranceData.title && !insuranceData.groupKey) {
|
|
888
856
|
if (insuranceData.isGroup) {
|
|
889
857
|
//组合险,则遍历其所选中的险种,并转换数据
|
|
890
|
-
const insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId]
|
|
858
|
+
const insuranceId = Array.isArray(insuranceData.insuranceId) ? insuranceData.insuranceId : [insuranceData.insuranceId]
|
|
891
859
|
insuranceId.forEach(insId => {
|
|
892
|
-
const checkedIns = (<IProdInsurance
|
|
860
|
+
const checkedIns = (<IProdInsurance[]>prodData.mulInsOrderList).find(p => p.key === insId)
|
|
893
861
|
if (checkedIns) {
|
|
894
862
|
// 转换组合险中选中的险种
|
|
895
|
-
const checkedInsData = convertEleOrderListToObj(checkedIns)
|
|
863
|
+
const checkedInsData = convertEleOrderListToObj(checkedIns)
|
|
896
864
|
insurance.eleOrderList &&
|
|
897
865
|
insurance.eleOrderList.forEach(function(ele) {
|
|
898
866
|
if (!['title', 'insuranceId'].includes(ele.key)) {
|
|
899
|
-
checkedInsData[ele.key] = insuranceData[ele.key]
|
|
867
|
+
checkedInsData[ele.key] = insuranceData[ele.key]
|
|
900
868
|
}
|
|
901
869
|
});
|
|
902
|
-
(<IProdInsurance
|
|
870
|
+
(<IProdInsurance[]>productData.mulInsOrderList).push(cloneDeep(checkedInsData))
|
|
903
871
|
}
|
|
904
|
-
})
|
|
905
|
-
return
|
|
872
|
+
})
|
|
873
|
+
return
|
|
906
874
|
}
|
|
907
|
-
(<IProdInsurance
|
|
875
|
+
(<IProdInsurance[]>productData.mulInsOrderList).push(insuranceData)
|
|
908
876
|
}
|
|
909
|
-
})
|
|
910
|
-
return productData
|
|
877
|
+
})
|
|
878
|
+
return productData
|
|
911
879
|
}
|
|
912
880
|
|
|
913
881
|
/**
|
|
@@ -917,32 +885,28 @@ export function convertProductData(prodData : IPbProduct) : IPbProduct {
|
|
|
917
885
|
* @param {IPbProduct} productData 产品数据
|
|
918
886
|
* @returns {IPbProduct} 产品数据
|
|
919
887
|
*/
|
|
920
|
-
export function clearAddAndTakeAndAdjustBaoeData(productData
|
|
921
|
-
if (
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
productData.mulInsOrderList.forEach(ins => {
|
|
929
|
-
if (ins.accountData && ins.accountData.addAndTakeData) {
|
|
930
|
-
ins.accountData.addAndTakeData.forEach(aat => {
|
|
931
|
-
aat.adjustData = [];
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
if (ins.reduceBaof) {
|
|
935
|
-
if (ins.reduceBaofData) {
|
|
936
|
-
ins.reduceBaofData.addAndTakeData.forEach(aat => {
|
|
937
|
-
aat.adjustData = [];
|
|
938
|
-
});
|
|
888
|
+
export function clearAddAndTakeAndAdjustBaoeData(productData: IPbProduct): IPbProduct {
|
|
889
|
+
if (productData && Array.isArray(productData.mulInsOrderList)) {
|
|
890
|
+
productData.adjustBaoeData = null
|
|
891
|
+
productData.mulInsOrderList.forEach(ins => {
|
|
892
|
+
if (ins.accountData && ins.accountData.addAndTakeData) {
|
|
893
|
+
ins.accountData.addAndTakeData.forEach(aat => {
|
|
894
|
+
aat.adjustData = []
|
|
895
|
+
})
|
|
939
896
|
}
|
|
940
|
-
if (ins.
|
|
941
|
-
ins.
|
|
942
|
-
aat
|
|
943
|
-
|
|
897
|
+
if (ins.reduceBaof) {
|
|
898
|
+
if (ins.reduceBaofData) {
|
|
899
|
+
ins.reduceBaofData.addAndTakeData.forEach(aat => {
|
|
900
|
+
aat.adjustData = []
|
|
901
|
+
})
|
|
902
|
+
}
|
|
903
|
+
if (ins.duplicateReduceBaofData) {
|
|
904
|
+
ins.duplicateReduceBaofData.addAndTakeData.forEach(aat => {
|
|
905
|
+
aat.adjustData = []
|
|
906
|
+
})
|
|
907
|
+
}
|
|
944
908
|
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
return productData
|
|
909
|
+
})
|
|
910
|
+
}
|
|
911
|
+
return productData
|
|
948
912
|
}
|