bxs-tools-ui 3.2.0-1 → 3.2.0-2

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.
@@ -1,22 +1,32 @@
1
- <!--仅用于绕过 eslint-loader 校验的错误信息:Parsing error: Invalid character-->
2
- <!--??以目前现象看,文档首字符不为 "<" 会报错??-->
3
1
  ## 计划书产品(ProductInfo)
4
- 说明:计划书产品组件
5
- 内容:包括产品中各险种的各项元素值的修改、校验
6
- 属性:inputData、verifyData、groupKey、productKey、params
7
- 方法:change、validate
8
2
 
9
- ### 示例
10
- ```html
11
- import { ProductInfo } from 'bxs-tools-ui'
12
- export default {
13
- components: {
14
- ProductInfo
15
- }
3
+ 计划书投保页的产品组件,基于服务端下发的 `mulInsOrderList` 动态渲染各险种的表单元素,支持元素值修改、险种联动逻辑处理与表单校验。
4
+
5
+ > 数据来源:访问[计划书初始化 API](http://app.winbaoxian.cn/planBook/V2/getInitData?insuranceTypeId=6128) 查看示例数据,或参考 `demo/constant.js`。
6
+ > - `inputData`:`data → initData → inputData`
7
+ > - `verifyData`:`data → verifyData`
8
+ > - `groupKey`:`inputData → productGroupList → key`
9
+ > - `productKey`:`inputData → productGroupList → prodOrderList → key`
10
+
11
+ ---
12
+
13
+ ### 模块引用(import)
14
+
15
+ ```javascript
16
+ import { ProductInfo } from 'bxs-tools-ui';
17
+ export default {
18
+ components: {
19
+ ProductInfo
16
20
  }
21
+ };
17
22
  ```
18
23
 
24
+ ---
25
+
26
+ ### 示例(example)
27
+
19
28
  ```html
29
+ <template>
20
30
  <ProductInfo
21
31
  ref="productInfo"
22
32
  :input-data="inputData"
@@ -24,63 +34,114 @@
24
34
  :group-key="'allMainInsData'"
25
35
  :product-key="2695"
26
36
  @change="cgProduct"
