w-ui-v1 1.0.44 → 1.0.45
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/index.ts +4 -1
- package/package.json +1 -1
- package/w-report-table/w-report-table.vue +78 -36
package/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import WSelectTable from './w-select-table/w-select-table.vue'
|
|
|
14
14
|
import WFormMessageBox from './w-form-message-box/w-form-message-box.vue'
|
|
15
15
|
import WAudio from './w-audio/w-audio.vue'
|
|
16
16
|
import WReportTable from './w-report-table/w-report-table.vue'
|
|
17
|
+
import {menu} from './utils/apis/menu'
|
|
17
18
|
const coms: any[] = [
|
|
18
19
|
wTest,
|
|
19
20
|
wLogin,
|
|
@@ -37,5 +38,7 @@ function install(Vue: App) {
|
|
|
37
38
|
Vue.component(com.name, com)
|
|
38
39
|
})
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
export const api={
|
|
42
|
+
menu
|
|
43
|
+
}
|
|
41
44
|
export default install // 这个方法以后再使用的时候可以被vue.use调用
|
package/package.json
CHANGED
|
@@ -62,13 +62,14 @@
|
|
|
62
62
|
<template v-for="(childCol, childIndex) in col.children" :key="childIndex">
|
|
63
63
|
<view
|
|
64
64
|
:class="['body-cell', childCol.className]"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
:style="{
|
|
66
|
+
width: childCol.width || 'auto',
|
|
67
|
+
'min-width': childCol.width || 'auto',
|
|
68
|
+
'text-align': childCol.align || 'center',
|
|
69
|
+
display: getRowSpan(row, childCol) === 0 ? 'none' : 'block'
|
|
70
|
+
}"
|
|
71
|
+
:rowspan="getRowSpan(row, childCol) > 1 ? getRowSpan(row, childCol) : null"
|
|
72
|
+
:colspan="getColSpan(row, childCol) > 1 ? getColSpan(row, childCol) : null"
|
|
72
73
|
>
|
|
73
74
|
{{ row[childCol.key] }}
|
|
74
75
|
</view>
|
|
@@ -78,12 +79,13 @@
|
|
|
78
79
|
<view
|
|
79
80
|
:class="['body-cell', col.className]"
|
|
80
81
|
:style="{
|
|
81
|
-
|
|
82
|
+
width: col.width || 'auto',
|
|
83
|
+
'min-width': col.width || 'auto',
|
|
82
84
|
'text-align': col.align || 'center',
|
|
83
|
-
display: getRowSpan(row, col) === 0 ? 'none' : '
|
|
85
|
+
display: getRowSpan(row, col) === 0 ? 'none' : 'block'
|
|
84
86
|
}"
|
|
85
|
-
:rowspan="getRowSpan(row, col)"
|
|
86
|
-
:colspan="getColSpan(row, col)"
|
|
87
|
+
:rowspan="getRowSpan(row, col) > 1 ? getRowSpan(row, col) : null"
|
|
88
|
+
:colspan="getColSpan(row, col) > 1 ? getColSpan(row, col) : null"
|
|
87
89
|
>
|
|
88
90
|
{{ row[col.key] }}
|
|
89
91
|
</view>
|
|
@@ -103,15 +105,18 @@
|
|
|
103
105
|
<!-- 合计行 -->
|
|
104
106
|
<view v-if="showSummary" class="table-footer">
|
|
105
107
|
<view class="table-row summary-row">
|
|
106
|
-
<view v-if="showCheckbox" class="checkbox-col"></view>
|
|
108
|
+
<view v-if="showCheckbox" class="checkbox-col summary-cell" style="width: 50px;"></view>
|
|
107
109
|
<template v-for="(col, colIndex) in columns" :key="colIndex">
|
|
108
110
|
<template v-if="col.children">
|
|
109
111
|
<template v-for="(childCol, childIndex) in col.children" :key="childIndex">
|
|
110
112
|
<view
|
|
113
|
+
v-if="!childCol.mergeRule || childCol.mergeRule(paginatedData[0], 0)"
|
|
111
114
|
:class="['summary-cell', childCol.className]"
|
|
112
115
|
:style="{
|
|
113
|
-
|
|
114
|
-
'
|
|
116
|
+
width: childCol.width || 'auto',
|
|
117
|
+
'min-width': childCol.width || 'auto',
|
|
118
|
+
'text-align': childCol.align || 'center',
|
|
119
|
+
'flex': childCol.width || 1
|
|
115
120
|
}"
|
|
116
121
|
>
|
|
117
122
|
{{ getSummary(childCol) }}
|
|
@@ -120,17 +125,20 @@
|
|
|
120
125
|
</template>
|
|
121
126
|
<template v-else>
|
|
122
127
|
<view
|
|
128
|
+
v-if="!col.mergeRule || col.mergeRule(paginatedData[0], 0)"
|
|
123
129
|
:class="['summary-cell', col.className]"
|
|
124
130
|
:style="{
|
|
125
|
-
|
|
126
|
-
'
|
|
131
|
+
width: col.width || 'auto',
|
|
132
|
+
'min-width': col.width || 'auto',
|
|
133
|
+
'text-align': col.align || 'center',
|
|
134
|
+
'flex': col.width || 1
|
|
127
135
|
}"
|
|
128
136
|
>
|
|
129
137
|
{{ getSummary(col) }}
|
|
130
138
|
</view>
|
|
131
139
|
</template>
|
|
132
140
|
</template>
|
|
133
|
-
<view v-if="showAction"></view>
|
|
141
|
+
<view v-if="showAction" class="action-col summary-cell" style="width: 120px; flex: 0 0 120px;"></view>
|
|
134
142
|
</view>
|
|
135
143
|
</view>
|
|
136
144
|
</scroll-view>
|
|
@@ -274,22 +282,26 @@ const getRowSpan = (row: any, col: Column) => {
|
|
|
274
282
|
if (!col.mergeRule) return 1
|
|
275
283
|
|
|
276
284
|
const index = props.data.indexOf(row)
|
|
285
|
+
// 如果当前行不需要合并,返回1
|
|
277
286
|
if (!col.mergeRule(row, index)) return 1
|
|
278
287
|
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
// 如果是第一行或与前一行不同,则开始合并
|
|
289
|
+
if (index === 0 || props.data[index-1][col.key] !== row[col.key]) {
|
|
290
|
+
let span = 1
|
|
291
|
+
// 计算相同内容的连续行数
|
|
292
|
+
for (let i = index + 1; i < props.data.length; i++) {
|
|
293
|
+
if (props.data[i][col.key] === row[col.key] &&
|
|
294
|
+
col.mergeRule(props.data[i], i)) {
|
|
295
|
+
span++
|
|
296
|
+
} else {
|
|
297
|
+
break
|
|
298
|
+
}
|
|
289
299
|
}
|
|
300
|
+
return span
|
|
290
301
|
}
|
|
291
302
|
|
|
292
|
-
|
|
303
|
+
// 如果与前一行相同,则返回0表示不显示
|
|
304
|
+
return 0
|
|
293
305
|
}
|
|
294
306
|
|
|
295
307
|
const getColSpan = (row: any, col: Column) => {
|
|
@@ -348,19 +360,23 @@ const handleAction = (action: Action, row: any) => {
|
|
|
348
360
|
|
|
349
361
|
.table-container {
|
|
350
362
|
width: 100%;
|
|
351
|
-
overflow:
|
|
363
|
+
overflow: auto;
|
|
364
|
+
border: 1px solid #ebeef5;
|
|
352
365
|
|
|
353
366
|
.table-body {
|
|
354
|
-
width:
|
|
367
|
+
width: max-content;
|
|
368
|
+
min-width: 100%;
|
|
355
369
|
height: 100%;
|
|
356
370
|
|
|
357
371
|
.table-header, .table-body, .table-footer {
|
|
358
|
-
width:
|
|
372
|
+
width: max-content;
|
|
373
|
+
min-width: 100%;
|
|
359
374
|
}
|
|
360
375
|
|
|
361
376
|
.table-row {
|
|
362
377
|
display: flex;
|
|
363
|
-
width:
|
|
378
|
+
width: max-content;
|
|
379
|
+
min-width: 100%;
|
|
364
380
|
border-bottom: 1px solid #ebeef5;
|
|
365
381
|
}
|
|
366
382
|
|
|
@@ -371,6 +387,13 @@ const handleAction = (action: Action, row: any) => {
|
|
|
371
387
|
display: flex;
|
|
372
388
|
align-items: center;
|
|
373
389
|
justify-content: center;
|
|
390
|
+
box-sizing: border-box;
|
|
391
|
+
flex-shrink: 0;
|
|
392
|
+
min-width: 0;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.summary-cell {
|
|
396
|
+
flex: none !important;
|
|
374
397
|
}
|
|
375
398
|
|
|
376
399
|
.group-header {
|
|
@@ -426,29 +449,48 @@ const handleAction = (action: Action, row: any) => {
|
|
|
426
449
|
justify-content: space-between;
|
|
427
450
|
align-items: center;
|
|
428
451
|
margin-top: 16px;
|
|
429
|
-
padding:
|
|
452
|
+
padding: 12px 16px;
|
|
430
453
|
background-color: #f5f7fa;
|
|
454
|
+
border-radius: 4px;
|
|
431
455
|
|
|
432
456
|
.page-controls {
|
|
433
457
|
display: flex;
|
|
434
458
|
align-items: center;
|
|
459
|
+
gap: 12px;
|
|
435
460
|
|
|
436
461
|
button {
|
|
437
|
-
|
|
438
|
-
|
|
462
|
+
padding: 6px 16px;
|
|
463
|
+
font-size: 12px;
|
|
439
464
|
background-color: #fff;
|
|
440
465
|
border: 1px solid #dcdfe6;
|
|
441
466
|
border-radius: 4px;
|
|
442
467
|
cursor: pointer;
|
|
468
|
+
transition: all 0.3s;
|
|
469
|
+
color: #606266;
|
|
470
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
471
|
+
display: flex;
|
|
472
|
+
align-items: center;
|
|
473
|
+
gap: 4px;
|
|
474
|
+
|
|
475
|
+
&:hover {
|
|
476
|
+
color: #409eff;
|
|
477
|
+
border-color: #c6e2ff;
|
|
478
|
+
background-color: #ecf5ff;
|
|
479
|
+
box-shadow: 0 1px 6px rgba(32, 160, 255, 0.2);
|
|
480
|
+
}
|
|
443
481
|
|
|
444
482
|
&:disabled {
|
|
445
483
|
color: #c0c4cc;
|
|
446
484
|
cursor: not-allowed;
|
|
485
|
+
background-color: #f5f7fa;
|
|
486
|
+
border-color: #e4e7ed;
|
|
487
|
+
box-shadow: none;
|
|
447
488
|
}
|
|
448
489
|
}
|
|
449
490
|
|
|
450
491
|
.page-current {
|
|
451
|
-
|
|
492
|
+
color: #606266;
|
|
493
|
+
font-weight: 500;
|
|
452
494
|
}
|
|
453
495
|
}
|
|
454
496
|
}
|