@94ai/nf-table 8.3.4 → 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.
@@ -1,226 +1,66 @@
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"
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
- {{ columnDisplayBtnText }}
45
- </nf-button>
46
- </slot>
47
- <!-- 非虚拟 -->
48
- <el-table
49
- v-if="!virtualized"
50
- ref="elTableRef"
51
- :class="{'nf-table-container': true, 'nf-default-table-border': !nfTableBorder && !tableAttrs?.border }"
52
- :data="showData"
53
- :fit="tableAttrer?.fit ?? true"
54
- :height="elTableHeight"
55
- v-bind="tableAttrer"
56
- v-on="tableEventer"
57
- :key="elTableRefKey"
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
- <el-table-column
85
- v-else-if="!column.type && isShow(column)"
86
- :key="column.key || column.prop || column.type"
87
- :type="column.type"
88
- :prop="column.prop"
89
- :label="resolveValue(column.label)"
90
- v-bind="column.attr"
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
- <!-- column套column -->
93
- <slot v-if="column.singleHeadMutiColSlot" :name="column.singleHeadMutiColSlot" />
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
- </el-table>
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="tableData"
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="cStorageKey"
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-else-if="column.type!=='expand'"
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
- </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"
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
- <template v-if="item.children?.length">
416
- <template
417
- v-for="(itemChildren, j) in item.children"
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
- <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>
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
- </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"
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
- <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>
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-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>
351
+ </el-table-column>
669
352
  </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>
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
- </div>
687
- <column-check-dialog
688
- :title="columnCheckTitle"
689
- :confirm-text="columnCheckConfirmButtonText"
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
- :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,
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
- * 表格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,
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
- 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
- viewIdentity: '',
921
- dragCached: true,
922
- emptyImageSize: 145,
923
- emptyText: '',
924
- priority: 'cached',
925
- storageKey: '', // 默认值为 `nf-table-columns-cached-key-${routeName}`
926
- searchFormStorageKey: '',
927
- checkMode: 'drawer',
928
- data: () => [],
929
- columns: () => [],
930
- searchFormAttrs: () => ({}),
931
- tableAttrs: () => ({}),
932
- pageAttrs: () => ({}),
933
- searchFormEvents: () => ({}),
934
- tableEvents: () => ({}),
935
- pageEvents: () => ({}),
936
- actionBarOptList: () => [],
937
- initSearchApi: undefined, // 初始化自动查询
938
- pageChangeSearchApi: undefined, // 分页切换的时候自动查询
939
- pageKeys: () => ['pageNo', 'pageSize'], // 分页使用的字段
940
- setEasyConf: false,
941
- detectResize: false,
942
- calHeight: false,
943
- columnEdit: false,
944
- columnPosition: 'embed',
945
- showColumn: undefined,
946
- loading: false,
947
- target: undefined,
948
- body: false,
949
- fullscreen: false,
950
- lock: true,
951
- text: undefined,
952
- spinner: undefined,
953
- background: undefined,
954
- customClass: undefined,
955
- columnDisplayBtnIcon: 'el-icon-plus',
956
- columnDisplayBtnType: 'primary',
957
- columnDisplayBtnPlain: true,
958
- columnDisplayBtnSize: 'mini',
959
- columnDisplayBtnRound: false,
960
- columnDisplayBtnCircle: false,
961
- columnDisplayBtnLoading: false,
962
- columnDisplayBtnDisabled: false,
963
- columnDisplayBtnClass: '',
964
- alwaysShowPage: true,
965
- operationPropKey: 'operation',
966
- columnCheckWidth: '600px',
967
- columnCheckModalAppendToBody: true,
968
- columnCheckModal: true,
969
- columnCheckFullscreen: false,
970
- columnCheckTop: '15vh',
971
- columnCheckAppendToBody: false,
972
- columnCheckLockScroll: true,
973
- columnCheckCustomClass: '',
974
- columnCheckCloseOnlickModal: true,
975
- columnCheckCloseOnPressEscape: true,
976
- columnCheckShowClose: true,
977
- columnCheckBeforeClose: undefined,
978
- columnCheckCenter: false,
979
- columnCheckDestroyOnClose: false,
980
- selectEmptyWarningTips: '请选择至少一个选项',
981
- columnDisplayBtnText: '设置列表字段',
982
- columnCheckTitle: '设置显示字段',
983
- columnCheckCancelButtonText: '取消',
984
- columnCheckConfirmButtonText: '确定',
985
- columnCheckSearchPlaceholder: '搜索',
986
- columnCheckFixedLeftDesc: '固定在左侧',
987
- columnCheckClearDesc: '清除',
988
- columnCheckNoFixedDesc: '不固定',
989
- columnCheckBasicFieldDesc: '基础字段',
990
- columnCheckGetCheckedLengthDesc: (length) => (length) => '已选(' + length + ')',
991
- columnCheckGetAllCheckDesc: (length) => (length) => '全选(' + length + ')',
992
- drawerProps: () => ({}),
993
- virtualized: false,
994
- virtualTableData: () => [],
995
- virtualProps: () => ({}),
996
- })
997
-
998
- const emit = defineEmits<{
999
- (e: 'fieldsChange', event: string[]): void
1000
- (e: 'update:showColumn', event: string[] | undefined): void
1001
- (e: 'searchApi', event: { data: Record<string, any>, callback: Function}): void
1002
- }>()
1003
-
1004
- const processedColumns = computed(() => {
1005
- const viewField = (window as any).viewField
1006
- if (props.viewIdentity && viewField) {
1007
- const showList = viewField.find(item => item.viewIdentity === props.viewIdentity)?.fieldList
1008
- if (showList?.length) {
1009
- return props.columns.filter(item => showList.includes(item.prop) || item.prop === props.operationPropKey || item.type === 'selection' || item.type === 'index' || item.type === 'expand')
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
- return props.columns
1013
- })
1023
+ return props.columns
1024
+ })
1014
1025
 
