n20-common-lib 3.0.30 → 3.0.32
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/assets/css/font-icon.scss +0 -1
- package/src/assets/css/table.scss +2 -0
- package/src/components/FileUploadTable/37.svg +29 -0
- package/src/components/FileUploadTable/46.svg +29 -0
- package/src/components/FileUploadTable/60.svg +29 -0
- package/src/components/FileUploadTable/FileUploadTableV3.vue +555 -652
- package/src/components/TablePro/index.vue +84 -21
- package/src/components/TableSetSize/index.vue +9 -2
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
@cell-mouseenter="handleCellMouseEnter"
|
|
58
58
|
@cell-mouseleave="handleCellMouseLeave"
|
|
59
59
|
@scroll="handleTableScroll"
|
|
60
|
+
@toggle-tree-expand="syncExpandState"
|
|
60
61
|
>
|
|
61
62
|
<template v-for="(item, i) in _columns">
|
|
62
63
|
<slot v-if="item.slotName" :name="item.slotName" :column="item"></slot>
|
|
@@ -170,12 +171,21 @@
|
|
|
170
171
|
@mouseenter="hoverHeaderProp = item.prop"
|
|
171
172
|
@mouseleave="hoverHeaderProp = null"
|
|
172
173
|
>
|
|
173
|
-
<
|
|
174
|
-
<i
|
|
174
|
+
<span
|
|
175
175
|
v-if="item.tooltip"
|
|
176
|
-
class="
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
class="pointer"
|
|
177
|
+
style="border-bottom: 1px dashed"
|
|
178
|
+
v-title="typeof item.tooltip === 'function' ? item.tooltip(column) : item.tooltip"
|
|
179
|
+
>
|
|
180
|
+
<slot :name="`header_${column.field}`" :column="column">
|
|
181
|
+
{{ column.title }}
|
|
182
|
+
</slot>
|
|
183
|
+
</span>
|
|
184
|
+
<template v-else>
|
|
185
|
+
<slot :name="`header_${column.field}`" :column="column">
|
|
186
|
+
{{ column.title }}
|
|
187
|
+
</slot>
|
|
188
|
+
</template>
|
|
179
189
|
<!-- 已固定列(fixed='left'):hover 时显示 lock 图标,点击取消固定 -->
|
|
180
190
|
<i
|
|
181
191
|
v-if="item.fixed === 'left'"
|
|
@@ -196,24 +206,37 @@
|
|
|
196
206
|
</template>
|
|
197
207
|
</vxe-column>
|
|
198
208
|
</template>
|
|
199
|
-
<vxe-column
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
<vxe-column fixed="right" header-class-name="fixed-column__static" :min-width="clacStaticColumnWidth">
|
|
210
|
+
<template #header>
|
|
211
|
+
<div class="flex-box flex-v flex-c">
|
|
212
|
+
<i
|
|
213
|
+
v-if="showColumn"
|
|
214
|
+
v-title="$lc('设置显示列')"
|
|
215
|
+
class="v3-icon-system-solution pointer"
|
|
216
|
+
:class="hoverIconKey === 'showColumn' ? 'color-primary' : ''"
|
|
217
|
+
@mouseenter="hoverIconKey = 'showColumn'"
|
|
218
|
+
@mouseleave="hoverIconKey = null"
|
|
219
|
+
@click="$emit('visible-column')"
|
|
220
|
+
></i>
|
|
221
|
+
<tableSetSize v-if="showSetsize" :size="sizeC" v-bind="$attrs" @update:size="sizeUp" @resize="sizeSet" />
|
|
222
|
+
<i
|
|
223
|
+
v-if="$attrs.treeConfig || $attrs['tree-config']"
|
|
224
|
+
v-title="!isExpand ? $lc('展开分组') : $lc('折叠分组')"
|
|
225
|
+
class="pointer"
|
|
226
|
+
:class="[
|
|
227
|
+
isExpand ? 'v3-icon-group-collapse' : 'v3-icon-group-expand',
|
|
228
|
+
hoverIconKey === 'toggleExpand' ? 'color-primary' : ''
|
|
229
|
+
]"
|
|
230
|
+
@mouseenter="hoverIconKey = 'toggleExpand'"
|
|
231
|
+
@mouseleave="hoverIconKey = null"
|
|
232
|
+
@click="toggleExpand"
|
|
233
|
+
></i>
|
|
234
|
+
</div>
|
|
235
|
+
</template>
|
|
213
236
|
</vxe-column>
|
|
214
237
|
<template #empty>
|
|
215
238
|
<slot name="empty">
|
|
216
|
-
<empty type="
|
|
239
|
+
<empty type="noData" :content="$lc('暂无数据')" :height="200" :width="200" />
|
|
217
240
|
</slot>
|
|
218
241
|
</template>
|
|
219
242
|
</vxe-table>
|
|
@@ -429,7 +452,9 @@ export default {
|
|
|
429
452
|
hoverHideTimer: null, // 隐藏延迟定时器
|
|
430
453
|
isHoverOnBtnGroup: false, // 鼠标是否在按钮组上
|
|
431
454
|
isDropdownVisible: false, // "更多"下拉菜单是否展开
|
|
432
|
-
hoverHeaderProp: null // 当前悬停表头列的 prop
|
|
455
|
+
hoverHeaderProp: null, // 当前悬停表头列的 prop
|
|
456
|
+
hoverIconKey: null, // 当前悬停的静态列头图标标识
|
|
457
|
+
isExpand: false
|
|
433
458
|
}
|
|
434
459
|
},
|
|
435
460
|
computed: {
|
|
@@ -474,6 +499,12 @@ export default {
|
|
|
474
499
|
right: 0, // 固定在右侧设置列按钮左边
|
|
475
500
|
height: `${this.hoverBtnsPosition.height}px`
|
|
476
501
|
}
|
|
502
|
+
},
|
|
503
|
+
// 计算列宽
|
|
504
|
+
clacStaticColumnWidth() {
|
|
505
|
+
const hasExpand = this.$attrs.expandConfig || this.$attrs['expand-config']
|
|
506
|
+
const activeCount = [this.showColumn, this.showSetsize, hasExpand].filter(Boolean).length
|
|
507
|
+
return activeCount === 3 ? 100 : activeCount === 2 ? 80 : 50
|
|
477
508
|
}
|
|
478
509
|
},
|
|
479
510
|
watch: {
|
|
@@ -499,6 +530,38 @@ export default {
|
|
|
499
530
|
this.clearHoverTimers()
|
|
500
531
|
},
|
|
501
532
|
methods: {
|
|
533
|
+
/**
|
|
534
|
+
* 一键展开/折叠表格树形行(仅处理第一层级数据行)
|
|
535
|
+
* 通过 vxe-table 的 setTreeExpand API 批量设置顶层行的展开状态,
|
|
536
|
+
* await Promise 完成后再同步 isExpand 状态,保证图标与实际展开状态一致
|
|
537
|
+
* 不直接操作 DOM,不影响排序、筛选等原有逻辑
|
|
538
|
+
* @returns {Promise<void>}
|
|
539
|
+
*/
|
|
540
|
+
async toggleExpand() {
|
|
541
|
+
const $table = this.$refs.vxeTable
|
|
542
|
+
if (!$table) return
|
|
543
|
+
// 仅取顶层数据行(data prop 中的第一层,不包含子级)
|
|
544
|
+
const topLevelRows = this.data || []
|
|
545
|
+
if (topLevelRows.length === 0) return
|
|
546
|
+
// 切换展开状态:当前已展开则折叠,当前已折叠则展开
|
|
547
|
+
const nextExpand = !this.isExpand
|
|
548
|
+
// setTreeExpand 返回 Promise,await 确保展开动作完成后再更新图标状态
|
|
549
|
+
await $table.setTreeExpand(topLevelRows, nextExpand)
|
|
550
|
+
this.isExpand = nextExpand
|
|
551
|
+
},
|
|
552
|
+
/**
|
|
553
|
+
* 同步单行手动展开/折叠后的图标状态
|
|
554
|
+
* 监听 vxe-table toggle-tree-expand 事件,根据当前所有顶层行展开情况更新 isExpand
|
|
555
|
+
* @param {Object} expandRecords - vxe-table 当前所有已展开的行记录
|
|
556
|
+
* @returns {void}
|
|
557
|
+
*/
|
|
558
|
+
syncExpandState({ expandRecords }) {
|
|
559
|
+
const topLevelRows = this.data || []
|
|
560
|
+
if (topLevelRows.length === 0) return
|
|
561
|
+
// 若顶层行全部处于展开状态则认为是"已展开",否则为"未全部展开"
|
|
562
|
+
const expandSet = new Set(expandRecords)
|
|
563
|
+
this.isExpand = topLevelRows.every((row) => expandSet.has(row))
|
|
564
|
+
},
|
|
502
565
|
// 锁定列:将该列 fixed 设为 'left',直接修改 prop 对象并刷新表格
|
|
503
566
|
lockColumn(item) {
|
|
504
567
|
if (item.fixed || item.static) return
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-dropdown @command="setSize">
|
|
3
|
-
<i
|
|
3
|
+
<i
|
|
4
|
+
v-title="$lc('行高')"
|
|
5
|
+
class="v3-icon-line-height pointer"
|
|
6
|
+
:class="hoverIconKey === 'height' ? 'color-primary' : ''"
|
|
7
|
+
@mouseenter="hoverIconKey = 'height'"
|
|
8
|
+
@mouseleave="hoverIconKey = null"
|
|
9
|
+
></i>
|
|
4
10
|
<el-dropdown-menu slot="dropdown">
|
|
5
11
|
<el-dropdown-item command="small">{{ _lang === 'zh' ? '默认' : 'small' }}</el-dropdown-item>
|
|
6
12
|
<el-dropdown-item command="mini">{{ _lang === 'zh' ? '紧凑' : 'mini' }}</el-dropdown-item>
|
|
@@ -36,7 +42,8 @@ export default {
|
|
|
36
42
|
data() {
|
|
37
43
|
let _this = this
|
|
38
44
|
return {
|
|
39
|
-
sizeC: localStorage.getItem('table-size') || _this.size
|
|
45
|
+
sizeC: localStorage.getItem('table-size') || _this.size,
|
|
46
|
+
hoverIconKey: null
|
|
40
47
|
}
|
|
41
48
|
},
|
|
42
49
|
watch: {
|