bri-components 1.3.57 → 1.3.61
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 +1 -1
- package/src/components/controls/senior/cascaderTable.vue +49 -1
- package/src/components/form/searchMixin.js +14 -10
- package/src/components/list/BriTable.vue +1 -1
- package/src/components/list/DshCascaderTable.vue +202 -193
- package/src/components/list/DshFlatTable.vue +30 -43
- package/src/components/list/DshTreeTable.vue +12 -144
- package/src/components/list/common/{flatTableImportModal.vue → importModal.vue} +6 -6
- package/src/components/list/mixins/flatTableMixin.js +2 -5
- package/src/components/list/mixins/tableBaseMixin.js +194 -17
|
@@ -3,26 +3,27 @@
|
|
|
3
3
|
class="DshCasTable"
|
|
4
4
|
ref="DshCascaderTable"
|
|
5
5
|
>
|
|
6
|
-
<!--
|
|
7
|
-
<dsh-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
<!-- 顶部 -->
|
|
7
|
+
<dsh-render :render="getTableTopRender()"></dsh-render>
|
|
8
|
+
|
|
9
|
+
<!-- 搜索条件 -->
|
|
10
|
+
<dsh-render
|
|
11
|
+
v-if="!this.isEnlarge"
|
|
12
|
+
:render="topSearchRender"
|
|
13
|
+
></dsh-render>
|
|
13
14
|
|
|
14
15
|
<!-- 表格 -->
|
|
15
|
-
<div class="DshCasTable-
|
|
16
|
+
<div class="DshCasTable-main">
|
|
16
17
|
<div
|
|
17
|
-
class="DshCasTable-
|
|
18
|
+
class="DshCasTable-main-center"
|
|
18
19
|
:style="{
|
|
19
20
|
maxHeight: `${contentHeight}px`,
|
|
20
21
|
height: `${contentHeight}px`
|
|
21
22
|
}"
|
|
22
23
|
>
|
|
23
24
|
<!-- 表头 -->
|
|
24
|
-
<div class="DshCasTable-
|
|
25
|
-
<div class="DshCasTable-
|
|
25
|
+
<div class="DshCasTable-main-center-top">
|
|
26
|
+
<div class="DshCasTable-main-center-top-inner">
|
|
26
27
|
<table
|
|
27
28
|
class="table"
|
|
28
29
|
border="1"
|
|
@@ -70,8 +71,8 @@
|
|
|
70
71
|
</div>
|
|
71
72
|
|
|
72
73
|
<!-- 数据行 -->
|
|
73
|
-
<div class="DshCasTable-
|
|
74
|
-
<div class="DshCasTable-
|
|
74
|
+
<div class="DshCasTable-main-center-list">
|
|
75
|
+
<div class="DshCasTable-main-center-list-inner">
|
|
75
76
|
<table
|
|
76
77
|
class="table"
|
|
77
78
|
border="1"
|
|
@@ -79,9 +80,9 @@
|
|
|
79
80
|
bordercolor="#E7EDF8"
|
|
80
81
|
>
|
|
81
82
|
<tbody>
|
|
82
|
-
<template v-if="
|
|
83
|
+
<template v-if="showListData.length">
|
|
83
84
|
<tr
|
|
84
|
-
v-for="(row, rowIndex) in
|
|
85
|
+
v-for="(row, rowIndex) in showListData"
|
|
85
86
|
:key="row._id"
|
|
86
87
|
class="table-row"
|
|
87
88
|
>
|
|
@@ -186,180 +187,189 @@
|
|
|
186
187
|
|
|
187
188
|
<!-- 全屏查看 -->
|
|
188
189
|
<dsh-modal
|
|
190
|
+
class="DshCasTable-fullscreen"
|
|
189
191
|
v-model="isEnlarge"
|
|
190
192
|
:mode="modalPropsObj.mode"
|
|
191
193
|
:propsObj="modalPropsObj"
|
|
192
194
|
>
|
|
193
195
|
<div
|
|
194
196
|
v-if="isEnlargeFlag"
|
|
195
|
-
class="DshCasTable-
|
|
197
|
+
class="DshCasTable-fullscreen-inner"
|
|
196
198
|
>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
>
|
|
222
|
-
<
|
|
199
|
+
<!-- 顶部 -->
|
|
200
|
+
<dsh-render :render="getTableTopRender(true)"></dsh-render>
|
|
201
|
+
|
|
202
|
+
<!-- 搜索条件 -->
|
|
203
|
+
<dsh-render :render="topSearchRender"></dsh-render>
|
|
204
|
+
|
|
205
|
+
<div class="DshCasTable-main">
|
|
206
|
+
<div
|
|
207
|
+
class="DshCasTable-main-center"
|
|
208
|
+
:style="{
|
|
209
|
+
maxHeight: `${contentHeight}px`,
|
|
210
|
+
height: `${contentHeight}px`
|
|
211
|
+
}"
|
|
212
|
+
>
|
|
213
|
+
<!-- 表头 -->
|
|
214
|
+
<div class="DshCasTable-main-center-top">
|
|
215
|
+
<div class="DshCasTable-main-center-top-inner">
|
|
216
|
+
<table
|
|
217
|
+
class="table"
|
|
218
|
+
border="1"
|
|
219
|
+
cellspacing="0"
|
|
220
|
+
bordercolor="#E7EDF8"
|
|
221
|
+
>
|
|
222
|
+
<tbody>
|
|
223
|
+
<tr>
|
|
224
|
+
<th
|
|
225
|
+
v-for="(column, colIndex) in showColumns"
|
|
226
|
+
:key="column._id"
|
|
227
|
+
class="table-th bri-table-th"
|
|
228
|
+
:style="getThStyle(column, 'th')"
|
|
229
|
+
@click="$dispatchEvent(operationMap.clickTh, column)"
|
|
230
|
+
>
|
|
231
|
+
<dsh-render :render="getThRender(column)"></dsh-render>
|
|
223
232
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
233
|
+
<!-- 级联表头 的下拉 -->
|
|
234
|
+
<dsh-dropdown
|
|
235
|
+
v-if="
|
|
227
236
|
!isSearching &&
|
|
228
237
|
column.colType === 'tree' &&
|
|
229
238
|
column.level === treeColumns.length &&
|
|
230
239
|
$getOperationList(getTreeThBtns(column)).length
|
|
231
240
|
"
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
241
|
+
class="table-th-dropdown"
|
|
242
|
+
menuClass="table-th-dropdown-list"
|
|
243
|
+
trigger="hover"
|
|
244
|
+
:list="$getOperationList(getTreeThBtns(column))"
|
|
245
|
+
@click="$dispatchEvent($event, column, colIndex, showColumns)"
|
|
246
|
+
@click.native.stop="0"
|
|
247
|
+
>
|
|
248
|
+
<a href="javascript:void(0)">
|
|
249
|
+
<Icon
|
|
250
|
+
type="md-add-circle"
|
|
251
|
+
size="20"
|
|
252
|
+
/>
|
|
253
|
+
</a>
|
|
254
|
+
</dsh-dropdown>
|
|
255
|
+
</th>
|
|
256
|
+
</tr>
|
|
257
|
+
</tbody>
|
|
258
|
+
</table>
|
|
259
|
+
</div>
|
|
250
260
|
</div>
|
|
251
|
-
</div>
|
|
252
261
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
262
|
+
<!-- 数据行 -->
|
|
263
|
+
<div class="DshCasTable-main-center-list">
|
|
264
|
+
<div class="DshCasTable-main-center-list-inner">
|
|
265
|
+
<table
|
|
266
|
+
class="table"
|
|
267
|
+
border="1"
|
|
268
|
+
cellspacing="0"
|
|
269
|
+
bordercolor="#E7EDF8"
|
|
270
|
+
>
|
|
271
|
+
<tbody>
|
|
272
|
+
<template v-if="showListData.length">
|
|
273
|
+
<tr
|
|
274
|
+
v-for="(row, rowIndex) in showListData"
|
|
275
|
+
:key="row._id"
|
|
276
|
+
class="table-row"
|
|
277
|
+
>
|
|
278
|
+
<template v-for="column in rowColumnsArr[rowIndex]">
|
|
279
|
+
<!-- 树节点单元格、汇总单元格 -->
|
|
280
|
+
<td
|
|
281
|
+
v-if="['tree', 'summary'].includes(column.colType)"
|
|
282
|
+
:key="column._key"
|
|
283
|
+
:class="{
|
|
275
284
|
[`table-td-${column.colType}`]: true,
|
|
276
285
|
'bri-table-td': true , // 可以不要,为了position: relative,上面有
|
|
277
286
|
'bri-table-td-edit': canEdit
|
|
278
287
|
}"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
288
|
+
:style="getTdStyle(column, row[column.nodeKey])"
|
|
289
|
+
:rowspan="getTdRowSpan(column, row[column.nodeKey || column._key])"
|
|
290
|
+
:colspan="getTdColSpan(column, row[column.nodeKey])"
|
|
291
|
+
@click="$dispatchEvent(operationMap.clickNode, column, row, row[column._key])"
|
|
292
|
+
>
|
|
293
|
+
<!-- 树节点单元格 -->
|
|
294
|
+
<template v-if="column.colType === 'tree'">
|
|
295
|
+
<!-- 编辑状态 -->
|
|
296
|
+
<Input
|
|
297
|
+
v-if="row[column._key].isEdit"
|
|
298
|
+
:ref="`${column._id}${row._id}`"
|
|
299
|
+
v-model="row[column._key].name"
|
|
300
|
+
class="textarea"
|
|
301
|
+
type="textarea"
|
|
302
|
+
:autosize="{
|
|
294
303
|
minRows: getTdRowSpan(column, row[column.nodeKey || column._key]) * 3 - 1,
|
|
295
304
|
maxRows: 100
|
|
296
305
|
}"
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
306
|
+
@on-blur="$dispatchEvent(operationMap.blurNode, column, row, row[column._key])"
|
|
307
|
+
@on-change="$dispatchEvent(operationMap.changeNode, column, row, row[column._key])"
|
|
308
|
+
/>
|
|
309
|
+
|
|
310
|
+
<!-- 查看状态 -->
|
|
311
|
+
<template v-else>
|
|
312
|
+
<bri-tooltip
|
|
313
|
+
:content="enterText(row[column._key].name)"
|
|
314
|
+
:transfer="true"
|
|
315
|
+
>
|
|
316
|
+
<span v-html="enterText(row[column._key].name)"></span>
|
|
317
|
+
</bri-tooltip>
|
|
318
|
+
|
|
319
|
+
<!-- 操作下拉 -->
|
|
320
|
+
<dsh-dropdown
|
|
321
|
+
v-if="!isSearching && $getOperationList(getTreeTdBtns(column, row, row[column._key])).length"
|
|
322
|
+
class="table-td-tree-dropdown"
|
|
323
|
+
menuClass="table-td-tree-dropdown-list"
|
|
324
|
+
trigger="hover"
|
|
325
|
+
:list="$getOperationList(getTreeTdBtns(column, row, row[column._key]))"
|
|
326
|
+
@click="$dispatchEvent($event, row, rowIndex, column)"
|
|
327
|
+
@click.native.stop="0"
|
|
328
|
+
>
|
|
329
|
+
<a href="javascript:void(0)">
|
|
330
|
+
<Icon
|
|
331
|
+
type="md-add-circle"
|
|
332
|
+
size="20"
|
|
333
|
+
/>
|
|
334
|
+
</a>
|
|
335
|
+
</dsh-dropdown>
|
|
336
|
+
</template>
|
|
327
337
|
</template>
|
|
328
|
-
</template>
|
|
329
338
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
339
|
+
<!-- 汇总单元格 -->
|
|
340
|
+
<template v-else-if="column.colType === 'summary'">
|
|
341
|
+
<span>{{ getSummaryVal(column, row[column.nodeKey]) }}</span>
|
|
342
|
+
</template>
|
|
343
|
+
</td>
|
|
344
|
+
|
|
345
|
+
<!-- 普通单元格 -->
|
|
346
|
+
<dsh-render
|
|
347
|
+
v-else
|
|
348
|
+
:key="column._key + 'data'"
|
|
349
|
+
:render="getTdRender(column, row, rowIndex)"
|
|
350
|
+
></dsh-render>
|
|
351
|
+
</template>
|
|
352
|
+
</tr>
|
|
353
|
+
</template>
|
|
345
354
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
355
|
+
<!-- 无数据 -->
|
|
356
|
+
<tr
|
|
357
|
+
v-else
|
|
358
|
+
class="table-nodata"
|
|
359
|
+
>
|
|
360
|
+
<td
|
|
361
|
+
:style="{
|
|
353
362
|
width: `${boxWidth}px`,
|
|
354
363
|
minWidth: `${boxWidth}px`,
|
|
355
364
|
maxWidth: `${boxWidth}px`,
|
|
356
365
|
}"
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
366
|
+
:rowspan="1"
|
|
367
|
+
:colspan="showColumns.length"
|
|
368
|
+
>暂无数据…</td>
|
|
369
|
+
</tr>
|
|
370
|
+
</tbody>
|
|
371
|
+
</table>
|
|
372
|
+
</div>
|
|
363
373
|
</div>
|
|
364
374
|
</div>
|
|
365
375
|
</div>
|
|
@@ -490,26 +500,10 @@
|
|
|
490
500
|
allTreeData () {
|
|
491
501
|
return this.getCalcuedTree();
|
|
492
502
|
},
|
|
493
|
-
showAllTreeData () {
|
|
494
|
-
const loop = (list = []) => {
|
|
495
|
-
return list.filter(row => {
|
|
496
|
-
if (row.children && row.children.length) {
|
|
497
|
-
row.children = loop(row.children);
|
|
498
|
-
return !!row.children.length;
|
|
499
|
-
} else {
|
|
500
|
-
return this.$isAdvRelyAccord(this.finalTableAdvSearch, row);
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
return this.isSearching
|
|
506
|
-
? loop(this.allTreeData)
|
|
507
|
-
: this.allTreeData;
|
|
508
|
-
},
|
|
509
503
|
allListData () {
|
|
510
504
|
return this.$getTreeFlatArr(this.data.tree, node => !(node.children && node.children.length));
|
|
511
505
|
},
|
|
512
|
-
|
|
506
|
+
showListData () {
|
|
513
507
|
return this.transformRows();
|
|
514
508
|
},
|
|
515
509
|
|
|
@@ -526,8 +520,8 @@
|
|
|
526
520
|
},
|
|
527
521
|
mounted () {
|
|
528
522
|
setTimeout(() => {
|
|
529
|
-
this.$el.querySelector(".DshCasTable-
|
|
530
|
-
this.$el.querySelector(".DshCasTable-
|
|
523
|
+
this.$el.querySelector(".DshCasTable-main-center-list").addEventListener("scroll", (e) => {
|
|
524
|
+
this.$el.querySelector(".DshCasTable-main-center-top").scrollLeft = e.srcElement.scrollLeft;
|
|
531
525
|
}, false);
|
|
532
526
|
this.boxWidth = this.$refs.DshCascaderTable.clientWidth;
|
|
533
527
|
}, 0);
|
|
@@ -770,8 +764,10 @@
|
|
|
770
764
|
return this.data.tree;
|
|
771
765
|
},
|
|
772
766
|
// 转化渲染使用的columns数组
|
|
773
|
-
transformRowColumnsArr (nodes = this.
|
|
767
|
+
transformRowColumnsArr (nodes = this.allTreeData, treeForm = this.treeColumns) {
|
|
774
768
|
let loop = (nodes, rowColumnsArr) => {
|
|
769
|
+
nodes = this.getFilteredNodes(nodes);
|
|
770
|
+
|
|
775
771
|
return nodes.reduce((rowColumnsArr, node, nodeIndex) => {
|
|
776
772
|
if (nodeIndex !== 0 || rowColumnsArr.length === 0) {
|
|
777
773
|
rowColumnsArr.push(this.transformColumns(treeForm.slice(node.level - 1)));
|
|
@@ -784,11 +780,14 @@
|
|
|
784
780
|
}
|
|
785
781
|
}, rowColumnsArr);
|
|
786
782
|
};
|
|
783
|
+
|
|
787
784
|
return loop(nodes, []);
|
|
788
785
|
},
|
|
789
786
|
// 转化表格数据
|
|
790
|
-
transformRows (nodes = this.
|
|
787
|
+
transformRows (nodes = this.allTreeData, treeForm = this.treeColumns) {
|
|
791
788
|
const loop = (nodes, rows) => {
|
|
789
|
+
nodes = this.getFilteredNodes(nodes);
|
|
790
|
+
|
|
792
791
|
return nodes.reduce((rows, node, nodeIndex) => {
|
|
793
792
|
// 创建行,并把节点数据(对象类型)注入到行对象内
|
|
794
793
|
if (nodeIndex !== 0 || rows.length === 0) {
|
|
@@ -811,6 +810,20 @@
|
|
|
811
810
|
};
|
|
812
811
|
return loop(nodes, []);
|
|
813
812
|
},
|
|
813
|
+
getFilteredNodes (nodes) {
|
|
814
|
+
const loop = (nodes = []) => {
|
|
815
|
+
return nodes.filter(node => {
|
|
816
|
+
if (node.children && node.children.length) {
|
|
817
|
+
const children = loop(node.children);
|
|
818
|
+
return !!children.length;
|
|
819
|
+
} else {
|
|
820
|
+
return this.$isAdvRelyAccord(this.finalTableAdvSearch, node);
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
return loop(nodes);
|
|
826
|
+
},
|
|
814
827
|
|
|
815
828
|
// 清除节点到叶子节点
|
|
816
829
|
clearNodeToLeaf (list) {
|
|
@@ -843,7 +856,7 @@
|
|
|
843
856
|
};
|
|
844
857
|
} else {
|
|
845
858
|
let parentCol = treeForm[col.level - 2];
|
|
846
|
-
let loop = (row, rowIndex) => row[parentCol._key] || loop(this.
|
|
859
|
+
let loop = (row, rowIndex) => row[parentCol._key] || loop(this.showListData[rowIndex - 1], rowIndex - 1);
|
|
847
860
|
return loop(row, rowIndex);
|
|
848
861
|
}
|
|
849
862
|
},
|
|
@@ -981,17 +994,7 @@
|
|
|
981
994
|
.DshCasTable {
|
|
982
995
|
width: 100%;
|
|
983
996
|
|
|
984
|
-
&-
|
|
985
|
-
margin-bottom: 3px;
|
|
986
|
-
text-align: right;
|
|
987
|
-
color: @textColor;
|
|
988
|
-
|
|
989
|
-
&-item {
|
|
990
|
-
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
&-wrap {
|
|
997
|
+
&-main {
|
|
995
998
|
width: 100%;
|
|
996
999
|
|
|
997
1000
|
&-center {
|
|
@@ -1086,5 +1089,11 @@
|
|
|
1086
1089
|
}
|
|
1087
1090
|
}
|
|
1088
1091
|
}
|
|
1092
|
+
|
|
1093
|
+
&-fullscreen {
|
|
1094
|
+
&-inner {
|
|
1095
|
+
padding: 10px 20px;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1089
1098
|
}
|
|
1090
1099
|
</style>
|