27
- ></ProductInfo>
37
+ @openCrmPerson="openCrmPersonPopup"
38
+ />
39
+ </template>
40
+
41
+ <script>
42
+ import { ProductInfo } from 'bxs-tools-ui';
43
+
44
+ export default {
45
+ components: { ProductInfo },
46
+ methods: {
47
+ cgProduct(product, options, inst) {
48
+ if (options.type === 'change' && options.errorMsg) {
49
+ this.$nextTick(() => {
50
+ this.$toast(options.errorMsg);
51
+ });
52
+ }
53
+ },
54
+ openCrmPersonPopup() {
55
+ // 打开人员信息修改浮层(含 CRM 导入功能)
56
+ },
57
+ validate() {
58
+ this.$refs.productInfo
59
+ .validate()
60
+ .then(valid => {
61
+ // 校验通过
62
+ })
63
+ .catch(err => {
64
+ console.log(err);
65
+ });
66
+ }
67
+ }
68
+ };
69
+ </script>
28
70
  ```
29
-
71
+
72
+ ---
73
+
30
74
  ### Attributes
31
- | 参数| 说明 | 类型 | 默认值 |
32
- | --- | --- | --- | --- |
33
- | input-data | 必传,计划书初始化数据。 | Object | {} |
34
- | verify-data | 可不传,计划书限制条件。如不传,不会调用模块内部封装的产品逻辑处理函数 | Object | {} |
35
- | group-key | 必传,产品组的key。 | Number, String | null |
36
- | product-key | 必传,产品的key。 | Number, String | null |
37
- | params | 可传,一些可选参数,目前有:allowCustomResult(自定义保额、保费)。 | Object | {} |
38
-
39
- ### 数据说明
40
- 注: 访问[计划书初始化API](http://app.winbaoxian.cn/planBook/V2/getInitData?insuranceTypeId=6128)查看示例数据,或者查看[静态示例数据](./demo/constant.js)。
41
- > inputData: data -> initData -> inputData
42
- > verifyData: data -> verifyData
43
- > groupKey: inputData -> productGroupList -> key
44
- > productKey: inputData -> productGroupList -> prodOrderList -> key
45
-
46
- #### productData对象
47
- | 参数| 说明 | 类型 | 默认值 |
48
- | --- | --- | --- | --- |
49
- | mulInsOrderList | 必传。险种列表,具体查看mulInsOrderList数组 | Array | - |
50
- | key | 必传。产品id | Number | - |
51
-
52
- #### mulInsOrderList数组
53
- | 参数| 说明 | 类型 | 默认值 |
54
- | --- | --- | --- | --- |
55
- | eleOrderList | 必传。险种中元素列表,具体查看eleOrderList数组 | Array | - |
56
- | key | 必传。险种id | Number | - |
57
- | code | 可不传。险种code | String | - |
58
- | isFollowing | 可不传。是否去除与上一险种之间的间距 | Boolean | - |
59
-
60
- #### eleOrderList数组
61
- | 参数| 说明 | 类型 | 默认值 |
62
- | --- | --- | --- | --- |
63
- | componentName | 必传。元素对应的组件名称。 cmCommonTitle \| cmCommonInput \| cmCommonRadioBtn \| cmCommonRadio \| cmCommonSelect | String | - |
64
- | key | 必传。元素id | String | - |
65
- | value | 必传。元素的值 | [String, Number] | - |
66
- | labelName | 必传。元素名称 | String | - |
67
- | common | 可不传。是否为通用元素 | Boolean | - |
68
- | isDisabled | 必传。元素是否不可修改 | Boolean | - |
69
- | isHide | 必传。元素是否隐藏 | Boolean | - |
70
- | isIgnoreValidate | 必传。是否忽略元素校验 | Boolean | - |
71
- | rules | 可不传。元素校验规则。基于[async-validate](https://github.com/yiminghe/async-validator#type)的校验规则 | Array | - |
72
- | opts | 必传。适用于 cmCommonRadioBtn \| cmCommonRadio \| cmCommonSelect 组件 | Array | - |
73
- | restrictions | 可不传。当前元素的限制条件 | Array | - |
74
- | placeholder | 可不传。适用于 cmCommonInput 组件 | String | - |
75
-
76
-
75
+
76
+ | 参数 | 说明 | 类型 | 默认值 |
77
+ | --- | --- | --- | --- |
78
+ | `input-data` | 必传,计划书初始化数据 | Object | `{}` |
79
+ | `group-key` | 必传,产品组的 key | Number / String | `null` |
80
+ | `product-key` | 必传,产品的 key | Number / String | `null` |
81
+ | `verify-data` | 可选,计划书限制条件;不传则不执行产品逻辑处理函数 | Object | `{}` |
82
+ | `show-recommend-value` | 可选,是否展示保额/保费推荐值 | Boolean | `true` |
83
+ | `params` | 可选,其他参数,见 Params 对象 | Object | `{}` |
84
+
85
+
86
+ #### Params 对象
87
+
88
+ | 参数 | 说明 | 类型 |
89
+ | --- | --- | --- |
90
+ | `planbookId` | 计划书 ID,用于产品联动逻辑 | Number |
91
+ | `publicPbUuid` | 公开计划书 uuid,传入后使用 public 接口重算 | String |
92
+ | `allowCustomResult` | 是否显示「自定义保费/保额」开关 | Boolean |
93
+ | `insuranceSaleStatus` | 险种停售状态映射:`{ [insuranceKey]: number }`;值为 `2` 时展示「停」标签 | Object |
94
+
95
+
96
+ #### ProductData 对象(inputData 中的产品结构)
97
+
98
+ | 参数 | 说明 | 类型 |
99
+ | --- | --- | --- |
100
+ | `key` | 必传,产品 ID | Number |
101
+ | `mulInsOrderList` | 必传,险种列表,见 MulInsOrderList 数组 | Array |
102
+
103
+
104
+ #### MulInsOrderList 数组(单项)
105
+
106
+ | 参数 | 说明 | 类型 |
107
+ | --- | --- | --- |
108
+ | `key` | 必传,险种 ID | Number |
109
+ | `eleOrderList` | 必传,险种内元素列表,见 EleOrderList 数组 | Array |
110
+ | `code` | 险种 code | String |
111
+ | `isFollowing` | 是否去除与上一险种之间的间距 | Boolean |
112
+
113
+
114
+ #### EleOrderList 数组(单项)
115
+
116
+ | 参数 | 说明 | 类型 |
117
+ | --- | --- | --- |
118
+ | `key` | 必传,元素 ID | String |
119
+ | `value` | 必传,元素当前值 | String / Number |
120
+ | `componentName` | 必传,对应渲染组件(`cmCommonTitle` / `cmCommonInput` / `cmCommonRadioBtn` / `cmCommonRadio` / `cmCommonSelect`) | String |
121
+ | `labelName` | 必传,元素名称 | String |
122
+ | `isDisabled` | 必传,是否不可修改 | Boolean |
123
+ | `isHide` | 必传,是否隐藏 | Boolean |
124
+ | `isIgnoreValidate` | 必传,是否忽略校验 | Boolean |
125
+ | `common` | 是否为通用元素 | Boolean |
126
+ | `opts` | 选项列表(`cmCommonRadioBtn` / `cmCommonRadio` / `cmCommonSelect` 适用) | Array |
127
+ | `rules` | 校验规则,基于 [async-validator](https://github.com/yiminghe/async-validator#type) | Array |
128
+ | `restrictions` | 当前元素的限制条件 | Array |
129
+ | `placeholder` | 占位符(`cmCommonInput` 适用) | String |
130
+
131
+ ---
132
+
77
133
  ### Methods
78
- | 方法名 | 说明 | 参数 | 备注 |
79
- | --- | --- | --- | --- |
80
- | validate | 组件的校验方法,可用$refs调用。返回Promise | - | - |
81
-
134
+
135
+ | 方法名 | 说明 | 参数 |
136
+ | --- | --- | --- |
137
+ | `validate` | 表单校验,通过 `$refs` 调用,返回 Promise | — |
138
+
139
+ ---
140
+
82
141
  ### Events
83
- | 方法名 | 说明 | 参数 | 备注 |
84
- | --- | --- | --- | --- |
85
- | change | 产品信息改变时触发 | function(product, options, inst) {}。product: options: {ins: 险种, ele: 元素,type: init \| change}, inst: 当前Vue组件的实例 | - |
86
- | openCrmPerson | 点击豁免险中标题的提示信息时触。一般用于打开浮层,修改人员信息(包含CRM导入功能)。<br/>注意:由于 BottomSheets 不支持嵌套。人员信息修改浮层需要开发者在外层定义。<br/>注意:如果不传该方法,豁免险中不会显示相关提示信息。 | - | - |
142
+
143
+ | 事件名 | 说明 | 回调参数 |
144
+ | --- | --- | --- |
145
+ | `change` | 产品信息改变时触发 | `Function(product, options, inst)`;初始化时 `options` 为 `{ errorMsg }`;字段变更时 `options` 含 `{ type: 'change', insData: 险种, eleData: 元素, errorMsg }`;`inst` 为当前 Vue 实例 |
146
+ | `openCrmPerson` | 点击豁免险标题提示信息时触发,用于打开人员信息修改浮层(含 CRM 导入功能);不传该监听则豁免险中不显示相关提示 | — |
147
+ | `reCalculate` | 险种存在 `revalidateFlag` 且外部监听了该事件时触发,用于外部执行重算并回调通知组件 | `Function(inputData, params, resolve, reject)` |