bri-components 1.2.65 → 1.2.66

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,185 +1,219 @@
1
1
  <template>
2
2
  <div class="DshPanel">
3
- <div
4
- v-for="(groupItem, groupIndex) in data"
5
- :key="groupIndex"
6
- class="DshPanel-group"
3
+ <!-- 加载 -->
4
+ <bri-loading
5
+ v-if="isLoading"
6
+ class="DshPanel-loading"
7
7
  >
8
- <!-- 标头 -->
9
- <div
10
- class="DshPanel-group-header"
11
- :style="{
8
+ {{ loadingText }}
9
+ </bri-loading>
10
+ <template>
11
+ <!-- 有数据 -->
12
+ <template v-if="data.length">
13
+ <div
14
+ v-for="(groupItem, groupIndex) in data"
15
+ :key="groupIndex"
16
+ class="DshPanel-group"
17
+ >
18
+ <!-- 组 标头 -->
19
+ <div
20
+ class="DshPanel-group-header"
21
+ :style="{
12
22
  backgroundColor: getBgColor(groupItem),
13
23
  color: '#ffffff'
14
24
  }"
15
- >
16
- <!-- 左 -->
17
- <Checkbox
18
- v-if="multiple"
19
- class="header-checkbox"
20
- v-model="groupItem.isSelectAll"
21
- @on-change="selectGroupAll(groupItem, $event)"
22
- ></Checkbox>
23
-
24
- <!-- 左 -->
25
- <bri-tooltip
26
- class="header-left"
27
- :content="groupItem.name"
28
- placement="top"
29
- :transfer="true"
30
- >
31
- <span class="header-left-name">
32
- {{ groupItem.name }}
33
- </span>
34
- </bri-tooltip>
35
-
36
- <!-- 右 -->
37
- <span class="header-right">
38
- <span class="header-right-num">
39
- {{ groupItem.total }}
40
- </span>
41
- 条(已加载{{ groupItem.list.length }}条)
42
- </span>
43
- </div>
44
-
45
- <!-- 组 数据列 -->
46
- <div
47
- class="DshPanel-group-list"
48
- :style="{
25
+ >
26
+ <!-- 左 -->
27
+ <Checkbox
28
+ v-if="multiple"
29
+ class="header-checkbox"
30
+ v-model="groupItem.isSelectAll"
31
+ @on-change="selectGroupAll(groupItem, $event)"
32
+ ></Checkbox>
33
+
34
+ <!-- 左 -->
35
+ <bri-tooltip
36
+ class="header-left"
37
+ :content="groupItem.name"
38
+ placement="top"
39
+ :transfer="true"
40
+ >
41
+ <span class="header-left-name">
42
+ {{ groupItem.name }}
43
+ </span>
44
+ </bri-tooltip>
45
+
46
+ <!-- 右 -->
47
+ <span class="header-right">
48
+ <span class="header-right-num">
49
+ {{ groupItem.total }}
50
+ </span>
51
+ 条(已加载{{ groupItem.list.length }}条)
52
+ </span>
53
+ </div>
54
+
55
+ <!-- 组 数据列 -->
56
+ <div
57
+ class="DshPanel-group-list"
58
+ :style="{
49
59
  backgroundColor: $getColor(getBgColor(groupItem))
50
60
  }"
51
- >
52
- <!-- 有数据 -->
53
- <template v-if="groupItem.list.length">
54
- <CheckboxGroup
55
- class="list-drag"
56
- v-model="groupItem.selectIds"
57
- @on-change="selectRow(groupItem, $event)"
58
61
  >
