@lx-frontend/wrap-element-ui 1.0.0-beta.6 → 1.0.1-beta.1
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 +2 -3
- package/src/components/AddMembers/index.vue +40 -32
- package/src/components/EditableTable/index.less +26 -34
- package/src/components/EditableTable/index.vue +35 -108
- package/src/components/EditableTable/types.ts +10 -32
- package/src/components/EditableTable/useColumnHeaderOperation.ts +28 -166
- package/src/components/EditableTable/useDefaultOperation.ts +10 -10
- package/src/components/EditableTable/useDragSort.ts +5 -4
- package/src/components/EditableTable/usePagination.ts +7 -4
- package/src/components/EditableTable/useRowBgColor.ts +3 -3
- package/src/components/EditableTable/useViewSetting.ts +1 -53
- package/dist/AddMembers/index.vue.d.ts +0 -31
- package/dist/AuditSteps/index.vue.d.ts +0 -46
- package/dist/DemoComponent/index.vue.d.ts +0 -2
- package/dist/EditableTable/index.vue.d.ts +0 -291
- package/dist/EditableTable/types.d.ts +0 -151
- package/dist/EditableTable/useCellHover.d.ts +0 -11
- package/dist/EditableTable/useColumnHeaderOperation.d.ts +0 -223
- package/dist/EditableTable/useDefaultOperation.d.ts +0 -22
- package/dist/EditableTable/useDragSort.d.ts +0 -14
- package/dist/EditableTable/usePagination.d.ts +0 -12
- package/dist/EditableTable/useRowBgColor.d.ts +0 -16
- package/dist/EditableTable/useViewSetting.d.ts +0 -114
- package/dist/Ellipsis/MultilineEllipsis.vue.d.ts +0 -91
- package/dist/Ellipsis/index.vue.d.ts +0 -89
- package/dist/LxTable/index.vue.d.ts +0 -2
- package/dist/PopoverForm/index.vue.d.ts +0 -50
- package/dist/SearchForm/index.vue.d.ts +0 -105
- package/dist/SearchSelect/index.vue.d.ts +0 -53
- package/dist/assets/index.286f4f2d.css +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.mjs +0 -39998
- package/dist/singleMessage/index.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lx-frontend/wrap-element-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-beta.1",
|
|
4
4
|
"description": "wrap-element-ui",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
7
|
"private": false,
|
|
9
8
|
"scripts": {
|
|
10
9
|
"clean": "rimraf dist",
|
|
@@ -65,7 +64,7 @@
|
|
|
65
64
|
"storybook": "7.6.19",
|
|
66
65
|
"through2": "^4.0.2",
|
|
67
66
|
"typescript": "^4.9.5",
|
|
68
|
-
"vite": "^
|
|
67
|
+
"vite": "^4.5.3",
|
|
69
68
|
"vite-plugin-dts": "^3.9.1",
|
|
70
69
|
"vite-plugin-lib-inject-css": "^2.1.1",
|
|
71
70
|
"vite-tsconfig-paths": "^4.3.2",
|
|
@@ -4,37 +4,40 @@
|
|
|
4
4
|
:title="title"
|
|
5
5
|
:with-submit-btn="false"
|
|
6
6
|
:width="360"
|
|
7
|
-
@on-change="
|
|
7
|
+
@on-change="handleCloseSelectPopup"
|
|
8
8
|
>
|
|
9
9
|
<div
|
|
10
10
|
slot="form"
|
|
11
|
-
class="team-
|
|
11
|
+
class="team-setting__members-popover"
|
|
12
12
|
>
|
|
13
|
-
<div class="team-
|
|
13
|
+
<div class="team-setting__members-select">
|
|
14
14
|
<el-input
|
|
15
|
-
v-model="
|
|
15
|
+
v-model="searchQuery"
|
|
16
16
|
placeholder="请输入姓名"
|
|
17
|
-
@input="
|
|
17
|
+
@input="handleInputSearch(searchQuery, $attrs.keyId)"
|
|
18
18
|
/>
|
|
19
19
|
</div>
|
|
20
20
|
<div
|
|
21
|
-
v-if="
|
|
22
|
-
class="team-setting__empty-
|
|
21
|
+
v-if="searchQuery && !options.length && !fetchLoading"
|
|
22
|
+
class="team-setting__empty-members-options"
|
|
23
23
|
>
|
|
24
24
|
{{ $attrs.empty || '系统未登记该员工,请先添加员工账号' }}
|
|
25
25
|
</div>
|
|
26
26
|
<ul
|
|
27
27
|
v-else
|
|
28
|
-
class="team-
|
|
28
|
+
class="team-setting__members-options"
|
|
29
29
|
>
|
|
30
30
|
<li
|
|
31
|
-
class="team-
|
|
32
|
-
v-for="item in
|
|
31
|
+
class="team-setting__members-option"
|
|
32
|
+
v-for="item in options"
|
|
33
33
|
:key="item[$attrs.showConfig.id]"
|
|
34
34
|
>
|
|
35
|
-
<div class="team-
|
|
35
|
+
<div class="team-setting__members-option-left" v-if="isShowRoles">
|
|
36
36
|
{{ `${item[$attrs.showConfig.name]} | ${item.roles}` }}
|
|
37
37
|
</div>
|
|
38
|
+
<div class="team-setting__members-option-left" v-else>
|
|
39
|
+
{{item[$attrs.showConfig.name]}}
|
|
40
|
+
</div>
|
|
38
41
|
<el-button
|
|
39
42
|
v-if="item.is_selected"
|
|
40
43
|
type="text"
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
<el-button
|
|
46
49
|
v-else
|
|
47
50
|
type="text"
|
|
48
|
-
@click="
|
|
51
|
+
@click="handleAdd($attrs.keyId, item)"
|
|
49
52
|
>
|
|
50
53
|
添加
|
|
51
54
|
</el-button>
|
|
@@ -80,26 +83,31 @@ export default {
|
|
|
80
83
|
type: String,
|
|
81
84
|
default: '添加成员',
|
|
82
85
|
},
|
|
86
|
+
/** 角色名称展示 */
|
|
87
|
+
isShowRoles: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: true,
|
|
90
|
+
},
|
|
83
91
|
},
|
|
84
92
|
data() {
|
|
85
93
|
return {
|
|
86
|
-
|
|
94
|
+
searchQuery: '',
|
|
87
95
|
}
|
|
88
96
|
},
|
|
89
97
|
watch: {
|
|
90
98
|
},
|
|
91
99
|
methods: {
|
|
92
|
-
|
|
100
|
+
handleCloseSelectPopup(show) {
|
|
93
101
|
if (show) return;
|
|
94
|
-
this.
|
|
95
|
-
this.$emit('update:
|
|
102
|
+
this.searchQuery = '';
|
|
103
|
+
this.$emit('update:options', []);
|
|
96
104
|
},
|
|
97
|
-
|
|
98
|
-
this.$emit('
|
|
105
|
+
handleInputSearch(query, keyId) {
|
|
106
|
+
this.$emit('fetchMethods', { query, keyId });
|
|
99
107
|
},
|
|
100
|
-
|
|
108
|
+
handleAdd(id, item) {
|
|
101
109
|
const query = { id, item };
|
|
102
|
-
this.$emit('
|
|
110
|
+
this.$emit('handleAdd', query);
|
|
103
111
|
},
|
|
104
112
|
},
|
|
105
113
|
};
|
|
@@ -107,25 +115,25 @@ export default {
|
|
|
107
115
|
|
|
108
116
|
<style lang="less">
|
|
109
117
|
.team-setting {
|
|
110
|
-
&
|
|
111
|
-
padding: 20px;
|
|
118
|
+
&__members-popover {
|
|
119
|
+
padding: 20px 0;
|
|
120
|
+
margin: 0 20px;
|
|
112
121
|
height: 350px;
|
|
113
122
|
overflow-y: auto;
|
|
114
123
|
}
|
|
115
|
-
&
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
margin-top: 10px;
|
|
124
|
+
&__empty-members {
|
|
125
|
+
&-options {
|
|
126
|
+
font-size: 12px;
|
|
127
|
+
color: #80838e;
|
|
128
|
+
text-align: center;
|
|
129
|
+
margin-top: 10px;
|
|
130
|
+
}
|
|
123
131
|
}
|
|
124
|
-
&
|
|
132
|
+
&__members-options {
|
|
125
133
|
display: flex;
|
|
126
134
|
flex-direction: column;
|
|
127
135
|
}
|
|
128
|
-
&
|
|
136
|
+
&__members-option {
|
|
129
137
|
display: flex;
|
|
130
138
|
justify-content: space-between;
|
|
131
139
|
align-items: center;
|
|
@@ -180,31 +180,6 @@
|
|
|
180
180
|
border-right: 2px #e4e8ef solid;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
.el-table-filter,
|
|
185
|
-
th.el-table__cell .el-table__column-filter-trigger,
|
|
186
|
-
th.is-sortable .caret-wrapper {
|
|
187
|
-
display: none;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.el-table__body tr.current-row > td,
|
|
191
|
-
.el-table__body tr.hover-row > td {
|
|
192
|
-
background-color: #fafafa;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
table tbody tr td {
|
|
196
|
-
& .el-date-editor.el-input {
|
|
197
|
-
width: 100%;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
& .cell {
|
|
201
|
-
font-size: 14px;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.el-table__fixed-body-wrapper {
|
|
206
|
-
background: #fff;
|
|
207
|
-
}
|
|
208
183
|
}
|
|
209
184
|
|
|
210
185
|
.view-setting {
|
|
@@ -232,7 +207,7 @@
|
|
|
232
207
|
padding: 0px;
|
|
233
208
|
|
|
234
209
|
.el-dialog__body {
|
|
235
|
-
max-height:
|
|
210
|
+
max-height: 800px;
|
|
236
211
|
}
|
|
237
212
|
|
|
238
213
|
.el-dialog__body {
|
|
@@ -522,12 +497,6 @@
|
|
|
522
497
|
background-color: @--theme-blue--;
|
|
523
498
|
border-color: @--theme-blue--;
|
|
524
499
|
}
|
|
525
|
-
|
|
526
|
-
.el-checkbox__input.is-checked .el-checkbox__inner,
|
|
527
|
-
.el-radio__input.is-checked .el-radio__inner {
|
|
528
|
-
background: #2468f2;
|
|
529
|
-
border-color: #2468f2;
|
|
530
|
-
}
|
|
531
500
|
}
|
|
532
501
|
|
|
533
502
|
.btn-pointer {
|
|
@@ -607,8 +576,6 @@
|
|
|
607
576
|
margin-top: 12px;
|
|
608
577
|
|
|
609
578
|
& .el-pagination {
|
|
610
|
-
padding: 0;
|
|
611
|
-
|
|
612
579
|
.el-pager li.number {
|
|
613
580
|
background-color: #fff;
|
|
614
581
|
border: 1px solid #d6dbe3;
|
|
@@ -638,7 +605,26 @@
|
|
|
638
605
|
}
|
|
639
606
|
}
|
|
640
607
|
|
|
608
|
+
.el-table__body tr.current-row > td,
|
|
609
|
+
.el-table__body tr.hover-row > td {
|
|
610
|
+
background-color: #fafafa;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.el-table-filter,
|
|
614
|
+
th.el-table__cell .el-table__column-filter-trigger,
|
|
615
|
+
th.is-sortable .caret-wrapper {
|
|
616
|
+
display: none;
|
|
617
|
+
}
|
|
641
618
|
|
|
619
|
+
table tbody tr td {
|
|
620
|
+
& .el-date-editor.el-input {
|
|
621
|
+
width: 100%;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
& .cell {
|
|
625
|
+
font-size: 14px;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
642
628
|
|
|
643
629
|
.editable-table {
|
|
644
630
|
& table th {
|
|
@@ -688,6 +674,12 @@
|
|
|
688
674
|
}
|
|
689
675
|
}
|
|
690
676
|
|
|
677
|
+
.el-select-dropdown {
|
|
678
|
+
&__item {
|
|
679
|
+
text-align: center;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
691
683
|
.el-dialog__header {
|
|
692
684
|
display: flex;
|
|
693
685
|
justify-content: space-between;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="editable-table">
|
|
3
3
|
<div class="view-setting">
|
|
4
|
-
<div
|
|
5
|
-
v-if="!hideViewSettingBtn"
|
|
6
|
-
class="view-setting__btn-wrapper"
|
|
7
|
-
>
|
|
4
|
+
<div class="view-setting__btn-wrapper">
|
|
8
5
|
<div
|
|
9
6
|
class="view-setting__btn btn-pointer"
|
|
10
7
|
@click="handleViewSettingShow"
|
|
@@ -20,7 +17,6 @@
|
|
|
20
17
|
title="显示设置"
|
|
21
18
|
:visible.sync="viewSettingVisible"
|
|
22
19
|
width="750px"
|
|
23
|
-
top="12vh"
|
|
24
20
|
:close-on-click-modal="false"
|
|
25
21
|
:append-to-body="true"
|
|
26
22
|
custom-class="view-setting__dialog"
|
|
@@ -55,9 +51,8 @@
|
|
|
55
51
|
<div class="view-setting__content-right-frize">
|
|
56
52
|
冻结前
|
|
57
53
|
<el-input
|
|
54
|
+
v-model="leftFixedColumnCount"
|
|
58
55
|
class="view-setting__content-right-input"
|
|
59
|
-
:value="tempLeftFixedColumnCount"
|
|
60
|
-
@input="handleInputTempLeftFixedColumnCount"
|
|
61
56
|
/>
|
|
62
57
|
列
|
|
63
58
|
</div>
|
|
@@ -223,7 +218,7 @@
|
|
|
223
218
|
:key="column.prop + index"
|
|
224
219
|
resizable
|
|
225
220
|
class-name="editable-table__data-column"
|
|
226
|
-
:filtered-value="
|
|
221
|
+
:filtered-value="filteredValue[column.prop] || []"
|
|
227
222
|
v-bind="getColumnBindProps(column)"
|
|
228
223
|
>
|
|
229
224
|
<template
|
|
@@ -272,7 +267,7 @@
|
|
|
272
267
|
</div>
|
|
273
268
|
</div>
|
|
274
269
|
<div
|
|
275
|
-
v-if="column.
|
|
270
|
+
v-if="column.isColumnSearchAble"
|
|
276
271
|
class="sort-filter__search"
|
|
277
272
|
>
|
|
278
273
|
<div class="sort-filter__search-title">
|
|
@@ -284,41 +279,19 @@
|
|
|
284
279
|
placeholder="请输入内容"
|
|
285
280
|
/>
|
|
286
281
|
</div>
|
|
287
|
-
|
|
288
282
|
<div
|
|
289
|
-
v-if="column.
|
|
290
|
-
class="sort-filter__search"
|
|
291
|
-
style="display: flex;flex-direction: column;gap: 12px;"
|
|
292
|
-
>
|
|
293
|
-
<div
|
|
294
|
-
v-for="item in column.search"
|
|
295
|
-
:key="item.prop"
|
|
296
|
-
>
|
|
297
|
-
<div class="sort-filter__search-title">
|
|
298
|
-
{{ item.label }}
|
|
299
|
-
</div>
|
|
300
|
-
<el-input
|
|
301
|
-
v-model="tempSearchValue[item.prop]"
|
|
302
|
-
class="sort-filter__search-input"
|
|
303
|
-
placeholder="请输入内容"
|
|
304
|
-
/>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
|
|
308
|
-
<div
|
|
309
|
-
v-if="column.filters && ((Array.isArray(column.filters) ? column.filters : column.filters.options).length > 0)"
|
|
283
|
+
v-if="column.filters && column.filters.length > 0"
|
|
310
284
|
class="sort-filter__filter"
|
|
311
285
|
>
|
|
312
286
|
<div class="sort-filter__filter-title">
|
|
313
287
|
筛选
|
|
314
288
|
</div>
|
|
315
289
|
<el-checkbox-group
|
|
316
|
-
v-if="column.filters && (Array.isArray(column.filters) || column.filters.type === 'checkbox')"
|
|
317
290
|
v-model="tempFilteredValue[column.prop]"
|
|
318
291
|
class="sort-filter__filter-checkbox-group"
|
|
319
292
|
>
|
|
320
293
|
<el-checkbox
|
|
321
|
-
v-for="item in
|
|
294
|
+
v-for="item in column.filters"
|
|
322
295
|
:key="item.value"
|
|
323
296
|
:label="item.value"
|
|
324
297
|
class="sort-filter__filter-checkbox"
|
|
@@ -331,25 +304,6 @@
|
|
|
331
304
|
</slot>
|
|
332
305
|
</el-checkbox>
|
|
333
306
|
</el-checkbox-group>
|
|
334
|
-
|
|
335
|
-
<el-radio-group
|
|
336
|
-
v-if="column.filters && !Array.isArray(column.filters) && column.filters.type === 'radio'"
|
|
337
|
-
v-model="tempFilteredValue[column.prop]"
|
|
338
|
-
style="display: flex;flex-direction: column;gap: 6px;"
|
|
339
|
-
>
|
|
340
|
-
<el-radio
|
|
341
|
-
v-for="item in column.filters.options"
|
|
342
|
-
:key="item.value"
|
|
343
|
-
:label="item.value"
|
|
344
|
-
>
|
|
345
|
-
<slot
|
|
346
|
-
:name="column.prop + '-filter-item'"
|
|
347
|
-
v-bind="item"
|
|
348
|
-
>
|
|
349
|
-
{{ item.text }}
|
|
350
|
-
</slot>
|
|
351
|
-
</el-radio>
|
|
352
|
-
</el-radio-group>
|
|
353
307
|
</div>
|
|
354
308
|
<div
|
|
355
309
|
v-if="column.summary"
|
|
@@ -385,7 +339,7 @@
|
|
|
385
339
|
<el-button
|
|
386
340
|
class="sort-filter__confirm-btn"
|
|
387
341
|
type="primary"
|
|
388
|
-
@click="handleHeaderOperationConfirm(
|
|
342
|
+
@click="handleHeaderOperationConfirm(scope)"
|
|
389
343
|
>
|
|
390
344
|
确定
|
|
391
345
|
</el-button>
|
|
@@ -584,7 +538,7 @@
|
|
|
584
538
|
:page-sizes="[10, 15, 30, 60, 100]"
|
|
585
539
|
:page-size.sync="pageSize"
|
|
586
540
|
:pager-count="11"
|
|
587
|
-
:current-page="currentPage"
|
|
541
|
+
:current-page.sync="currentPage"
|
|
588
542
|
:total="total"
|
|
589
543
|
@size-change="handlePageSizeChange"
|
|
590
544
|
@current-change="handleCurrPageChange"
|
|
@@ -611,7 +565,7 @@ interface IProps {
|
|
|
611
565
|
dataList: ITableDataItem[];
|
|
612
566
|
/** 列配置 */
|
|
613
567
|
columnConfig: IColumnConfig[];
|
|
614
|
-
/** 是否展示展开行 */
|
|
568
|
+
/** 是否展示展开行 */
|
|
615
569
|
hasExpandRow?: boolean;
|
|
616
570
|
/** 是否展示序号 */
|
|
617
571
|
hasIndexColumn?: boolean;
|
|
@@ -631,16 +585,6 @@ interface IProps {
|
|
|
631
585
|
dragSemiRange?: number;
|
|
632
586
|
/** 是否显示加载 */
|
|
633
587
|
loading?: boolean;
|
|
634
|
-
/** 是否隐藏显示设置按钮 */
|
|
635
|
-
hideViewSettingBtn?: boolean
|
|
636
|
-
/** 设置的缓存的key */
|
|
637
|
-
settingStorgeKey?: string
|
|
638
|
-
/** 前端排序,默认关闭 */
|
|
639
|
-
localSort?: boolean
|
|
640
|
-
/** 前端过滤,默认关闭 */
|
|
641
|
-
localFilter?: boolean
|
|
642
|
-
/** 页码 */
|
|
643
|
-
currentPage: number
|
|
644
588
|
}
|
|
645
589
|
|
|
646
590
|
interface IEmits {
|
|
@@ -662,10 +606,6 @@ interface IEmits {
|
|
|
662
606
|
(e: 'row-edit-cancel', param: { row: any; page: number; size: number;}): void
|
|
663
607
|
/** 页码改变 */
|
|
664
608
|
(e: 'page-change', param: { page: number, size: number }): void
|
|
665
|
-
/** 查询 */
|
|
666
|
-
(e: 'search', param: Record<string, any>): void
|
|
667
|
-
/** 排序 */
|
|
668
|
-
(e: 'sort-change', param: { order: 'descending' | 'ascending' | null, prop: string }): void
|
|
669
609
|
}
|
|
670
610
|
|
|
671
611
|
const props = withDefaults(defineProps<IProps>(), {
|
|
@@ -680,12 +620,7 @@ const props = withDefaults(defineProps<IProps>(), {
|
|
|
680
620
|
colorList: () => [],
|
|
681
621
|
leftFixedCount: 1,
|
|
682
622
|
dragSemiRange: 15,
|
|
683
|
-
loading: false
|
|
684
|
-
hideViewSettingBtn: false,
|
|
685
|
-
settingStorgeKey: '',
|
|
686
|
-
localSort: false,
|
|
687
|
-
localFilter: false,
|
|
688
|
-
currentPage: 1,
|
|
623
|
+
loading: false
|
|
689
624
|
})
|
|
690
625
|
|
|
691
626
|
// 同defineProps一样,不支持泛型参数从外部导入
|
|
@@ -705,14 +640,16 @@ const actualColumns = computed(() => {
|
|
|
705
640
|
isColumnSortable: rawItem.sortable,
|
|
706
641
|
sortable: inSorting.value ? rawItem.sortable : false
|
|
707
642
|
};
|
|
708
|
-
if (
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
643
|
+
if (item) {
|
|
644
|
+
if (cnt > 0) {
|
|
645
|
+
item.fixed = 'left';
|
|
646
|
+
// eslint-disable-next-line no-plusplus
|
|
647
|
+
cnt--;
|
|
648
|
+
} else {
|
|
649
|
+
item.fixed = undefined;
|
|
650
|
+
}
|
|
651
|
+
res.push(item);
|
|
714
652
|
}
|
|
715
|
-
res.push(item);
|
|
716
653
|
}
|
|
717
654
|
|
|
718
655
|
// 使用默认操作项,添加默认操作列。该列在编辑模式下隐藏
|
|
@@ -738,8 +675,9 @@ const beforePageChange = () => {
|
|
|
738
675
|
}
|
|
739
676
|
const {
|
|
740
677
|
pageSize,
|
|
678
|
+
currentPage,
|
|
741
679
|
handleCurrPageChange,
|
|
742
|
-
handlePageSizeChange
|
|
680
|
+
handlePageSizeChange
|
|
743
681
|
} = usePagination({
|
|
744
682
|
emit,
|
|
745
683
|
beforePageChange
|
|
@@ -779,7 +717,7 @@ const {
|
|
|
779
717
|
emit,
|
|
780
718
|
tableDomRef,
|
|
781
719
|
pageSize,
|
|
782
|
-
|
|
720
|
+
currentPage,
|
|
783
721
|
hasExpandRow: props.hasExpandRow
|
|
784
722
|
})
|
|
785
723
|
|
|
@@ -789,8 +727,6 @@ const {
|
|
|
789
727
|
columnsToBeShown,
|
|
790
728
|
viewSettingVisible,
|
|
791
729
|
leftFixedColumnCount,
|
|
792
|
-
tempLeftFixedColumnCount,
|
|
793
|
-
handleInputTempLeftFixedColumnCount,
|
|
794
730
|
handleViewSettingShow,
|
|
795
731
|
handleViewSettingClose,
|
|
796
732
|
handleViewSettingConfirm
|
|
@@ -803,9 +739,6 @@ const {
|
|
|
803
739
|
|
|
804
740
|
/************ 列头部操作相关 ************ */
|
|
805
741
|
const {
|
|
806
|
-
setSort,
|
|
807
|
-
clearSort,
|
|
808
|
-
setSearchParams,
|
|
809
742
|
isColumnHeadActive,
|
|
810
743
|
handleSort,
|
|
811
744
|
handleHeaderPopoverShow,
|
|
@@ -823,13 +756,11 @@ const {
|
|
|
823
756
|
sortingColumn,
|
|
824
757
|
isColumnFiltering,
|
|
825
758
|
searchValue,
|
|
826
|
-
inSorting
|
|
759
|
+
inSorting
|
|
827
760
|
} = useColumnHeaderOperation({
|
|
828
761
|
tableDomRef,
|
|
829
762
|
sortFilterPopoverRef,
|
|
830
|
-
props
|
|
831
|
-
emit,
|
|
832
|
-
showingColumns,
|
|
763
|
+
props
|
|
833
764
|
})
|
|
834
765
|
|
|
835
766
|
/************ 表格行拖拽和显示设置列拖拽 ************ */
|
|
@@ -856,6 +787,7 @@ useDragSort({
|
|
|
856
787
|
props,
|
|
857
788
|
viewSettingDragSortOptions,
|
|
858
789
|
beforeDragStart,
|
|
790
|
+
currentPage,
|
|
859
791
|
pageSize,
|
|
860
792
|
currScope,
|
|
861
793
|
tableDomRef,
|
|
@@ -866,10 +798,18 @@ const doTableLayout = async () => {
|
|
|
866
798
|
tableDomRef.value?.doLayout();
|
|
867
799
|
}
|
|
868
800
|
|
|
801
|
+
watch(
|
|
802
|
+
() => props.columnConfig,
|
|
803
|
+
(val) => {
|
|
804
|
+
showingColumns.value = val.map(c => c.prop);
|
|
805
|
+
},
|
|
806
|
+
{ immediate: true }
|
|
807
|
+
)
|
|
808
|
+
|
|
869
809
|
// 过滤出自定义属性,将其它属性全部透传给 el-table-column
|
|
870
810
|
const getColumnBindProps = (column: IColumnConfig) => {
|
|
871
811
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
872
|
-
const { editAble, editType, slotName, inputType, options,
|
|
812
|
+
const { editAble, editType, slotName, inputType, options, ...rest } = column;
|
|
873
813
|
return rest;
|
|
874
814
|
}
|
|
875
815
|
|
|
@@ -892,20 +832,7 @@ const handleColumnClose = (item) => {
|
|
|
892
832
|
|
|
893
833
|
defineExpose({
|
|
894
834
|
closeAllExpandedRows,
|
|
895
|
-
|
|
896
|
-
elTableRef: tableDomRef,
|
|
897
|
-
setSort,
|
|
898
|
-
clearSort,
|
|
899
|
-
setSearchParams,
|
|
900
|
-
})
|
|
901
|
-
|
|
902
|
-
// loading 结束和页码变化时滚动到顶部
|
|
903
|
-
watch([
|
|
904
|
-
() => props.loading,
|
|
905
|
-
() => props.currentPage,
|
|
906
|
-
], ([loading]) => {
|
|
907
|
-
if (loading) return;
|
|
908
|
-
tableDomRef.value.$el.querySelector('.el-table__body-wrapper').scrollTop = 0
|
|
835
|
+
elTableRef: tableDomRef
|
|
909
836
|
})
|
|
910
837
|
|
|
911
838
|
</script>
|
|
@@ -11,40 +11,24 @@ export interface IColumnConfigRequired {
|
|
|
11
11
|
sortable?: boolean; // 该列是否允许排序,ture则表头弹窗会显示升降序按钮
|
|
12
12
|
slotName?: string; // 如果要自定义,传入 slotName
|
|
13
13
|
isAlwaysShow?: boolean; // 不可隐藏,显示设置中,该列不允许隐藏
|
|
14
|
-
|
|
15
|
-
defaultHide?: boolean;
|
|
16
|
-
/** 列是否允许搜索,true则表头弹窗会多一个搜索框,一列中有多个搜索字段时传数组进行配置 */
|
|
17
|
-
search?: boolean | ISearchOptions
|
|
14
|
+
isColumnSearchAble?: boolean; // 列是否允许搜索,true则表头弹窗会多一个搜索框
|
|
18
15
|
summary?: boolean; // 是否可以显示该列的统计
|
|
19
16
|
summaryMethod?: (values: any[]) => string | number; // 这一列的统计方法,values为该列的所有值
|
|
20
|
-
|
|
21
|
-
filters?: {
|
|
22
|
-
type?: 'checkbox' | 'radio',
|
|
23
|
-
options: FiltersOption[]
|
|
24
|
-
default?: string | number | string[] | number[]
|
|
25
|
-
} | FiltersOption[]
|
|
17
|
+
// filters?: {value: string | number; text: string; [key: string]: any}[];
|
|
26
18
|
// 透传el-table column有的属性, https://element.eleme.cn/#/en-US/component/table#table-column-attributes
|
|
27
19
|
[key: string]: any;
|
|
28
20
|
}
|
|
29
21
|
|
|
30
|
-
type FiltersOption = { value: string | number; text: string; [key: string]: any }
|
|
31
|
-
|
|
32
|
-
type ISearchOptions = {
|
|
33
|
-
prop: string,
|
|
34
|
-
label: string,
|
|
35
|
-
validator?: (value: string) => boolean
|
|
36
|
-
}[]
|
|
37
|
-
|
|
38
22
|
type IInputColumn = IColumnConfigRequired & {
|
|
39
23
|
inputType: string | number;
|
|
40
24
|
}
|
|
41
25
|
|
|
42
26
|
type ISelectColumn = IColumnConfigRequired & {
|
|
43
|
-
options: {
|
|
27
|
+
options: {key: string; value: string | number; [key: string]: any}[];
|
|
44
28
|
}
|
|
45
29
|
|
|
46
|
-
type IDateOnlyColumn = IColumnConfigRequired
|
|
47
|
-
type IDateTimeColumn = IColumnConfigRequired
|
|
30
|
+
type IDateOnlyColumn = IColumnConfigRequired & {}
|
|
31
|
+
type IDateTimeColumn = IColumnConfigRequired & {}
|
|
48
32
|
|
|
49
33
|
export type IColumnConfig = IInputColumn | ISelectColumn | IDateOnlyColumn | IDateTimeColumn
|
|
50
34
|
|
|
@@ -95,22 +79,16 @@ export interface IProps {
|
|
|
95
79
|
leftFixedCount?: number;
|
|
96
80
|
dragSemiRange?: number;
|
|
97
81
|
loading?: boolean;
|
|
98
|
-
settingStorgeKey?: string
|
|
99
|
-
localSort?: boolean
|
|
100
|
-
localFilter?: boolean
|
|
101
|
-
currentPage: number
|
|
102
82
|
}
|
|
103
83
|
|
|
104
84
|
export interface IEmits {
|
|
105
85
|
(e: 'selection-change', selection: any): void
|
|
106
|
-
(e: 'row-bg-change', param: {
|
|
107
|
-
(e: 'row-drag-drop', param: { row: any; fromIndex: number; toIndex: number; page: number; size: number;
|
|
86
|
+
(e: 'row-bg-change', param: {colorId: number; row: ITableDataItem; rowIndex: number}): void
|
|
87
|
+
(e: 'row-drag-drop', param: { row: any; fromIndex: number; toIndex: number; page: number; size: number;}): void
|
|
108
88
|
(e: 'row-delete', param: { row: any; index: number; page: number; size: number; }): void
|
|
109
|
-
(e: 'row-edit', param: { row: any, index: number; page: number; size: number;
|
|
110
|
-
(e: 'row-pin-to-top', param: { row: any, rawIndex: number; page: number; size: number;
|
|
89
|
+
(e: 'row-edit', param: { row: any, index: number; page: number; size: number;}): void
|
|
90
|
+
(e: 'row-pin-to-top', param: { row: any, rawIndex: number; page: number; size: number;}): void
|
|
111
91
|
(e: 'row-edit-save', param: { page: number; size: number; row: any; changedData: Record<string, any>; }): void
|
|
112
|
-
(e: 'row-edit-cancel', param: { row: any; page: number; size: number;
|
|
92
|
+
(e: 'row-edit-cancel', param: { row: any; page: number; size: number;}): void
|
|
113
93
|
(e: 'page-change', param: { page: number, size: number }): void
|
|
114
|
-
(e: 'search', param: Record<string, any>): void
|
|
115
|
-
(e: 'sort-change', param: { order: 'descending' | 'ascending' | null, prop: string }): void
|
|
116
94
|
}
|