bxs-tools-ui 3.3.2 → 3.4.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/es/add-and-take/index.js +1 -7969
- package/es/adjust-baoe/index.js +196 -8195
- package/es/index.css +1 -1
- package/es/index.js +8788 -43744
- package/es/insure-calculate/index.css +1 -1
- package/es/insure-calculate/index.js +1046 -36665
- package/es/person-info/index.css +1 -1
- package/es/person-info/index.js +83 -8042
- package/es/product-info/index.css +1 -1
- package/es/product-info/index.js +3005 -10614
- package/es/share-sheet/index.js +69 -8040
- package/es/utils/index.js +1250 -9334
- package/lib/add-and-take/index.js +4 -7973
- package/lib/adjust-baoe/index.js +195 -8195
- package/lib/index.css +1 -1
- package/lib/index.js +8717 -43678
- package/lib/insure-calculate/index.css +1 -1
- package/lib/insure-calculate/index.js +1034 -36662
- package/lib/person-info/index.css +1 -1
- package/lib/person-info/index.js +86 -8046
- package/lib/product-info/index.css +1 -1
- package/lib/product-info/index.js +2807 -10417
- package/lib/share-sheet/index.js +72 -8044
- package/lib/utils/index.js +1252 -9337
- package/package.json +5 -3
- package/packages/add-and-take/demo/index.vue +3 -6
- package/packages/adjust-baoe/index.vue +21 -34
- package/packages/adjust-baoe/readme.md +0 -1
- package/packages/bxs-utils/planbook/common.ts +5 -0
- package/packages/bxs-utils/planbook/insurance.ts +19 -0
- package/packages/bxs-utils/planbook/person.ts +3 -2
- package/packages/bxs-utils/planbook/product.ts +57 -164
- package/packages/bxs-utils/readme.md +3 -1
- package/packages/index.ts +1 -1
- package/packages/insure-calculate/demo/index.vue +1 -1
- package/packages/insure-calculate/index.vue +18 -17
- package/packages/person-info/demo/index.vue +2 -4
- package/packages/planbook-input/components/product-table.vue +3 -14
- package/packages/planbook-input/helper.js +16 -53
- package/packages/planbook-input/index.vue +20 -28
- package/packages/planbook-input/readme.md +3 -3
- package/packages/product-info/components/product-insurance-form.md +46 -0
- package/packages/product-info/components/product-insurance-form.vue +360 -0
- package/packages/product-info/demo/index.vue +4 -5
- package/packages/product-info/handler.js +307 -0
- package/packages/product-info/handler.md +26 -0
- package/packages/product-info/index.less +33 -0
- package/packages/product-info/index.vue +306 -534
- package/packages/product-info/readme.md +7 -2
- package/packages/share-sheet/constant.js +1 -2
- package/src/api/adjust-baoe.js +2 -2
- package/src/api/planbook.js +4 -20
- package/src/api/trade.js +31 -0
- package/src/components/common/common-group-title.less +54 -0
- package/src/components/common/common-group-title.md +34 -0
- package/src/components/common/common-group-title.vue +72 -0
- package/src/components/common/common-title.less +4 -0
- package/src/components/common/common-title.vue +8 -2
- package/src/components/profession-list/README.md +114 -0
- package/src/components/profession-list/constant.js +4 -0
- package/src/components/profession-list/handler.js +155 -0
- package/src/components/profession-list/index.less +182 -0
- package/src/components/profession-list/index.vue +443 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bxs-tools-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "微易前端业务组件",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"docs": "npm run init && rollup -c rollup/rollup.prod.site.js",
|
|
16
16
|
"dev": "npm run init && rollup -c rollup/rollup.dev.js -w",
|
|
17
17
|
"build": "npm run init && rollup -c rollup/rollup.prod.js",
|
|
18
|
+
"analyze": "ANALYZE=1 npm run build",
|
|
18
19
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
19
20
|
"eslint:fix": "eslint --fix '{src,packages,docs}/**/*.{js,vue,ts}'",
|
|
20
21
|
"prettier": "prettier --write '{src,packages}/**/*.{js,vue}'",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"@babel/plugin-transform-runtime": "^7.28.0",
|
|
52
53
|
"@babel/preset-env": "^7.16.0",
|
|
53
54
|
"@babel/preset-typescript": "^7.10.4",
|
|
55
|
+
"@bxs/jax": "^1.23.0",
|
|
54
56
|
"@commitlint/cli": "^19.3.0",
|
|
55
57
|
"@commitlint/config-conventional": "^19.2.2",
|
|
56
58
|
"@commitlint/parse": "^19.0.3",
|
|
@@ -97,6 +99,7 @@
|
|
|
97
99
|
"rollup-plugin-postcss": "^4.0.2",
|
|
98
100
|
"rollup-plugin-serve": "^3.0.0",
|
|
99
101
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
102
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
100
103
|
"rollup-plugin-vue": "^5.1.9",
|
|
101
104
|
"selfsigned": "^2.4.1",
|
|
102
105
|
"standard-version": "^9.5.0",
|
|
@@ -118,12 +121,11 @@
|
|
|
118
121
|
},
|
|
119
122
|
"dependencies": {
|
|
120
123
|
"@babel/runtime": "^7.27.6",
|
|
121
|
-
"@bxs/jax": "^1.23.0",
|
|
122
|
-
"bxs-ui-vue": "^4.2.1",
|
|
123
124
|
"lodash": "^4.17.21",
|
|
124
125
|
"qs": "^6.15.0"
|
|
125
126
|
},
|
|
126
127
|
"peerDependencies": {
|
|
128
|
+
"@bxs/jax": "^1.23.0",
|
|
127
129
|
"vant": "^2.13.2",
|
|
128
130
|
"vue": "2.6.14"
|
|
129
131
|
},
|
|
@@ -153,12 +153,10 @@ export default {
|
|
|
153
153
|
getPlanbookData() {
|
|
154
154
|
const self = this
|
|
155
155
|
const { URL_PARAM } = self
|
|
156
|
-
const { planbookId,
|
|
156
|
+
const { planbookId, uuid } = URL_PARAM
|
|
157
157
|
return getPlanbookData({
|
|
158
158
|
insuranceTypeId: planbookId || 13767,
|
|
159
|
-
resultUuid: uuid
|
|
160
|
-
publicPbUuid
|
|
161
|
-
// publicPbUuid: '5d6499946bbb47bb8f6a286e9d4eee77'
|
|
159
|
+
resultUuid: uuid
|
|
162
160
|
})
|
|
163
161
|
.then(async data => {
|
|
164
162
|
await initPageData(data)
|
|
@@ -173,7 +171,7 @@ export default {
|
|
|
173
171
|
},
|
|
174
172
|
autoImportData() {
|
|
175
173
|
const { URL_PARAM, exportData, inputData } = this
|
|
176
|
-
const { planbookId
|
|
174
|
+
const { planbookId } = URL_PARAM
|
|
177
175
|
if (inputData) {
|
|
178
176
|
const gPromises = inputData.productGroupList
|
|
179
177
|
.filter(g => g.prodOrderList)
|
|
@@ -182,7 +180,6 @@ export default {
|
|
|
182
180
|
return doubleCalcProductData(inputData, {
|
|
183
181
|
planbookId: Number(planbookId) || 13767,
|
|
184
182
|
executeSource: exportData ? 'import' : 'init',
|
|
185
|
-
publicPbUuid,
|
|
186
183
|
groupKey: g.key,
|
|
187
184
|
productKey: p.key,
|
|
188
185
|
isIgnoreError: true
|
|
@@ -196,19 +196,12 @@ export default class AdjustBaoe extends Vue {
|
|
|
196
196
|
return null
|
|
197
197
|
}
|
|
198
198
|
const adjustRecord = {}
|
|
199
|
-
insList.map(
|
|
199
|
+
insList.map(ins => {
|
|
200
200
|
const titleUi = ins.eleOrderList.find(e => e.key === 'title')
|
|
201
201
|
if (!(ins.adjustBaoe && !ins.groupKey && titleUi && titleUi.value)) {
|
|
202
202
|
return
|
|
203
203
|
}
|
|
204
|
-
|
|
205
|
-
if (ins.isGroup) {
|
|
206
|
-
groupChecked = arr.find(groupIns => {
|
|
207
|
-
const insuranceIdUi = ins.eleOrderList.find(e => e.key === 'insuranceId')
|
|
208
|
-
return insuranceIdUi && groupIns.key == insuranceIdUi.value
|
|
209
|
-
})
|
|
210
|
-
}
|
|
211
|
-
const adjustKey = `baoe_${(groupChecked || ins).code || (groupChecked || ins).key}`
|
|
204
|
+
const adjustKey = `baoe_${ins.code || ins.key}`
|
|
212
205
|
const baoeUi = ins.eleOrderList.find(e => e.key === 'baoe')
|
|
213
206
|
adjustRecord[adjustKey] = baoeUi && baoeUi.value ? baoeUi.value : 0
|
|
214
207
|
})
|
|
@@ -246,32 +239,26 @@ export default class AdjustBaoe extends Vue {
|
|
|
246
239
|
delete ins[ele]
|
|
247
240
|
})
|
|
248
241
|
})
|
|
249
|
-
return validateAdjustBaoe(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
personOrderList
|
|
255
|
-
|
|
256
|
-
personData.personOrderList.map(p => p.key)
|
|
257
|
-
)
|
|
258
|
-
},
|
|
259
|
-
productGroupList: [
|
|
260
|
-
{
|
|
261
|
-
key: params.groupKey,
|
|
262
|
-
prodOrderList: [
|
|
263
|
-
{
|
|
264
|
-
...cloneProductData,
|
|
265
|
-
adjustBaoeData: this.adjustBaoeData
|
|
266
|
-
}
|
|
267
|
-
]
|
|
268
|
-
}
|
|
269
|
-
]
|
|
242
|
+
return validateAdjustBaoe({
|
|
243
|
+
insuranceTypeId: params.planbookId * 1,
|
|
244
|
+
personData: {
|
|
245
|
+
personOrderList: convertPersonData(
|
|
246
|
+
personData,
|
|
247
|
+
personData.personOrderList.map(p => p.key)
|
|
248
|
+
)
|
|
270
249
|
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
250
|
+
productGroupList: [
|
|
251
|
+
{
|
|
252
|
+
key: params.groupKey,
|
|
253
|
+
prodOrderList: [
|
|
254
|
+
{
|
|
255
|
+
...cloneProductData,
|
|
256
|
+
adjustBaoeData: this.adjustBaoeData
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
}).catch(err => {
|
|
275
262
|
this.adjustBaoeData = cloneAdjustBaoeData
|
|
276
263
|
if (err) {
|
|
277
264
|
this.$toast(err)
|
|
@@ -290,6 +290,11 @@ export function getExpressionParamMap(personData: IPbPersons, product: IPbProduc
|
|
|
290
290
|
insuranceList.forEach(item => {
|
|
291
291
|
map[`i${item.key}`] = item
|
|
292
292
|
})
|
|
293
|
+
insuranceList
|
|
294
|
+
.filter(item => item.groupKey && item.title && !item.isCheckbox)
|
|
295
|
+
.forEach(item => {
|
|
296
|
+
map[`i${item.groupKey}`] = item
|
|
297
|
+
})
|
|
293
298
|
}
|
|
294
299
|
}
|
|
295
300
|
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { convertEleOrderListToObj, converUnit10000 } from './common'
|
|
2
2
|
|
|
3
|
+
export function getInsDeriveRequired(ins: IProdInsurance): boolean {
|
|
4
|
+
if (!ins) {
|
|
5
|
+
return false
|
|
6
|
+
}
|
|
7
|
+
const { required, deriveRequired, eleOrderList } = ins
|
|
8
|
+
if (deriveRequired !== undefined) {
|
|
9
|
+
return deriveRequired
|
|
10
|
+
}
|
|
11
|
+
const titleEle = (eleOrderList || []).find((e: IInsElement) => e.key === 'title')
|
|
12
|
+
const requiredTitle = !!(titleEle && titleEle.value && titleEle.isDisabled)
|
|
13
|
+
return required === undefined ? requiredTitle : !!required && requiredTitle
|
|
14
|
+
}
|
|
15
|
+
|
|
3
16
|
/**
|
|
4
17
|
* **初始化险种数据**
|
|
5
18
|
* - 补充一些显示文案
|
|
6
19
|
* - 转换元素的选项字段
|
|
7
20
|
* - 预设一些后面可能用到的字段,如追加领取、减保领取
|
|
21
|
+
* - 首次初始化:按 title 锁定勾选写入 deriveRequired(只写一次;承保规则改 title 不再更新)
|
|
8
22
|
* @author Lizhao <lz@winbaoxian.com>
|
|
9
23
|
* @date 2022-04-26
|
|
10
24
|
* @param {IProdInsurance} insData 必传。险种数据(单个)
|
|
@@ -99,6 +113,11 @@ export function initInsuranceData(insData: IProdInsurance): void {
|
|
|
99
113
|
}
|
|
100
114
|
}
|
|
101
115
|
})
|
|
116
|
+
|
|
117
|
+
// 只根据初始化时的 title 锁定勾选写一次 deriveRequired;已有值则不改(含 cloneDeep 后再 init)
|
|
118
|
+
if (insData.deriveRequired === undefined) {
|
|
119
|
+
insData.deriveRequired = getInsDeriveRequired(insData)
|
|
120
|
+
}
|
|
102
121
|
}
|
|
103
122
|
|
|
104
123
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { consoleLogWhenEnable, convertEleOrderListToObj } from './common'
|
|
2
|
+
import { getInsDeriveRequired } from './insurance'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* **初始化人员数据**
|
|
@@ -284,10 +285,10 @@ export function getInsuredAgeRange(inputData: IPbInput, verifyData: any): any {
|
|
|
284
285
|
return
|
|
285
286
|
}
|
|
286
287
|
// 产品中是否有必选险种
|
|
287
|
-
let hasRequiredIns = (<IProdInsurance[]>prod.mulInsOrderList).some(ins =>
|
|
288
|
+
let hasRequiredIns = (<IProdInsurance[]>prod.mulInsOrderList).some(ins => getInsDeriveRequired(ins))
|
|
288
289
|
//无必选产品,根据所有产品的最小值,最大值确定;有必选产品, 根据必选产品的最小值,最大值确定
|
|
289
290
|
//无必选险种,根据所有险种的最小值,最大值确定;如果有必选险种:根据必选险种的最小值,最大值确定
|
|
290
|
-
if ((!ins.huomian || ins.huomian === 'beiHuomian') && (!hasRequiredProd || prod.required) && (!hasRequiredIns || ins
|
|
291
|
+
if ((!ins.huomian || ins.huomian === 'beiHuomian') && (!hasRequiredProd || prod.required) && (!hasRequiredIns || getInsDeriveRequired(ins))) {
|
|
291
292
|
verifyData[prod.key][ins.key].forEach(condi => {
|
|
292
293
|
let currentAgeRange = ageRange[`insuredInfo${condi.sex}`]
|
|
293
294
|
ageRange[`insuredInfo${condi.sex}`] = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import QS from 'qs'
|
|
2
|
-
import { memoize, cloneDeep
|
|
2
|
+
import { memoize, cloneDeep } from 'lodash'
|
|
3
3
|
import { getPlanbookInsuranceVerifyData } from '../../../src/api/planbook.js'
|
|
4
4
|
import {
|
|
5
5
|
consoleLogWhenEnable,
|
|
@@ -10,12 +10,14 @@ import {
|
|
|
10
10
|
executeElementRule
|
|
11
11
|
} from './common'
|
|
12
12
|
import { convertPersonData } from './person'
|
|
13
|
-
import { initInsuranceData, insuranceDataHandler, restrictElementsInInsurance } from './insurance'
|
|
13
|
+
import { initInsuranceData, insuranceDataHandler, restrictElementsInInsurance, getInsDeriveRequired } from './insurance'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* **初始化产品数据(单个)**
|
|
17
17
|
* - 初始化调整保额数据
|
|
18
18
|
* - 初始化险种数据
|
|
19
|
+
* - 非 isCheckbox 组合险:同组子险只保留一个选中
|
|
20
|
+
* - 险种排序:普通险在前,组合险按首个子险出现顺序排在后
|
|
19
21
|
* @author Lizhao <lz@winbaoxian.com>
|
|
20
22
|
* @date 2022-04-26
|
|
21
23
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
@@ -35,17 +37,60 @@ export function initProductData(prodData: IPbProduct): IPbProduct {
|
|
|
35
37
|
prodData.mulInsOrderList.forEach((ins: IProdInsurance) => {
|
|
36
38
|
initInsuranceData(ins)
|
|
37
39
|
})
|
|
40
|
+
prodData.mulInsOrderList = normalizeGroupInsuranceList(prodData.mulInsOrderList)
|
|
38
41
|
setCommonInfo(prodData)
|
|
39
42
|
return prodData
|
|
40
43
|
}
|
|
41
44
|
|
|
45
|
+
/**
|
|
46
|
+
* 组合险初始化整理:
|
|
47
|
+
* - 非 isCheckbox:同组多个选中时只保留第一个
|
|
48
|
+
* - 排序:普通险在前,组合险按 groupKey 首次出现顺序排在后(组内相对序不变)
|
|
49
|
+
*/
|
|
50
|
+
function normalizeGroupInsuranceList(list: IProdInsurance[]): IProdInsurance[] {
|
|
51
|
+
const normals: IProdInsurance[] = []
|
|
52
|
+
const groupBuckets = new Map<string, IProdInsurance[]>()
|
|
53
|
+
const groupOrder: string[] = []
|
|
54
|
+
|
|
55
|
+
list.forEach(ins => {
|
|
56
|
+
if (!ins.groupKey) {
|
|
57
|
+
normals.push(ins)
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
const gk = String(ins.groupKey)
|
|
61
|
+
if (!groupBuckets.has(gk)) {
|
|
62
|
+
groupBuckets.set(gk, [])
|
|
63
|
+
groupOrder.push(gk)
|
|
64
|
+
}
|
|
65
|
+
groupBuckets.get(gk)!.push(ins)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
groupOrder.forEach(gk => {
|
|
69
|
+
let hasChecked = false
|
|
70
|
+
const siblings = groupBuckets.get(gk) || []
|
|
71
|
+
siblings
|
|
72
|
+
.filter((s: IProdInsurance) => !s.isCheckbox)
|
|
73
|
+
.map(s => (s.eleOrderList || []).find(e => e.key === 'title'))
|
|
74
|
+
.filter((title): title is IInsElement => !!title)
|
|
75
|
+
.forEach(title => {
|
|
76
|
+
if (hasChecked) {
|
|
77
|
+
title.value = false
|
|
78
|
+
} else {
|
|
79
|
+
hasChecked = !!title.value
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const groups = groupOrder.reduce((arr: IProdInsurance[], gk) => arr.concat(groupBuckets.get(gk) || []), [])
|
|
85
|
+
return normals.concat(groups)
|
|
86
|
+
}
|
|
87
|
+
|
|
42
88
|
/**
|
|
43
89
|
* **处理产品数据(单个)**
|
|
44
90
|
* - 提取通用信息
|
|
45
91
|
* - 处理险种数据
|
|
46
92
|
* - 根据被、投保人信息,处理险种状态。如:险种是否可选
|
|
47
93
|
* - 根据校验条件解析产品状态。如:险种是否可选、重新获取元素(下拉框、单选框)的可选项
|
|
48
|
-
* - 创建或更新组合险(多个险种组合成一个险种)
|
|
49
94
|
* - 根据被、投保人信息,判断该产品是否可以显示
|
|
50
95
|
* @author Lizhao <lz@winbaoxian.com>
|
|
51
96
|
* @date 2022-04-26
|
|
@@ -57,24 +102,7 @@ export function initProductData(prodData: IPbProduct): IPbProduct {
|
|
|
57
102
|
*/
|
|
58
103
|
export async function productDataHandler(prodData: IPbProduct, prodVerifyData: any, personData: IPbPersons, parmas?: any): Promise<IPbProduct> {
|
|
59
104
|
if (prodData) {
|
|
60
|
-
const { eventTarget } = parmas || {}
|
|
61
105
|
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
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
106
|
const hasProduct = prodData.mulInsOrderList
|
|
79
107
|
const hasVerifyData = productVerifyData && Object.keys(productVerifyData).length
|
|
80
108
|
const hasPersonData = personData && personData.personOrderList
|
|
@@ -135,14 +163,7 @@ export async function productDataHandler(prodData: IPbProduct, prodVerifyData: a
|
|
|
135
163
|
: `${eleTitle.labelName}-${ins.key}: 费率不存在!`
|
|
136
164
|
)
|
|
137
165
|
} else {
|
|
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
|
-
}
|
|
166
|
+
eleTitle.isDisabled = getInsDeriveRequired(ins)
|
|
146
167
|
}
|
|
147
168
|
if (!curCondition) {
|
|
148
169
|
break
|
|
@@ -274,7 +295,6 @@ export async function productDataHandler(prodData: IPbProduct, prodVerifyData: a
|
|
|
274
295
|
}
|
|
275
296
|
})
|
|
276
297
|
}
|
|
277
|
-
setGroupInsurance(prodData)
|
|
278
298
|
isHideProduct(prodData, productVerifyData, personOrderList)
|
|
279
299
|
}
|
|
280
300
|
return prodData
|
|
@@ -363,9 +383,6 @@ function getSingleInsurancesVerifyData(verifyData: any, prodData: IPbProduct, pe
|
|
|
363
383
|
}
|
|
364
384
|
}
|
|
365
385
|
const insuranceIdList = prodData?.mulInsOrderList?.map(ins => ins.key).filter((k: any) => !['common'].includes(k))
|
|
366
|
-
prodData?.mulInsOrderList?.reduce((list: any, ins: IProdInsurance) => {
|
|
367
|
-
return ins.key === 'common' || ins.isGroup ? list : list.concat(ins.key)
|
|
368
|
-
}, [])
|
|
369
386
|
return getAndCacheInsurancesVerifyData({
|
|
370
387
|
pbId,
|
|
371
388
|
productId,
|
|
@@ -467,113 +484,6 @@ export function setCommonInfo(prodData: IPbProduct): IPbProduct {
|
|
|
467
484
|
return prodData
|
|
468
485
|
}
|
|
469
486
|
|
|
470
|
-
/**
|
|
471
|
-
* **创建或更新组合险**
|
|
472
|
-
* - 组合险是虚拟的险种,是为了解决特殊场景:多个险种,只能同时选中一个。
|
|
473
|
-
* - 组合险的初始状态取决于子险种,状态包括:是否可选、包含的元素、元素的选项及值。用户有交互,以交互后的状态为准。
|
|
474
|
-
* @ignore
|
|
475
|
-
* @author Lizhao <lz@winbaoxian.com>
|
|
476
|
-
* @date 2022-04-26
|
|
477
|
-
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
478
|
-
* @returns {IPbProduct} 产品数据(单个)
|
|
479
|
-
*/
|
|
480
|
-
export function setGroupInsurance(prodData: IPbProduct): IPbProduct {
|
|
481
|
-
const mulInsOrderList = (prodData && prodData.mulInsOrderList ? prodData.mulInsOrderList : []) as IProdInsurance[]
|
|
482
|
-
// 清空险种列表中的已有的险种组合
|
|
483
|
-
prodData.mulInsOrderList = mulInsOrderList.filter(ins => !ins.isGroup)
|
|
484
|
-
|
|
485
|
-
// 多险种选一,或多险种选多。生成一个组合,如多个险种合成豁免险
|
|
486
|
-
const groupInsuranceList = mulInsOrderList.filter(ins => !!ins.groupKey)
|
|
487
|
-
if (groupInsuranceList.length) {
|
|
488
|
-
const newGroupInsMap = {}
|
|
489
|
-
groupInsuranceList
|
|
490
|
-
.filter(ins => ins.groupKey)
|
|
491
|
-
.forEach(ins => {
|
|
492
|
-
newGroupInsMap[ins.groupKey!] = newGroupInsMap[ins.groupKey!] || {
|
|
493
|
-
key: ins.groupKey,
|
|
494
|
-
name: ins.groupName,
|
|
495
|
-
huomian: ins.huomian,
|
|
496
|
-
isGroup: true,
|
|
497
|
-
eleOrderList: [
|
|
498
|
-
{
|
|
499
|
-
key: 'title',
|
|
500
|
-
value: false,
|
|
501
|
-
isDisabled: false,
|
|
502
|
-
componentName: 'cmCommonTitle',
|
|
503
|
-
labelName: ins.groupName
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
key: 'insuranceId',
|
|
507
|
-
value: ins.isCheckbox ? [] : null,
|
|
508
|
-
componentName: ins.isCheckbox ? 'cmCommonCheckbox' : 'cmCommonRadio',
|
|
509
|
-
opts: []
|
|
510
|
-
}
|
|
511
|
-
]
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
// 将子险种转换成险种组合的选项
|
|
515
|
-
const titleEle = (<IInsElement[]>ins.eleOrderList).find(e => e.key === 'title') as IInsElement
|
|
516
|
-
const insuranceIdEle = newGroupInsMap[ins.groupKey!].eleOrderList.find(e => e.key === 'insuranceId')
|
|
517
|
-
insuranceIdEle.opts.push({
|
|
518
|
-
val: ins.key,
|
|
519
|
-
code: ins.code,
|
|
520
|
-
desc: titleEle.labelName,
|
|
521
|
-
isDisabled: titleEle.isDisabled
|
|
522
|
-
})
|
|
523
|
-
})
|
|
524
|
-
|
|
525
|
-
// 处理组合险中的逻辑,并加入到产品险种列表中
|
|
526
|
-
for (let k in newGroupInsMap) {
|
|
527
|
-
const oldGroupInsurance = mulInsOrderList.find(ins => ins.key === k)
|
|
528
|
-
const oldGroupTitleElement = oldGroupInsurance ? oldGroupInsurance.eleOrderList?.find(e => e.key === 'title') : null
|
|
529
|
-
const oldGroupTitleValue = oldGroupTitleElement ? oldGroupTitleElement.value : null
|
|
530
|
-
const nGroupTitleEle = newGroupInsMap[k].eleOrderList.find(e => e.key === 'title')
|
|
531
|
-
const nGroupInsuranceIdEle = newGroupInsMap[k].eleOrderList.find(e => e.key === 'insuranceId')
|
|
532
|
-
const groupInsList = mulInsOrderList.filter((ins: IProdInsurance) => ins.groupKey == k)
|
|
533
|
-
if (nGroupTitleEle && nGroupInsuranceIdEle && groupInsList.length) {
|
|
534
|
-
const notDisabledInsurances: any[] = groupInsList.filter(ins => {
|
|
535
|
-
const titleEle = (ins.eleOrderList || []).find(e => e.key === 'title')
|
|
536
|
-
return titleEle && !titleEle.isDisabled
|
|
537
|
-
})
|
|
538
|
-
const checkedInsurances = notDisabledInsurances.filter(ins => {
|
|
539
|
-
const titleEle = (ins.eleOrderList || []).find(ele => ele.key === 'title')
|
|
540
|
-
return titleEle && titleEle.value
|
|
541
|
-
})
|
|
542
|
-
const hasRequiredIns = notDisabledInsurances.some(ins => ins.required)
|
|
543
|
-
const checkedInsurance = checkedInsurances[0]
|
|
544
|
-
// hasRequiredIns:如果组合险中有一款是必选的,则整个组合险为选中状态
|
|
545
|
-
// 所有险种都不可选,则组合险不可修改且不选中。否则,组合险种可选
|
|
546
|
-
nGroupTitleEle.value = oldGroupTitleValue === false ? oldGroupTitleValue : oldGroupTitleValue || !!checkedInsurance
|
|
547
|
-
if (hasRequiredIns) {
|
|
548
|
-
nGroupTitleEle.value = hasRequiredIns
|
|
549
|
-
}
|
|
550
|
-
nGroupTitleEle.isDisabled = hasRequiredIns || (nGroupInsuranceIdEle.opts || []).every(opt => !!opt.isDisabled)
|
|
551
|
-
nGroupInsuranceIdEle.value = checkedInsurance ? checkedInsurance.key : null
|
|
552
|
-
|
|
553
|
-
//将当前选中险种的部分数据复制到组合险中
|
|
554
|
-
if (checkedInsurance) {
|
|
555
|
-
// 定义组件险中的元素:自身eleOrderList + 所选险种的eleOrderList(不包含标题)
|
|
556
|
-
const keys = ['code', 'groupKey', 'groupName', 'isFollowing', 'key', 'name', 'accountData', 'reduceBaofData', 'duplicateReduceBaofData']
|
|
557
|
-
for (let ck in checkedInsurance) {
|
|
558
|
-
if (!keys.includes(ck)) {
|
|
559
|
-
if (ck === 'eleOrderList') {
|
|
560
|
-
newGroupInsMap[k][ck] = newGroupInsMap[k][ck].concat((<IInsElement[]>checkedInsurance[ck]).filter(ele => ele.key !== 'title'))
|
|
561
|
-
} else {
|
|
562
|
-
newGroupInsMap[k][ck] = checkedInsurance[ck]
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
const index = findLastIndex(mulInsOrderList, ins => ins.groupKey === k)
|
|
569
|
-
if (index >= 0) {
|
|
570
|
-
prodData.mulInsOrderList.splice(index + 1, 0, newGroupInsMap[k])
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
return prodData
|
|
575
|
-
}
|
|
576
|
-
|
|
577
487
|
/**
|
|
578
488
|
* **判断是否隐藏产品**
|
|
579
489
|
* - 根据必选险种,或者所有险种的年龄范围,取并集,计算出产品年龄范围
|
|
@@ -591,13 +501,13 @@ export function isHideProduct(prodData: IPbProduct, prodVerifyData: any, personO
|
|
|
591
501
|
if (prodData && prodVerifyData && Object.keys(prodVerifyData).length && personOrderList) {
|
|
592
502
|
if (prodData.mulInsOrderList) {
|
|
593
503
|
// 产品中是否有必选险种且有费率
|
|
594
|
-
let hasRequiredIns = prodData.mulInsOrderList.some(ins =>
|
|
504
|
+
let hasRequiredIns = prodData.mulInsOrderList.some(ins => getInsDeriveRequired(ins) && prodVerifyData[ins.key])
|
|
595
505
|
prodData.mulInsOrderList.forEach(ins => {
|
|
596
506
|
// 当前险种的限制条件
|
|
597
507
|
let insuranceVerifyData = prodVerifyData[ins.key]
|
|
598
508
|
if (insuranceVerifyData) {
|
|
599
509
|
// 产品年龄范围取各险种最大范围
|
|
600
|
-
if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || (hasRequiredIns && ins
|
|
510
|
+
if ((!ins.huomian || ins.huomian == 'beiHuomian') && (!hasRequiredIns || (hasRequiredIns && getInsDeriveRequired(ins)))) {
|
|
601
511
|
insuranceVerifyData.forEach(verify => {
|
|
602
512
|
ageRangeProd[verify.sex] = ageRangeProd[verify.sex] || []
|
|
603
513
|
ageRangeProd[verify.sex] = [
|
|
@@ -830,8 +740,8 @@ export function restrictInsurancesInProduct({
|
|
|
830
740
|
/**
|
|
831
741
|
* **转换产品数据**
|
|
832
742
|
* - 转换通用信息的数据
|
|
833
|
-
* -
|
|
834
|
-
* -
|
|
743
|
+
* - 转换常规险种的数据(含组合险子险种)。包括将 eleOrderList 数组下的 value 值,转换成 key-value 键值对
|
|
744
|
+
* - 仅输出 title 为真的真实险种;组合险 UI 状态不进入本转换
|
|
835
745
|
* @author Lizhao <lz@winbaoxian.com>
|
|
836
746
|
* @date 2022-04-26
|
|
837
747
|
* @param {IPbProduct} prodData 必传。产品数据(单个)
|
|
@@ -856,27 +766,10 @@ export function convertProductData(prodData: IPbProduct): IPbProduct {
|
|
|
856
766
|
productData.common = insuranceData
|
|
857
767
|
return
|
|
858
768
|
}
|
|
859
|
-
if (insuranceData.title
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
insuranceId.forEach(insId => {
|
|
864
|
-
const checkedIns = (<IProdInsurance[]>prodData.mulInsOrderList).find(p => p.key === insId)
|
|
865
|
-
if (checkedIns) {
|
|
866
|
-
// 转换组合险中选中的险种
|
|
867
|
-
const checkedInsData = convertEleOrderListToObj(checkedIns)
|
|
868
|
-
insurance.eleOrderList &&
|
|
869
|
-
insurance.eleOrderList.forEach(function(ele) {
|
|
870
|
-
if (!['title', 'insuranceId'].includes(ele.key)) {
|
|
871
|
-
checkedInsData[ele.key] = insuranceData[ele.key]
|
|
872
|
-
}
|
|
873
|
-
});
|
|
874
|
-
(<IProdInsurance[]>productData.mulInsOrderList).push(cloneDeep(checkedInsData))
|
|
875
|
-
}
|
|
876
|
-
})
|
|
877
|
-
return
|
|
878
|
-
}
|
|
879
|
-
(<IProdInsurance[]>productData.mulInsOrderList).push(insuranceData)
|
|
769
|
+
if (insuranceData.title) {
|
|
770
|
+
delete (insuranceData as any).deriveRequired
|
|
771
|
+
const mulInsOrderList = productData.mulInsOrderList as IProdInsurance[]
|
|
772
|
+
mulInsOrderList.push(insuranceData)
|
|
880
773
|
}
|
|
881
774
|
})
|
|
882
775
|
return productData
|
|
@@ -308,6 +308,8 @@ textOverflowEllipsis('hello world', 4); // returns 'hello world'
|
|
|
308
308
|
|
|
309
309
|
- 初始化调整保额数据
|
|
310
310
|
- 初始化险种数据
|
|
311
|
+
- 非 `isCheckbox` 组合险:同组子险只保留一个选中
|
|
312
|
+
- 险种排序:普通险在前,组合险按首个子险出现顺序排在后(组内相对序不变)
|
|
311
313
|
|
|
312
314
|
**参数**
|
|
313
315
|
|
|
@@ -329,7 +331,6 @@ textOverflowEllipsis('hello world', 4); // returns 'hello world'
|
|
|
329
331
|
- 处理险种数据
|
|
330
332
|
- 根据被、投保人信息处理险种状态(如:险种是否可选)
|
|
331
333
|
- 根据校验条件解析产品状态(如:重新获取元素的可选项)
|
|
332
|
-
- 创建或更新组合险
|
|
333
334
|
- 判断产品是否隐藏
|
|
334
335
|
|
|
335
336
|
**参数**
|
|
@@ -390,6 +391,7 @@ textOverflowEllipsis('hello world', 4); // returns 'hello world'
|
|
|
390
391
|
- 补充显示文案(保额、保费等字段的占位符)
|
|
391
392
|
- 转换元素的选项字段(`optConf` → `opts`,补全 `isHide`、`isDisabled`、`isInvalid`)
|
|
392
393
|
- 预设后续可能用到的字段,如追加领取、减保领取数据结构
|
|
394
|
+
- 首次初始化时,按 title 锁定勾选写入 `deriveRequired`(只写一次;**仅**人员/产品年龄范围逻辑使用,不用于组合险 UI)
|
|
393
395
|
|
|
394
396
|
**参数**
|
|
395
397
|
|
package/packages/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ Vue.use(Vant)
|
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
export default class InsureCalculateDemo extends Vue {
|
|
32
|
-
productId: number | string =
|
|
32
|
+
productId: number | string = 103647 // 104367 100585 104733 102805 104931 110019;
|
|
33
33
|
uuid = ''
|
|
34
34
|
planParams = {
|
|
35
35
|
detail_age: '',
|
|
@@ -147,8 +147,8 @@
|
|
|
147
147
|
</slot>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
|
-
<!--
|
|
151
|
-
<
|
|
150
|
+
<!-- 职业列表:异步查询,无检验规则 -->
|
|
151
|
+
<bxt-profession-list v-model="isShowProfession" :async-columns-params="asyncColumnsParams" readonly />
|
|
152
152
|
|
|
153
153
|
<van-popup v-model="pickerConfig.visible" round position="bottom" get-container="body">
|
|
154
154
|
<van-picker
|
|
@@ -186,9 +186,7 @@ import { Toast } from 'vant'
|
|
|
186
186
|
import { get as _get } from 'lodash'
|
|
187
187
|
import { parseTime } from '../../src/js/utils.js'
|
|
188
188
|
import { getCommonCurrentUser, getAddress } from '../../src/api'
|
|
189
|
-
import '
|
|
190
|
-
import { ProfessionList } from 'bxs-ui-vue'
|
|
191
|
-
import 'bxs-ui-vue/esm/profession-list/index.css'
|
|
189
|
+
import ProfessionList from 'src/components/profession-list'
|
|
192
190
|
|
|
193
191
|
import { insureCalculate, hasPlanParams } from 'packages/bxs-utils/index'
|
|
194
192
|
import './index.less'
|
|
@@ -239,7 +237,7 @@ function initDatePickerConfig() {
|
|
|
239
237
|
|
|
240
238
|
@Component({
|
|
241
239
|
components: {
|
|
242
|
-
|
|
240
|
+
BxtProfessionList: ProfessionList
|
|
243
241
|
}
|
|
244
242
|
})
|
|
245
243
|
export default class InsureCalculate extends Vue {
|
|
@@ -344,11 +342,13 @@ export default class InsureCalculate extends Vue {
|
|
|
344
342
|
vm.setIsDevelop()
|
|
345
343
|
if (!vm.uuid) {
|
|
346
344
|
try {
|
|
345
|
+
// request 默认返回 res.data,即用户对象本身(含 uuid),不是 { data: { uuid } }
|
|
347
346
|
const userInfo = await getCommonCurrentUser()
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
const uuid = _get(userInfo, 'uuid') || _get(userInfo, 'data.uuid')
|
|
348
|
+
if (uuid) {
|
|
349
|
+
vm.uuidFromApi = uuid
|
|
350
350
|
} else {
|
|
351
|
-
Toast(userInfo
|
|
351
|
+
Toast(_get(userInfo, 'info') || _get(userInfo, 'message') || '用户信息获取失败')
|
|
352
352
|
}
|
|
353
353
|
} catch (error) {
|
|
354
354
|
Toast(error && error.info ? error.info : '用户信息获取失败')
|
|
@@ -357,17 +357,18 @@ export default class InsureCalculate extends Vue {
|
|
|
357
357
|
vm.init()
|
|
358
358
|
}
|
|
359
359
|
init() {
|
|
360
|
-
const
|
|
361
|
-
userUuid: this.getU()
|
|
362
|
-
}
|
|
360
|
+
const userUuid = this.getU()
|
|
363
361
|
const postParamsProfess = {
|
|
364
362
|
productId: this.productId
|
|
365
363
|
}
|
|
366
|
-
//
|
|
367
|
-
this.asyncColumnsParams =
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
// 无 userUuid 时不传异步参数,避免 prop validator 告警;职业查询前需有登录态
|
|
365
|
+
this.asyncColumnsParams = userUuid
|
|
366
|
+
? {
|
|
367
|
+
urlParams: { userUuid },
|
|
368
|
+
postParams: postParamsProfess,
|
|
369
|
+
isDev: this.isDevelop
|
|
370
|
+
}
|
|
371
|
+
: null
|
|
371
372
|
let originData
|
|
372
373
|
this.hasCalculateData = !!(this.calculateData && this.calculateData.current_data && this.calculateData.current_data.length)
|
|
373
374
|
if (this.hasCalculateData) {
|