1015
1026
 
1016
- const getOperationListLocal = (column, scope) => {
1017
- if (typeof column.operationList === 'function') {
1018
- return column.operationList(scope)
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
- const routeName = computed(() => useRoute().name)
1034
- const instance = getCurrentInstance()?.proxy
1035
- const elTableRef = ref()
1036
- const nfTableActionContainerRef = ref()
1037
- const nfTablePaginationRef = ref()
1038
- const nfTableActionBarRef = ref()
1039
- const nfTableRef = ref()
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
- return key
1058
- })
1059
-
1060
- const cStorageKeyViewIdentity = computed(() => {
1061
- return 'nf-table-view-identity'
1062
- })
1063
-
1064
- const checkViewIdentityChange = async () => {
1065
- const userId = (window as any).userId
1066
- const viewField = (window as any).viewField
1067
- if (props.viewIdentity && userId && viewField) {
1068
- let viewIdentity = CachedManager.syncCachedGet(cStorageKeyViewIdentity.value)
1069
- if (!viewIdentity) {
1070
- viewIdentity = await CachedManager.asyncCachedGet(cStorageKeyViewIdentity.value)
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
- if (!viewIdentity) {
1073
- await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewField)
1074
- } else {
1075
- const newViewIdentity = viewField.find(item => item.viewIdentity === props.viewIdentity)
1076
- const oldViewIdentity = viewIdentity.find(item => item.viewIdentity === props.viewIdentity)
1077
- if ((newViewIdentity && !oldViewIdentity) || (!newViewIdentity && oldViewIdentity)) {
1078
- await clearColumnEditCached()
1079
- await clearDragCached()
1080
- } else if (newViewIdentity && oldViewIdentity) {
1081
- let change = false
1082
- newViewIdentity.fieldList.every(item => {
1083
- if (!oldViewIdentity.fieldList.includes(item)) {
1084
- change = true
1085
- return
1086
- }
1087
- return true
1088
- })
1089
- if (!change) {
1090
- oldViewIdentity.fieldList.every(item => {
1091
- if (!newViewIdentity.fieldList.includes(item)) {
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
- if (change) {
1099
- await clearColumnEditCached()
1100
- await clearDragCached()
1101
- oldViewIdentity.fieldList = newViewIdentity.fieldList
1102
- await CachedManager.asyncCachedSet(cStorageKeyViewIdentity.value, viewIdentity)
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
- const cPageAttrs = reactive({
1110
- // 页码,没有props时 & 允许分页时;默认 = 1
1111
- 'current-page': props.pageAttrs['current-page'] || (props.alwaysShowPage ? 1 : undefined),
1112
- 'page-size': props.pageAttrs['page-size'] || 10,
1113
- pageKeys: props.pageKeys
1114
- })
1115
- const tableLoading = ref(false)
1116
- const isLoading = computed(() => props.loading || tableLoading.value)
1117
-
1118
- // 切换size
1119
- const handleSizeChange = (val) => {
1120
- // props.pageEvents?.['size-change']?.(val)
1121
- cPageAttrs['page-size'] = val
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
- if (isSearch && cPageChangeSearchApi.value) onNfSearchFormSearch()
1132
- }
1133
-
1134
- /**
1135
- * 处理前端分页和后端分页
1136
- */
1137
- const showData = computed(() => {
1138
- const pageSize = props.pageAttrs['page-size']
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 hasOperationSlot = computed(() => {
1152
- return instance?.$slots.operation
1153
- })
1154
- const hasActionBarSlot = computed(() => {
1155
- return instance?.$slots.actionBar
1156
- })
1157
-
1158
-
1159
- const loadingInstance = ref()
1160
- watch(() => {
1161
- return props.loading || tableLoading.value
1162
- }, async () => {
1163
- if (props.loading || tableLoading.value) {
1164
- await nextTick()
1165
- const {
1166
- target,
1167
- lock,
1168
- fullscreen,
1169
- text,
1170
- spinner,
1171
- background,
1172
- customClass
1173
- } = props
1174
- loadingInstance.value = Loading.service({
1175
- target: target || elTableRef.value?.$el.parentNode || document.body,
1176
- lock,
1177
- fullscreen,
1178
- text,
1179
- spinner,
1180
- background,
1181
- customClass
1182
- })
1183
- } else {
1184
- loadingInstance.value?.close()
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
- immediate: true
1188
- })
1189
- // 同步用户参数
1190
- const initLocalShow = (init = false) => {
1191
- if (!init) {
1192
- props.columns._skip = true
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
- const result = processedColumns.value.filter(item => {
1195
- const prop = item.prop || item.attr?.prop
1196
- if (props.showColumn?.includes(prop!)) {
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
- return !item.initHidden
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
- if (result.length) {
1207
- return result
1208
- }
1209
- return processedColumns.value.map(item => item.prop! || item.attr?.prop!)
1210
- }
1211
- const localShowColumn = ref<string[]>(initLocalShow(true))
1212
- watch(() => localShowColumn.value?.length, () => {
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
- const showColumnItems: string[] = []
1261
- for (const key in columnState as NfTableColumnAttributes) {
1262
- if (!columnState![key].initHidden) {
1263
- showColumnItems.push(columnState![key].prop)
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
- localShowColumn.value = showColumnItems
1267
- syncShowItemToInitHidden()
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
- if (props.columnEdit) {
1277
- // 同步缓存参数
1278
- try {
1279
- await checkViewIdentityChange()
1280
- let cached: string | NfTableColumnAttributes | undefined = CachedManager.syncCachedGet(cStorageKey.value)
1281
- if (!cached) {
1282
- cached = await CachedManager.asyncCachedGet(cStorageKey.value)
1283
- }
1284
- const cachedPriority = props.priority === 'cached'
1285
- if (cachedPriority ? cached : localShowColumn.value?.length) {
1286
- cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies()
1287
- } else if (cachedPriority ? localShowColumn.value?.length : cached) {
1288
- cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn()
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
- if (props.dragCached) {
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
- const fs = 14
1308
- const char = columnLabel.match(/[\u2E80-\u9FFF]/g)
1309
- const charLen = char ? char.length : 0
1310
- const num = columnLabel.match(/\d|\./g)
1311
- const numLen = num ? num.length : 0
1312
- const otherLen = columnLabel.length - charLen - numLen
1313
- return fs * (charLen * 1 + numLen * 0.7 + otherLen * 0.58) + 20 + (column.sortable ? 24 : 0)
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
- item.attr = {
1334
- ...item.attr,
1335
- ...attr
1336
- } as ElTableColumnAttributes
1337
- delete item.attr.prop
1338
- delete item.attr.label
1339
- item._index = index
1340
- set(item, 'initHidden', item.initHidden)
1341
- set(item, 'destory', item.destory)
1342
- item.__index = index
1343
- // 根据id映射文案
1344
- set(item, 'optionsTag', {})
1345
- if (item.getOptions) {
1346
- set(item, 'optionsEnum', {})
1347
- item.getOptions((list) => {
1348
- list.forEach(o => {
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
- props.columns._skip = true
1371
- if (columnState) {
1372
- if (typeof columnState === 'string') {
1373
- columnState = JSON.parse(columnState)
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
- for (const key in columnState as NfTableColumnAttributes) {
1376
- const state = columnState![key]
1377
- columns.every(i => {
1378
- if (i.prop === key) {
1379
- i.initHidden = state.initHidden
1380
- i.attr ? i.attr['fixed'] = state.fixed : i.attr = { fixed: state.fixed }
1381
- i._index = state.index
1382
- return false
1383
- }
1384
- return true
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
- tableColumns.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
1393
- nextTick(() => {
1394
- props.columns._skip = false
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
- initColumn()
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
- onBeforeMount(() => {
1406
- watch(() => {
1407
- return props.columns
1408
- }, async () => {
1409
- if (props.columns._skip) {
1410
- return
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
- localShowColumn.value = initLocalShow()
1413
- await syncCookiesToTableColumn()
1414
- }, {
1415
- deep: true
1473
+ delete obj.data
1474
+ return obj
1416
1475
  })
1417
- watch(() => props.pageAttrs, (val) => {
1418
- if ('current-page' in val) {
1419
- cPageAttrs['current-page'] = Number(val['current-page'])
1476
+
1477
+ const tableEventer = computed(() => {
1478
+ const obj: Record<string, any> = {
1479
+ ...props.tableEvents,
1480
+ 'header-dragend': headerDragend
1420
1481
  }
1421
- if ('page-size' in val) {
1422
- cPageAttrs['page-size'] = Number(val['page-size'])
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
- deep: true
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
- const searchFormAttrer = computed(() => {
1430
- const obj: Record<string, any> = {
1431
- ...(props.setEasyConf ? {
1432
- labelWidth: 80,
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
- return obj
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
- delete obj.data
1463
- return obj
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
- return obj
1472
- })
1473
-
1474
- const pageSizes = ref([10, 20, 30, 40, 50, 100, 200])
1475
- const initPageSizes = () => {
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
- initPageSizes()
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 pageAttrer = computed(() => {
1493
- const map = {
1494
- background: false,
1495
- layout: 'total, sizes, prev, pager, next, jumper',
1496
- 'page-sizes': pageSizes.value,
1497
- total: typeof props.pageAttrs.total === 'undefined' ? props.data?.length : undefined,
1498
- ...props.pageAttrs
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
- delete map['current-page']
1501
- delete map['page-size']
1502
- return map
1503
- })
1504
-
1505
- const isShow = (column: Record<string, any>) => {
1506
- if (column.type) {
1507
- return true
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
- return !column.initHidden && !resolveValue(column.destory, column)
1510
- }
1511
-
1512
- const resetNfSearchFormModel = () => {
1513
- nfSearchFormRef.value?.resetNfSearchFormModel()
1514
- }
1515
- const onNfSearchFormValidate = (callback) => {
1516
- nfSearchFormRef.value?.onNfSearchFormValidate(callback)
1517
- }
1518
- const onNfSearchFormSearch = () => {
1519
- nfSearchFormRef.value?.onNfSearchFormSearch()
1520
- }
1521
- const onNfSearchFormExport = () => {
1522
- nfSearchFormRef.value?.onNfSearchFormExport()
1523
- }
1524
-
1525
- const clearSelection = () => {
1526
- elTableRef.value?.clearSelection()
1527
- }
1528
- const toggleRowSelection = (row: Record<string, any>, selected: boolean) => {
1529
- elTableRef.value?.toggleRowSelection(row, selected)
1530
- }
1531
- const toggleAllSelection = () => {
1532
- elTableRef.value?.toggleAllSelection()
1533
- }
1534
- const toggleRowExpansion = (row: Record<string, any>, expanded: boolean) => {
1535
- elTableRef.value?.toggleRowExpansion(row, expanded)
1536
- }
1537
- const setCurrentRow = (row: Record<string, any>) => {
1538
- elTableRef.value?.setCurrentRow(row)
1539
- }
1540
- const clearSort = () => {
1541
- elTableRef.value?.clearSort()
1542
- }
1543
- const clearFilter = () => {
1544
- elTableRef.value?.clearFilter()
1545
- }
1546
- const doLayout = () => {
1547
- elTableRef.value?.doLayout?.()
1548
- }
1549
- const sort = (prop, order) => {
1550
- elTableRef.value?.sort(prop, order)
1551
- }
1552
-
1553
- const getActionBarItemStyle = (item: {style: Record<string, any>}, additionStyle: Record<string, any>) => {
1554
- return {
1555
- // action默认右边距为8px
1556
- marginRight: '8px',
1557
- ...(additionStyle || {}),
1558
- ...(item.style || {})
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
- const headerDragend = async (newWidth, oldWidth, column, event) => {
1563
- await nextTick()
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
- if (props.dragCached) { // 记录缓存
1569
- const columnCachedData = await CachedManager.asyncCachedGet(`${cStorageKey.value}$drag-column-width`) || {}
1570
- columnCachedData[column.property] = column.width
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
- resizeTable()
1574
- await props.tableEvents['header-dragend']?.(newWidth, oldWidth, column, event)
1575
- }
1576
-
1577
- async function clearDragCached() {
1578
- await CachedManager.asyncCachedSet(`${cStorageKey.value}$drag-column-width`, null)
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
- * @param { Object } value
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 calcTableHeight = () => {
1631
- if (
1632
- props.calHeight && nfTableContent.value
1633
- ) {
1634
- const tableContentH = nfTableContent.value?.offsetHeight
1635
- const actionH = nfTableActionContainerRef.value.offsetHeight
1636
- const h = tableContentH - actionH
1637
- if (h > 0) {
1638
- elTableHeight.value = h
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
- preSearchFormData.value = formData
1657
- await nextTick()
1658
- emit('searchApi', {
1659
- data: {
1660
- ...formData,
1661
- ...(
1662
- props.alwaysShowPage ? {
1663
- [cPageAttrs.pageKeys[0]]: cPageAttrs['current-page'],
1664
- [cPageAttrs.pageKeys[1]]: cPageAttrs['page-size'],
1665
- } : {}
1666
- )
1667
- },
1668
- callback: () => {
1669
- tableLoading.value = false
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
- // 调整table固定列高度
1675
- const resizeTable = () => {
1676
- if (props.detectResize) {
1677
- const hasLeftFixed = processedColumns.value.find(item => item.attr.fixed === 'left' || item.attr.fixed === true)
1678
- const hasRightFixed = processedColumns.value.find(item => item.attr.fixed === 'right')
1679
- if (!hasLeftFixed && !hasRightFixed) {
1680
- return
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
- let timer: ReturnType<typeof setTimeout> | undefined = setTimeout(() => {
1683
- try {
1684
- clearTimeout(timer)
1685
- timer = undefined
1686
- if (elTableRef.value) {
1687
- const childrenEle = elTableRef.value.$el.children
1688
- /** 内容table */
1689
- const eleChildrenContent = childrenEle[2].children[0].children[1].children
1690
- for (let i = 0; i < eleChildrenContent?.['length']; i++) {
1691
- const offsetHeight = eleChildrenContent[i].offsetHeight + 'px'
1692
- if (hasLeftFixed) {
1693
- /** 左侧固定table */
1694
- const eleChildrenFixLeft = childrenEle[3].children[1].children[0].children[1].children
1695
- eleChildrenFixLeft[i].style.height = offsetHeight
1696
- }
1697
- if (hasRightFixed) {
1698
- /** 右侧固定table */
1699
- const eleChildrenFixRight = childrenEle[hasLeftFixed ? 4 : 3].children[1].children[0].children[1].children
1700
- eleChildrenFixRight[i].style.height = offsetHeight
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
- nextTick(() => {
1704
- doLayout()
1705
- })
1925
+ } catch (err) {
1926
+ console.error(err)
1706
1927
  }
1707
- } catch (err) {
1708
- console.error(err)
1709
- }
1710
- }, 50)
1928
+ }, 50)
1929
+ }
1711
1930
  }
1712
- }
1713
1931
 
1714
- // 动态绑定包裹组件属性
1715
- const wrapperProps = computed(() => {
1716
- return {
1717
- data: props.virtualTableData,
1718
- ...props.virtualProps
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 nfTableBorder = (window as any).nfTableBorder
1940
+ const tableData = ref([])
1941
+ const handleVirtualChange = (scrollData) => {
1942
+ tableData.value = scrollData
1943
+ }
1738
1944
 
1739
- /** nfSearchForm表单数据(如果存在<nf-search-form>) */
1740
- const nfSearchFormModel = computed({
1741
- get: () => nfSearchFormRef.value?.nfSearchFormModel || {},
1742
- set: formData => nfSearchFormRef.value?.setNfSearchFormModel?.(formData)
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
- defineExpose({
1746
- /**
1747
- * 表格clearFilter
1748
- */
1749
- clearFilter,
1750
- /**
1751
- * 表格sort
1752
- */
1753
- sort,
1754
- /**
1755
- * 表格doLayout
1756
- */
1757
- doLayout,
1758
- /**
1759
- * 表格clearSort
1760
- */
1761
- clearSort,
1762
- /**
1763
- * 表格setCurrentRow
1764
- */
1765
- setCurrentRow,
1766
- /**
1767
- * 表格toggleRowExpansion
1768
- */
1769
- toggleRowExpansion,
1770
- /**
1771
- * 表格toggleAllSelection
1772
- */
1773
- toggleAllSelection,
1774
- /**
1775
- * 表格toggleRowSelection
1776
- */
1777
- toggleRowSelection,
1778
- /**
1779
- * 表格clearSelection
1780
- */
1781
- clearSelection,
1782
- /**
1783
- * 表单重置
1784
- */
1785
- resetNfSearchFormModel,
1786
- /**
1787
- * 表单验证
1788
- */
1789
- onNfSearchFormValidate,
1790
- /**
1791
- * 表单搜索
1792
- */
1793
- onNfSearchFormSearch,
1794
- /**
1795
- * 表单导出
1796
- */
1797
- onNfSearchFormExport,
1798
- /**
1799
- * 表格nf-table ref(div)
1800
- */
1801
- nfTableRef,
1802
- /**
1803
- * 表格el-table ref
1804
- */
1805
- elTableRef,
1806
- /**
1807
- * 表格actionBar ref(div)
1808
- */
1809
- nfTableActionContainerRef,
1810
- /**
1811
- * 表格actionBar ref(slot)
1812
- */
1813
- nfTableActionBarRef,
1814
- /**
1815
- * 表格pagination ref
1816
- */
1817
- nfTablePaginationRef,
1818
- /**
1819
- * 表单nf-search-form ref
1820
- */
1821
- nfSearchFormRef,
1822
- /**
1823
- * loadingInstance
1824
- */
1825
- loadingInstance,
1826
- /**
1827
- * 列编辑dialog/drawer显示/隐藏
1828
- */
1829
- nfColumCheckDialogVisible,
1830
- /**
1831
- * 列编辑nf-drawer ref
1832
- */
1833
- columnCheckNfDrawer,
1834
- /**
1835
- * 列编辑column-check-dialog ref
1836
- */
1837
- columnCheckDialog,
1838
- /**
1839
- * 列编辑column-check-drawer ref
1840
- */
1841
- columnCheckDrawer,
1842
- /**
1843
- * showItems同步props.formOptions[i].initHidden
1844
- */
1845
- syncShowItemToInitHidden,
1846
- /**
1847
- * 分页数据(处理前端分页和后端分页)
1848
- */
1849
- showData,
1850
- /**
1851
- * 列编辑显示的列prop
1852
- */
1853
- localShowColumn,
1854
- /**
1855
- * 渲染表格项数据
1856
- */
1857
- tableColumns,
1858
- /**
1859
- * 表格loading
1860
- */
1861
- isLoading,
1862
- /**
1863
- * 计算表格高度
1864
- */
1865
- calcTableHeight,
1866
- /**
1867
- * 列编辑同步组件到cookies
1868
- */
1869
- syncLocalShowColumnToCookies,
1870
- /**
1871
- * 列编辑同步cookies到组件localShowItems
1872
- */
1873
- syncCookiesToLocalShowColumn,
1874
- /**
1875
- * 列编辑同步cookies到组件渲染数据
1876
- */
1877
- syncCookiesToTableColumn,
1878
- elTableRefKey,
1879
- clearDragCached,
1880
- clearColumnEditCached,
1881
- /** 切换页码 */
1882
- handleCurrentChange,
1883
- /** 当前页码 */
1884
- pageAttrs: computed(() => cPageAttrs),
1885
- resizeTable
1886
- })
1887
-
1888
- </script>
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>