bri-components 1.4.14 → 1.4.16

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": "bri-components",
3
- "version": "1.4.14",
3
+ "version": "1.4.16",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -25,6 +25,7 @@
25
25
  closable: true
26
26
  }"
27
27
  @delete="clickDeleteItem"
28
+ @clickItem="clickItem"
28
29
  ></dsh-tags>
29
30
 
30
31
  <!-- 对象的 地理坐标 -->
@@ -105,6 +106,9 @@
105
106
  clickDeleteItem (...params) {
106
107
  this.$emit("deleteItem", ...params);
107
108
  },
109
+ clickItem (...params) {
110
+ this.$emit("clickItem", ...params);
111
+ },
108
112
  clickClear () {
109
113
  this.$emit("clear");
110
114
  }
@@ -657,6 +657,7 @@
657
657
 
658
658
  &-nodata {
659
659
  padding-left: 7px;
660
+ line-height: 32px;
660
661
  color: @placeholderColor;
661
662
  }
662
663
  }
@@ -201,6 +201,18 @@
201
201
  name: "次年末",
202
202
  numbers: [1],
203
203
  dateTypes: ["year", "date", "datetime"]
204
+ },
205
+ {
206
+ _key: "last_month_21",
207
+ name: "上月21日",
208
+ numbers: [0],
209
+ dateTypes: ["month", "date", "datetime"]
210
+ },
211
+ {
212
+ _key: "dyn_month_21",
213
+ name: "本月21日",
214
+ numbers: [0, 1],
215
+ dateTypes: ["month", "date", "datetime"]
204
216
  }
205
217
  ]
206
218
  };
@@ -99,11 +99,11 @@ export default {
99
99
  const selectControlTypes = ["coordinates", "date", "switch", "select", "checkbox", "file", "region", "regions", "cascader", "cascaders", "users", "departments", "reference"];
100
100
  return {
101
101
  // TODO: 此处的请输入可能还有请选择之类的,待处理
102
- _placeholder: this.canEdit && this.propsObj._enterType !== "calculate" && this.propsObj._disabled !== true
102
+ _placeholder: this.canEdit && this.propsObj._enterType !== "calculate" && this.propsObj._disabled !== true && this.propsObj._readonly !== true
103
103
  ? (this.propsObj._placeholder || `${selectControlTypes.includes(this.controlType) ? "选择" : "输入"}${this.propsObj._name}`)
104
104
  : undefined,
105
105
  _clearable: this.finalCanEdit && (this.propsObj._clearable === undefined ? true : this.propsObj._clearable),
106
- _disabled: this.propsObj._disabled || !this.finalCanEdit
106
+ _disabled: !this.finalCanEdit || this.propsObj._disabled || this.propsObj._readonly
107
107
  };
108
108
  },
109
109
  // 是否为多选模式
@@ -149,6 +149,7 @@ export default {
149
149
  this.curValList = this.getItemCheckStatus(item)
150
150
  ? this.curValList.filter(key => key !== item[this.saveKey])
151
151
  : [...this.curValList, item[this.saveKey]];
152
+ this.curValList = this.curValList.filter(key => this.listDataKeys.includes(key));
152
153
  }
153
154
  },
154
155
 
@@ -16,6 +16,7 @@
16
16
  :disabled="selfPropsObj._disabled"
17
17
  :heightAuto="isHeightAuto"
18
18
  :propsObj="selfPropsObj"
19
+ @clickItem="clickItem"
19
20
  @deleteItem="clickDeleteItem"
20
21
  @clear="clickClear"
21
22
  ></dsh-control-input>
@@ -23,9 +24,12 @@
23
24
  </div>
24
25
  </bri-tooltip>
25
26
 
27
+ <!-- label后可自定义内容 -->
28
+ <dsh-render :render="itemTipRender"></dsh-render>
29
+
26
30
  <!-- 搜索选择框 -->
27
31
  <dsh-modal
28
- v-if="finalCanEdit"
32
+ v-if="!selfPropsObj._disabled"
29
33
  class="selectUsers-modal"
30
34
  v-model="showModal"
31
35
  mode="custom"
@@ -242,6 +246,9 @@
242
246
  props: {},
