bxs-tools-ui 1.2.9 → 1.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bxs-tools-ui",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "description": "微易前端业务组件",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -17,18 +17,16 @@
17
17
  }
18
18
 
19
19
  & .bxt-item-title-label {
20
- @apply --noWrap;
21
-
22
- display: inline-block;
23
- width: 18rem;
20
+ display: flex;
24
21
  padding: 15px 0;
25
22
  line-height: normal;
26
23
  font-size: 17px;
27
24
  font-weight: bold;
28
25
  vertical-align: middle;
26
+ white-space: nowrap;
29
27
 
30
- & span {
31
- vertical-align: middle;
28
+ & .bxt-item-title-label-item {
29
+ flex: 0 0 auto;
32
30
  }
33
31
 
34
32
  & .bxt-title-code {
@@ -40,39 +38,42 @@
40
38
  font-size: 12px;
41
39
  transform: scale(0.8334);
42
40
  transform-origin: left center;
41
+ vertical-align: 1px;
43
42
  }
44
43
 
45
- & .bxt-titile-content--disabled {
46
- color: var(--color-text-assist);
47
- }
44
+ & .bxt-item-title-label-name {
45
+ flex: 1;
48
46
 
49
- & .bxt-titile-persion-modify {
50
- margin-left: 12px;
51
- color: var(--color-primary);
52
- font-weight: normal;
53
- font-size: 14px;
47
+ & span {
48
+ display: inline-block;
49
+ vertical-align: top;
50
+ white-space: normal;
54
51
 
55
- & i.iconfont {
56
- font-size: 12px;
57
- }
58
- }
59
- }
52
+ &.bxt-title-content--disabled {
53
+ color: var(--color-text-assist);
54
+ }
60
55
 
61
- & .bxt-title-huomian-tag {
62
- position: absolute;
63
- top: 50%;
64
- right: 30px;
65
- transform: translateY(-50%);
66
- color: #f90;
67
- font-size: 14px;
68
- line-height: normal;
69
- }
56
+ &.bxt-title-persion-modify {
57
+ margin-left: 12px;
58
+ color: var(--color-primary);
59
+ font-weight: normal;
60
+ font-size: 14px;
61
+ vertical-align: middle;
70
62
 
71
- & .bxt-item-title-checkbox {
72
- position: absolute;
73
- top: 50%;
74
- right: 0;
75
- transform: translateY(-50%);
63
+ & i.iconfont {
64
+ font-size: 12px;
65
+ }
66
+ }
67
+
68
+ &.bxt-title-huomian-tag {
69
+ margin-left: 5px;
70
+ color: #f90;
71
+ font-size: 14px;
72
+ line-height: normal;
73
+ vertical-align: middle;
74
+ }
75
+ }
76
+ }
76
77
  }
77
78
  }
78
79
 
@@ -1,33 +1,43 @@
1
1
  <template>
2
2
  <div>
3
3
  <div class="bxt-item-title">
4
- <label class="bxt-item-title-label" :style="{ width: huomianTag ? '16rem' : '18rem' }">
5
- <span v-if="code" class="bxt-title-code">{{ code }}</span>
6
- <span
7
- :class="{
8
- 'bxt-titile-content': true,
9
- 'bxt-titile-content--disabled': !!disabled && !value
10
- }"
11
- >{{ label }}</span
12
- >
13
- <span
14
- v-if="isShowCrmPerson"
15
- class="bxt-titile-persion-modify"
16
- :data-stat-id="dataStatId"
17
- @click="$emit('modify')"
18
- >
19
- 修改
20
- <i class="iconfont icon-arrows_right"></i>
21
- </span>
22
- </label>
23
- <span v-if="huomianTag" class="bxt-title-huomian-tag">{{ huomianTag }}</span>
24
- <bxs-checkbox
25
- v-if="!(currentValue && disabled)"
26
- class="bxt-item-title-checkbox"
27
- :value="currentValue"
28
- :disabled="disabled"
29
- @click.native="onchange"
30
- />
4
+ <div class="bxt-item-title-label">
5
+ <div v-if="code" class="bxt-item-title-label-item">
6
+ <span class="bxt-title-code">{{ code }}</span>
7
+ </div>
8
+ <div class="bxt-item-title-label-item bxt-item-title-label-name">
9
+ <span
10
+ :class="{
11
+ 'bxt-titile-content': true,
12
+ 'bxt-titile-content--disabled': !!disabled && !value
13
+ }"
14
+ :style="{
15
+ maxWidth: huomianTag ? '78%' : '100%'
16
+ }"
17
+ >{{ label }}</span
18
+ >
19
+ <span
20
+ v-if="isShowCrmPerson"
21
+ class="bxt-title-persion-modify"
22
+ :data-stat-id="dataStatId"
23
+ @click="$emit('modify')"
24
+ >
25
+ 修改
26
+ <i class="iconfont icon-arrows_right"></i>
27
+ </span>
28
+ <span v-if="huomianTag" class="bxt-title-huomian-tag">
29
+ {{ huomianTag }}
30
+ </span>
31
+ </div>
32
+ <div v-if="!(currentValue && disabled)" class="bxt-item-title-label-item">
33
+ <bxs-checkbox
34
+ class="bxt-item-title-checkbox"
35
+ :value="currentValue"
36
+ :disabled="disabled"
37
+ @click.native="onchange"
38
+ />
39
+ </div>
40
+ </div>
31
41
  </div>
