@94ai/nf-table 8.3.6 → 8.3.7
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/lib/index.d.ts +92 -0
- package/lib/nf-table.cjs.js +212 -0
- package/lib/nf-table.esm-bundler.js +212 -0
- package/lib/nf-table.vue.d.ts +22 -0
- package/package/nf-column-check-drawer.vue +1 -1
- package/package/nf-table.vue +1853 -1633
- package/package.json +9 -9
package/package/nf-table.vue
CHANGED
|
@@ -1,226 +1,66 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
>
|
|
10
|
-
<template v-for="item in (nfSearchFormRef?.renderSearchFormItemOptions || [])">
|
|
11
|
-
<!-- 定制化SearchItem?提示-->
|
|
12
|
-
<slot :name="item.tooltip.slot" :slot="item.tooltip.slot" v-if="item.tooltip?.slot" />
|
|
13
|
-
<!-- 定制化SearchItem插槽-->
|
|
14
|
-
<slot :name="item.slot" :slot="item.slot" v-if="item.slot" :formData="nfSearchFormModel" />
|
|
15
|
-
<slot :name="item.inputSlot?.prepend" v-if="item.inputSlot?.prepend" :slot="item.inputSlot?.prepend" />
|
|
16
|
-
<slot :name="item.inputSlot?.append" v-if="item.inputSlot?.append" :slot="item.inputSlot?.append" />
|
|
17
|
-
<slot :name="item.inputSlot?.suffix" v-if="item.inputSlot?.suffix" :slot="item.inputSlot?.suffix" />
|
|
18
|
-
<slot :name="item.inputSlot?.prefix" v-if="item.inputSlot?.prefix" :slot="item.inputSlot?.prefix" />
|
|
19
|
-
<slot :name="item.inputSlot?.doublePrepend" v-if="item.inputSlot?.doublePrepend" :slot="item.inputSlot?.doublePrepend" />
|
|
20
|
-
<slot :name="item.inputSlot?.doubleAppend" v-if="item.inputSlot?.doubleAppend" :slot="item.inputSlot?.doubleAppend" />
|
|
21
|
-
<slot :name="item.inputSlot?.doubleSuffix" v-if="item.inputSlot?.doubleSuffix" :slot="item.inputSlot?.doubleSuffix" />
|
|
22
|
-
<slot :name="item.inputSlot?.doublePrefix" v-if="item.inputSlot?.doublePrefix" :slot="item.inputSlot?.doublePrefix" />
|
|
23
|
-
<slot :name="item.inputSlot?.doubleSegment" v-if="item.inputSlot?.doubleSegment" :slot="item.inputSlot?.doubleSegment" />
|
|
24
|
-
<slot :name="item.labelSlot" :slot="item.labelSlot" v-if="item.labelSlot" />
|
|
25
|
-
</template>
|
|
26
|
-
<slot name="btnBox" slot="btnBox" />
|
|
27
|
-
<slot name="searchFormColumnEditDialogTitle" slot="dialogTitle" />
|
|
28
|
-
<slot name="searchFormColumnEditDialogFooter" slot="dialogFooter" />
|
|
29
|
-
</nf-search-form>
|
|
30
|
-
</slot>
|
|
31
|
-
<div class="nf-table-content" ref="nfTableContent">
|
|
32
|
-
<slot name="columnEdit" v-if="columnEdit && columnPosition === 'free'">
|
|
33
|
-
<nf-button @click="nfColumCheckDialogVisible = true"
|
|
34
|
-
:class="(columnDisplayBtnClass || '') + ' nf-column-display'"
|
|
35
|
-
:type="columnDisplayBtnType"
|
|
36
|
-
:plain="columnDisplayBtnPlain"
|
|
37
|
-
:icon="columnDisplayBtnIcon"
|
|
38
|
-
:size="columnDisplayBtnSize"
|
|
39
|
-
:round="columnDisplayBtnRound"
|
|
40
|
-
:circle="columnDisplayBtnCircle"
|
|
41
|
-
:loading="columnDisplayBtnLoading"
|
|
42
|
-
:disabled="columnDisplayBtnDisabled"
|
|
1
|
+
<template>
|
|
2
|
+
<div class="nf-table" ref="nfTableRef">
|
|
3
|
+
<slot name="searchBox" ref="searchBox">
|
|
4
|
+
<nf-search-form
|
|
5
|
+
ref="nfSearchFormRef"
|
|
6
|
+
v-bind="searchFormAttrer"
|
|
7
|
+
v-on="searchFormEvents"
|
|
8
|
+
@onSearch="searchApi"
|
|
43
9
|
>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<template v-for="column in tableColumns">
|
|
60
|
-
<!-- 特殊类型,如selection -->
|
|
61
|
-
<template v-if="column.type && isShow(column)">
|
|
62
|
-
<el-table-column
|
|
63
|
-
v-if="column.type!=='expand'"
|
|
64
|
-
:key="column.key || column.prop || column.type"
|
|
65
|
-
:type="column.type"
|
|
66
|
-
:prop="column.prop"
|
|
67
|
-
:label="resolveValue(column.label)"
|
|
68
|
-
v-bind="column.attr"
|
|
69
|
-
>
|
|
70
|
-
</el-table-column>
|
|
71
|
-
<el-table-column
|
|
72
|
-
v-else
|
|
73
|
-
:key="column.key || column.prop || column.type"
|
|
74
|
-
:type="column.type"
|
|
75
|
-
:prop="column.prop"
|
|
76
|
-
:label="resolveValue(column.label)"
|
|
77
|
-
v-bind="column.attr"
|
|
78
|
-
>
|
|
79
|
-
<template slot-scope="scope" v-if="column.slot">
|
|
80
|
-
<slot :name="column.slot" :row="scope.row" :index="scope.$index" />
|
|
81
|
-
</template>
|
|
82
|
-
</el-table-column>
|
|
10
|
+
<template v-for="item in (nfSearchFormRef?.renderSearchFormItemOptions || [])">
|
|
11
|
+
<!-- 定制化SearchItem?提示-->
|
|
12
|
+
<slot :name="item.tooltip.slot" :slot="item.tooltip.slot" v-if="item.tooltip?.slot" />
|
|
13
|
+
<!-- 定制化SearchItem插槽-->
|
|
14
|
+
<slot :name="item.slot" :slot="item.slot" v-if="item.slot" :formData="nfSearchFormModel" />
|
|
15
|
+
<slot :name="item.inputSlot?.prepend" v-if="item.inputSlot?.prepend" :slot="item.inputSlot?.prepend" />
|
|
16
|
+
<slot :name="item.inputSlot?.append" v-if="item.inputSlot?.append" :slot="item.inputSlot?.append" />
|
|
17
|
+
<slot :name="item.inputSlot?.suffix" v-if="item.inputSlot?.suffix" :slot="item.inputSlot?.suffix" />
|
|
18
|
+
<slot :name="item.inputSlot?.prefix" v-if="item.inputSlot?.prefix" :slot="item.inputSlot?.prefix" />
|
|
19
|
+
<slot :name="item.inputSlot?.doublePrepend" v-if="item.inputSlot?.doublePrepend" :slot="item.inputSlot?.doublePrepend" />
|
|
20
|
+
<slot :name="item.inputSlot?.doubleAppend" v-if="item.inputSlot?.doubleAppend" :slot="item.inputSlot?.doubleAppend" />
|
|
21
|
+
<slot :name="item.inputSlot?.doubleSuffix" v-if="item.inputSlot?.doubleSuffix" :slot="item.inputSlot?.doubleSuffix" />
|
|
22
|
+
<slot :name="item.inputSlot?.doublePrefix" v-if="item.inputSlot?.doublePrefix" :slot="item.inputSlot?.doublePrefix" />
|
|
23
|
+
<slot :name="item.inputSlot?.doubleSegment" v-if="item.inputSlot?.doubleSegment" :slot="item.inputSlot?.doubleSegment" />
|
|
24
|
+
<slot :name="item.labelSlot" :slot="item.labelSlot" v-if="item.labelSlot" />
|
|
83
25
|
</template>
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
26
|
+
<slot name="btnBox" slot="btnBox" />
|
|
27
|
+
<slot name="searchFormColumnEditDialogTitle" slot="dialogTitle" />
|
|
28
|
+
<slot name="searchFormColumnEditDialogFooter" slot="dialogFooter" />
|
|
29
|
+
</nf-search-form>
|
|
30
|
+
</slot>
|
|
31
|
+
<div class="nf-table-content" ref="nfTableContent">
|
|
32
|
+
<slot name="columnEdit" v-if="columnEdit && columnPosition === 'free'">
|
|
33
|
+
<nf-button @click="nfColumCheckDialogVisible = true"
|
|
34
|
+
:class="(columnDisplayBtnClass || '') + ' nf-column-display'"
|
|
35
|
+
:type="columnDisplayBtnType"
|
|
36
|
+
:plain="columnDisplayBtnPlain"
|
|
37
|
+
:icon="columnDisplayBtnIcon"
|
|
38
|
+
:size="columnDisplayBtnSize"
|
|
39
|
+
:round="columnDisplayBtnRound"
|
|
40
|
+
:circle="columnDisplayBtnCircle"
|
|
41
|
+
:loading="columnDisplayBtnLoading"
|
|
42
|
+
:disabled="columnDisplayBtnDisabled"
|
|
91
43
|
>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<!-- -------------- header区域 -------------- -->
|
|
95
|
-
<template slot="header" slot-scope="scope">
|
|
96
|
-
<!-- 操作 -->
|
|
97
|
-
<slot
|
|
98
|
-
v-if="
|
|
99
|
-
columnEdit &&
|
|
100
|
-
column.prop === operationPropKey &&
|
|
101
|
-
columnPosition === 'embed'
|
|
102
|
-
"
|
|
103
|
-
name="operationIconColumnCheck"
|
|
104
|
-
:column="column"
|
|
105
|
-
>
|
|
106
|
-
<span style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
107
|
-
<el-tooltip
|
|
108
|
-
popper-class="actionTooltipRef"
|
|
109
|
-
placement="top"
|
|
110
|
-
effect="dark"
|
|
111
|
-
:content="columnDisplayBtnText">
|
|
112
|
-
<i class="iconfont icon-liebiao_xianshiliemu operation-icon-column-check"
|
|
113
|
-
@click="nfColumCheckDialogVisible = true"
|
|
114
|
-
/>
|
|
115
|
-
</el-tooltip>
|
|
116
|
-
</slot>
|
|
117
|
-
<!-- labelTooltip -->
|
|
118
|
-
<template v-else-if="column.labelTooltip">
|
|
119
|
-
<el-tooltip :placement="column.labelTooltipPlacement || 'right'" effect="dark">
|
|
120
|
-
<div slot="content">{{ column.labelTooltip }}</div>
|
|
121
|
-
<span class="bottom-line" style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
122
|
-
</el-tooltip>
|
|
123
|
-
</template>
|
|
124
|
-
<!-- 头部插槽 -->
|
|
125
|
-
<template v-else-if="column.headerSlot">
|
|
126
|
-
<slot :name="column.headerSlot" :$index="scope.$index" :column="scope.column" />
|
|
127
|
-
</template>
|
|
128
|
-
<!-- 默认 -->
|
|
129
|
-
<span v-else>
|
|
130
|
-
{{ resolveValue(column.label) }}
|
|
131
|
-
</span>
|
|
132
|
-
</template>
|
|
133
|
-
<!-- -------------- 内容区域 -------------- -->
|
|
134
|
-
<template slot-scope="scope">
|
|
135
|
-
<!-- 插槽 -->
|
|
136
|
-
<slot
|
|
137
|
-
v-if="column.slot"
|
|
138
|
-
:name="column.slot"
|
|
139
|
-
:row="scope.row"
|
|
140
|
-
:index="scope.$index"
|
|
141
|
-
/>
|
|
142
|
-
<!-- render -->
|
|
143
|
-
<render-component
|
|
144
|
-
v-else-if="column.render"
|
|
145
|
-
:render="column.render"
|
|
146
|
-
:row="scope.row"
|
|
147
|
-
/>
|
|
148
|
-
<!-- 操作 -->
|
|
149
|
-
<nf-action
|
|
150
|
-
v-else-if="column.prop === operationPropKey && !hasOperationSlot"
|
|
151
|
-
:span="column.operationSpan || 0"
|
|
152
|
-
:unique="scope.index"
|
|
153
|
-
>
|
|
154
|
-
<template v-for="(item, index) in getOperationListLocal(column, scope)">
|
|
155
|
-
<nf-button
|
|
156
|
-
v-if="!resolveValue(item.destroy, scope.row, scope)"
|
|
157
|
-
:size="resolveValue(item.size || 'mini', scope.row, scope)"
|
|
158
|
-
:type="resolveValue(item.type || 'primary', scope.row, scope, scope.row, scope)"
|
|
159
|
-
:text="resolveValue(item.text === undefined ? true : item.text, scope.row, scope)"
|
|
160
|
-
:disabled="resolveValue(item.disabled, scope.row, scope)"
|
|
161
|
-
:loading="resolveValue(item.loading, scope.row, scope)"
|
|
162
|
-
:class="resolveValue(item.class, scope.row, scope)"
|
|
163
|
-
:plain="resolveValue(item.plain, scope.row, scope)"
|
|
164
|
-
:icon="resolveValue(item.icon, scope.row, scope)"
|
|
165
|
-
:round="resolveValue(item.round, scope.row, scope)"
|
|
166
|
-
:circle="resolveValue(item.circle, scope.row, scope)"
|
|
167
|
-
:style="resolveValue(item.style, scope.row, scope)"
|
|
168
|
-
v-on="eventsOperationListBtns(item, scope)"
|
|
169
|
-
:key="item.key || index"
|
|
170
|
-
>{{ resolveValue(item.name, scope.row, scope) }}
|
|
171
|
-
</nf-button>
|
|
172
|
-
</template>
|
|
173
|
-
</nf-action>
|
|
174
|
-
<span v-else-if="column.attr?.formatter">
|
|
175
|
-
{{ column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index) }}
|
|
176
|
-
</span>
|
|
177
|
-
<template v-else-if="column.optionsEnum">
|
|
178
|
-
<nf-tag
|
|
179
|
-
v-if="column.optionsTag[scope.row[column.prop]]"
|
|
180
|
-
:type='column.optionsTag[scope.row[column.prop]]'
|
|
181
|
-
:value="column.optionsEnum[scope.row[column.prop]]"
|
|
182
|
-
/>
|
|
183
|
-
<span v-else>
|
|
184
|
-
{{ column.optionsEnum[scope.row[column.prop]] }}
|
|
185
|
-
</span>
|
|
186
|
-
</template>
|
|
187
|
-
<span v-else>
|
|
188
|
-
{{ scope.row[column.prop] }}{{ column.unit }}
|
|
189
|
-
</span>
|
|
190
|
-
</template>
|
|
191
|
-
</el-table-column>
|
|
192
|
-
</template>
|
|
193
|
-
<slot name="append" slot="append"></slot>
|
|
194
|
-
<slot name="empty" slot="empty">
|
|
195
|
-
<nf-empty slot="empty" :image-size="emptyImageSize" :description="emptyText"></nf-empty>
|
|
44
|
+
{{ columnDisplayBtnText }}
|
|
45
|
+
</nf-button>
|
|
196
46
|
</slot>
|
|
197
|
-
|
|
198
|
-
<!-- 虚拟 -->
|
|
199
|
-
<virtual-scroll v-else v-bind="{...wrapperProps}" @change="handleVirtualChange">
|
|
47
|
+
<!-- 非虚拟 -->
|
|
200
48
|
<el-table
|
|
49
|
+
v-if="!virtualized"
|
|
201
50
|
ref="elTableRef"
|
|
202
51
|
:class="{'nf-table-container': true, 'nf-default-table-border': !nfTableBorder && !tableAttrs?.border }"
|
|
203
|
-
:data="
|
|
52
|
+
:data="showData"
|
|
204
53
|
:fit="tableAttrer?.fit ?? true"
|
|
205
54
|
:height="elTableHeight"
|
|
206
55
|
v-bind="tableAttrer"
|
|
207
56
|
v-on="tableEventer"
|
|
208
|
-
:key="
|
|
57
|
+
:key="elTableRefKey"
|
|
209
58
|
>
|
|
210
59
|
<template v-for="column in tableColumns">
|
|
211
60
|
<!-- 特殊类型,如selection -->
|
|
212
61
|
<template v-if="column.type && isShow(column)">
|
|
213
|
-
<virtual-column
|
|
214
|
-
v-if="column.type === 'selection'"
|
|
215
|
-
:key="column.key || column.prop || column.type"
|
|
216
|
-
type="selection"
|
|
217
|
-
:prop="column.prop"
|
|
218
|
-
:label="resolveValue(column.label)"
|
|
219
|
-
v-bind="column.attr"
|
|
220
|
-
>
|
|
221
|
-
</virtual-column>
|
|
222
62
|
<el-table-column
|
|
223
|
-
v-
|
|
63
|
+
v-if="column.type!=='expand'"
|
|
224
64
|
:key="column.key || column.prop || column.type"
|
|
225
65
|
:type="column.type"
|
|
226
66
|
:prop="column.prop"
|
|
@@ -355,1534 +195,1914 @@
|
|
|
355
195
|
<nf-empty slot="empty" :image-size="emptyImageSize" :description="emptyText"></nf-empty>
|
|
356
196
|
</slot>
|
|
357
197
|
</el-table>
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
:
|
|
407
|
-
:
|
|
408
|
-
:
|
|
409
|
-
:
|
|
410
|
-
|
|
411
|
-
:style="getActionBarItemStyle(item)"
|
|
412
|
-
v-if="item.element === 'el-checkbox-group'"
|
|
413
|
-
v-on="item.events"
|
|
198
|
+
<!-- 虚拟 -->
|
|
199
|
+
<virtual-scroll v-else v-bind="{...wrapperProps}" @change="handleVirtualChange">
|
|
200
|
+
<el-table
|
|
201
|
+
ref="elTableRef"
|
|
202
|
+
:class="{'nf-table-container': true, 'nf-default-table-border': !nfTableBorder && !tableAttrs?.border }"
|
|
203
|
+
:data="tableData"
|
|
204
|
+
:fit="tableAttrer?.fit ?? true"
|
|
205
|
+
:height="elTableHeight"
|
|
206
|
+
v-bind="tableAttrer"
|
|
207
|
+
v-on="tableEventer"
|
|
208
|
+
:key="cStorageKey"
|
|
209
|
+
>
|
|
210
|
+
<template v-for="column in tableColumns">
|
|
211
|
+
<!-- 特殊类型,如selection -->
|
|
212
|
+
<template v-if="column.type && isShow(column)">
|
|
213
|
+
<virtual-column
|
|
214
|
+
v-if="column.type === 'selection'"
|
|
215
|
+
:key="column.key || column.prop || column.type"
|
|
216
|
+
type="selection"
|
|
217
|
+
:prop="column.prop"
|
|
218
|
+
:label="resolveValue(column.label)"
|
|
219
|
+
v-bind="column.attr"
|
|
220
|
+
>
|
|
221
|
+
</virtual-column>
|
|
222
|
+
<el-table-column
|
|
223
|
+
v-else-if="column.type!=='expand'"
|
|
224
|
+
:key="column.key || column.prop || column.type"
|
|
225
|
+
:type="column.type"
|
|
226
|
+
:prop="column.prop"
|
|
227
|
+
:label="resolveValue(column.label)"
|
|
228
|
+
v-bind="column.attr"
|
|
229
|
+
>
|
|
230
|
+
</el-table-column>
|
|
231
|
+
<el-table-column
|
|
232
|
+
v-else
|
|
233
|
+
:key="column.key || column.prop || column.type"
|
|
234
|
+
:type="column.type"
|
|
235
|
+
:prop="column.prop"
|
|
236
|
+
:label="resolveValue(column.label)"
|
|
237
|
+
v-bind="column.attr"
|
|
238
|
+
>
|
|
239
|
+
<template slot-scope="scope" v-if="column.slot">
|
|
240
|
+
<slot :name="column.slot" :row="scope.row" :index="scope.$index" />
|
|
241
|
+
</template>
|
|
242
|
+
</el-table-column>
|
|
243
|
+
</template>
|
|
244
|
+
<el-table-column
|
|
245
|
+
v-else-if="!column.type && isShow(column)"
|
|
246
|
+
:key="column.key || column.prop || column.type"
|
|
247
|
+
:type="column.type"
|
|
248
|
+
:prop="column.prop"
|
|
249
|
+
:label="resolveValue(column.label)"
|
|
250
|
+
v-bind="column.attr"
|
|
414
251
|
>
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
252
|
+
<!-- column套column -->
|
|
253
|
+
<slot v-if="column.singleHeadMutiColSlot" :name="column.singleHeadMutiColSlot" />
|
|
254
|
+
<!-- -------------- header区域 -------------- -->
|
|
255
|
+
<template slot="header" slot-scope="scope">
|
|
256
|
+
<!-- 操作 -->
|
|
257
|
+
<slot
|
|
258
|
+
v-if="
|
|
259
|
+
columnEdit &&
|
|
260
|
+
column.prop === operationPropKey &&
|
|
261
|
+
columnPosition === 'embed'
|
|
262
|
+
"
|
|
263
|
+
name="operationIconColumnCheck"
|
|
264
|
+
:column="column"
|
|
418
265
|
>
|
|
419
|
-
<
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
:
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
>
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
:class="itemChildren.class"
|
|
441
|
-
:label="itemChildren.label"
|
|
442
|
-
:true-label="itemChildren['true-label']"
|
|
443
|
-
:false-label="itemChildren['false-label']"
|
|
444
|
-
:disabled="resolveValue(itemChildren.disabled)"
|
|
445
|
-
:border="itemChildren.border"
|
|
446
|
-
:size="itemChildren.size"
|
|
447
|
-
:name="itemChildren.name"
|
|
448
|
-
:checked="itemChildren.checked"
|
|
449
|
-
:indeterminate="itemChildren.indeterminate"
|
|
450
|
-
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
451
|
-
v-if="itemChildren.element === 'el-checkbox-button'"
|
|
452
|
-
v-on="itemChildren.events"
|
|
453
|
-
>{{ resolveValue(item.text) }}
|
|
454
|
-
</el-checkbox-button>
|
|
266
|
+
<span style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
267
|
+
<el-tooltip
|
|
268
|
+
popper-class="actionTooltipRef"
|
|
269
|
+
placement="top"
|
|
270
|
+
effect="dark"
|
|
271
|
+
:content="columnDisplayBtnText">
|
|
272
|
+
<i class="iconfont icon-liebiao_xianshiliemu operation-icon-column-check"
|
|
273
|
+
@click="nfColumCheckDialogVisible = true"
|
|
274
|
+
/>
|
|
275
|
+
</el-tooltip>
|
|
276
|
+
</slot>
|
|
277
|
+
<!-- labelTooltip -->
|
|
278
|
+
<template v-else-if="column.labelTooltip">
|
|
279
|
+
<el-tooltip :placement="column.labelTooltipPlacement || 'right'" effect="dark">
|
|
280
|
+
<div slot="content">{{ column.labelTooltip }}</div>
|
|
281
|
+
<span class="bottom-line" style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
282
|
+
</el-tooltip>
|
|
283
|
+
</template>
|
|
284
|
+
<!-- 头部插槽 -->
|
|
285
|
+
<template v-else-if="column.headerSlot">
|
|
286
|
+
<slot :name="column.headerSlot" :$index="scope.$index" :column="scope.column" />
|
|
455
287
|
</template>
|
|
288
|
+
<!-- 默认 -->
|
|
289
|
+
<span v-else>
|
|
290
|
+
{{ resolveValue(column.label) }}
|
|
291
|
+
</span>
|
|
456
292
|
</template>
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
:key="item.key || index"
|
|
478
|
-
v-model="item.value"
|
|
479
|
-
:label="item.label"
|
|
480
|
-
:disabled="resolveValue(item.disabled)"
|
|
481
|
-
:border="item.border"
|
|
482
|
-
:name="item.name"
|
|
483
|
-
:size="item.size"
|
|
484
|
-
:class="item.class"
|
|
485
|
-
:style="getActionBarItemStyle(item)"
|
|
486
|
-
v-if="item.element === 'el-radio'"
|
|
487
|
-
v-on="item.events"
|
|
488
|
-
>{{ resolveValue(item.text) }}
|
|
489
|
-
</el-radio>
|
|
490
|
-
<el-radio-group
|
|
491
|
-
:key="item.key || index"
|
|
492
|
-
v-model="item.value"
|
|
493
|
-
:disabled="resolveValue(item.disabled)"
|
|
494
|
-
:size="item.size"
|
|
495
|
-
:class="item.class"
|
|
496
|
-
:text-color="item['text-color']"
|
|
497
|
-
:fill="item['fill']"
|
|
498
|
-
:style="getActionBarItemStyle(item)"
|
|
499
|
-
v-if="item.element === 'el-radio-group'"
|
|
500
|
-
v-on="item.events"
|
|
501
|
-
>
|
|
502
|
-
<template v-if="item.children?.length">
|
|
503
|
-
<template
|
|
504
|
-
v-for="(itemChildren, j) in item.children"
|
|
293
|
+
<!-- -------------- 内容区域 -------------- -->
|
|
294
|
+
<template slot-scope="scope">
|
|
295
|
+
<!-- 插槽 -->
|
|
296
|
+
<slot
|
|
297
|
+
v-if="column.slot"
|
|
298
|
+
:name="column.slot"
|
|
299
|
+
:row="scope.row"
|
|
300
|
+
:index="scope.$index"
|
|
301
|
+
/>
|
|
302
|
+
<!-- render -->
|
|
303
|
+
<render-component
|
|
304
|
+
v-else-if="column.render"
|
|
305
|
+
:render="column.render"
|
|
306
|
+
:row="scope.row"
|
|
307
|
+
/>
|
|
308
|
+
<!-- 操作 -->
|
|
309
|
+
<nf-action
|
|
310
|
+
v-else-if="column.prop === operationPropKey && !hasOperationSlot"
|
|
311
|
+
:span="column.operationSpan || 0"
|
|
312
|
+
:unique="scope.index"
|
|
505
313
|
>
|
|
506
|
-
<
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
v-
|
|
532
|
-
|
|
533
|
-
|
|
314
|
+
<template v-for="(item, index) in getOperationListLocal(column, scope)">
|
|
315
|
+
<nf-button
|
|
316
|
+
v-if="!resolveValue(item.destroy, scope.row, scope)"
|
|
317
|
+
:size="resolveValue(item.size || 'mini', scope.row, scope)"
|
|
318
|
+
:type="resolveValue(item.type || 'primary', scope.row, scope, scope.row, scope)"
|
|
319
|
+
:text="resolveValue(item.text === undefined ? true : item.text, scope.row, scope)"
|
|
320
|
+
:disabled="resolveValue(item.disabled, scope.row, scope)"
|
|
321
|
+
:loading="resolveValue(item.loading, scope.row, scope)"
|
|
322
|
+
:class="resolveValue(item.class, scope.row, scope)"
|
|
323
|
+
:plain="resolveValue(item.plain, scope.row, scope)"
|
|
324
|
+
:icon="resolveValue(item.icon, scope.row, scope)"
|
|
325
|
+
:round="resolveValue(item.round, scope.row, scope)"
|
|
326
|
+
:circle="resolveValue(item.circle, scope.row, scope)"
|
|
327
|
+
:style="resolveValue(item.style, scope.row, scope)"
|
|
328
|
+
v-on="eventsOperationListBtns(item, scope)"
|
|
329
|
+
:key="item.key || index"
|
|
330
|
+
>{{ resolveValue(item.name, scope.row, scope) }}
|
|
331
|
+
</nf-button>
|
|
332
|
+
</template>
|
|
333
|
+
</nf-action>
|
|
334
|
+
<span v-else-if="column.attr?.formatter">
|
|
335
|
+
{{ column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index) }}
|
|
336
|
+
</span>
|
|
337
|
+
<template v-else-if="column.optionsEnum">
|
|
338
|
+
<nf-tag
|
|
339
|
+
v-if="column.optionsTag[scope.row[column.prop]]"
|
|
340
|
+
:type='column.optionsTag[scope.row[column.prop]]'
|
|
341
|
+
:value="column.optionsEnum[scope.row[column.prop]]"
|
|
342
|
+
/>
|
|
343
|
+
<span v-else>
|
|
344
|
+
{{ column.optionsEnum[scope.row[column.prop]] }}
|
|
345
|
+
</span>
|
|
534
346
|
</template>
|
|
347
|
+
<span v-else>
|
|
348
|
+
{{ scope.row[column.prop] }}{{ column.unit }}
|
|
349
|
+
</span>
|
|
535
350
|
</template>
|
|
536
|
-
</el-
|
|
537
|
-
<el-radio-button
|
|
538
|
-
:key="item.key || index"
|
|
539
|
-
v-model="item.value"
|
|
540
|
-
:label="item.label"
|
|
541
|
-
:disabled="resolveValue(item.disabled)"
|
|
542
|
-
:border="item.border"
|
|
543
|
-
:name="item.name"
|
|
544
|
-
:size="item.size"
|
|
545
|
-
:class="item.class"
|
|
546
|
-
:style="getActionBarItemStyle(item)"
|
|
547
|
-
v-if="item.element === 'el-radio-button'"
|
|
548
|
-
v-on="item.events"
|
|
549
|
-
>{{ resolveValue(item.text) }}
|
|
550
|
-
</el-radio-button>
|
|
551
|
-
<el-input
|
|
552
|
-
:key="item.key || index"
|
|
553
|
-
v-model="item.value"
|
|
554
|
-
:class="item.class"
|
|
555
|
-
:show-word-limit="item['show-word-limit']"
|
|
556
|
-
:show-password="item['show-password']"
|
|
557
|
-
:prefix-icon="item['prefix-icon']"
|
|
558
|
-
:suffix-icon="item['suffix-icon']"
|
|
559
|
-
:validate-event="item['validate-event']"
|
|
560
|
-
:type="item.type"
|
|
561
|
-
:placeholder="item.placeholder"
|
|
562
|
-
:disabled="resolveValue(item.disabled)"
|
|
563
|
-
:size="item.size"
|
|
564
|
-
:name="item.name"
|
|
565
|
-
:max="item.max"
|
|
566
|
-
:min="item.min"
|
|
567
|
-
:step="item.step"
|
|
568
|
-
:label="item.label"
|
|
569
|
-
:maxlength="item.maxlength"
|
|
570
|
-
:minlength="item.minlength"
|
|
571
|
-
:clearable="item.clearable"
|
|
572
|
-
:rows="item.rows"
|
|
573
|
-
:autosize="item.autosize"
|
|
574
|
-
:autocomplete="item.autocomplete"
|
|
575
|
-
:readonly="item.readonly"
|
|
576
|
-
:resize="item.resize"
|
|
577
|
-
:autofocus="item.autofocus"
|
|
578
|
-
:form="item.form"
|
|
579
|
-
:tabindex="item.tabindex"
|
|
580
|
-
:style="getActionBarItemStyle(item)"
|
|
581
|
-
v-if="item.element === 'el-input'"
|
|
582
|
-
v-on="item.events"
|
|
583
|
-
>
|
|
584
|
-
<slot v-if="item.slot?.prefix" :name="item.slot.prefix" slot="prefix" />
|
|
585
|
-
<slot v-if="item.slot?.suffix" :name="item.slot.suffix" slot="suffix" />
|
|
586
|
-
<slot v-if="item.slot?.prepend" :name="item.slot.prepend" slot="prepend" />
|
|
587
|
-
<slot v-if="item.slot?.append" :name="item.slot.append" slot="append" />
|
|
588
|
-
</el-input>
|
|
589
|
-
<el-autocomplete
|
|
590
|
-
:key="item.key || index"
|
|
591
|
-
v-model="item.value"
|
|
592
|
-
:class="item.class"
|
|
593
|
-
:style="getActionBarItemStyle(item)"
|
|
594
|
-
:value-key="item['value-key']"
|
|
595
|
-
:fetch-suggestions="item['fetch-suggestions']"
|
|
596
|
-
:popper-class="item['popper-class']"
|
|
597
|
-
:trigger-on-focus="item['trigger-on-focus']"
|
|
598
|
-
:select-when-unmatched="item['select-when-unmatched']"
|
|
599
|
-
:hide-loading="item['hide-loading']"
|
|
600
|
-
:popper-append-to-body="item['popper-append-to-body']"
|
|
601
|
-
:highlight-first-item="item['highlight-first-item']"
|
|
602
|
-
:prefix-icon="item['prefix-icon']"
|
|
603
|
-
:suffix-icon="item['suffix-icon']"
|
|
604
|
-
:placeholder="item.placeholder"
|
|
605
|
-
:disabled="item.disabled"
|
|
606
|
-
:debounce="item.debounce"
|
|
607
|
-
:placement="item.placement"
|
|
608
|
-
:label="item.label"
|
|
609
|
-
:name="item.name"
|
|
610
|
-
v-if="item.element === 'el-autocomplete'"
|
|
611
|
-
v-on="item.events"
|
|
612
|
-
>
|
|
613
|
-
<slot v-if="item.slot?.prefix" :name="item.slot.prefix" slot="prefix" />
|
|
614
|
-
<slot v-if="item.slot?.suffix" :name="item.slot.suffix" slot="suffix" />
|
|
615
|
-
<slot v-if="item.slot?.prepend" :name="item.slot.prepend" slot="prepend" />
|
|
616
|
-
<slot v-if="item.slot?.append" :name="item.slot.append" slot="append" />
|
|
617
|
-
</el-autocomplete>
|
|
618
|
-
<el-switch
|
|
619
|
-
:key="item.key || index"
|
|
620
|
-
v-model="item.value"
|
|
621
|
-
:disabled="resolveValue(item.disabled)"
|
|
622
|
-
:width="item.width"
|
|
623
|
-
:name="item.name"
|
|
624
|
-
:active-icon-class="item['active-icon-class']"
|
|
625
|
-
:inactive-icon-class="item['inactive-icon-class']"
|
|
626
|
-
:active-text="item['active-text']"
|
|
627
|
-
:inactive-text="item['inactive-text']"
|
|
628
|
-
:active-value="item['active-value']"
|
|
629
|
-
:inactive-value="item['inactive-value']"
|
|
630
|
-
:active-color="item['active-color']"
|
|
631
|
-
:inactive-color="item['inactive-color']"
|
|
632
|
-
:validate-event="item['validate-event']"
|
|
633
|
-
:class="item.class"
|
|
634
|
-
:style="getActionBarItemStyle(item)"
|
|
635
|
-
v-if="item.element === 'el-switch'"
|
|
636
|
-
v-on="item.events"
|
|
637
|
-
>{{ resolveValue(item.text) }}
|
|
638
|
-
</el-switch>
|
|
639
|
-
<el-input-number
|
|
640
|
-
:key="item.key || index"
|
|
641
|
-
v-model="item.value"
|
|
642
|
-
:class="item.class"
|
|
643
|
-
:min="item.min"
|
|
644
|
-
:max="item.max"
|
|
645
|
-
:step="item.step"
|
|
646
|
-
:step-strictly="item['step-strictly']"
|
|
647
|
-
:precision="item.precision"
|
|
648
|
-
:size="item.size"
|
|
649
|
-
:disabled="resolveValue(item.disabled)"
|
|
650
|
-
:controls="item.controls"
|
|
651
|
-
:controls-position="item['controls-position']"
|
|
652
|
-
:name="item.name"
|
|
653
|
-
:label="item.label"
|
|
654
|
-
:placeholder="item.placeholder"
|
|
655
|
-
:style="getActionBarItemStyle(item)"
|
|
656
|
-
v-if="item.element === 'el-input-number'"
|
|
657
|
-
v-on="item.events"
|
|
658
|
-
></el-input-number>
|
|
659
|
-
<span
|
|
660
|
-
:key="item.key || index"
|
|
661
|
-
:class="item.class"
|
|
662
|
-
v-if="item.element === 'text'"
|
|
663
|
-
:style="getActionBarItemStyle(item)"
|
|
664
|
-
v-on="item.events"
|
|
665
|
-
v-bind="item.attr"
|
|
666
|
-
>
|
|
667
|
-
{{ resolveValue(item.value) }}
|
|
668
|
-
</span>
|
|
351
|
+
</el-table-column>
|
|
669
352
|
</template>
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
353
|
+
<slot name="append" slot="append"></slot>
|
|
354
|
+
<slot name="empty" slot="empty">
|
|
355
|
+
<nf-empty slot="empty" :image-size="emptyImageSize" :description="emptyText"></nf-empty>
|
|
356
|
+
</slot>
|
|
357
|
+
</el-table>
|
|
358
|
+
</virtual-scroll>
|
|
359
|
+
<div ref="nfTableActionContainerRef" class="nf-action-box nf-clearfix">
|
|
360
|
+
<slot name="actionBar" ref="nfTableActionBarRef">
|
|
361
|
+
<template v-if="actionBarOptList?.length && !hasActionBarSlot">
|
|
362
|
+
<template v-for="(item, index) in actionBarOptList">
|
|
363
|
+
<nf-button
|
|
364
|
+
:key="item.key || index"
|
|
365
|
+
v-if="item.element === 'el-button'"
|
|
366
|
+
:size="resolveValue(item.size || 'mini')"
|
|
367
|
+
:type="resolveValue(item.type || 'text')"
|
|
368
|
+
:text="resolveValue(item.text === undefined ? true : item.text)"
|
|
369
|
+
:disabled="resolveValue(item.disabled)"
|
|
370
|
+
:loading="resolveValue(item.loading)"
|
|
371
|
+
:class="resolveValue(item.class)"
|
|
372
|
+
:plain="resolveValue(item.plain)"
|
|
373
|
+
:icon="resolveValue(item.icon)"
|
|
374
|
+
:round="resolveValue(item.round)"
|
|
375
|
+
:circle="resolveValue(item.circle)"
|
|
376
|
+
:style="getActionBarItemStyle(item, {marginLeft: '0px'})"
|
|
377
|
+
v-on="item.events"
|
|
378
|
+
>{{ resolveValue(item.value) }}
|
|
379
|
+
</nf-button>
|
|
380
|
+
<el-checkbox
|
|
381
|
+
:key="item.key || index"
|
|
382
|
+
v-model="item.value"
|
|
383
|
+
:class="item.class"
|
|
384
|
+
:label="item.label"
|
|
385
|
+
:true-label="item['true-label']"
|
|
386
|
+
:false-label="item['false-label']"
|
|
387
|
+
:disabled="resolveValue(item.disabled)"
|
|
388
|
+
:border="item.border"
|
|
389
|
+
:size="item.size"
|
|
390
|
+
:name="item.name"
|
|
391
|
+
:checked="item.checked"
|
|
392
|
+
:indeterminate="item.indeterminate"
|
|
393
|
+
:style="getActionBarItemStyle(item)"
|
|
394
|
+
v-if="item.element === 'el-checkbox'"
|
|
395
|
+
v-on="item.events"
|
|
396
|
+
>{{ resolveValue(item.text) }}
|
|
397
|
+
</el-checkbox>
|
|
398
|
+
<el-checkbox-group
|
|
399
|
+
:key="item.key || index"
|
|
400
|
+
v-model="item.value"
|
|
401
|
+
:class="item.class"
|
|
402
|
+
:label="item.label"
|
|
403
|
+
:true-label="item['true-label']"
|
|
404
|
+
:false-label="item['false-label']"
|
|
405
|
+
:disabled="resolveValue(item.disabled)"
|
|
406
|
+
:border="item.border"
|
|
407
|
+
:size="item.size"
|
|
408
|
+
:name="item.name"
|
|
409
|
+
:checked="item.checked"
|
|
410
|
+
:indeterminate="item.indeterminate"
|
|
411
|
+
:style="getActionBarItemStyle(item)"
|
|
412
|
+
v-if="item.element === 'el-checkbox-group'"
|
|
413
|
+
v-on="item.events"
|
|
414
|
+
>
|
|
415
|
+
<template v-if="item.children?.length">
|
|
416
|
+
<template
|
|
417
|
+
v-for="(itemChildren, j) in item.children"
|
|
418
|
+
>
|
|
419
|
+
<el-checkbox
|
|
420
|
+
:key="itemChildren.key || j"
|
|
421
|
+
v-model="itemChildren.value"
|
|
422
|
+
:class="itemChildren.class"
|
|
423
|
+
:label="itemChildren.label"
|
|
424
|
+
:true-label="itemChildren['true-label']"
|
|
425
|
+
:false-label="itemChildren['false-label']"
|
|
426
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
427
|
+
:border="itemChildren.border"
|
|
428
|
+
:size="itemChildren.size"
|
|
429
|
+
:name="itemChildren.name"
|
|
430
|
+
:checked="itemChildren.checked"
|
|
431
|
+
:indeterminate="itemChildren.indeterminate"
|
|
432
|
+
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
433
|
+
v-if="itemChildren.element === 'el-checkbox'"
|
|
434
|
+
v-on="itemChildren.events"
|
|
435
|
+
>{{ resolveValue(item.text) }}
|
|
436
|
+
</el-checkbox>
|
|
437
|
+
<el-checkbox-button
|
|
438
|
+
:key="itemChildren.key || j"
|
|
439
|
+
v-model="itemChildren.value"
|
|
440
|
+
:class="itemChildren.class"
|
|
441
|
+
:label="itemChildren.label"
|
|
442
|
+
:true-label="itemChildren['true-label']"
|
|
443
|
+
:false-label="itemChildren['false-label']"
|
|
444
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
445
|
+
:border="itemChildren.border"
|
|
446
|
+
:size="itemChildren.size"
|
|
447
|
+
:name="itemChildren.name"
|
|
448
|
+
:checked="itemChildren.checked"
|
|
449
|
+
:indeterminate="itemChildren.indeterminate"
|
|
450
|
+
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
451
|
+
v-if="itemChildren.element === 'el-checkbox-button'"
|
|
452
|
+
v-on="itemChildren.events"
|
|
453
|
+
>{{ resolveValue(item.text) }}
|
|
454
|
+
</el-checkbox-button>
|
|
455
|
+
</template>
|
|
456
|
+
</template>
|
|
457
|
+
</el-checkbox-group>
|
|
458
|
+
<el-checkbox-button
|
|
459
|
+
:key="item.key || index"
|
|
460
|
+
v-model="item.value"
|
|
461
|
+
:class="item.class"
|
|
462
|
+
:label="item.label"
|
|
463
|
+
:true-label="item['true-label']"
|
|
464
|
+
:false-label="item['false-label']"
|
|
465
|
+
:disabled="resolveValue(item.disabled)"
|
|
466
|
+
:border="item.border"
|
|
467
|
+
:size="item.size"
|
|
468
|
+
:name="item.name"
|
|
469
|
+
:checked="item.checked"
|
|
470
|
+
:indeterminate="item.indeterminate"
|
|
471
|
+
:style="getActionBarItemStyle(item)"
|
|
472
|
+
v-if="item.element === 'el-checkbox-button'"
|
|
473
|
+
v-on="item.events"
|
|
474
|
+
>{{ resolveValue(item.text) }}
|
|
475
|
+
</el-checkbox-button>
|
|
476
|
+
<el-radio
|
|
477
|
+
:key="item.key || index"
|
|
478
|
+
v-model="item.value"
|
|
479
|
+
:label="item.label"
|
|
480
|
+
:disabled="resolveValue(item.disabled)"
|
|
481
|
+
:border="item.border"
|
|
482
|
+
:name="item.name"
|
|
483
|
+
:size="item.size"
|
|
484
|
+
:class="item.class"
|
|
485
|
+
:style="getActionBarItemStyle(item)"
|
|
486
|
+
v-if="item.element === 'el-radio'"
|
|
487
|
+
v-on="item.events"
|
|
488
|
+
>{{ resolveValue(item.text) }}
|
|
489
|
+
</el-radio>
|
|
490
|
+
<el-radio-group
|
|
491
|
+
:key="item.key || index"
|
|
492
|
+
v-model="item.value"
|
|
493
|
+
:disabled="resolveValue(item.disabled)"
|
|
494
|
+
:size="item.size"
|
|
495
|
+
:class="item.class"
|
|
496
|
+
:text-color="item['text-color']"
|
|
497
|
+
:fill="item['fill']"
|
|
498
|
+
:style="getActionBarItemStyle(item)"
|
|
499
|
+
v-if="item.element === 'el-radio-group'"
|
|
500
|
+
v-on="item.events"
|
|
501
|
+
>
|
|
502
|
+
<template v-if="item.children?.length">
|
|
503
|
+
<template
|
|
504
|
+
v-for="(itemChildren, j) in item.children"
|
|
505
|
+
>
|
|
506
|
+
<el-radio
|
|
507
|
+
:key="itemChildren.key || j"
|
|
508
|
+
v-model="itemChildren.value"
|
|
509
|
+
:label="itemChildren.label"
|
|
510
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
511
|
+
:border="itemChildren.border"
|
|
512
|
+
:name="itemChildren.name"
|
|
513
|
+
:size="itemChildren.size"
|
|
514
|
+
:class="itemChildren.class"
|
|
515
|
+
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
516
|
+
v-if="itemChildren.element === 'el-radio'"
|
|
517
|
+
v-on="itemChildren.events"
|
|
518
|
+
>{{ resolveValue(item.text) }}
|
|
519
|
+
</el-radio>
|
|
520
|
+
<el-radio-button
|
|
521
|
+
:key="itemChildren.key || j"
|
|
522
|
+
v-model="itemChildren.value"
|
|
523
|
+
:label="itemChildren.label"
|
|
524
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
525
|
+
:border="itemChildren.border"
|
|
526
|
+
:name="itemChildren.name"
|
|
527
|
+
:size="itemChildren.size"
|
|
528
|
+
:class="itemChildren.class"
|
|
529
|
+
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
530
|
+
v-if="itemChildren.element === 'el-radio-button'"
|
|
531
|
+
v-on="itemChildren.events"
|
|
532
|
+
>{{ resolveValue(item.text) }}
|
|
533
|
+
</el-radio-button>
|
|
534
|
+
</template>
|
|
535
|
+
</template>
|
|
536
|
+
</el-radio-group>
|
|
537
|
+
<el-radio-button
|
|
538
|
+
:key="item.key || index"
|
|
539
|
+
v-model="item.value"
|
|
540
|
+
:label="item.label"
|
|
541
|
+
:disabled="resolveValue(item.disabled)"
|
|
542
|
+
:border="item.border"
|
|
543
|
+
:name="item.name"
|
|
544
|
+
:size="item.size"
|
|
545
|
+
:class="item.class"
|
|
546
|
+
:style="getActionBarItemStyle(item)"
|
|
547
|
+
v-if="item.element === 'el-radio-button'"
|
|
548
|
+
v-on="item.events"
|
|
549
|
+
>{{ resolveValue(item.text) }}
|
|
550
|
+
</el-radio-button>
|
|
551
|
+
<el-input
|
|
552
|
+
:key="item.key || index"
|
|
553
|
+
v-model="item.value"
|
|
554
|
+
:class="item.class"
|
|
555
|
+
:show-word-limit="item['show-word-limit']"
|
|
556
|
+
:show-password="item['show-password']"
|
|
557
|
+
:prefix-icon="item['prefix-icon']"
|
|
558
|
+
:suffix-icon="item['suffix-icon']"
|
|
559
|
+
:validate-event="item['validate-event']"
|
|
560
|
+
:type="item.type"
|
|
561
|
+
:placeholder="item.placeholder"
|
|
562
|
+
:disabled="resolveValue(item.disabled)"
|
|
563
|
+
:size="item.size"
|
|
564
|
+
:name="item.name"
|
|
565
|
+
:max="item.max"
|
|
566
|
+
:min="item.min"
|
|
567
|
+
:step="item.step"
|
|
568
|
+
:label="item.label"
|
|
569
|
+
:maxlength="item.maxlength"
|
|
570
|
+
:minlength="item.minlength"
|
|
571
|
+
:clearable="item.clearable"
|
|
572
|
+
:rows="item.rows"
|
|
573
|
+
:autosize="item.autosize"
|
|
574
|
+
:autocomplete="item.autocomplete"
|
|
575
|
+
:readonly="item.readonly"
|
|
576
|
+
:resize="item.resize"
|
|
577
|
+
:autofocus="item.autofocus"
|
|
578
|
+
:form="item.form"
|
|
579
|
+
:tabindex="item.tabindex"
|
|
580
|
+
:style="getActionBarItemStyle(item)"
|
|
581
|
+
v-if="item.element === 'el-input'"
|
|
582
|
+
v-on="item.events"
|
|
583
|
+
>
|
|
584
|
+
<slot v-if="item.slot?.prefix" :name="item.slot.prefix" slot="prefix" />
|
|
585
|
+
<slot v-if="item.slot?.suffix" :name="item.slot.suffix" slot="suffix" />
|
|
586
|
+
<slot v-if="item.slot?.prepend" :name="item.slot.prepend" slot="prepend" />
|
|
587
|
+
<slot v-if="item.slot?.append" :name="item.slot.append" slot="append" />
|
|
588
|
+
</el-input>
|
|
589
|
+
<el-autocomplete
|
|
590
|
+
:key="item.key || index"
|
|
591
|
+
v-model="item.value"
|
|
592
|
+
:class="item.class"
|
|
593
|
+
:style="getActionBarItemStyle(item)"
|
|
594
|
+
:value-key="item['value-key']"
|
|
595
|
+
:fetch-suggestions="item['fetch-suggestions']"
|
|
596
|
+
:popper-class="item['popper-class']"
|
|
597
|
+
:trigger-on-focus="item['trigger-on-focus']"
|
|
598
|
+
:select-when-unmatched="item['select-when-unmatched']"
|
|
599
|
+
:hide-loading="item['hide-loading']"
|
|
600
|
+
:popper-append-to-body="item['popper-append-to-body']"
|
|
601
|
+
:highlight-first-item="item['highlight-first-item']"
|
|
602
|
+
:prefix-icon="item['prefix-icon']"
|
|
603
|
+
:suffix-icon="item['suffix-icon']"
|
|
604
|
+
:placeholder="item.placeholder"
|
|
605
|
+
:disabled="item.disabled"
|
|
606
|
+
:debounce="item.debounce"
|
|
607
|
+
:placement="item.placement"
|
|
608
|
+
:label="item.label"
|
|
609
|
+
:name="item.name"
|
|
610
|
+
v-if="item.element === 'el-autocomplete'"
|
|
611
|
+
v-on="item.events"
|
|
612
|
+
>
|
|
613
|
+
<slot v-if="item.slot?.prefix" :name="item.slot.prefix" slot="prefix" />
|
|
614
|
+
<slot v-if="item.slot?.suffix" :name="item.slot.suffix" slot="suffix" />
|
|
615
|
+
<slot v-if="item.slot?.prepend" :name="item.slot.prepend" slot="prepend" />
|
|
616
|
+
<slot v-if="item.slot?.append" :name="item.slot.append" slot="append" />
|
|
617
|
+
</el-autocomplete>
|
|
618
|
+
<el-switch
|
|
619
|
+
:key="item.key || index"
|
|
620
|
+
v-model="item.value"
|
|
621
|
+
:disabled="resolveValue(item.disabled)"
|
|
622
|
+
:width="item.width"
|
|
623
|
+
:name="item.name"
|
|
624
|
+
:active-icon-class="item['active-icon-class']"
|
|
625
|
+
:inactive-icon-class="item['inactive-icon-class']"
|
|
626
|
+
:active-text="item['active-text']"
|
|
627
|
+
:inactive-text="item['inactive-text']"
|
|
628
|
+
:active-value="item['active-value']"
|
|
629
|
+
:inactive-value="item['inactive-value']"
|
|
630
|
+
:active-color="item['active-color']"
|
|
631
|
+
:inactive-color="item['inactive-color']"
|
|
632
|
+
:validate-event="item['validate-event']"
|
|
633
|
+
:class="item.class"
|
|
634
|
+
:style="getActionBarItemStyle(item)"
|
|
635
|
+
v-if="item.element === 'el-switch'"
|
|
636
|
+
v-on="item.events"
|
|
637
|
+
>{{ resolveValue(item.text) }}
|
|
638
|
+
</el-switch>
|
|
639
|
+
<el-input-number
|
|
640
|
+
:key="item.key || index"
|
|
641
|
+
v-model="item.value"
|
|
642
|
+
:class="item.class"
|
|
643
|
+
:min="item.min"
|
|
644
|
+
:max="item.max"
|
|
645
|
+
:step="item.step"
|
|
646
|
+
:step-strictly="item['step-strictly']"
|
|
647
|
+
:precision="item.precision"
|
|
648
|
+
:size="item.size"
|
|
649
|
+
:disabled="resolveValue(item.disabled)"
|
|
650
|
+
:controls="item.controls"
|
|
651
|
+
:controls-position="item['controls-position']"
|
|
652
|
+
:name="item.name"
|
|
653
|
+
:label="item.label"
|
|
654
|
+
:placeholder="item.placeholder"
|
|
655
|
+
:style="getActionBarItemStyle(item)"
|
|
656
|
+
v-if="item.element === 'el-input-number'"
|
|
657
|
+
v-on="item.events"
|
|
658
|
+
></el-input-number>
|
|
659
|
+
<span
|
|
660
|
+
:key="item.key || index"
|
|
661
|
+
:class="item.class"
|
|
662
|
+
v-if="item.element === 'text'"
|
|
663
|
+
:style="getActionBarItemStyle(item)"
|
|
664
|
+
v-on="item.events"
|
|
665
|
+
v-bind="item.attr"
|
|
666
|
+
>
|
|
667
|
+
{{ resolveValue(item.value) }}
|
|
668
|
+
</span>
|
|
669
|
+
</template>
|
|
670
|
+
</template>
|
|
671
|
+
</slot>
|
|
672
|
+
<slot name="pagination">
|
|
673
|
+
<el-pagination
|
|
674
|
+
ref="nfTablePaginationRef"
|
|
675
|
+
v-if="renderPage"
|
|
676
|
+
v-bind="pageAttrer"
|
|
677
|
+
v-on="pageEvents"
|
|
678
|
+
:current-page="cPageAttrs['current-page']"
|
|
679
|
+
:page-size="cPageAttrs['page-size']"
|
|
680
|
+
class="nf-pagination-box nf-fr"
|
|
681
|
+
@size-change="handleSizeChange"
|
|
682
|
+
@current-change="handleCurrentChange"
|
|
683
|
+
/>
|
|
684
|
+
</slot>
|
|
685
|
+
</div>
|
|
685
686
|
</div>
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
:cancel-text="columnCheckCancelButtonText"
|
|
691
|
-
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
692
|
-
|
|
693
|
-
:show.sync="nfColumCheckDialogVisible"
|
|
694
|
-
:table-columns="processedColumns"
|
|
695
|
-
:column-edit="columnEdit"
|
|
696
|
-
:storage-key="cStorageKey"
|
|
697
|
-
:width="columnCheckWidth"
|
|
698
|
-
:modal-append-to-body="columnCheckModalAppendToBody"
|
|
699
|
-
:modal="columnCheckModal"
|
|
700
|
-
:fullscreen="columnCheckFullscreen"
|
|
701
|
-
:top="columnCheckTop"
|
|
702
|
-
:append-to-body="columnCheckAppendToBody"
|
|
703
|
-
:lock-scroll="columnCheckLockScroll"
|
|
704
|
-
:custom-class="columnCheckCustomClass"
|
|
705
|
-
:close-onlick-modal="columnCheckCloseOnlickModal"
|
|
706
|
-
:close-on-press-escape="columnCheckCloseOnPressEscape"
|
|
707
|
-
:show-close="columnCheckShowClose"
|
|
708
|
-
:before-close="columnCheckBeforeClose"
|
|
709
|
-
:center="columnCheckCenter"
|
|
710
|
-
:destroy-on-close="columnCheckDestroyOnClose"
|
|
711
|
-
:operation-prop-key="operationPropKey"
|
|
712
|
-
|
|
713
|
-
v-if="nfColumCheckDialogVisible && checkMode === 'dialog'"
|
|
714
|
-
ref="columnCheckDialog"
|
|
715
|
-
@save="fieldsConfirm"
|
|
716
|
-
>
|
|
717
|
-
<slot slot="tableColumnEditDialogTitle" name="title"></slot>
|
|
718
|
-
<slot slot="tableColumnEditDialogFooter" name="footer"></slot>
|
|
719
|
-
</column-check-dialog>
|
|
720
|
-
<nf-drawer
|
|
721
|
-
:title="columnCheckTitle"
|
|
722
|
-
:cancel-button-text="columnCheckCancelButtonText"
|
|
723
|
-
:confirm-button-text="columnCheckConfirmButtonText"
|
|
724
|
-
v-bind="drawerProps"
|
|
725
|
-
ref="columnCheckNfDrawer"
|
|
726
|
-
size="680px"
|
|
727
|
-
:visible.sync="nfColumCheckDialogVisible"
|
|
728
|
-
:tabs="columnCheckTabs"
|
|
729
|
-
:destroy-on-close="true"
|
|
730
|
-
:currentTab="columnCheckCurrentTab"
|
|
731
|
-
|
|
732
|
-
v-if="checkMode === 'drawer'"
|
|
733
|
-
@confirm="columnCheckConfirm"
|
|
734
|
-
@changeTab="(done) => $emit('changeTab', done)"
|
|
735
|
-
@cancel="(name) => $emit('cancel', name)"
|
|
736
|
-
>
|
|
737
|
-
<slot slot="tableColumnEditDialogTitle" name="title" />
|
|
738
|
-
<slot slot="tableColumnEditDialogFooter" name="footer" />
|
|
739
|
-
<column-check-drawer
|
|
740
|
-
:search-placeholder="columnCheckSearchPlaceholder"
|
|
741
|
-
:fixed-left-desc="columnCheckFixedLeftDesc"
|
|
742
|
-
:clear-desc="columnCheckClearDesc"
|
|
743
|
-
:no-fixed-desc="columnCheckNoFixedDesc"
|
|
687
|
+
<column-check-dialog
|
|
688
|
+
:title="columnCheckTitle"
|
|
689
|
+
:confirm-text="columnCheckConfirmButtonText"
|
|
690
|
+
:cancel-text="columnCheckCancelButtonText"
|
|
744
691
|
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
745
|
-
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
746
|
-
:get-checked-length-desc="columnCheckGetCheckedLengthDesc"
|
|
747
|
-
:get-all-check-desc="columnCheckGetAllCheckDesc"
|
|
748
|
-
ref="columnCheckDrawer"
|
|
749
692
|
|
|
693
|
+
:show.sync="nfColumCheckDialogVisible"
|
|
694
|
+
:table-columns="processedColumns"
|
|
750
695
|
:column-edit="columnEdit"
|
|
751
|
-
:operation-prop-key="operationPropKey"
|
|
752
696
|
:storage-key="cStorageKey"
|
|
753
|
-
:
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
import ColumnCheckDialog from './nf-column-check-dialog.vue'
|
|
769
|
-
import ColumnCheckDrawer from './nf-column-check-drawer.vue'
|
|
770
|
-
import RenderComponent from './nf-render-component.vue'
|
|
771
|
-
import { Loading } from 'element-ui'
|
|
772
|
-
import {
|
|
773
|
-
computed,
|
|
774
|
-
getCurrentInstance,
|
|
775
|
-
nextTick,
|
|
776
|
-
onMounted,
|
|
777
|
-
onBeforeMount,
|
|
778
|
-
ref,
|
|
779
|
-
watch,
|
|
780
|
-
set,
|
|
781
|
-
reactive
|
|
782
|
-
} from 'vue-demi'
|
|
783
|
-
import {
|
|
784
|
-
NfTableColumnAttributes,
|
|
785
|
-
ElTableColumnAttributes,
|
|
786
|
-
ElTableAttributes,
|
|
787
|
-
ElTableEventKey,
|
|
788
|
-
ElPaginationEventKey,
|
|
789
|
-
ElPaginationAttributes,
|
|
790
|
-
NfSearchFormAttributes,
|
|
791
|
-
NfSearchFormEventKey,
|
|
792
|
-
NfTableActionBtnAttributes
|
|
793
|
-
} from './types'
|
|
794
|
-
import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
795
|
-
import { CachedManager, resolveValue } from '@94ai/common-utils'
|
|
796
|
-
import { useRoute } from 'vue-router/composables'
|
|
797
|
-
import VirtualScroll, { VirtualColumn } from 'el-table-virtual-scroll'
|
|
798
|
-
|
|
799
|
-
const props = withDefaults(defineProps<{
|
|
800
|
-
viewIdentity?: string,
|
|
801
|
-
data?: Record<string, any>[],
|
|
802
|
-
columns?: NfTableColumnAttributes[] | any,
|
|
803
|
-
searchFormAttrs?: NfSearchFormAttributes,
|
|
804
|
-
searchFormEvents?: Partial<Record<NfSearchFormEventKey, Function>>,
|
|
805
|
-
tableAttrs?: ElTableAttributes,
|
|
806
|
-
tableEvents?: Partial<Record<ElTableEventKey, Function>>,
|
|
807
|
-
pageAttrs?: ElPaginationAttributes,
|
|
808
|
-
pageEvents?: Partial<Record<ElPaginationEventKey, Function>>,
|
|
809
|
-
actionBarOptList?: NfTableActionBtnAttributes[],
|
|
810
|
-
initSearchApi?: boolean | undefined, // 初始化自动查询
|
|
811
|
-
pageChangeSearchApi?: boolean | undefined, // 分页切换的时候自动查询
|
|
812
|
-
pageKeys?: string[], // 分页使用的字段
|
|
813
|
-
setEasyConf?: boolean, // 简易配置
|
|
814
|
-
detectResize?: boolean, // 检测表格内容展开自动同步fix column和 unfix column
|
|
815
|
-
/**
|
|
816
|
-
* 开启表格列拖拽缓存记录
|
|
817
|
-
*/
|
|
818
|
-
dragCached?: boolean,
|
|
819
|
-
/**
|
|
820
|
-
* 表格空数据时空组件size
|
|
821
|
-
*/
|
|
822
|
-
emptyImageSize?: number,
|
|
823
|
-
/**
|
|
824
|
-
* 表格空数据时空组件描述文字
|
|
825
|
-
*/
|
|
826
|
-
emptyText?: string,
|
|
827
|
-
/**
|
|
828
|
-
* 固定窗口满屏table自动计算table高度
|
|
829
|
-
*/
|
|
830
|
-
calHeight?: boolean,
|
|
831
|
-
/**
|
|
832
|
-
* 列编辑显示开关
|
|
833
|
-
*/
|
|
834
|
-
columnEdit?: boolean,
|
|
835
|
-
columnPosition?: 'free' | 'embed',
|
|
836
|
-
checkMode?: 'dialog' | 'drawer',
|
|
837
|
-
priority?: 'cached' | 'value',
|
|
838
|
-
storageKey?: string
|
|
839
|
-
searchFormStorageKey?: string
|
|
840
|
-
/**
|
|
841
|
-
* 列编辑要显示的表格项字段
|
|
842
|
-
*/
|
|
843
|
-
showColumn?: string[],
|
|
844
|
-
selectEmptyWarningTips?: string,
|
|
845
|
-
/**
|
|
846
|
-
* 列编辑按钮修饰
|
|
847
|
-
*/
|
|
848
|
-
columnDisplayBtnClass?: string,
|
|
849
|
-
columnDisplayBtnIcon?: string,
|
|
850
|
-
columnDisplayBtnType?: string,
|
|
851
|
-
columnDisplayBtnPlain?: boolean,
|
|
852
|
-
columnDisplayBtnSize?: string,
|
|
853
|
-
columnDisplayBtnRound?: boolean,
|
|
854
|
-
columnDisplayBtnCircle?: boolean,
|
|
855
|
-
columnDisplayBtnLoading?: boolean,
|
|
856
|
-
columnDisplayBtnDisabled?: boolean,
|
|
857
|
-
columnDisplayBtnText?: string,
|
|
858
|
-
/**
|
|
859
|
-
* 列编辑dialog/drawer模式
|
|
860
|
-
*/
|
|
861
|
-
columnCheckTitle?: string,
|
|
862
|
-
columnCheckCancelButtonText?: string,
|
|
863
|
-
columnCheckConfirmButtonText?: string,
|
|
864
|
-
columnCheckBasicFieldDesc?: string
|
|
865
|
-
/**
|
|
866
|
-
* 列编辑dialog模式
|
|
867
|
-
*/
|
|
868
|
-
columnCheckWidth?: string,
|
|
869
|
-
columnCheckModalAppendToBody?: boolean,
|
|
870
|
-
columnCheckModal?: boolean,
|
|
871
|
-
columnCheckFullscreen?: boolean,
|
|
872
|
-
columnCheckTop?: string,
|
|
873
|
-
columnCheckAppendToBody?: boolean,
|
|
874
|
-
columnCheckLockScroll?: boolean,
|
|
875
|
-
columnCheckCustomClass?: string,
|
|
876
|
-
columnCheckCloseOnlickModal?: boolean,
|
|
877
|
-
columnCheckCloseOnPressEscape?: boolean,
|
|
878
|
-
columnCheckShowClose?: boolean,
|
|
879
|
-
columnCheckBeforeClose?: Function,
|
|
880
|
-
columnCheckCenter?: boolean,
|
|
881
|
-
columnCheckDestroyOnClose?: boolean,
|
|
882
|
-
/**
|
|
883
|
-
* 列编辑drawer模式
|
|
884
|
-
*/
|
|
885
|
-
columnCheckSearchPlaceholder?: string
|
|
886
|
-
columnCheckFixedLeftDesc?: string
|
|
887
|
-
columnCheckClearDesc?: string
|
|
888
|
-
columnCheckNoFixedDesc?: string
|
|
889
|
-
columnCheckGetCheckedLengthDesc?: any
|
|
890
|
-
columnCheckGetAllCheckDesc?: any
|
|
891
|
-
columnCheckTabs?: ITabItem[],
|
|
892
|
-
columnCheckCurrentTab?: string,
|
|
697
|
+
:width="columnCheckWidth"
|
|
698
|
+
:modal-append-to-body="columnCheckModalAppendToBody"
|
|
699
|
+
:modal="columnCheckModal"
|
|
700
|
+
:fullscreen="columnCheckFullscreen"
|
|
701
|
+
:top="columnCheckTop"
|
|
702
|
+
:append-to-body="columnCheckAppendToBody"
|
|
703
|
+
:lock-scroll="columnCheckLockScroll"
|
|
704
|
+
:custom-class="columnCheckCustomClass"
|
|
705
|
+
:close-onlick-modal="columnCheckCloseOnlickModal"
|
|
706
|
+
:close-on-press-escape="columnCheckCloseOnPressEscape"
|
|
707
|
+
:show-close="columnCheckShowClose"
|
|
708
|
+
:before-close="columnCheckBeforeClose"
|
|
709
|
+
:center="columnCheckCenter"
|
|
710
|
+
:destroy-on-close="columnCheckDestroyOnClose"
|
|
711
|
+
:operation-prop-key="operationPropKey"
|
|
893
712
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
713
|
+
v-if="nfColumCheckDialogVisible && checkMode === 'dialog'"
|
|
714
|
+
ref="columnCheckDialog"
|
|
715
|
+
@save="fieldsConfirm"
|
|
716
|
+
>
|
|
717
|
+
<slot slot="tableColumnEditDialogTitle" name="title"></slot>
|
|
718
|
+
<slot slot="tableColumnEditDialogFooter" name="footer"></slot>
|
|
719
|
+
</column-check-dialog>
|
|
720
|
+
<nf-drawer
|
|
721
|
+
:title="columnCheckTitle"
|
|
722
|
+
:cancel-button-text="columnCheckCancelButtonText"
|
|
723
|
+
:confirm-button-text="columnCheckConfirmButtonText"
|
|
724
|
+
v-bind="drawerProps"
|
|
725
|
+
ref="columnCheckNfDrawer"
|
|
726
|
+
size="680px"
|
|
727
|
+
:visible.sync="nfColumCheckDialogVisible"
|
|
728
|
+
:tabs="columnCheckTabs"
|
|
729
|
+
:destroy-on-close="true"
|
|
730
|
+
:currentTab="columnCheckCurrentTab"
|
|
906
731
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
732
|
+
v-if="checkMode === 'drawer'"
|
|
733
|
+
@confirm="columnCheckConfirm"
|
|
734
|
+
@changeTab="(done) => $emit('changeTab', done)"
|
|
735
|
+
@cancel="(name) => $emit('cancel', name)"
|
|
736
|
+
>
|
|
737
|
+
<slot slot="tableColumnEditDialogTitle" name="title" />
|
|
738
|
+
<slot slot="tableColumnEditDialogFooter" name="footer" />
|
|
739
|
+
<column-check-drawer
|
|
740
|
+
:search-placeholder="columnCheckSearchPlaceholder"
|
|
741
|
+
:fixed-left-desc="columnCheckFixedLeftDesc"
|
|
742
|
+
:clear-desc="columnCheckClearDesc"
|
|
743
|
+
:no-fixed-desc="columnCheckNoFixedDesc"
|
|
744
|
+
:basic-field-desc="columnCheckBasicFieldDesc"
|
|
745
|
+
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
746
|
+
:get-checked-length-desc="columnCheckGetCheckedLengthDesc"
|
|
747
|
+
:get-all-check-desc="columnCheckGetAllCheckDesc"
|
|
748
|
+
ref="columnCheckDrawer"
|
|
749
|
+
|
|
750
|
+
:column-edit="columnEdit"
|
|
751
|
+
:operation-prop-key="operationPropKey"
|
|
752
|
+
:storage-key="cStorageKey"
|
|
753
|
+
:table-columns="processedColumns"
|
|
754
|
+
/>
|
|
755
|
+
</nf-drawer>
|
|
756
|
+
</div>
|
|
757
|
+
</template>
|
|
758
|
+
|
|
759
|
+
<script lang="ts">
|
|
760
|
+
import { defineComponent } from 'vue-demi'
|
|
761
|
+
|
|
762
|
+
export default defineComponent({
|
|
763
|
+
name: 'nf-table'
|
|
764
|
+
})
|
|
765
|
+
</script>
|
|
766
|
+
|
|
767
|
+
<script lang="ts" setup>
|
|
768
|
+
import ColumnCheckDialog from './nf-column-check-dialog.vue'
|
|
769
|
+
import ColumnCheckDrawer from './nf-column-check-drawer.vue'
|
|
770
|
+
import RenderComponent from './nf-render-component.vue'
|
|
771
|
+
import { Loading } from 'element-ui'
|
|
772
|
+
import {
|
|
773
|
+
computed,
|
|
774
|
+
getCurrentInstance,
|
|
775
|
+
nextTick,
|
|
776
|
+
onMounted,
|
|
777
|
+
onBeforeMount,
|
|
778
|
+
ref,
|
|
779
|
+
watch,
|
|
780
|
+
set,
|
|
781
|
+
reactive
|
|
782
|
+
} from 'vue-demi'
|
|
783
|
+
import {
|
|
784
|
+
NfTableColumnAttributes,
|
|
785
|
+
ElTableColumnAttributes,
|
|
786
|
+
ElTableAttributes,
|
|
787
|
+
ElTableEventKey,
|
|
788
|
+
ElPaginationEventKey,
|
|
789
|
+
ElPaginationAttributes,
|
|
790
|
+
NfSearchFormAttributes,
|
|
791
|
+
NfSearchFormEventKey,
|
|
792
|
+
NfTableActionBtnAttributes
|
|
793
|
+
} from './types'
|
|
794
|
+
import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
795
|
+
import { CachedManager, resolveValue } from '@94ai/common-utils'
|
|
796
|
+
import { useRoute } from 'vue-router/composables'
|
|
797
|
+
import VirtualScroll, { VirtualColumn } from 'el-table-virtual-scroll'
|
|
798
|
+
|
|
799
|
+
const props = withDefaults(defineProps<{
|
|
800
|
+
viewIdentity?: string,
|
|
801
|
+
data?: Record<string, any>[],
|
|
802
|
+
columns?: NfTableColumnAttributes[] | any,
|
|
803
|
+
searchFormAttrs?: NfSearchFormAttributes,
|
|
804
|
+
searchFormEvents?: Partial<Record<NfSearchFormEventKey, Function>>,
|
|
805
|
+
tableAttrs?: ElTableAttributes,
|
|
806
|
+
tableEvents?: Partial<Record<ElTableEventKey, Function>>,
|
|
807
|
+
pageAttrs?: ElPaginationAttributes,
|
|
808
|
+
pageEvents?: Partial<Record<ElPaginationEventKey, Function>>,
|
|
809
|
+
actionBarOptList?: NfTableActionBtnAttributes[],
|
|
810
|
+
initSearchApi?: boolean | undefined, // 初始化自动查询
|
|
811
|
+
pageChangeSearchApi?: boolean | undefined, // 分页切换的时候自动查询
|
|
812
|
+
pageKeys?: string[], // 分页使用的字段
|
|
813
|
+
setEasyConf?: boolean, // 简易配置
|
|
814
|
+
detectResize?: boolean, // 检测表格内容展开自动同步fix column和 unfix column
|
|
815
|
+
/**
|
|
816
|
+
* 开启表格列拖拽缓存记录
|
|
817
|
+
*/
|
|
818
|
+
dragCached?: boolean,
|
|
819
|
+
/**
|
|
820
|
+
* 表格空数据时空组件size
|
|
821
|
+
*/
|
|
822
|
+
emptyImageSize?: number,
|
|
823
|
+
/**
|
|
824
|
+
* 表格空数据时空组件描述文字
|
|
825
|
+
*/
|
|
826
|
+
emptyText?: string,
|
|
827
|
+
/**
|
|
828
|
+
* 固定窗口满屏table自动计算table高度
|
|
829
|
+
*/
|
|
830
|
+
calHeight?: boolean,
|
|
831
|
+
/**
|
|
832
|
+
* 列编辑显示开关
|
|
833
|
+
*/
|
|
834
|
+
columnEdit?: boolean,
|
|
835
|
+
columnPosition?: 'free' | 'embed',
|
|
836
|
+
checkMode?: 'dialog' | 'drawer',
|
|
837
|
+
priority?: 'cached' | 'value',
|
|
838
|
+
storageKey?: string
|
|
839
|
+
searchFormStorageKey?: string
|
|
840
|
+
/**
|
|
841
|
+
* 列编辑要显示的表格项字段
|
|
842
|
+
*/
|
|
843
|
+
showColumn?: string[],
|
|
844
|
+
selectEmptyWarningTips?: string,
|
|
845
|
+
/**
|
|
846
|
+
* 列编辑按钮修饰
|
|
847
|
+
*/
|
|
848
|
+
columnDisplayBtnClass?: string,
|
|
849
|
+
columnDisplayBtnIcon?: string,
|
|
850
|
+
columnDisplayBtnType?: string,
|
|
851
|
+
columnDisplayBtnPlain?: boolean,
|
|
852
|
+
columnDisplayBtnSize?: string,
|
|
853
|
+
columnDisplayBtnRound?: boolean,
|
|
854
|
+
columnDisplayBtnCircle?: boolean,
|
|
855
|
+
columnDisplayBtnLoading?: boolean,
|
|
856
|
+
columnDisplayBtnDisabled?: boolean,
|
|
857
|
+
columnDisplayBtnText?: string,
|
|
858
|
+
/**
|
|
859
|
+
* 列编辑dialog/drawer模式
|
|
860
|
+
*/
|
|
861
|
+
columnCheckTitle?: string,
|
|
862
|
+
columnCheckCancelButtonText?: string,
|
|
863
|
+
columnCheckConfirmButtonText?: string,
|
|
864
|
+
columnCheckBasicFieldDesc?: string
|
|
865
|
+
/**
|
|
866
|
+
* 列编辑dialog模式
|
|
867
|
+
*/
|
|
868
|
+
columnCheckWidth?: string,
|
|
869
|
+
columnCheckModalAppendToBody?: boolean,
|
|
870
|
+
columnCheckModal?: boolean,
|
|
871
|
+
columnCheckFullscreen?: boolean,
|
|
872
|
+
columnCheckTop?: string,
|
|
873
|
+
columnCheckAppendToBody?: boolean,
|
|
874
|
+
columnCheckLockScroll?: boolean,
|
|
875
|
+
columnCheckCustomClass?: string,
|
|
876
|
+
columnCheckCloseOnlickModal?: boolean,
|
|
877
|
+
columnCheckCloseOnPressEscape?: boolean,
|
|
878
|
+
columnCheckShowClose?: boolean,
|
|
879
|
+
columnCheckBeforeClose?: Function,
|
|
880
|
+
columnCheckCenter?: boolean,
|
|
881
|
+
columnCheckDestroyOnClose?: boolean,
|
|
882
|
+
/**
|
|
883
|
+
* 列编辑drawer模式
|
|
884
|
+
*/
|
|
885
|
+
columnCheckSearchPlaceholder?: string
|
|
886
|
+
columnCheckFixedLeftDesc?: string
|
|
887
|
+
columnCheckClearDesc?: string
|
|
888
|
+
columnCheckNoFixedDesc?: string
|
|
889
|
+
columnCheckGetCheckedLengthDesc?: any
|
|
890
|
+
columnCheckGetAllCheckDesc?: any
|
|
891
|
+
columnCheckTabs?: ITabItem[],
|
|
892
|
+
columnCheckCurrentTab?: string,
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* 表格loading
|
|
896
|
+
*/
|
|
897
|
+
loading?: boolean,
|
|
898
|
+
target?: HTMLElement,
|
|
899
|
+
body?: boolean,
|
|
900
|
+
fullscreen?: boolean,
|
|
901
|
+
lock?: boolean,
|
|
902
|
+
text?: string,
|
|
903
|
+
spinner?: string,
|
|
904
|
+
background?: string,
|
|
905
|
+
customClass?: string,
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* 分页
|
|
909
|
+
*/
|
|
910
|
+
alwaysShowPage?: boolean,
|
|
911
|
+
/**
|
|
912
|
+
* 操作列属性key
|
|
913
|
+
*/
|
|
914
|
+
operationPropKey?: string,
|
|
915
|
+
drawerProps?: Record<string, any>,
|
|
916
|
+
virtualized?: boolean,
|
|
917
|
+
virtualTableData?: Record<string, any>[],
|
|
918
|
+
virtualProps?: Record<string, any>,
|
|
919
|
+
/** 固定列拖拽指示线距离左侧的最小距离 */
|
|
920
|
+
dragIndicatorPaddingLeft?: number,
|
|
921
|
+
/** 固定列拖拽指示线距离右侧的最小距离 */
|
|
922
|
+
dragIndicatorPaddingRight?: number,
|
|
923
|
+
/** 是否开启右侧固定列拖拽 */
|
|
924
|
+
fixedRightDragEnabled?: boolean,
|
|
925
|
+
}>(), {
|
|
926
|
+
viewIdentity: '',
|
|
927
|
+
dragCached: true,
|
|
928
|
+
emptyImageSize: 145,
|
|
929
|
+
emptyText: '',
|
|
930
|
+
priority: 'cached',
|
|
931
|
+
storageKey: '', // 默认值为 `nf-table-columns-cached-key-${routeName}`
|
|
932
|
+
searchFormStorageKey: '',
|
|
933
|
+
checkMode: 'drawer',
|
|
934
|
+
data: () => [],
|
|
935
|
+
columns: () => [],
|
|
936
|
+
searchFormAttrs: () => ({}),
|
|
937
|
+
tableAttrs: () => ({}),
|
|
938
|
+
pageAttrs: () => ({}),
|
|
939
|
+
searchFormEvents: () => ({}),
|
|
940
|
+
tableEvents: () => ({}),
|
|
941
|
+
pageEvents: () => ({}),
|
|
942
|
+
actionBarOptList: () => [],
|
|
943
|
+
initSearchApi: undefined, // 初始化自动查询
|
|
944
|
+
pageChangeSearchApi: undefined, // 分页切换的时候自动查询
|
|
945
|
+
pageKeys: () => ['pageNo', 'pageSize'], // 分页使用的字段
|
|
946
|
+
setEasyConf: false,
|
|
947
|
+
detectResize: false,
|
|
948
|
+
calHeight: false,
|
|
949
|
+
columnEdit: false,
|
|
950
|
+
columnPosition: 'embed',
|
|
951
|
+
showColumn: undefined,
|
|
952
|
+
loading: false,
|
|
953
|
+
target: undefined,
|
|
954
|
+
body: false,
|
|
955
|
+
fullscreen: false,
|
|
956
|
+
lock: true,
|
|
957
|
+
text: undefined,
|
|
958
|
+
spinner: undefined,
|
|
959
|
+
background: undefined,
|
|
960
|
+
customClass: undefined,
|
|
961
|
+
columnDisplayBtnIcon: 'el-icon-plus',
|
|
962
|
+
columnDisplayBtnType: 'primary',
|
|
963
|
+
columnDisplayBtnPlain: true,
|
|
964
|
+
columnDisplayBtnSize: 'mini',
|
|
965
|
+
columnDisplayBtnRound: false,
|
|
966
|
+
columnDisplayBtnCircle: false,
|
|
967
|
+
columnDisplayBtnLoading: false,
|
|
968
|
+
columnDisplayBtnDisabled: false,
|
|
969
|
+
columnDisplayBtnClass: '',
|
|
970
|
+
alwaysShowPage: true,
|
|
971
|
+
operationPropKey: 'operation',
|
|
972
|
+
columnCheckWidth: '600px',
|
|
973
|
+
columnCheckModalAppendToBody: true,
|
|
974
|
+
columnCheckModal: true,
|
|
975
|
+
columnCheckFullscreen: false,
|
|
976
|
+
columnCheckTop: '15vh',
|
|
977
|
+
columnCheckAppendToBody: false,
|
|
978
|
+
columnCheckLockScroll: true,
|
|
979
|
+
columnCheckCustomClass: '',
|
|
980
|
+
columnCheckCloseOnlickModal: true,
|
|
981
|
+
columnCheckCloseOnPressEscape: true,
|
|
982
|
+
columnCheckShowClose: true,
|
|
983
|
+
columnCheckBeforeClose: undefined,
|
|
984
|
+
columnCheckCenter: false,
|
|
985
|
+
columnCheckDestroyOnClose: false,
|
|
986
|
+
selectEmptyWarningTips: '请选择至少一个选项',
|
|
987
|
+
columnDisplayBtnText: '设置列表字段',
|
|
988
|
+
columnCheckTitle: '设置显示字段',
|
|
989
|
+
columnCheckCancelButtonText: '取消',
|
|
990
|
+
columnCheckConfirmButtonText: '确定',
|
|
991
|
+
columnCheckSearchPlaceholder: '搜索',
|
|
992
|
+
columnCheckFixedLeftDesc: '固定在左侧',
|
|
993
|
+
columnCheckClearDesc: '清除',
|
|
994
|
+
columnCheckNoFixedDesc: '不固定',
|
|
995
|
+
columnCheckBasicFieldDesc: '基础字段',
|
|
996
|
+
columnCheckGetCheckedLengthDesc: (length) => (length) => '已选(' + length + ')',
|
|
997
|
+
columnCheckGetAllCheckDesc: (length) => (length) => '全选(' + length + ')',
|
|
998
|
+
drawerProps: () => ({}),
|
|
999
|
+
virtualized: false,
|
|
1000
|
+
virtualTableData: () => [],
|
|
1001
|
+
virtualProps: () => ({}),
|
|
1002
|
+
dragIndicatorPaddingLeft: 120,
|
|
1003
|
+
dragIndicatorPaddingRight: 120,
|
|
1004
|
+
fixedRightDragEnabled: false,
|
|
1005
|
+
})
|
|
1006
|
+
|
|
1007
|
+
const emit = defineEmits<{
|
|
1008
|
+
(e: 'fieldsChange', event: string[]): void
|
|
1009
|
+
(e: 'update:showColumn', event: string[] | undefined): void
|
|
1010
|
+
(e: 'searchApi', event: { data: Record<string, any>, callback: Function}): void
|
|
1011
|
+
/** 固定列(自定义句柄)拖拽结束 */
|
|
1012
|
+
(e: 'fixedColumnDragEnd', event: { width: number, oldWidth: number, prop?: string, column?: any, nativeEvent?: Event }): void
|
|
1013
|
+
}>()
|
|
1014
|
+
|
|
1015
|
+
const processedColumns = computed(() => {
|
|
1016
|
+
const viewField = (window as any).viewField
|
|
1017
|
+
if (props.viewIdentity && viewField) {
|
|
1018
|
+
const showList = viewField.find(item => item.viewIdentity === props.viewIdentity)?.fieldList
|
|
1019
|
+
if (showList?.length) {
|
|
1020
|
+
return props.columns.filter(item => showList.includes(item.prop) || item.prop === props.operationPropKey || item.type === 'selection' || item.type === 'index' || item.type === 'expand')
|
|
1021
|
+
}
|
|
1010
1022
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
})
|
|
1023
|
+
return props.columns
|
|
1024
|
+
})
|
|
1014
1025
|
|
|
1015
1026
|
|
|
1016
|
-
const getOperationListLocal = (column, scope) => {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
}
|
|
1020
|
-
return column.operationList || []
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
const eventsOperationListBtns = (item, scope) => {
|
|
1024
|
-
return {
|
|
1025
|
-
...(item.events || {}),
|
|
1026
|
-
click: (...args) => {
|
|
1027
|
-
item.events?.click(args);
|
|
1028
|
-
item.onClick?.(scope.row, scope)
|
|
1027
|
+
const getOperationListLocal = (column, scope) => {
|
|
1028
|
+
if (typeof column.operationList === 'function') {
|
|
1029
|
+
return column.operationList(scope)
|
|
1029
1030
|
}
|
|
1031
|
+
return column.operationList || []
|
|
1030
1032
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
const nfTableContent = ref()
|
|
1041
|
-
const nfSearchFormRef = ref()
|
|
1042
|
-
const columnCheckDrawer = ref()
|
|
1043
|
-
const columnCheckDialog = ref()
|
|
1044
|
-
const columnCheckNfDrawer = ref()
|
|
1045
|
-
const elTableHeight = ref()
|
|
1046
|
-
const nfColumCheckDialogVisible = ref(false)
|
|
1047
|
-
const preSearchFormData = ref({})
|
|
1048
|
-
const cPageChangeSearchApi = ref(props.pageChangeSearchApi ?? props.setEasyConf)
|
|
1049
|
-
const cInitSearchApi = ref(props.initSearchApi ?? props.setEasyConf)
|
|
1050
|
-
|
|
1051
|
-
const cStorageKey = computed(() => {
|
|
1052
|
-
const key = props.storageKey || `nf-table-columns-cached-key-${routeName.value}`
|
|
1053
|
-
const userId = (window as any).userId
|
|
1054
|
-
if (props.viewIdentity && userId) {
|
|
1055
|
-
return userId + '-' + key
|
|
1033
|
+
|
|
1034
|
+
const eventsOperationListBtns = (item, scope) => {
|
|
1035
|
+
return {
|
|
1036
|
+
...(item.events || {}),
|
|
1037
|
+
click: (...args) => {
|
|
1038
|
+
item.events?.click(args);
|
|
1039
|
+
item.onClick?.(scope.row, scope)
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1056
1042
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
const
|
|
1065
|
-
const
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1043
|
+
|
|
1044
|
+
const routeName = computed(() => useRoute().name)
|
|
1045
|
+
const instance = getCurrentInstance()?.proxy
|
|
1046
|
+
const elTableRef = ref()
|
|
1047
|
+
const nfTableActionContainerRef = ref()
|
|
1048
|
+
const nfTablePaginationRef = ref()
|
|
1049
|
+
const nfTableActionBarRef = ref()
|
|
1050
|
+
const nfTableRef = ref()
|
|
1051
|
+
const nfTableContent = ref()
|
|
1052
|
+
const nfSearchFormRef = ref()
|
|
1053
|
+
const columnCheckDrawer = ref()
|
|
1054
|
+
const columnCheckDialog = ref()
|
|
1055
|
+
const columnCheckNfDrawer = ref()
|
|
1056
|
+
const elTableHeight = ref()
|
|
1057
|
+
const nfColumCheckDialogVisible = ref(false)
|
|
1058
|
+
const preSearchFormData = ref({})
|
|
1059
|
+
const cPageChangeSearchApi = ref(props.pageChangeSearchApi ?? props.setEasyConf)
|
|
1060
|
+
const cInitSearchApi = ref(props.initSearchApi ?? props.setEasyConf)
|
|
1061
|
+
|
|
1062
|
+
const cStorageKey = computed(() => {
|
|
1063
|
+
const key = props.storageKey || `nf-table-columns-cached-key-${routeName.value}`
|
|
1064
|
+
const userId = (window as any).userId
|
|
1065
|
+
if (props.viewIdentity && userId) {
|
|
1066
|
+
return userId + '-' + key
|
|
1071
1067
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1068
|
+
return key
|
|
1069
|
+
})
|
|
1070
|
+
|
|
1071
|
+
const cStorageKeyViewIdentity = computed(() => {
|
|
1072
|
+
return 'nf-table-view-identity'
|
|
1073
|
+
})
|
|
1074
|
+
|
|
1075
|
+
const checkViewIdentityChange = async () => {
|
|
1076
|
+
const userId = (window as any).userId
|
|
1077
|
+
const viewField = (window as any).viewField
|
|
1078
|
+
if (props.viewIdentity && userId && viewField) {
|
|
1079
|
+
let viewIdentity = CachedManager.syncCachedGet(cStorageKeyViewIdentity.value)
|
|
1080
|
+
if (!viewIdentity) {
|
|
1081
|
+
viewIdentity = await CachedManager.asyncCachedGet(cStorageKeyViewIdentity.value)
|
|
1082
|
+
}
|
|
1083
|
+
if (!viewIdentity) {
|
|
1084
|
+
await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewField)
|
|
1085
|
+
} else {
|
|
1086
|
+
const newViewIdentity = viewField.find(item => item.viewIdentity === props.viewIdentity)
|
|
1087
|
+
const oldViewIdentity = viewIdentity.find(item => item.viewIdentity === props.viewIdentity)
|
|
1088
|
+
if ((newViewIdentity && !oldViewIdentity) || (!newViewIdentity && oldViewIdentity)) {
|
|
1089
|
+
await clearColumnEditCached()
|
|
1090
|
+
await clearDragCached()
|
|
1091
|
+
} else if (newViewIdentity && oldViewIdentity) {
|
|
1092
|
+
let change = false
|
|
1093
|
+
newViewIdentity.fieldList.every(item => {
|
|
1094
|
+
if (!oldViewIdentity.fieldList.includes(item)) {
|
|
1092
1095
|
change = true
|
|
1093
1096
|
return
|
|
1094
1097
|
}
|
|
1095
1098
|
return true
|
|
1096
1099
|
})
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1100
|
+
if (!change) {
|
|
1101
|
+
oldViewIdentity.fieldList.every(item => {
|
|
1102
|
+
if (!newViewIdentity.fieldList.includes(item)) {
|
|
1103
|
+
change = true
|
|
1104
|
+
return
|
|
1105
|
+
}
|
|
1106
|
+
return true
|
|
1107
|
+
})
|
|
1108
|
+
}
|
|
1109
|
+
if (change) {
|
|
1110
|
+
await clearColumnEditCached()
|
|
1111
|
+
await clearDragCached()
|
|
1112
|
+
oldViewIdentity.fieldList = newViewIdentity.fieldList
|
|
1113
|
+
await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewIdentity)
|
|
1114
|
+
}
|
|
1103
1115
|
}
|
|
1104
1116
|
}
|
|
1105
1117
|
}
|
|
1106
1118
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
if (cPageChangeSearchApi.value) onNfSearchFormSearch()
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
// 切换页码
|
|
1126
|
-
const handleCurrentChange = (val, isSearch = true) => {
|
|
1127
|
-
// props.pageEvents?.['current-change']?.(val)
|
|
1128
|
-
if (val !== undefined) {
|
|
1129
|
-
cPageAttrs['current-page'] = val
|
|
1119
|
+
|
|
1120
|
+
const cPageAttrs = reactive({
|
|
1121
|
+
// 页码,没有props时 & 允许分页时;默认 = 1
|
|
1122
|
+
'current-page': props.pageAttrs['current-page'] || (props.alwaysShowPage ? 1 : undefined),
|
|
1123
|
+
'page-size': props.pageAttrs['page-size'] || 10,
|
|
1124
|
+
pageKeys: props.pageKeys
|
|
1125
|
+
})
|
|
1126
|
+
const tableLoading = ref(false)
|
|
1127
|
+
const isLoading = computed(() => props.loading || tableLoading.value)
|
|
1128
|
+
|
|
1129
|
+
// 切换size
|
|
1130
|
+
const handleSizeChange = (val) => {
|
|
1131
|
+
// props.pageEvents?.['size-change']?.(val)
|
|
1132
|
+
cPageAttrs['page-size'] = val
|
|
1133
|
+
if (cPageChangeSearchApi.value) onNfSearchFormSearch()
|
|
1130
1134
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
const currentPage = props.pageAttrs['current-page'] || 1
|
|
1140
|
-
const noTotal = typeof props.pageAttrs.total === 'undefined'
|
|
1141
|
-
if (!pageSize || !noTotal) return props.data
|
|
1142
|
-
if (props.data.length > pageSize) {
|
|
1143
|
-
return props.data.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
|
1144
|
-
} else {
|
|
1145
|
-
return props.data
|
|
1135
|
+
|
|
1136
|
+
// 切换页码
|
|
1137
|
+
const handleCurrentChange = (val, isSearch = true) => {
|
|
1138
|
+
// props.pageEvents?.['current-change']?.(val)
|
|
1139
|
+
if (val !== undefined) {
|
|
1140
|
+
cPageAttrs['current-page'] = val
|
|
1141
|
+
}
|
|
1142
|
+
if (isSearch && cPageChangeSearchApi.value) onNfSearchFormSearch()
|
|
1146
1143
|
}
|
|
1147
|
-
|
|
1148
|
-
/**
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* 处理前端分页和后端分页
|
|
1147
|
+
*/
|
|
1148
|
+
const showData = computed(() => {
|
|
1149
|
+
const pageSize = props.pageAttrs['page-size']
|
|
1150
|
+
const currentPage = props.pageAttrs['current-page'] || 1
|
|
1151
|
+
const noTotal = typeof props.pageAttrs.total === 'undefined'
|
|
1152
|
+
if (!pageSize || !noTotal) return props.data
|
|
1153
|
+
if (props.data.length > pageSize) {
|
|
1154
|
+
return props.data.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
|
1155
|
+
} else {
|
|
1156
|
+
return props.data
|
|
1157
|
+
}
|
|
1158
|
+
})
|
|
1159
|
+
/**
|
|
1160
|
+
* 定制按钮
|
|
1161
|
+
*/
|
|
1162
|
+
const hasOperationSlot = computed(() => {
|
|
1163
|
+
return instance?.$slots.operation
|
|
1164
|
+
})
|
|
1165
|
+
const hasActionBarSlot = computed(() => {
|
|
1166
|
+
return instance?.$slots.actionBar
|
|
1167
|
+
})
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
const loadingInstance = ref()
|
|
1171
|
+
watch(() => {
|
|
1172
|
+
return props.loading || tableLoading.value
|
|
1173
|
+
}, async () => {
|
|
1174
|
+
if (props.loading || tableLoading.value) {
|
|
1175
|
+
await nextTick()
|
|
1176
|
+
const {
|
|
1177
|
+
target,
|
|
1178
|
+
lock,
|
|
1179
|
+
fullscreen,
|
|
1180
|
+
text,
|
|
1181
|
+
spinner,
|
|
1182
|
+
background,
|
|
1183
|
+
customClass
|
|
1184
|
+
} = props
|
|
1185
|
+
loadingInstance.value = Loading.service({
|
|
1186
|
+
target: target || elTableRef.value?.$el.parentNode || document.body,
|
|
1187
|
+
lock,
|
|
1188
|
+
fullscreen,
|
|
1189
|
+
text,
|
|
1190
|
+
spinner,
|
|
1191
|
+
background,
|
|
1192
|
+
customClass
|
|
1193
|
+
})
|
|
1194
|
+
} else {
|
|
1195
|
+
loadingInstance.value?.close()
|
|
1196
|
+
}
|
|
1197
|
+
}, {
|
|
1198
|
+
immediate: true
|
|
1199
|
+
})
|
|
1200
|
+
// 同步用户参数
|
|
1201
|
+
const initLocalShow = (init = false) => {
|
|
1202
|
+
if (!init) {
|
|
1203
|
+
props.columns._skip = true
|
|
1204
|
+
}
|
|
1205
|
+
const result = processedColumns.value.filter(item => {
|
|
1206
|
+
const prop = item.prop || item.attr?.prop
|
|
1207
|
+
if (props.showColumn?.includes(prop!)) {
|
|
1208
|
+
item.initHidden = false
|
|
1209
|
+
}
|
|
1210
|
+
return !item.initHidden
|
|
1211
|
+
}).map(item => item.prop! || item.attr?.prop!)
|
|
1212
|
+
if (!init) {
|
|
1213
|
+
nextTick(() => {
|
|
1214
|
+
props.columns._skip = false
|
|
1215
|
+
})
|
|
1216
|
+
}
|
|
1217
|
+
if (result.length) {
|
|
1218
|
+
return result
|
|
1219
|
+
}
|
|
1220
|
+
return processedColumns.value.map(item => item.prop! || item.attr?.prop!)
|
|
1185
1221
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1222
|
+
const localShowColumn = ref<string[]>(initLocalShow(true))
|
|
1223
|
+
watch(() => localShowColumn.value?.length, () => {
|
|
1224
|
+
emit('update:showColumn', localShowColumn.value)
|
|
1225
|
+
}, {
|
|
1226
|
+
immediate: true
|
|
1227
|
+
})
|
|
1228
|
+
|
|
1229
|
+
const syncLocalShowColumnToCookies = () => {
|
|
1230
|
+
if (props.columnEdit) {
|
|
1231
|
+
const columnState = {}
|
|
1232
|
+
processedColumns.value.map((i, index) => {
|
|
1233
|
+
const prop = i.prop || i.attr?.prop
|
|
1234
|
+
columnState[prop!] = {
|
|
1235
|
+
initHidden: i.initHidden || false,
|
|
1236
|
+
fixed: i.attr?.fixed || false,
|
|
1237
|
+
prop,
|
|
1238
|
+
index
|
|
1239
|
+
}
|
|
1240
|
+
})
|
|
1241
|
+
return CachedManager.syncCachedSet(cStorageKey.value, columnState)
|
|
1242
|
+
}
|
|
1193
1243
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1244
|
+
|
|
1245
|
+
const syncShowItemToInitHidden = () => {
|
|
1246
|
+
props.columns._skip = true
|
|
1247
|
+
processedColumns.value.forEach(item => {
|
|
1248
|
+
const prop = item.prop || item.attr?.prop
|
|
1249
|
+
if (localShowColumn.value?.includes(prop!)) {
|
|
1197
1250
|
item.initHidden = false
|
|
1251
|
+
} else {
|
|
1252
|
+
item.initHidden = true
|
|
1198
1253
|
}
|
|
1199
|
-
|
|
1200
|
-
}).map(item => item.prop! || item.attr?.prop!)
|
|
1201
|
-
if (!init) {
|
|
1254
|
+
})
|
|
1202
1255
|
nextTick(() => {
|
|
1203
1256
|
props.columns._skip = false
|
|
1204
1257
|
})
|
|
1205
1258
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
emit('update:showColumn', localShowColumn.value)
|
|
1214
|
-
}, {
|
|
1215
|
-
immediate: true
|
|
1216
|
-
})
|
|
1217
|
-
|
|
1218
|
-
const syncLocalShowColumnToCookies = () => {
|
|
1219
|
-
if (props.columnEdit) {
|
|
1220
|
-
const columnState = {}
|
|
1221
|
-
processedColumns.value.map((i, index) => {
|
|
1222
|
-
const prop = i.prop || i.attr?.prop
|
|
1223
|
-
columnState[prop!] = {
|
|
1224
|
-
initHidden: i.initHidden || false,
|
|
1225
|
-
fixed: i.attr?.fixed || false,
|
|
1226
|
-
prop,
|
|
1227
|
-
index
|
|
1228
|
-
}
|
|
1229
|
-
})
|
|
1230
|
-
return CachedManager.syncCachedSet(cStorageKey.value, columnState)
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
const syncShowItemToInitHidden = () => {
|
|
1235
|
-
props.columns._skip = true
|
|
1236
|
-
processedColumns.value.forEach(item => {
|
|
1237
|
-
const prop = item.prop || item.attr?.prop
|
|
1238
|
-
if (localShowColumn.value?.includes(prop!)) {
|
|
1239
|
-
item.initHidden = false
|
|
1240
|
-
} else {
|
|
1241
|
-
item.initHidden = true
|
|
1242
|
-
}
|
|
1243
|
-
})
|
|
1244
|
-
nextTick(() => {
|
|
1245
|
-
props.columns._skip = false
|
|
1246
|
-
})
|
|
1247
|
-
}
|
|
1248
|
-
const syncCookiesToLocalShowColumn = async () => {
|
|
1249
|
-
if (props.columnEdit) {
|
|
1250
|
-
try {
|
|
1251
|
-
await checkViewIdentityChange()
|
|
1252
|
-
let columnState: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(cStorageKey.value)
|
|
1253
|
-
if (!columnState) {
|
|
1254
|
-
columnState = await CachedManager.asyncCachedGet(cStorageKey.value)
|
|
1255
|
-
}
|
|
1256
|
-
if (columnState) {
|
|
1257
|
-
if (typeof columnState === 'string') {
|
|
1258
|
-
columnState = JSON.parse(columnState)
|
|
1259
|
+
const syncCookiesToLocalShowColumn = async () => {
|
|
1260
|
+
if (props.columnEdit) {
|
|
1261
|
+
try {
|
|
1262
|
+
await checkViewIdentityChange()
|
|
1263
|
+
let columnState: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(cStorageKey.value)
|
|
1264
|
+
if (!columnState) {
|
|
1265
|
+
columnState = await CachedManager.asyncCachedGet(cStorageKey.value)
|
|
1259
1266
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1267
|
+
if (columnState) {
|
|
1268
|
+
if (typeof columnState === 'string') {
|
|
1269
|
+
columnState = JSON.parse(columnState)
|
|
1270
|
+
}
|
|
1271
|
+
const showColumnItems: string[] = []
|
|
1272
|
+
for (const key in columnState as NfTableColumnAttributes) {
|
|
1273
|
+
if (!columnState![key].initHidden) {
|
|
1274
|
+
showColumnItems.push(columnState![key].prop)
|
|
1275
|
+
}
|
|
1264
1276
|
}
|
|
1277
|
+
localShowColumn.value = showColumnItems
|
|
1278
|
+
syncShowItemToInitHidden()
|
|
1265
1279
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1280
|
+
} catch (e) {
|
|
1281
|
+
console.log(e)
|
|
1268
1282
|
}
|
|
1269
|
-
} catch (e) {
|
|
1270
|
-
console.log(e)
|
|
1271
1283
|
}
|
|
1272
1284
|
}
|
|
1273
|
-
}
|
|
1274
1285
|
|
|
1275
|
-
const initCachedData = async () => {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1286
|
+
const initCachedData = async () => {
|
|
1287
|
+
if (props.columnEdit) {
|
|
1288
|
+
// 同步缓存参数
|
|
1289
|
+
try {
|
|
1290
|
+
await checkViewIdentityChange()
|
|
1291
|
+
let cached: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(cStorageKey.value)
|
|
1292
|
+
if (!cached) {
|
|
1293
|
+
cached = await CachedManager.asyncCachedGet(cStorageKey.value)
|
|
1294
|
+
}
|
|
1295
|
+
const cachedPriority = props.priority === 'cached'
|
|
1296
|
+
if (cachedPriority ? cached : localShowColumn.value?.length) {
|
|
1297
|
+
cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies()
|
|
1298
|
+
} else if (cachedPriority ? localShowColumn.value?.length : cached) {
|
|
1299
|
+
cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn()
|
|
1300
|
+
}
|
|
1301
|
+
} catch (e) {
|
|
1302
|
+
console.log(e)
|
|
1289
1303
|
}
|
|
1290
|
-
} catch (e) {
|
|
1291
|
-
console.log(e)
|
|
1292
1304
|
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
await CachedManager.asyncCachedGet(`${cStorageKey.value}$drag-column-width`)
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
const getMinWidth = (column) => {
|
|
1300
|
-
const columnLabel = resolveValue(column.label)
|
|
1301
|
-
if (columnLabel?.indexOf('$$') === 0) {
|
|
1302
|
-
const value = Number(columnLabel.replace('$$', ''))
|
|
1303
|
-
if (!Number.isNaN(value) && value) {
|
|
1304
|
-
return value
|
|
1305
|
+
if (props.dragCached) {
|
|
1306
|
+
await CachedManager.asyncCachedGet(`${cStorageKey.value}$drag-column-width`)
|
|
1305
1307
|
}
|
|
1306
1308
|
}
|
|
1307
|
-
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
const tableColumns = ref<NfTableColumnAttributes[]>([])
|
|
1317
|
-
const elTableRefKey = ref(Date.now())
|
|
1318
|
-
const syncCookiesToTableColumn = async (readCached = true) => {
|
|
1319
|
-
props.columns._skip = true
|
|
1320
|
-
const columns = processedColumns.value!.map((item, index) => {
|
|
1321
|
-
const attr = (item.attr || {}) as ElTableColumnAttributes
|
|
1322
|
-
// 区分中文、数字、其他字符
|
|
1323
|
-
if (!attr['min-width'] && item.label) {
|
|
1324
|
-
attr['min-width'] = String(getMinWidth(item)) + 'px'
|
|
1325
|
-
}
|
|
1326
|
-
if (props.dragCached) {
|
|
1327
|
-
const prop = item.prop || item.attr?.prop
|
|
1328
|
-
let columnWidth = CachedManager.syncCachedGet(`${cStorageKey.value}$drag-column-width`) || {}
|
|
1329
|
-
if (columnWidth[prop]) { // 读取缓存
|
|
1330
|
-
attr.width = columnWidth[prop]
|
|
1309
|
+
|
|
1310
|
+
const getMinWidth = (column) => {
|
|
1311
|
+
const columnLabel = resolveValue(column.label)
|
|
1312
|
+
if (columnLabel?.indexOf('$$') === 0) {
|
|
1313
|
+
const value = Number(columnLabel.replace('$$', ''))
|
|
1314
|
+
if (!Number.isNaN(value) && value) {
|
|
1315
|
+
return value
|
|
1331
1316
|
}
|
|
1332
1317
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
item.
|
|
1348
|
-
|
|
1318
|
+
const fs = 14
|
|
1319
|
+
const char = columnLabel.match(/[\u2E80-\u9FFF]/g)
|
|
1320
|
+
const charLen = char ? char.length : 0
|
|
1321
|
+
const num = columnLabel.match(/\d|\./g)
|
|
1322
|
+
const numLen = num ? num.length : 0
|
|
1323
|
+
const otherLen = columnLabel.length - charLen - numLen
|
|
1324
|
+
return fs * (charLen * 1 + numLen * 0.7 + otherLen * 0.58) + 20 + (column.sortable ? 24 : 0)
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
const tableColumns = ref<NfTableColumnAttributes[]>([])
|
|
1328
|
+
const elTableRefKey = ref(Date.now())
|
|
1329
|
+
const syncCookiesToTableColumn = async (readCached = true) => {
|
|
1330
|
+
props.columns._skip = true
|
|
1331
|
+
const columns = processedColumns.value!.map((item, index) => {
|
|
1332
|
+
const attr = (item.attr || {}) as ElTableColumnAttributes
|
|
1333
|
+
// 区分中文、数字、其他字符
|
|
1334
|
+
if (!attr['min-width'] && item.label) {
|
|
1335
|
+
attr['min-width'] = String(getMinWidth(item)) + 'px'
|
|
1336
|
+
}
|
|
1337
|
+
if (props.dragCached) {
|
|
1338
|
+
const prop = item.prop || item.attr?.prop
|
|
1339
|
+
let columnWidth = CachedManager.syncCachedGet(`${cStorageKey.value}$drag-column-width`) || {}
|
|
1340
|
+
if (columnWidth[prop]) { // 读取缓存
|
|
1341
|
+
attr.width = columnWidth[prop]
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
item.attr = {
|
|
1345
|
+
...item.attr,
|
|
1346
|
+
...attr
|
|
1347
|
+
} as ElTableColumnAttributes
|
|
1348
|
+
delete item.attr.prop
|
|
1349
|
+
delete item.attr.label
|
|
1350
|
+
item._index = index
|
|
1351
|
+
set(item, 'initHidden', item.initHidden)
|
|
1352
|
+
set(item, 'destory', item.destory)
|
|
1353
|
+
item.__index = index
|
|
1354
|
+
// 根据id映射文案
|
|
1355
|
+
set(item, 'optionsTag', {})
|
|
1356
|
+
if (item.getOptions) {
|
|
1357
|
+
set(item, 'optionsEnum', {})
|
|
1358
|
+
item.getOptions((list) => {
|
|
1359
|
+
list.forEach(o => {
|
|
1360
|
+
item.optionsEnum[o.value] = o.label
|
|
1361
|
+
item.optionsTag[o.value] = o.tagType
|
|
1362
|
+
})
|
|
1363
|
+
})
|
|
1364
|
+
} else if (item.options) {
|
|
1365
|
+
set(item, 'optionsEnum', {})
|
|
1366
|
+
item.options.forEach(o => {
|
|
1349
1367
|
item.optionsEnum[o.value] = o.label
|
|
1350
1368
|
item.optionsTag[o.value] = o.tagType
|
|
1351
1369
|
})
|
|
1352
|
-
})
|
|
1353
|
-
} else if (item.options) {
|
|
1354
|
-
set(item, 'optionsEnum', {})
|
|
1355
|
-
item.options.forEach(o => {
|
|
1356
|
-
item.optionsEnum[o.value] = o.label
|
|
1357
|
-
item.optionsTag[o.value] = o.tagType
|
|
1358
|
-
})
|
|
1359
|
-
}
|
|
1360
|
-
return item
|
|
1361
|
-
})
|
|
1362
|
-
if (readCached && props.columnEdit) {
|
|
1363
|
-
// 读取缓存 Column 配置
|
|
1364
|
-
try {
|
|
1365
|
-
await checkViewIdentityChange()
|
|
1366
|
-
let columnState: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(cStorageKey.value)
|
|
1367
|
-
if (!columnState) {
|
|
1368
|
-
columnState = await CachedManager.asyncCachedGet(cStorageKey.value)
|
|
1369
1370
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1371
|
+
return item
|
|
1372
|
+
})
|
|
1373
|
+
if (readCached && props.columnEdit) {
|
|
1374
|
+
// 读取缓存 Column 配置
|
|
1375
|
+
try {
|
|
1376
|
+
await checkViewIdentityChange()
|
|
1377
|
+
let columnState: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(cStorageKey.value)
|
|
1378
|
+
if (!columnState) {
|
|
1379
|
+
columnState = await CachedManager.asyncCachedGet(cStorageKey.value)
|
|
1374
1380
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1381
|
+
props.columns._skip = true
|
|
1382
|
+
if (columnState) {
|
|
1383
|
+
if (typeof columnState === 'string') {
|
|
1384
|
+
columnState = JSON.parse(columnState)
|
|
1385
|
+
}
|
|
1386
|
+
for (const key in columnState as NfTableColumnAttributes) {
|
|
1387
|
+
const state = columnState![key]
|
|
1388
|
+
columns.every(i => {
|
|
1389
|
+
if (i.prop === key) {
|
|
1390
|
+
i.initHidden = state.initHidden
|
|
1391
|
+
i.attr ? i.attr['fixed'] = state.fixed : i.attr = { fixed: state.fixed }
|
|
1392
|
+
i._index = state.index
|
|
1393
|
+
return false
|
|
1394
|
+
}
|
|
1395
|
+
return true
|
|
1396
|
+
})
|
|
1397
|
+
}
|
|
1386
1398
|
}
|
|
1399
|
+
} catch (e) {
|
|
1400
|
+
console.log(e)
|
|
1387
1401
|
}
|
|
1388
|
-
} catch (e) {
|
|
1389
|
-
console.log(e)
|
|
1390
1402
|
}
|
|
1403
|
+
tableColumns.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
|
|
1404
|
+
nextTick(() => {
|
|
1405
|
+
props.columns._skip = false
|
|
1406
|
+
})
|
|
1407
|
+
elTableRefKey.value = Date.now()
|
|
1408
|
+
}
|
|
1409
|
+
const initColumn = async () => {
|
|
1410
|
+
await initCachedData()
|
|
1411
|
+
syncCookiesToTableColumn(true)
|
|
1391
1412
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1413
|
+
|
|
1414
|
+
initColumn()
|
|
1415
|
+
|
|
1416
|
+
onBeforeMount(() => {
|
|
1417
|
+
watch(() => {
|
|
1418
|
+
return props.columns
|
|
1419
|
+
}, async () => {
|
|
1420
|
+
if (props.columns._skip) {
|
|
1421
|
+
return
|
|
1422
|
+
}
|
|
1423
|
+
localShowColumn.value = initLocalShow()
|
|
1424
|
+
await syncCookiesToTableColumn()
|
|
1425
|
+
}, {
|
|
1426
|
+
deep: true
|
|
1427
|
+
})
|
|
1428
|
+
watch(() => props.pageAttrs, (val) => {
|
|
1429
|
+
if ('current-page' in val) {
|
|
1430
|
+
cPageAttrs['current-page'] = Number(val['current-page'])
|
|
1431
|
+
}
|
|
1432
|
+
if ('page-size' in val) {
|
|
1433
|
+
cPageAttrs['page-size'] = Number(val['page-size'])
|
|
1434
|
+
}
|
|
1435
|
+
}, {
|
|
1436
|
+
deep: true
|
|
1437
|
+
})
|
|
1395
1438
|
})
|
|
1396
|
-
elTableRefKey.value = Date.now()
|
|
1397
|
-
}
|
|
1398
|
-
const initColumn = async () => {
|
|
1399
|
-
await initCachedData()
|
|
1400
|
-
syncCookiesToTableColumn(true)
|
|
1401
|
-
}
|
|
1402
1439
|
|
|
1403
|
-
|
|
1440
|
+
const searchFormAttrer = computed(() => {
|
|
1441
|
+
const obj: Record<string, any> = {
|
|
1442
|
+
...(props.setEasyConf ? {
|
|
1443
|
+
labelWidth: 80,
|
|
1444
|
+
btnModel: 'inline',
|
|
1445
|
+
columnEdit: true
|
|
1446
|
+
} : {}),
|
|
1447
|
+
storageKey: props.searchFormStorageKey,
|
|
1448
|
+
viewIdentity: props.viewIdentity,
|
|
1449
|
+
...props.searchFormAttrs
|
|
1450
|
+
}
|
|
1451
|
+
return obj
|
|
1452
|
+
})
|
|
1404
1453
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1454
|
+
const tableAttrer = computed(() => {
|
|
1455
|
+
const obj: Record<string, any> = {
|
|
1456
|
+
'header-cell-style': {
|
|
1457
|
+
'text-align': 'left',
|
|
1458
|
+
'background': '#F5F7FA',
|
|
1459
|
+
'height': '48px',
|
|
1460
|
+
'color': '#303133',
|
|
1461
|
+
'font-size': '14px'
|
|
1462
|
+
|
|
1463
|
+
},
|
|
1464
|
+
'cell-style': { 'text-align': 'left' },
|
|
1465
|
+
resizable: true,
|
|
1466
|
+
border: true,
|
|
1467
|
+
stripe: (window as any).nfTableStripe,
|
|
1468
|
+
...(props.setEasyConf ? {
|
|
1469
|
+
'row-key': 'id'
|
|
1470
|
+
} : {}),
|
|
1471
|
+
...props.tableAttrs
|
|
1411
1472
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
}, {
|
|
1415
|
-
deep: true
|
|
1473
|
+
delete obj.data
|
|
1474
|
+
return obj
|
|
1416
1475
|
})
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1476
|
+
|
|
1477
|
+
const tableEventer = computed(() => {
|
|
1478
|
+
const obj: Record<string, any> = {
|
|
1479
|
+
...props.tableEvents,
|
|
1480
|
+
'header-dragend': headerDragend
|
|
1420
1481
|
}
|
|
1421
|
-
|
|
1422
|
-
|
|
1482
|
+
return obj
|
|
1483
|
+
})
|
|
1484
|
+
|
|
1485
|
+
const pageSizes = ref([10, 20, 30, 40, 50, 100, 200])
|
|
1486
|
+
const initPageSizes = () => {
|
|
1487
|
+
const pageSizeArr = props.pageAttrs['page-sizes']
|
|
1488
|
+
if (props.pageAttrs['page-size']! < (pageSizeArr?.length ? pageSizeArr[0] : 10)) {
|
|
1489
|
+
pageSizes.value.unshift(props.pageAttrs['page-size']!)
|
|
1423
1490
|
}
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
const showPage = computed(() => {
|
|
1494
|
+
return showData.value.length > props.pageAttrs['page-size']!
|
|
1495
|
+
})
|
|
1496
|
+
|
|
1497
|
+
const renderPage = computed(() => {
|
|
1498
|
+
return props.alwaysShowPage || showPage.value
|
|
1499
|
+
})
|
|
1500
|
+
|
|
1501
|
+
initPageSizes()
|
|
1502
|
+
|
|
1503
|
+
const pageAttrer = computed(() => {
|
|
1504
|
+
const map = {
|
|
1505
|
+
background: false,
|
|
1506
|
+
layout: 'total, sizes, prev, pager, next, jumper',
|
|
1507
|
+
'page-sizes': pageSizes.value,
|
|
1508
|
+
total: typeof props.pageAttrs.total === 'undefined' ? props.data?.length : undefined,
|
|
1509
|
+
...props.pageAttrs
|
|
1510
|
+
}
|
|
1511
|
+
delete map['current-page']
|
|
1512
|
+
delete map['page-size']
|
|
1513
|
+
return map
|
|
1426
1514
|
})
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
btnModel: 'inline',
|
|
1434
|
-
columnEdit: true
|
|
1435
|
-
} : {}),
|
|
1436
|
-
storageKey: props.searchFormStorageKey,
|
|
1437
|
-
viewIdentity: props.viewIdentity,
|
|
1438
|
-
...props.searchFormAttrs
|
|
1515
|
+
|
|
1516
|
+
const isShow = (column: Record<string, any>) => {
|
|
1517
|
+
if (column.type) {
|
|
1518
|
+
return true
|
|
1519
|
+
}
|
|
1520
|
+
return !column.initHidden && !resolveValue(column.destory, column)
|
|
1439
1521
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
const tableAttrer = computed(() => {
|
|
1444
|
-
const obj: Record<string, any> = {
|
|
1445
|
-
'header-cell-style': {
|
|
1446
|
-
'text-align': 'left',
|
|
1447
|
-
'background': '#F5F7FA',
|
|
1448
|
-
'height': '48px',
|
|
1449
|
-
'color': '#303133',
|
|
1450
|
-
'font-size': '14px'
|
|
1451
|
-
|
|
1452
|
-
},
|
|
1453
|
-
'cell-style': { 'text-align': 'left' },
|
|
1454
|
-
resizable: true,
|
|
1455
|
-
border: true,
|
|
1456
|
-
stripe: (window as any).nfTableStripe,
|
|
1457
|
-
...(props.setEasyConf ? {
|
|
1458
|
-
'row-key': 'id'
|
|
1459
|
-
} : {}),
|
|
1460
|
-
...props.tableAttrs
|
|
1522
|
+
|
|
1523
|
+
const resetNfSearchFormModel = () => {
|
|
1524
|
+
nfSearchFormRef.value?.resetNfSearchFormModel()
|
|
1461
1525
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
})
|
|
1465
|
-
|
|
1466
|
-
const tableEventer = computed(() => {
|
|
1467
|
-
const obj: Record<string, any> = {
|
|
1468
|
-
...props.tableEvents,
|
|
1469
|
-
'header-dragend': headerDragend
|
|
1526
|
+
const onNfSearchFormValidate = (callback) => {
|
|
1527
|
+
nfSearchFormRef.value?.onNfSearchFormValidate(callback)
|
|
1470
1528
|
}
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
const pageSizeArr = props.pageAttrs['page-sizes']
|
|
1477
|
-
if (props.pageAttrs['page-size']! < (pageSizeArr?.length ? pageSizeArr[0] : 10)) {
|
|
1478
|
-
pageSizes.value.unshift(props.pageAttrs['page-size']!)
|
|
1529
|
+
const onNfSearchFormSearch = () => {
|
|
1530
|
+
nfSearchFormRef.value?.onNfSearchFormSearch()
|
|
1531
|
+
}
|
|
1532
|
+
const onNfSearchFormExport = () => {
|
|
1533
|
+
nfSearchFormRef.value?.onNfSearchFormExport()
|
|
1479
1534
|
}
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
const showPage = computed(() => {
|
|
1483
|
-
return showData.value.length > props.pageAttrs['page-size']!
|
|
1484
|
-
})
|
|
1485
|
-
|
|
1486
|
-
const renderPage = computed(() => {
|
|
1487
|
-
return props.alwaysShowPage || showPage.value
|
|
1488
|
-
})
|
|
1489
1535
|
|
|
1490
|
-
|
|
1536
|
+
const clearSelection = () => {
|
|
1537
|
+
elTableRef.value?.clearSelection()
|
|
1538
|
+
}
|
|
1539
|
+
const toggleRowSelection = (row: Record<string, any>, selected: boolean) => {
|
|
1540
|
+
elTableRef.value?.toggleRowSelection(row, selected)
|
|
1541
|
+
}
|
|
1542
|
+
const toggleAllSelection = () => {
|
|
1543
|
+
elTableRef.value?.toggleAllSelection()
|
|
1544
|
+
}
|
|
1545
|
+
const toggleRowExpansion = (row: Record<string, any>, expanded: boolean) => {
|
|
1546
|
+
elTableRef.value?.toggleRowExpansion(row, expanded)
|
|
1547
|
+
}
|
|
1548
|
+
const setCurrentRow = (row: Record<string, any>) => {
|
|
1549
|
+
elTableRef.value?.setCurrentRow(row)
|
|
1550
|
+
}
|
|
1551
|
+
const clearSort = () => {
|
|
1552
|
+
elTableRef.value?.clearSort()
|
|
1553
|
+
}
|
|
1554
|
+
const clearFilter = () => {
|
|
1555
|
+
elTableRef.value?.clearFilter()
|
|
1556
|
+
}
|
|
1557
|
+
const doLayout = () => {
|
|
1558
|
+
elTableRef.value?.doLayout?.()
|
|
1559
|
+
}
|
|
1560
|
+
const sort = (prop, order) => {
|
|
1561
|
+
elTableRef.value?.sort(prop, order)
|
|
1562
|
+
}
|
|
1491
1563
|
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1564
|
+
const getActionBarItemStyle = (item: {style: Record<string, any>}, additionStyle: Record<string, any>) => {
|
|
1565
|
+
return {
|
|
1566
|
+
// action默认右边距为8px
|
|
1567
|
+
marginRight: '8px',
|
|
1568
|
+
...(additionStyle || {}),
|
|
1569
|
+
...(item.style || {})
|
|
1570
|
+
}
|
|
1499
1571
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1572
|
+
|
|
1573
|
+
const headerDragend = async (newWidth, oldWidth, column, event) => {
|
|
1574
|
+
await nextTick()
|
|
1575
|
+
const minWidth = getMinWidth(column)
|
|
1576
|
+
if (newWidth < minWidth) {
|
|
1577
|
+
column.width = minWidth
|
|
1578
|
+
}
|
|
1579
|
+
if (props.dragCached) { // 记录缓存
|
|
1580
|
+
const columnCachedData = await CachedManager.asyncCachedGet(`${cStorageKey.value}$drag-column-width`) || {}
|
|
1581
|
+
columnCachedData[column.property] = column.width
|
|
1582
|
+
await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData)
|
|
1583
|
+
}
|
|
1584
|
+
resizeTable()
|
|
1585
|
+
await props.tableEvents['header-dragend']?.(newWidth, oldWidth, column, event)
|
|
1508
1586
|
}
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1587
|
+
|
|
1588
|
+
// 为固定在右侧的"操作"列添加拖拽句柄(脱离文档流也可拖拽)
|
|
1589
|
+
let opFixedRightCleanup: Function | null = null
|
|
1590
|
+
const initOpFixedRightResizer = async () => {
|
|
1591
|
+
await nextTick()
|
|
1592
|
+
opFixedRightCleanup?.(); opFixedRightCleanup = null
|
|
1593
|
+
if (!props.fixedRightDragEnabled) return
|
|
1594
|
+
const tableEl = elTableRef.value?.$el as HTMLElement
|
|
1595
|
+
|
|
1596
|
+
if (!tableEl) return
|
|
1597
|
+
// 找出当前实际渲染并可见的列
|
|
1598
|
+
const visibleColumns = tableColumns.value.filter(col => isShow(col))
|
|
1599
|
+
|
|
1600
|
+
const opCol = visibleColumns.find(col => (col.prop || col.attr?.prop) === props.operationPropKey)
|
|
1601
|
+
if (!opCol || opCol?.attr?.fixed !== 'right') return
|
|
1602
|
+
|
|
1603
|
+
// 固定右侧表头 th 列集合(仅包含 fixed right 的列)
|
|
1604
|
+
const fixedRightHeader = tableEl.querySelector('.el-table__fixed-right .el-table__fixed-header-wrapper thead tr') as HTMLElement
|
|
1605
|
+
|
|
1606
|
+
if (!fixedRightHeader) return
|
|
1607
|
+
// 仅包含 fixed='right' 的列,用于定位对应 th
|
|
1608
|
+
const fixedIndex = visibleColumns.findIndex(col => col?.attr?.fixed === 'right')
|
|
1609
|
+
if (fixedIndex < 0) return
|
|
1610
|
+
const th = fixedRightHeader.querySelectorAll('th')[fixedIndex] as HTMLElement
|
|
1611
|
+
if (!th) return
|
|
1612
|
+
|
|
1613
|
+
// 在 .el-table__fixed-right 下创建覆盖层(宽高自适应、相对定位),句柄相对该层绝对定位到左侧
|
|
1614
|
+
const fixedRightRoot = tableEl.querySelector('.el-table__fixed-right') as HTMLElement
|
|
1615
|
+
if (!fixedRightRoot) return
|
|
1616
|
+
// 清理历史覆盖层
|
|
1617
|
+
const oldOverlay = fixedRightRoot.querySelector('[data-nf-fixed-right-overlay="true"]') as HTMLElement
|
|
1618
|
+
if (oldOverlay) oldOverlay.remove()
|
|
1619
|
+
const overlay = document.createElement('div')
|
|
1620
|
+
overlay.setAttribute('data-nf-fixed-right-overlay', 'true')
|
|
1621
|
+
overlay.style.position = 'relative'
|
|
1622
|
+
overlay.style.width = '100%'
|
|
1623
|
+
overlay.style.height = '100%'
|
|
1624
|
+
overlay.style.pointerEvents = 'none'
|
|
1625
|
+
overlay.style.zIndex = '30'
|
|
1626
|
+
fixedRightRoot.appendChild(overlay)
|
|
1627
|
+
|
|
1628
|
+
// 隐藏固定列相邻列与固定列本身的原生拖拽 after,避免干扰
|
|
1629
|
+
const mainHeader = tableEl.querySelector('.el-table__header-wrapper thead tr') as HTMLElement
|
|
1630
|
+
const cleanupHideAfter: HTMLElement[] = []
|
|
1631
|
+
const hideNativeAfter = (el?: HTMLElement) => {
|
|
1632
|
+
if (!el) return
|
|
1633
|
+
el.classList.add('nf-table-hide-after')
|
|
1634
|
+
cleanupHideAfter.push(el)
|
|
1635
|
+
}
|
|
1636
|
+
// 相邻的非固定列(左侧)
|
|
1637
|
+
const lastNormalIndex = fixedIndex - 1
|
|
1638
|
+
if (mainHeader) {
|
|
1639
|
+
const mainThs = mainHeader.querySelectorAll('th')
|
|
1640
|
+
if (lastNormalIndex >= 0 && lastNormalIndex < mainThs.length) {
|
|
1641
|
+
hideNativeAfter(mainThs[lastNormalIndex] as HTMLElement)
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
// 固定列自身
|
|
1645
|
+
hideNativeAfter(th)
|
|
1646
|
+
|
|
1647
|
+
// 创建句柄(相对覆盖层左侧对齐)
|
|
1648
|
+
const handle = document.createElement('div')
|
|
1649
|
+
handle.setAttribute('data-nf-fixed-op-resizer', 'true')
|
|
1650
|
+
handle.style.position = 'absolute'
|
|
1651
|
+
handle.style.left = '-8px'
|
|
1652
|
+
handle.style.top = '0'
|
|
1653
|
+
handle.style.bottom = '0'
|
|
1654
|
+
handle.style.width = '16px'
|
|
1655
|
+
handle.style.cursor = 'col-resize'
|
|
1656
|
+
handle.style.zIndex = '10'
|
|
1657
|
+
handle.style.background = 'transparent'
|
|
1658
|
+
handle.style.pointerEvents = 'auto'
|
|
1659
|
+
overlay.appendChild(handle)
|
|
1660
|
+
|
|
1661
|
+
// 拖拽逻辑
|
|
1662
|
+
let indicatorLine: HTMLElement | null = null
|
|
1663
|
+
const columnProp = opCol.prop || opCol.attr?.prop
|
|
1664
|
+
|
|
1665
|
+
// 创建指示线
|
|
1666
|
+
const createIndicatorLine = (rect?: DOMRect) => {
|
|
1667
|
+
const line = document.createElement('div')
|
|
1668
|
+
line.id = 'nf-fixed-right-indicator-line'
|
|
1669
|
+
|
|
1670
|
+
// 获取表格位置信息(入参优先,避免多次触发回流)
|
|
1671
|
+
const tableRect = rect || tableEl.getBoundingClientRect()
|
|
1672
|
+
|
|
1673
|
+
line.style.cssText = `
|
|
1674
|
+
position: fixed;
|
|
1675
|
+
top: ${tableRect.top}px;
|
|
1676
|
+
left: 0;
|
|
1677
|
+
height: ${tableRect.height}px;
|
|
1678
|
+
width: 2px;
|
|
1679
|
+
background: #409EFF;
|
|
1680
|
+
z-index: 10000;
|
|
1681
|
+
pointer-events: none;
|
|
1682
|
+
display: none;
|
|
1683
|
+
transform: translateX(0px);
|
|
1684
|
+
will-change: transform;
|
|
1685
|
+
`
|
|
1686
|
+
document.body.appendChild(line)
|
|
1687
|
+
return line
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// 拖动时显示指示线
|
|
1691
|
+
// 拖动时显示指示线(使用 rAF + transform 提升性能)
|
|
1692
|
+
let pending = false
|
|
1693
|
+
let cachedRect: DOMRect | null = null
|
|
1694
|
+
const onPointerMove = (e: PointerEvent) => {
|
|
1695
|
+
e.preventDefault()
|
|
1696
|
+
|
|
1697
|
+
if (!cachedRect) cachedRect = tableEl.getBoundingClientRect()
|
|
1698
|
+
const tableRect = cachedRect
|
|
1699
|
+
const leftBound = tableRect.left + (props.dragIndicatorPaddingLeft || 0)
|
|
1700
|
+
const rightBound = tableRect.right - (props.dragIndicatorPaddingRight || 0)
|
|
1701
|
+
|
|
1702
|
+
let dragX = e.clientX
|
|
1703
|
+
if (dragX < leftBound) dragX = leftBound
|
|
1704
|
+
if (dragX > rightBound) dragX = rightBound
|
|
1705
|
+
|
|
1706
|
+
if (indicatorLine) {
|
|
1707
|
+
if (!pending) {
|
|
1708
|
+
pending = true
|
|
1709
|
+
requestAnimationFrame(() => {
|
|
1710
|
+
indicatorLine!.style.display = 'block'
|
|
1711
|
+
indicatorLine!.style.transform = `translateX(${dragX}px)`
|
|
1712
|
+
pending = false
|
|
1713
|
+
})
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
const onPointerUp = async (e: PointerEvent) => {
|
|
1719
|
+
document.removeEventListener('pointermove', onPointerMove)
|
|
1720
|
+
document.removeEventListener('pointerup', onPointerUp)
|
|
1721
|
+
const dragMask = document.getElementById('nf-fixed-right-drag-mask')
|
|
1722
|
+
dragMask && dragMask.remove()
|
|
1723
|
+
|
|
1724
|
+
// 移除指示线
|
|
1725
|
+
if (indicatorLine) {
|
|
1726
|
+
indicatorLine.remove()
|
|
1727
|
+
indicatorLine = null
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
try { handle.releasePointerCapture && handle.releasePointerCapture(e.pointerId) } catch {}
|
|
1731
|
+
|
|
1732
|
+
// 计算最终宽度并更新
|
|
1733
|
+
try {
|
|
1734
|
+
// 复用缓存的 rect,避免额外回流
|
|
1735
|
+
const tableRect = cachedRect || tableEl.getBoundingClientRect()
|
|
1736
|
+
cachedRect = null
|
|
1737
|
+
// 以限定边界后的 clientX 计算最终宽度
|
|
1738
|
+
const leftBound = tableRect.left + (props.dragIndicatorPaddingLeft || 0)
|
|
1739
|
+
const rightBound = tableRect.right - (props.dragIndicatorPaddingRight || 0)
|
|
1740
|
+
const clampX = Math.min(Math.max(e.clientX, leftBound), rightBound)
|
|
1741
|
+
const rawWidth = tableRect.right - clampX
|
|
1742
|
+
const minWidth = getMinWidth(opCol)
|
|
1743
|
+
const finalWidthNum = Math.max(rawWidth, minWidth)
|
|
1744
|
+
|
|
1745
|
+
// 缓存宽度
|
|
1746
|
+
if (props.dragCached && columnProp) {
|
|
1747
|
+
const columnCachedData = await CachedManager.asyncCachedGet(`${cStorageKey.value}$drag-column-width`) || {}
|
|
1748
|
+
columnCachedData[columnProp] = finalWidthNum
|
|
1749
|
+
await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData)
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
// 通知外部(自定义固定列拖拽事件)
|
|
1753
|
+
const oldWidth = th.getBoundingClientRect().width
|
|
1754
|
+
emit('fixedColumnDragEnd', { width: finalWidthNum, oldWidth, prop: columnProp, column: opCol, nativeEvent: e })
|
|
1755
|
+
} catch (error) {
|
|
1756
|
+
console.error('更新列宽失败:', error)
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
const onPointerDown = (e: PointerEvent) => {
|
|
1761
|
+
e.preventDefault()
|
|
1762
|
+
|
|
1763
|
+
// 创建指示线
|
|
1764
|
+
indicatorLine = createIndicatorLine()
|
|
1765
|
+
|
|
1766
|
+
// 添加全屏遮罩捕获指针,避免失焦
|
|
1767
|
+
const mask = document.createElement('div')
|
|
1768
|
+
mask.id = 'nf-fixed-right-drag-mask'
|
|
1769
|
+
mask.style.cssText = 'position:fixed;inset:0;cursor:col-resize;z-index:9999;'
|
|
1770
|
+
document.body.appendChild(mask)
|
|
1771
|
+
try { handle.setPointerCapture && handle.setPointerCapture(e.pointerId) } catch {}
|
|
1772
|
+
document.addEventListener('pointermove', onPointerMove, { passive: false } as any)
|
|
1773
|
+
document.addEventListener('pointerup', onPointerUp)
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
handle.addEventListener('pointerdown', onPointerDown)
|
|
1777
|
+
opFixedRightCleanup = () => {
|
|
1778
|
+
try {
|
|
1779
|
+
handle.removeEventListener('pointerdown', onPointerDown)
|
|
1780
|
+
handle.remove()
|
|
1781
|
+
// 恢复原生 after
|
|
1782
|
+
cleanupHideAfter.forEach(el => el.classList.remove('nf-table-hide-after'))
|
|
1783
|
+
} catch {}
|
|
1784
|
+
}
|
|
1559
1785
|
}
|
|
1560
|
-
|
|
1786
|
+
// 监听列或显示项变化,重建句柄
|
|
1787
|
+
watch(() => [tableColumns.value.length, localShowColumn.value?.length, elTableRefKey.value], () => {
|
|
1788
|
+
initOpFixedRightResizer()
|
|
1789
|
+
})
|
|
1790
|
+
// 当开关变化时,初始化或清理
|
|
1791
|
+
watch(() => props.fixedRightDragEnabled, () => {
|
|
1792
|
+
initOpFixedRightResizer()
|
|
1793
|
+
})
|
|
1561
1794
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
const minWidth = getMinWidth(column)
|
|
1565
|
-
if (newWidth < minWidth) {
|
|
1566
|
-
column.width = minWidth
|
|
1795
|
+
async function clearDragCached() {
|
|
1796
|
+
await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, null)
|
|
1567
1797
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, columnCachedData)
|
|
1798
|
+
|
|
1799
|
+
async function clearColumnEditCached() {
|
|
1800
|
+
await CachedManager.asyncCachedSet(cStorageKey.value, null)
|
|
1572
1801
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
async function clearColumnEditCached() {
|
|
1582
|
-
await CachedManager.asyncCachedSet(cStorageKey.value, null)
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
const columnCheckConfirmFeedback = (value: Record<string, any>) => {
|
|
1586
|
-
if (!props.columnEdit) {
|
|
1587
|
-
const itemsList: string[] = []
|
|
1588
|
-
for (const key in value) {
|
|
1589
|
-
if (value[key]) {
|
|
1590
|
-
itemsList.push(key)
|
|
1802
|
+
|
|
1803
|
+
const columnCheckConfirmFeedback = (value: Record<string, any>) => {
|
|
1804
|
+
if (!props.columnEdit) {
|
|
1805
|
+
const itemsList: string[] = []
|
|
1806
|
+
for (const key in value) {
|
|
1807
|
+
if (value[key]) {
|
|
1808
|
+
itemsList.push(key)
|
|
1809
|
+
}
|
|
1591
1810
|
}
|
|
1811
|
+
localShowColumn.value = itemsList
|
|
1812
|
+
syncShowItemToInitHidden()
|
|
1592
1813
|
}
|
|
1593
|
-
localShowColumn.value = itemsList
|
|
1594
|
-
syncShowItemToInitHidden()
|
|
1595
1814
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
const fieldsConfirm = async (value) => {
|
|
1603
|
-
columnCheckConfirmFeedback(value)
|
|
1604
|
-
await syncCookiesToLocalShowColumn()
|
|
1605
|
-
await syncCookiesToTableColumn()
|
|
1606
|
-
emit('fieldsChange', localShowColumn.value)
|
|
1607
|
-
}
|
|
1608
|
-
/**
|
|
1609
|
-
* 抽屉确定
|
|
1610
|
-
* @param { Function } cb
|
|
1611
|
-
* @param { Function } error
|
|
1612
|
-
*/
|
|
1613
|
-
const columnCheckConfirm = async (cb, error) => {
|
|
1614
|
-
try {
|
|
1615
|
-
const value = columnCheckDrawer.value.syncTableColumnsToCookies()
|
|
1815
|
+
|
|
1816
|
+
/**
|
|
1817
|
+
* 弹框确定
|
|
1818
|
+
* @param { Object } value
|
|
1819
|
+
*/
|
|
1820
|
+
const fieldsConfirm = async (value) => {
|
|
1616
1821
|
columnCheckConfirmFeedback(value)
|
|
1617
1822
|
await syncCookiesToLocalShowColumn()
|
|
1618
1823
|
await syncCookiesToTableColumn()
|
|
1619
1824
|
emit('fieldsChange', localShowColumn.value)
|
|
1620
|
-
cb()
|
|
1621
|
-
} catch (e) {
|
|
1622
|
-
error()
|
|
1623
|
-
console.log(e)
|
|
1624
1825
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1826
|
+
/**
|
|
1827
|
+
* 抽屉确定
|
|
1828
|
+
* @param { Function } cb
|
|
1829
|
+
* @param { Function } error
|
|
1830
|
+
*/
|
|
1831
|
+
const columnCheckConfirm = async (cb, error) => {
|
|
1832
|
+
try {
|
|
1833
|
+
const value = columnCheckDrawer.value.syncTableColumnsToCookies()
|
|
1834
|
+
columnCheckConfirmFeedback(value)
|
|
1835
|
+
await syncCookiesToLocalShowColumn()
|
|
1836
|
+
await syncCookiesToTableColumn()
|
|
1837
|
+
emit('fieldsChange', localShowColumn.value)
|
|
1838
|
+
cb()
|
|
1839
|
+
} catch (e) {
|
|
1840
|
+
error()
|
|
1841
|
+
console.log(e)
|
|
1639
1842
|
}
|
|
1640
|
-
} else {
|
|
1641
|
-
elTableHeight.value = props.tableAttrs?.height
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
// 触发列表查询
|
|
1646
|
-
const searchApi = async (formData = {}, refresh = false) => {
|
|
1647
|
-
// search-form-events有配置onSearch,则触发(兼容老版本)
|
|
1648
|
-
props.searchFormEvents?.['onSearch']?.(formData)
|
|
1649
|
-
if (!instance?.$listeners?.searchApi) return
|
|
1650
|
-
// 以下是配置@searchApi触发
|
|
1651
|
-
tableLoading.value = true
|
|
1652
|
-
// 查询条件改变,重置当前页数为1
|
|
1653
|
-
if (refresh || JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
|
|
1654
|
-
handleCurrentChange(1, false)
|
|
1655
1843
|
}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
* 计算表格高度
|
|
1847
|
+
*/
|
|
1848
|
+
const calcTableHeight = () => {
|
|
1849
|
+
if (
|
|
1850
|
+
props.calHeight && nfTableContent.value
|
|
1851
|
+
) {
|
|
1852
|
+
const tableContentH = nfTableContent.value?.offsetHeight
|
|
1853
|
+
const actionH = nfTableActionContainerRef.value.offsetHeight
|
|
1854
|
+
const h = tableContentH - actionH
|
|
1855
|
+
if (h > 0) {
|
|
1856
|
+
elTableHeight.value = h
|
|
1857
|
+
}
|
|
1858
|
+
} else {
|
|
1859
|
+
elTableHeight.value = props.tableAttrs?.height
|
|
1670
1860
|
}
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
// 触发列表查询
|
|
1864
|
+
const searchApi = async (formData = {}, refresh = false) => {
|
|
1865
|
+
// search-form-events有配置onSearch,则触发(兼容老版本)
|
|
1866
|
+
props.searchFormEvents?.['onSearch']?.(formData)
|
|
1867
|
+
if (!instance?.$listeners?.searchApi) return
|
|
1868
|
+
// 以下是配置@searchApi触发
|
|
1869
|
+
tableLoading.value = true
|
|
1870
|
+
// 查询条件改变,重置当前页数为1
|
|
1871
|
+
if (refresh || JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
|
|
1872
|
+
handleCurrentChange(1, false)
|
|
1681
1873
|
}
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1874
|
+
preSearchFormData.value = formData
|
|
1875
|
+
await nextTick()
|
|
1876
|
+
emit('searchApi', {
|
|
1877
|
+
data: {
|
|
1878
|
+
...formData,
|
|
1879
|
+
...(
|
|
1880
|
+
props.alwaysShowPage ? {
|
|
1881
|
+
[cPageAttrs.pageKeys[0]]: cPageAttrs['current-page'],
|
|
1882
|
+
[cPageAttrs.pageKeys[1]]: cPageAttrs['page-size'],
|
|
1883
|
+
} : {}
|
|
1884
|
+
)
|
|
1885
|
+
},
|
|
1886
|
+
callback: () => {
|
|
1887
|
+
tableLoading.value = false
|
|
1888
|
+
}
|
|
1889
|
+
})
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
// 调整table固定列高度
|
|
1893
|
+
const resizeTable = () => {
|
|
1894
|
+
if (props.detectResize) {
|
|
1895
|
+
const hasLeftFixed = processedColumns.value.find(item => item.attr.fixed === 'left' || item.attr.fixed === true)
|
|
1896
|
+
const hasRightFixed = processedColumns.value.find(item => item.attr.fixed === 'right')
|
|
1897
|
+
if (!hasLeftFixed && !hasRightFixed) {
|
|
1898
|
+
return
|
|
1899
|
+
}
|
|
1900
|
+
let timer: ReturnType<typeof setTimeout> | undefined = setTimeout(() => {
|
|
1901
|
+
try {
|
|
1902
|
+
clearTimeout(timer)
|
|
1903
|
+
timer = undefined
|
|
1904
|
+
if (elTableRef.value) {
|
|
1905
|
+
const childrenEle = elTableRef.value.$el.children
|
|
1906
|
+
/** 内容table */
|
|
1907
|
+
const eleChildrenContent = childrenEle[2].children[0].children[1].children
|
|
1908
|
+
for (let i = 0; i < eleChildrenContent?.['length']; i++) {
|
|
1909
|
+
const offsetHeight = eleChildrenContent[i].offsetHeight + 'px'
|
|
1910
|
+
if (hasLeftFixed) {
|
|
1911
|
+
/** 左侧固定table */
|
|
1912
|
+
const eleChildrenFixLeft = childrenEle[3].children[1].children[0].children[1].children
|
|
1913
|
+
eleChildrenFixLeft[i].style.height = offsetHeight
|
|
1914
|
+
}
|
|
1915
|
+
if (hasRightFixed) {
|
|
1916
|
+
/** 右侧固定table */
|
|
1917
|
+
const eleChildrenFixRight = childrenEle[hasLeftFixed ? 4 : 3].children[1].children[0].children[1].children
|
|
1918
|
+
eleChildrenFixRight[i].style.height = offsetHeight
|
|
1919
|
+
}
|
|
1701
1920
|
}
|
|
1921
|
+
nextTick(() => {
|
|
1922
|
+
doLayout()
|
|
1923
|
+
})
|
|
1702
1924
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
})
|
|
1925
|
+
} catch (err) {
|
|
1926
|
+
console.error(err)
|
|
1706
1927
|
}
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
}
|
|
1710
|
-
}, 50)
|
|
1928
|
+
}, 50)
|
|
1929
|
+
}
|
|
1711
1930
|
}
|
|
1712
|
-
}
|
|
1713
1931
|
|
|
1714
|
-
// 动态绑定包裹组件属性
|
|
1715
|
-
const wrapperProps = computed(() => {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
}
|
|
1720
|
-
})
|
|
1721
|
-
|
|
1722
|
-
const tableData = ref([])
|
|
1723
|
-
const handleVirtualChange = (scrollData) => {
|
|
1724
|
-
tableData.value = scrollData
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
onMounted(() => {
|
|
1728
|
-
calcTableHeight()
|
|
1729
|
-
props.columns.forEach(i => {
|
|
1730
|
-
if (i.singleHeadMutiColSlot) {
|
|
1731
|
-
console.log('🔅 ~ onMounted ~ props.columns:', props.columns)
|
|
1932
|
+
// 动态绑定包裹组件属性
|
|
1933
|
+
const wrapperProps = computed(() => {
|
|
1934
|
+
return {
|
|
1935
|
+
data: props.virtualTableData,
|
|
1936
|
+
...props.virtualProps
|
|
1732
1937
|
}
|
|
1733
1938
|
})
|
|
1734
|
-
if (cInitSearchApi.value) onNfSearchFormSearch()
|
|
1735
|
-
})
|
|
1736
1939
|
|
|
1737
|
-
const
|
|
1940
|
+
const tableData = ref([])
|
|
1941
|
+
const handleVirtualChange = (scrollData) => {
|
|
1942
|
+
tableData.value = scrollData
|
|
1943
|
+
}
|
|
1738
1944
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1945
|
+
onMounted(() => {
|
|
1946
|
+
calcTableHeight()
|
|
1947
|
+
props.columns.forEach(i => {
|
|
1948
|
+
if (i.singleHeadMutiColSlot) {
|
|
1949
|
+
console.log('🔅 ~ onMounted ~ props.columns:', props.columns)
|
|
1950
|
+
}
|
|
1951
|
+
})
|
|
1952
|
+
if (cInitSearchApi.value) onNfSearchFormSearch()
|
|
1953
|
+
// 初始化固定右侧操作列句柄
|
|
1954
|
+
initOpFixedRightResizer()
|
|
1955
|
+
})
|
|
1744
1956
|
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1957
|
+
const nfTableBorder = (window as any).nfTableBorder
|
|
1958
|
+
|
|
1959
|
+
/** nfSearchForm表单数据(如果存在<nf-search-form>) */
|
|
1960
|
+
const nfSearchFormModel = computed({
|
|
1961
|
+
get: () => nfSearchFormRef.value?.nfSearchFormModel || {},
|
|
1962
|
+
set: formData => nfSearchFormRef.value?.setNfSearchFormModel?.(formData)
|
|
1963
|
+
})
|
|
1964
|
+
|
|
1965
|
+
defineExpose({
|
|
1966
|
+
/**
|
|
1967
|
+
* 表格clearFilter
|
|
1968
|
+
*/
|
|
1969
|
+
clearFilter,
|
|
1970
|
+
/**
|
|
1971
|
+
* 表格sort
|
|
1972
|
+
*/
|
|
1973
|
+
sort,
|
|
1974
|
+
/**
|
|
1975
|
+
* 表格doLayout
|
|
1976
|
+
*/
|
|
1977
|
+
doLayout,
|
|
1978
|
+
/**
|
|
1979
|
+
* 表格clearSort
|
|
1980
|
+
*/
|
|
1981
|
+
clearSort,
|
|
1982
|
+
/**
|
|
1983
|
+
* 表格setCurrentRow
|
|
1984
|
+
*/
|
|
1985
|
+
setCurrentRow,
|
|
1986
|
+
/**
|
|
1987
|
+
* 表格toggleRowExpansion
|
|
1988
|
+
*/
|
|
1989
|
+
toggleRowExpansion,
|
|
1990
|
+
/**
|
|
1991
|
+
* 表格toggleAllSelection
|
|
1992
|
+
*/
|
|
1993
|
+
toggleAllSelection,
|
|
1994
|
+
/**
|
|
1995
|
+
* 表格toggleRowSelection
|
|
1996
|
+
*/
|
|
1997
|
+
toggleRowSelection,
|
|
1998
|
+
/**
|
|
1999
|
+
* 表格clearSelection
|
|
2000
|
+
*/
|
|
2001
|
+
clearSelection,
|
|
2002
|
+
/**
|
|
2003
|
+
* 表单重置
|
|
2004
|
+
*/
|
|
2005
|
+
resetNfSearchFormModel,
|
|
2006
|
+
/**
|
|
2007
|
+
* 表单验证
|
|
2008
|
+
*/
|
|
2009
|
+
onNfSearchFormValidate,
|
|
2010
|
+
/**
|
|
2011
|
+
* 表单搜索
|
|
2012
|
+
*/
|
|
2013
|
+
onNfSearchFormSearch,
|
|
2014
|
+
/**
|
|
2015
|
+
* 表单导出
|
|
2016
|
+
*/
|
|
2017
|
+
onNfSearchFormExport,
|
|
2018
|
+
/**
|
|
2019
|
+
* 表格nf-table ref(div)
|
|
2020
|
+
*/
|
|
2021
|
+
nfTableRef,
|
|
2022
|
+
/**
|
|
2023
|
+
* 表格el-table ref
|
|
2024
|
+
*/
|
|
2025
|
+
elTableRef,
|
|
2026
|
+
/**
|
|
2027
|
+
* 表格actionBar ref(div)
|
|
2028
|
+
*/
|
|
2029
|
+
nfTableActionContainerRef,
|
|
2030
|
+
/**
|
|
2031
|
+
* 表格actionBar ref(slot)
|
|
2032
|
+
*/
|
|
2033
|
+
nfTableActionBarRef,
|
|
2034
|
+
/**
|
|
2035
|
+
* 表格pagination ref
|
|
2036
|
+
*/
|
|
2037
|
+
nfTablePaginationRef,
|
|
2038
|
+
/**
|
|
2039
|
+
* 表单nf-search-form ref
|
|
2040
|
+
*/
|
|
2041
|
+
nfSearchFormRef,
|
|
2042
|
+
/**
|
|
2043
|
+
* loadingInstance
|
|
2044
|
+
*/
|
|
2045
|
+
loadingInstance,
|
|
2046
|
+
/**
|
|
2047
|
+
* 列编辑dialog/drawer显示/隐藏
|
|
2048
|
+
*/
|
|
2049
|
+
nfColumCheckDialogVisible,
|
|
2050
|
+
/**
|
|
2051
|
+
* 列编辑nf-drawer ref
|
|
2052
|
+
*/
|
|
2053
|
+
columnCheckNfDrawer,
|
|
2054
|
+
/**
|
|
2055
|
+
* 列编辑column-check-dialog ref
|
|
2056
|
+
*/
|
|
2057
|
+
columnCheckDialog,
|
|
2058
|
+
/**
|
|
2059
|
+
* 列编辑column-check-drawer ref
|
|
2060
|
+
*/
|
|
2061
|
+
columnCheckDrawer,
|
|
2062
|
+
/**
|
|
2063
|
+
* showItems同步props.formOptions[i].initHidden
|
|
2064
|
+
*/
|
|
2065
|
+
syncShowItemToInitHidden,
|
|
2066
|
+
/**
|
|
2067
|
+
* 分页数据(处理前端分页和后端分页)
|
|
2068
|
+
*/
|
|
2069
|
+
showData,
|
|
2070
|
+
/**
|
|
2071
|
+
* 列编辑显示的列prop
|
|
2072
|
+
*/
|
|
2073
|
+
localShowColumn,
|
|
2074
|
+
/**
|
|
2075
|
+
* 渲染表格项数据
|
|
2076
|
+
*/
|
|
2077
|
+
tableColumns,
|
|
2078
|
+
/**
|
|
2079
|
+
* 表格loading
|
|
2080
|
+
*/
|
|
2081
|
+
isLoading,
|
|
2082
|
+
/**
|
|
2083
|
+
* 计算表格高度
|
|
2084
|
+
*/
|
|
2085
|
+
calcTableHeight,
|
|
2086
|
+
/**
|
|
2087
|
+
* 列编辑同步组件到cookies
|
|
2088
|
+
*/
|
|
2089
|
+
syncLocalShowColumnToCookies,
|
|
2090
|
+
/**
|
|
2091
|
+
* 列编辑同步cookies到组件localShowItems
|
|
2092
|
+
*/
|
|
2093
|
+
syncCookiesToLocalShowColumn,
|
|
2094
|
+
/**
|
|
2095
|
+
* 列编辑同步cookies到组件渲染数据
|
|
2096
|
+
*/
|
|
2097
|
+
syncCookiesToTableColumn,
|
|
2098
|
+
elTableRefKey,
|
|
2099
|
+
clearDragCached,
|
|
2100
|
+
clearColumnEditCached,
|
|
2101
|
+
/** 切换页码 */
|
|
2102
|
+
handleCurrentChange,
|
|
2103
|
+
/** 当前页码 */
|
|
2104
|
+
pageAttrs: computed(() => cPageAttrs),
|
|
2105
|
+
resizeTable
|
|
2106
|
+
})
|
|
2107
|
+
|
|
2108
|
+
</script>
|