59
- <dsh-draggable
60
- class="list-drag-draggable"
61
- v-model="groupItem.list"
62
- group="panel"
63
- animation="300"
64
- :disabled="!dragOperationObj"
65
- @update="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
66
- @add="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
67
- >
68
- <transition-group
69
- :id="groupItem._key"
70
- class="list-drag-transition"
71
- @scroll.native="groupScroll(groupItem, groupIndex, $event)"
72
- >
73
- <div
74
- v-for="(dataItem, dataIndex) in groupItem.list"
75
- :key="dataItem._id"
76
- :id="dataItem._id"
77
- class="row-item"
78
- @click="clickRow(dataItem, dataIndex)"
62
+ <template>
63
+ <!-- 有数据 -->
64
+ <template v-if="groupItem.list.length">
65
+ <CheckboxGroup
66
+ class="list-drag"
67
+ v-model="groupItem.selectIds"
68
+ @on-change="selectRow(groupItem, $event)"
79
69
  >
80
- <!-- 复选框 -->
81
- <Checkbox
82
- v-if="multiple"
83
- class="row-item-checkbox"
84
- :label="dataItem._id"
85
- @click.native.stop="clickRowCheckbox(dataItem)"
70
+ <dsh-draggable
71
+ class="list-drag-draggable"
72
+ v-model="groupItem.list"
73
+ group="panel"
74
+ animation="300"
75
+ :disabled="!dragOperationObj"
76
+ @update="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
77
+ @add="$dshEmit(dragOperationObj, $event, groupItem, data.find(item => item._key === $event.from.id), { [groupField]: groupItem._key })"
86
78
  >
87
- {{ "" }}
88
- </Checkbox>
89
-
90
- <!-- 下拉操作 -->
91
- <dsh-dropdown
92
- v-if="operationList.length"
93
- class="row-item-dropdown"
94
- :dropdownObj="dropdownObj"
95
- :list="operationList"
96
- @click="$dshEmit($event, dataItem, dataIndex)"
97
- @click.native.stop="0"
98
- ></dsh-dropdown>
99
-
100
- <!-- 内容 -->
101
- <div class="row-item-info">
102
- <!-- 标题 -->
103
- <bri-tooltip
104
- class="title"
105
- :content="dataItem[titleField]"
106
- placement="top"
107
- :transfer="true"
79
+ <transition-group
80
+ :id="groupItem._key"
81
+ class="list-drag-transition"
82
+ @scroll.native="groupScroll(groupItem, groupIndex, $event)"
108
83
  >
109
- <div class="title-name">
110
- {{ dataItem[titleField] }}
84
+ <div
85
+ v-for="(dataItem, dataIndex) in groupItem.list"
86
+ :key="dataItem._id"
87
+ :id="dataItem._id"
88
+ class="row-item"
89
+ @click="clickRow(dataItem, dataIndex)"
90
+ >
91
+ <!-- 复选框 -->
92
+ <Checkbox
93
+ v-if="multiple"
94
+ class="row-item-checkbox"
95
+ :label="dataItem._id"
96
+ @click.native.stop="clickRowCheckbox(dataItem)"
97
+ >
98
+ {{ "" }}
99
+ </Checkbox>
100
+
101
+ <!-- 下拉操作 -->
102
+ <dsh-dropdown
103
+ v-if="operationList.length"
104
+ class="row-item-dropdown"
105
+ :dropdownObj="dropdownObj"
106
+ :list="operationList"
107
+ @click="$dshEmit($event, dataItem, dataIndex)"
108
+ @click.native.stop="0"
109
+ ></dsh-dropdown>
110
+
111
+ <!-- 内容 -->
112
+ <div class="row-item-info">
113
+ <!-- 标题 -->
114
+ <bri-tooltip
115
+ class="title"
116
+ :content="dataItem[titleField]"
117
+ placement="top"
118
+ :transfer="true"
119
+ >
120
+ <div class="title-name">
121
+ {{ dataItem[titleField] }}
122
+ </div>
123
+ </bri-tooltip>
124
+
125
+ <!-- 显示字段 -->
126
+ <div
127
+ v-for="colItem in selfColumns"
128
+ :key="colItem._key"
129
+ class="unit"
130
+ >
131
+ <!-- 左 label -->
132
+ <bri-tooltip
133
+ class="unit-label-tooltip"
134
+ :content="colItem._name"
135
+ :transfer="true"
136
+ >
137
+ <div class="unit-label">
138
+ <span class="unit-label-name">
139
+ {{ colItem._name }}
140
+ </span>
141
+ <span class="unit-label-colon">
142
+
143
+ </span>
144
+ </div>
145
+ </bri-tooltip>
146
+
147
+ <!-- 右 val -->
148
+ <div class="unit-control">
149
+ <dsh-list-render
150
+ v-if="colItem.renderBodyCell"
151
+ :row="dataItem"
152
+ :column="colItem"
153
+ :index="0"
154
+ :render="colItem.renderBodyCell"
155
+ ></dsh-list-render>
156
+
157
+ <div
158
+ v-else-if="colItem.formatter"
159
+ v-html="colItem.formatter(dataItem, 0)"
160
+ ></div>
161
+
162
+ <span
163
+ v-else
164
+ class="unit-control-text"
165
+ >
166
+ {{ dataItem[colItem._key] }}
167
+ </span>
168
+ </div>
169
+ </div>
170
+ </div>
111
171
  </div>