32
42
  <div v-if="huomianTips" class="bxt-title-huomian-tips" @click="$emit('openCrmPerson')" v-html="huomianTips" />
33
43
  </div>
@@ -121,7 +121,7 @@
121
121
  & .bxt-ins-unit-tips {
122
122
  display: inline-block;
123
123
  position: absolute;
124
- top: 60%;
124
+ top: 30px;
125
125
  right: 55px;
126
126
  margin-top: 11px;
127
127
  line-height: normal;
@@ -151,12 +151,38 @@
151
151
  }
152
152
  }
153
153
 
154
+ & .bxt-ins-recommend-values {
155
+ padding: 0 15px 18px 15px;
156
+ text-align: right;
157
+ white-space: nowrap;
158
+ overflow: auto;
159
+
160
+ & span {
161
+ display: inline-block;
162
+ margin-top: 5px;
163
+ margin-left: 6px;
164
+ padding: 4px 5px;
165
+ line-height: 100%;
166
+ color: #666;
167
+ background: #f8f8f8;
168
+ border: 1px solid #ccc;
169
+ border-radius: 50px;
170
+ font-size: 12px;
171
+ }
172
+ }
173
+
154
174
  & .bxt-ins-form-radio-btn {
155
175
  & .bx-form-item__inner {
156
176
  align-items: flex-start;
157
177
  }
158
178
  }
159
179
 
180
+ & .bx-form-item__input {
181
+ & .bx-form-item__inner {
182
+ align-items: flex-start;
183
+ }
184
+ }
185
+
160
186
  & .bx-form-item__unit {
161
187
  position: relative;
162
188
  z-index: 1;
@@ -33,6 +33,7 @@
33
33
  <bxs-form-item
34
34
  v-show="isInsuranceChecked(ins) && !ele.isHide"
35
35
  :class="{
36
+ 'bx-form-item__input': true,
36
37
  'bx-form-item__unit': activeInputKey === ins.key + ele.key && numberUnitStr
37
38
  }"
38
39
  :key="ins.key + ele.key"
@@ -72,6 +73,15 @@
72
73
  </span>
73
74
  </div>
74
75
  </bxs-form-item>
76
+ <div
77
+ v-if="isInsuranceChecked(ins) && !ele.isHide && getRecommendValues(ins, ele)"
78
+ :key="ins.key + ele.key"
79
+ class="bxt-ins-recommend-values"
80
+ >
81
+ <span v-for="v in getRecommendValues(ins, ele)" :key="v" @click="onClickRecommendValue(v, ins, ele)">
82
+ {{ v }}
83
+ </span>
84
+ </div>
75
85
  </template>
76
86
  <template v-if="['cmCommonRadioBtn'].includes(ele.componentName)">
77
87
  <bxs-form-item
@@ -176,7 +186,14 @@
176
186
  <script lang="ts">
177
187
  import Vue from 'vue';
178
188
  import { Component, Prop } from 'vue-property-decorator';