243
247
  data () {
244
248
  return {
249
+ itemTipRender: undefined,
250
+ showTipModal: false,
251
+
245
252
  // 弹框
246
253
  newValList: [],
247
254
  showModal: false,
@@ -351,18 +358,76 @@
351
358
  created () {},
352
359
  methods: {
353
360
  clickInput () {
354
- if (this.finalCanEdit) {
361
+ if (!this.selfPropsObj._disabled) {
355
362
  this.openModal();
356
363
  this.newValList = this.$deepCopy(this.curValList);
357
364
  this.modalInit();
358
365
  }
359
366
  },
367
+ clickItem (item, index) {
368
+ this.itemTipRender = this.getItemTipRender(item, index);
369
+ },
360
370
  clickDeleteItem (deleteItem) {
361
371
  this.curValList = this.curValList.filter(item => item._key !== deleteItem._key);
362
372
  },
363
373
  clickClear () {
364
374
  this.curValList = [];
365
375
  },
376
+ getItemTipRender (item, index) {
377
+ if (this.selfPropsObj._getItemTipRender) {
378
+ return this.selfPropsObj._getItemTipRender.call(this, item, index, this.selfPropsObj, this.value, this.parentObj);
379
+ } else {
380
+ this.showTipModal = true;
381
+
382
+ return this.selfPropsObj._openItemTip
383
+ ? (h) => {
384
+ return h("dsh-modal", {
385
+ class: "selectUsers-tip-modal",
386
+ props: {
387
+ value: this.showTipModal,
388
+ mode: "large",
389
+ propsObj: {
390
+ title: "温馨提示",
391
+ showSlotClose: false,
392
+ maskClosable: true
393
+ }
394
+ },
395
+ on: {
396
+ input: bool => {
397
+ this.showTipModal = bool;
398
+ }
399
+ }
400
+ }, [
401
+ h("div", {
402
+ class: "wrap"
403
+ }, [
404
+ h("div", {
405
+ class: "wrap-content",
406
+ domProps: {
407
+ innerHTML: item._tipContent
408
+ }
409
+ }),
410
+
411
+ h("div", {
412
+ class: "wrap-btns"
413
+ }, [
414
+ h("Button", {
415
+ props: {
416
+ type: "primary"
417
+ },
418
+ on: {
419
+ click: () => {
420
+ this.showTipModal = false;
421
+ }
422
+ }
423
+ }, "我知道了")
424
+ ])
425
+ ])
426
+ ]);
427
+ }
428
+ : undefined;
429
+ }
430
+ },
366
431
 
367
432
  /* ---------- 弹框里 --------- */
368
433
  modalInit () {
@@ -564,11 +629,6 @@
564
629
  }
565
630
  return [];
566
631
  }
567
- },
568
- filters: {
569
- isActive (item, list) {
570
- return list.some(o => o._key === item._key) ? "selectUsers-list-item-active" : "";
571
- }
572
632
  }
573
633
  };
574
634
  </script>
@@ -607,6 +667,37 @@
607
667
  </style>
608
668
  <style lang="less">
609
669
  .selectUsers {
670
+ // 提示框的
671
+ &-tip {
672
+ &-modal {
673
+ .wrap {
674
+ width: 100%;
675
+ height: 100%;
676
+ display: flex;
677
+ flex-direction: column;
678
+
679
+ &-content {
680
+ flex: 1;
681
+ min-height: 0px;
682
+ padding: 0px 12px;
683
+ overflow: auto;
684
+ }
685
+
686
+ &-btns {
687
+ margin: 10px;
688
+ text-align: right;
689
+
690
+ .ivu-btn {
691
+ font-size: 16px;
692
+ font-family: Microsoft YaHei-Semibold, Microsoft YaHei;
693
+ font-weight: 600;
694
+ border-radius: 4px;
695
+ }
696
+ }
697
+ }
698
+ }
699
+ }
700
+
610
701
  // 弹框部分
611
702
  &-modal {
612
703
  &-wrap {
@@ -186,7 +186,7 @@
186
186
  },
187
187
  watch: {
188
188
  "listPropsObj.checkboxOption.selectedRowKeys" (newVal) {
189
- if (!newVal.length && this.$refs.list.selections) {
189
+ if (!newVal.length && this.$refs.list && this.$refs.list.selections) {
190
190
  this.$refs.list.selections = [];
191
191
  }
192
192
  }
@@ -60,15 +60,11 @@
60
60
  </div>
61
61
 
62
62
  <!-- 组 数据列 -->
63
- <div
64
- class="DshPanel-group-list"
65
- >
66
- <div
67
- :class="{
63
+ <div class="DshPanel-group-list">
64
+ <div :class="{
68
65
  'list': true,
69
66
  'list-nodata': !groupItem.list.length
70
- }"
71
- >
67
+ }">
72
68
  <CheckboxGroup
73
69
  class="list-drag"
74
70
  v-model="groupItem.selectIds"
@@ -112,7 +108,7 @@
112
108
  class="title-checkbox"
113
109
  :label="dataItem._id"
114
110
  @click.native.stop="clickRowCheckbox(dataItem)"
115
- > {{ "" }}</Checkbox>
111
+ >{{ "" }}</Checkbox>
116
112
 
117
113
  <!-- 标题 -->
118
114
  <bri-tooltip
@@ -142,25 +138,25 @@
142
138
  :key="colItem._key"
143
139
  class="unit"
144
140
  >
145
- <dsh-list-render
146
- v-if="colItem.renderBodyCell"
147
- :row="dataItem"
148
- :column="colItem"
149
- :index="0"
150
- :render="colItem.renderBodyCell"
151
- ></dsh-list-render>
152
-
153
- <div
154
- v-else-if="colItem.formatter"
155
- v-html="colItem.formatter(dataItem, 0)"
156
- ></div>
157
-
158
- <span
159
- v-else
160
- class="unit-control-text"
161
- >
162
- {{ dataItem[colItem._key] }}
163
- </span>
141
+ <dsh-list-render
142
+ v-if="colItem.renderBodyCell"
143
+ :row="dataItem"
144
+ :column="colItem"
145
+ :index="0"
146
+ :render="colItem.renderBodyCell"
147
+ ></dsh-list-render>
148
+
149
+ <div
150
+ v-else-if="colItem.formatter"
151
+ v-html="colItem.formatter(dataItem, 0)"
152
+ ></div>
153
+
154
+ <span
155
+ v-else
156
+ class="unit-control-text"
157
+ >
158
+ {{ dataItem[colItem._key] }}
159
+ </span>
164
160
  </div>
165
161
  </div>
166
162
  </div>
@@ -289,6 +285,9 @@
289
285
  groupFieldObj () {
290
286
  return this.columns.find(colItem => colItem._key === this.groupField) || {};
291
287
  },
288
+ groupData () {
289
+ return this.groupFieldObj._data || [];
290
+ },
292
291
  titleField () {
293
292
  return this.selfPropsObj.titleField;
294
293
  },
@@ -409,8 +408,9 @@
409
408
 
410
409
  /* -------- 方法 -------- */
411
410
  getBgColor (groupItem) {
411
+ const colorType = (this.groupData.find(item => item._key === groupItem._key) || { color: "color-default" }).color;
412
412
  return this.groupFieldObj._useColor
413
- ? resourceData.colorMap[(this.groupFieldObj._data.find(item => item._key === groupItem._key) || { color: "color-default" }).color]
413
+ ? resourceData.colorMap[colorType]
414
414
  : resourceData.colorMap["color-default"];
415
415
  },
416
416
  getTip (groupItem) {
@@ -21,6 +21,7 @@
21
21
  :color="propsObj.color || tagItem.color || 'default'"
22
22
  :fade="propsObj.fade || false"
23
23
  :size="propsObj.size || 'medium'"
24
+ @click.native="clickTag($event, tagItem, tagIndex)"
24
25
  @on-close="deleteTag($event, tagItem, tagIndex)"
25
26
  @on-change="changeChecked"
26
27
  >
@@ -165,6 +166,10 @@
165
166
  }
166
167
  },
167
168
  methods: {
169
+ // 点击标签
170
+ clickTag (event, item, index) {
171
+ this.$emit("clickItem", item, index);
172
+ },
168
173
  // 删除标签
169
174
  deleteTag (event, item, index) {
170
175
  this.list.splice(index, 1);