112
- </bri-tooltip>
172
+ </transition-group>
113
173
 
114
- <!-- 显示字段 -->
174
+ <!-- 提示语 -->
115
175
  <div
116
- v-for="colItem in selfColumns"
117
- :key="colItem._key"
118
- class="unit"
176
+ class="list-drag-tip"
177
+ :style="{
178
+ color: getBgColor(groupItem)
179
+ }"
119
180
  >
120
- <!-- label -->
121
- <bri-tooltip
122
- class="unit-label"
123
- :content="colItem._name"
124
- :transfer="true"
125
- >
126
- <span class="unit-label-name">
127
- {{ colItem._name }}
128
- </span>
129
- <span class="unit-label-colon">
130
-
131
- </span>
132
- </bri-tooltip>
133
-
134
- <!-- 右 val -->
135
- <div class="unit-control">
136
- <dsh-list-render
137
- v-if="colItem.renderBodyCell"
138
- :row="dataItem"
139
- :column="colItem"
140
- :index="0"
141
- :render="colItem.renderBodyCell"
142
- ></dsh-list-render>
143
-
144
- <div
145
- v-else-if="colItem.formatter"
146
- v-html="colItem.formatter(dataItem, 0)"
147
- ></div>
148
-
149
- <span
150
- v-else
151
- class="unit-control-text"
152
- >
153
- {{ dataItem[colItem._key] }}
154
- </span>
155
- </div>
181
+ {{ groupItem.loading ? loadingText : groupItem.finished ? finishedText : "滑动加载更多数据..." }}
156
182
  </div>
157
- </div>
158
- </div>
159
- </transition-group>
160
- </dsh-draggable>
161
- </CheckboxGroup>
162
- </template>
163
-
164
- <!-- 无数据 -->
165
- <div
166
- v-else
167
- class="dsh-tip"
168
- :style="{
169
- color: getBgColor(groupItem)
170
- }"
171
- >
172
- {{ noDataText }}
183
+ </dsh-draggable>
184
+ </CheckboxGroup>
185
+ </template>
186
+
187
+ <!-- 无数据 -->
188
+ <div
189
+ v-else
190
+ class="list-nodata"
191
+ :style="{
192
+ color: getBgColor(groupItem)
193
+ }"
194
+ >
195
+ {{ noDataText }}
196
+ </div>
197
+ </template>
198
+
199
+ <!-- 组 操作按钮(添加) -->
200
+ <dsh-buttons
201
+ class="list-btns"
202
+ :list="groupBtnOperationList"
203
+ @click="$dshEmit($event, { [groupField]: groupItem._key })"
204
+ ></dsh-buttons>
205
+ </div>
173
206
  </div>
207
+ </template>
174
208
 