179
- import { productDataHandler, verifyProductRules, clearAddAndTakeAndAdjustBaoeData } from 'packages/bxs-utils/index';
189
+ import {
190
+ productDataHandler,
191
+ verifyProductRules,
192
+ clearAddAndTakeAndAdjustBaoeData,
193
+ convertEleOrderListToObj
194
+ } from 'packages/bxs-utils/index';
195
+ import { createdProductDataToCalc } from 'packages/planbook-input/helper.js';
196
+
180
197
  import SelectItem from 'packages/components/form-item/select-item.vue';
181
198
  import TitleItem from 'packages/components/form-item/title-item.vue';
182
199
 
@@ -198,6 +215,8 @@ import 'bxs-ui-vue/esm/index.css';
198
215
  export default class BxtProductInfo extends Vue {
199
216
  activeInputKey = '';
200
217
  numberUnitStr = '';
218
+ recommendValues = {};
219
+ recommendValuesCache = {};
201
220
 
202
221
  @Prop({
203
222
  default: () => ({})
@@ -280,6 +299,7 @@ export default class BxtProductInfo extends Vue {
280
299
  }
281
300
  change(options) {
282
301
  const self = this;
302
+ self.requiestRecommendValues();
283
303
  if (options.type === 'change') {
284
304
  self.$nextTick(() => {
285
305
  self.$emit(
@@ -415,6 +435,73 @@ export default class BxtProductInfo extends Vue {
415
435
  activeElement.blur();
416
436
  return false;
417
437
  }
438
+ getRecommendValues(ins, ele) {
439
+ if (!['baoe', 'baof'].includes(ele.key)) {
440
+ return null;
441
+ }
442
+ const insurance = convertEleOrderListToObj(ins);
443
+ return this.recommendValues && this.recommendValues[insurance.isGroup ? insurance.insuranceId : insurance.key];
444
+ }
445
+ async requiestRecommendValues() {
446
+ const { recommendValuesCache, inputData, groupData, productData } = this;
447
+ const IS_PRODUCT_ENV = location.hostname.search(/winbaoxian\.com/) !== -1;
448
+ const url = `https://app.winbaoxian.${IS_PRODUCT_ENV ? 'com' : 'cn'}/planBook/input/calculate/recommend`;
449
+ const calcData = await createdProductDataToCalc(inputData, {
450
+ groupKey: groupData.key,
451
+ productKey: productData.key
452
+ });
453
+
454
+ const reqParams: any = [];
455
+ const calcInputData = JSON.parse(calcData.jd);
456
+ const calcProductData = calcInputData && calcInputData.productGroupList[0].prodOrderList[0];
457
+ if (calcProductData && calcProductData.mulInsOrderList) {
458
+ calcProductData.mulInsOrderList.forEach(ins => {
459
+ reqParams.push({
460
+ insuranceId: ins.key,
461
+ period: ins.pPeriod,
462
+ calMethod: ins.calMethod || ins.calculatorType
463
+ });
464
+ });
465
+ }
466
+
467
+ if (recommendValuesCache[JSON.stringify(reqParams)]) {
468
+ this.recommendValues = recommendValuesCache[JSON.stringify(reqParams)];
469
+ return;
470
+ }
471
+
472
+ return fetch(url, {
473
+ method: 'POST',
474
+ credentials: 'include',
475
+ headers: {
476
+ Accept: 'application/json, text/plain, */*',
477
+ 'Content-Type': 'application/json;'
478
+ },
479
+ body: JSON.stringify(reqParams)
480
+ })
481
+ .then(response => response.json())
482
+ .then(({ success, data, info }: any) => {
483
+ if (!success || !data) {
484
+ this.$toast(info);
485
+ return Promise.reject();
486
+ }
487
+ this.recommendValues = data.reduce((obj, ele) => {
488
+ obj[ele.insuranceId] = ele.valueList;
489
+ return obj;
490
+ }, {});
491
+ recommendValuesCache[JSON.stringify(reqParams)] = this.recommendValues;
492
+ })
493
+ .catch(error => {
494
+ console.log(error);
495
+ });
496
+ }
497
+ onClickRecommendValue(value, ins, ele) {
498
+ ele.value = value;
499
+ this.change({
500
+ insData: ins,
501
+ eleData: ele,
502
+ type: 'change'
503
+ });
504
+ }
418
505
  }
419
506
  </script>
420
507
  <style>