175
- <!-- 操作按钮(添加) -->
176
- <dsh-buttons
177
- class="list-btns"
178
- :list="groupBtnOperationList"
179
- @click="$dshEmit($event, { [groupField]: groupItem._key })"
180
- ></dsh-buttons>
209
+ <!-- 无数据 -->
210
+ <div
211
+ v-else
212
+ class="DshCard-nodata"
213
+ >
214
+ {{ noDataText }}
181
215
  </div>
182
- </div>
216
+ </template>
183
217
  </div>
184
218
  </template>
185
219
 
@@ -189,6 +223,10 @@
189
223
  export default {
190
224
  name: "DshPanel",
191
225
  props: {
226
+ isLoading: {
227
+ type: Boolean,
228
+ default: false
229
+ },
192
230
  data: {
193
231
  type: Array,
194
232
  default () {
@@ -204,15 +242,9 @@
204
242
  propsObj: {
205
243
  type: Object,
206
244
  default () {
207
- return {
208
- titleField: ""
209
- };
245
+ return {};
210
246
  }
211
247
  },
212
- noDataText: {
213
- type: String,
214
- default: "暂无内容..."
215
- },
216
248
 
217
249
  operationList: {
218
250
  type: Array,
@@ -236,34 +268,43 @@
236
268
  dropdownObj: {
237
269
  icon: "ios-more",
238
270
  size: 22,
239
- color: "#E9ECF4",
240
271
  showDropdownItemIcon: false
241
272
  }
242
273
  };
243
274
  },
244
275
  computed: {
245
- selectIds: {
246
- get () {
247
- return this.selections.map(item => item._id);
248
- },
249
- set (val) {
250
- this.selections = this.data
251
- .reduce((arr, groupItem) => [...arr, ...groupItem.list], [])
252
- .filter(item => val.includes(item._id));
253
- }
276
+ selfPropsObj () {
277
+ return {
278
+ multiple: false,
279
+ groupField: "",
280
+ titleField: "",
281
+ loadingText: "加载中,请稍等……",
282
+ finishedText: "暂无更多数据!",
283
+ noDataText: "暂无数据…",
284
+
285
+ ...this.propsObj
286
+ };
254
287
  },
255
-
256
288
  multiple () {
257
- return !!this.propsObj.multiple;
289
+ return !!this.selfPropsObj.multiple;
290
+ },
291
+ loadingText () {
292
+ return this.selfPropsObj.loadingText;
293
+ },
294
+ finishedText () {
295
+ return this.selfPropsObj.finishedText;
296
+ },
297
+ noDataText () {
298
+ return this.selfPropsObj.noDataText;
258
299
  },
259
300
  groupField () {
260
- return this.propsObj.groupField;
301
+ return this.selfPropsObj.groupField;
261
302
  },
262
303
  groupFieldObj () {
263
304
  return this.columns.find(colItem => colItem._key === this.groupField) || {};
264
305
  },
265
306
  titleField () {
266
- return this.propsObj.titleField;
307
+ return this.selfPropsObj.titleField;
267
308
  },
268
309
  // titleFieldObj () {
269
310
  // return this.columns.find(colItem => colItem._key === this.titleField) || {};
@@ -276,19 +317,33 @@
276
317
  titleAlign: "left",
277
318
  columnAlign: "left"
278
319
  }))
279
- .slice(0, 2);
320
+ .slice(0, 1);
280
321
  },
281
-
282
322
  groupBtnOperationList () {
283
323
  return this.extraOperationList
284
- .filter(item => ["canCreate", "canCustomCreate"].includes(item.type) || item.type.includes("canCustomCreate"))
324
+ .filter(item =>
325
+ ["canCreate", "canCustomCreate"].includes(item.type) || item.type.includes("canCustomCreate")
326
+ )
285
327
  .map(item => ({
286
328
  ...item,
287
329
  long: true
288
330
  }));
289
331
  },
290
332
  dragOperationObj () {
291
- return this.extraOperationList.find(item => ["canDrag", "canCustomDrag"].includes(item.type) || item.type.includes("canCustomDrag"));
333
+ return this.extraOperationList.find(item =>
334
+ ["canDrag", "canCustomDrag"].includes(item.type) || item.type.includes("canCustomDrag")
335
+ );
336
+ },
337
+
338
+ selectIds: {
339
+ get () {
340
+ return this.selections.map(item => item._id);
341
+ },
342
+ set (val) {
343
+ this.selections = this.data
344
+ .reduce((arr, groupItem) => [...arr, ...groupItem.list], [])
345
+ .filter(item => val.includes(item._id));
346
+ }
292
347
  }
293
348
  },
294
349
  created () {},
@@ -323,7 +378,7 @@
323
378
  groupItem.loading !== true &&
324
379
  groupItem.finished !== true &&
325
380
  groupElement.children.length === groupItem.list.length &&
326
- groupElement.clientHeight + groupElement.scrollTop > groupElement.scrollHeight - 20
381
+ groupElement.clientHeight + groupElement.scrollTop > groupElement.scrollHeight - 80
327
382
  ) {
328
383
  this.$emit("groupLoad", groupItem, groupElement);
329
384
  }
@@ -387,7 +442,7 @@
387
442
  };
388
443
  </script>
389
444
 
390
- <style lang="less">
445
+ <style lang="less" scoped>
391
446
  .DshPanel {
392
447
  min-width: 100%;
393
448
  height: 100%;
@@ -415,17 +470,7 @@
415
470
 
416
471
  .header {
417
472
  &-checkbox {
418
- .ivu-checkbox-inner {
419
- border: 2px solid #ffffff;
420
- background-color: transparent;
421
- }
422
473
 
423
- .ivu-checkbox-checked {
424
- .ivu-checkbox-inner:after {
425
- top: 1px;
426
- left: 4px;
427
- }
428
- }
429
474
  }
430
475
 
431
476
  &-left {
@@ -457,102 +502,162 @@
457
502
  flex-direction: column;
458
503
  justify-content: space-between;
459
504
 
460
- .list-drag {
461
- width: 100%;
462
- flex: 1;
463
- min-height: 0px;
464
-
465
- &-draggable {
505
+ .list {
506
+ &-drag {
466
507
  width: 100%;
467
- height: 100%;
468
- }
469
-
470
- &-transition {
471
- display: block;
472
- width: 100%;
473
- height: 100%;
474
- padding: 10px;
475
- overflow: auto;
476
-
477
- .row-item {
478
- min-height: 60px;
479
- margin-bottom: 10px;
480
- padding: 8px 10px;
481
- border: 1px solid rgba(102, 110, 126, 0.1);
482
- // border-radius: 4px;
483
- background: #FFFFFF;
484
- cursor: pointer;
485
- position: relative;
486
-
487
- &-checkbox {
488
- position: absolute;
489
- top: -3px;
490
- left: -1px;
491
- }
508
+ flex: 1;
509
+ min-height: 0px;
492
510
 
493
- &-dropdown {
494
- position: absolute;
495
- top: 5px;
496
- right: 5px;
497
- }
511
+ &-draggable {
512
+ width: 100%;
513
+ height: 100%;
514
+ }
498
515
 
499
- &-info {
500
- background: #ffffff;
516
+ &-transition {
517
+ display: block;
518
+ width: 100%;
519
+ // height: 100%;
520
+ max-height: calc(100% - 36px);
521
+ padding: 8px 8px 0px;
522
+ overflow: auto;
523
+
524
+ .row-item {
525
+ min-height: 60px;
526
+ margin-bottom: 8px;
527
+ padding: 8px;
528
+ border: 1px solid rgba(102, 110, 126, 0.1);
529
+ // border-radius: 4px;
530
+ // box-shadow: 0px 4px 8px 0px rgba(222, 222, 222, 0.75);
531
+ background: #FFFFFF;
532
+ cursor: pointer;
501
533
  overflow: hidden;
534
+ position: relative;
535
+
536
+ &-checkbox {
537
+ padding-right: 3px;
538
+ padding-bottom: 3px;
539
+ position: absolute;
540
+ top: -2px;
541
+ left: 0px;
542
+ }
502
543
 
503
- .title {
504
- height: 24px;
505
- padding: 0px 16px 0px 10px;
506
- font-size: 14px;
507
- font-weight: 600;
508
-
509
- &-name {
510
- .dsh-ellipsis();
511
- }
544
+ &-dropdown {
545
+ position: absolute;
546
+ top: 5px;
547
+ right: 5px;
512
548
  }
513
549
 
514
- .unit {
515
- height: 24px;
516
- display: flex;
517
- flex-direction: row;
550
+ &-info {
551
+ background: #ffffff;
518
552
 
519
- &-label {
520
- width: auto;
521
- font-weight: 400;
522
- color: #515A6E;
553
+ .title {
554
+ height: 24px;
555
+ padding: 0px 18px 0px 10px;
556
+ font-size: 14px;
557
+ font-weight: 600;
523
558
 
524
559
  &-name {
525
- min-width: 70px;
526
- max-width: 70px;
527
560
  .dsh-ellipsis();
528
- display: inline-block;
529
561
  }
562
+ }
563
+
564
+ .unit {
565
+ display: flex;
566
+ flex-direction: row;
567
+ align-items: center;
530
568
 
531
- &-colon {
569
+ &-label {
570
+ &-tooltip {
571
+ width: auto;
572
+ }
532
573
 
574
+ font-weight: 400;
575
+ color: #515A6E;
576
+ display: flex;
577
+ flex-direction: row;
578
+ align-items: center;
579
+
580
+ &-name {
581
+ .dsh-ellipsis();
582
+ display: inline-block;
583
+ min-width: 29px;
584
+ max-width: 71px;
585
+ }
586
+
587
+ &-colon {
588
+
589
+ }
533
590
  }
534
- }
535
591
 
536
- &-control {
537
- flex: 1;
538
- min-width: 0px;
539
- overflow: hidden;
592
+ &-control {
593
+ flex: 1;
594
+ min-width: 0px;
540
595
 
541
- &-text {
596
+ &-text {
542
597
 
598
+ }
543
599
  }
544
600
  }
545
601
  }
602
+
603
+ &:last-child {
604
+ // margin-bottom: 0px;
605
+ }
546
606
  }
547
607
  }
608
+
609
+ &-tip {
610
+ .dsh-subtip();
611
+ height: 36px;
612
+ padding: 10px 0px;
613
+ line-height: 16px;
614
+ }
615
+ }
616
+
617
+ &-nodata {
618
+ #dsh-nodata();
619
+ }
620
+
621
+ &-btns {
622
+ width: 100%;
623
+ height: 40px;
624
+ padding: 4px 8px;
625
+ text-align: center;
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }
631
+ </style>
632
+ <style lang="less">
633
+ .DshPanel {
634
+ &-group {
635
+ &-header {
636
+ .ivu-checkbox-inner {
637
+ border: 2px solid #ffffff;
638
+ background-color: transparent;
639
+ }
640
+
641
+ .ivu-checkbox-checked {
642
+ .ivu-checkbox-inner:after {
643
+ top: 1px;
644
+ left: 4px;
548
645
  }
549
646
  }
647
+ }
648
+
649
+ &-list {
650
+ .ivu-checkbox-inner {
651
+ border: none;
652
+ // border-radius: 4px;
653
+ box-shadow: 0px 1px 2px 0px rgba(222, 222, 222, 0.75);
654
+ }
550
655
 
551
- .list-btns {
552
- width: 100%;
553
- height: 40px;
554
- padding: 0px 10px;
555
- text-align: center;
656
+ .ivu-checkbox-checked {
657
+ .ivu-checkbox-inner:after {
658
+ top: 3px;
659
+ left: 6px;
660
+ }
556
661
  }
557
662
  }
558
663
  }