@ctzy-web-client/plugin-component-vue 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/advance-select/advance-operation.mjs +51 -37
- package/es/advance-select/advance-option.mjs +167 -97
- package/es/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.mjs +7 -0
- package/es/advance-select/advance-select.mjs +368 -310
- package/es/advance-select/index.mjs +5 -5
- package/es/application-slot/breadcrumb-item.mjs +20 -17
- package/es/application-slot/header-tools-item.mjs +20 -17
- package/es/breadcrumb-select/breadcrumb-select.mjs +134 -112
- package/es/contextmenu/contextmenu-item.mjs +19 -15
- package/es/contextmenu/contextmenu.mjs +72 -56
- package/es/data-form/data-form-item.mjs +48 -30
- package/es/data-form/data-form.mjs +213 -166
- package/es/data-form/form-components/bwa-date-picker.mjs +51 -39
- package/es/data-form/form-components/bwa-date-time-picker.mjs +56 -44
- package/es/data-form/form-components/bwa-input-float.mjs +48 -37
- package/es/data-form/form-components/bwa-input-integer.mjs +68 -50
- package/es/data-form/form-components/bwa-input.mjs +43 -32
- package/es/data-form/form-components/bwa-multi-select.mjs +40 -29
- package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +554 -218
- package/es/data-form/form-components/bwa-rich-text.mjs +404 -316
- package/es/data-form/form-components/bwa-select.mjs +84 -70
- package/es/data-form/form-components/bwa-textarea.mjs +38 -27
- package/es/data-form/form-components/bwa-upload.mjs +172 -148
- package/es/data-form/form-components/bwa-user-multi-select.mjs +35 -24
- package/es/data-form/form-components/bwa-user-select.mjs +86 -61
- package/es/data-table/data-column-view.mjs +146 -115
- package/es/data-table/data-table-card.mjs +48 -40
- package/es/data-table/data-table-column.mjs +58 -45
- package/es/data-table/data-table.mjs +402 -316
- package/es/datatable-settings/datatable-settings.mjs +329 -254
- package/es/date-range/date-picker.mjs +130 -116
- package/es/date-range/date-range.mjs +215 -161
- package/es/drag-list/drag-item.mjs +56 -42
- package/es/drag-list/drag-list.mjs +60 -47
- package/es/dragable/dragable-item.mjs +23 -18
- package/es/dragable/dragable-operation.mjs +32 -24
- package/es/dragable/dragable.mjs +32 -23
- package/es/filter-panel/conditions/date-range-condition.mjs +50 -40
- package/es/filter-panel/conditions/department-condition/department-condition.mjs +99 -72
- package/es/filter-panel/conditions/department-condition/department-node.mjs +73 -59
- package/es/filter-panel/conditions/input-condition.mjs +90 -76
- package/es/filter-panel/conditions/multi-user-condition.mjs +67 -57
- package/es/filter-panel/conditions/multiple-menu-condition.mjs +54 -35
- package/es/filter-panel/conditions/single-menu-condition.mjs +65 -60
- package/es/filter-panel/conditions/single-user-condition.mjs +67 -57
- package/es/filter-panel/filter-panel-item.mjs +54 -39
- package/es/filter-panel/filter-panel.mjs +153 -135
- package/es/layout/layout.mjs +85 -78
- package/es/menu/menu-item.mjs +67 -52
- package/es/menu/menu.mjs +70 -53
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +28 -0
- package/es/panel/panel.mjs +53 -40
- package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +74 -63
- package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +76 -67
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +406 -178
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +153 -138
- package/es/pct-filter-panel/pct-filter-panel-item.mjs +55 -40
- package/es/pct-filter-panel/pct-filter-panel.mjs +247 -227
- package/es/progress/progress-item.mjs +81 -61
- package/es/progress/progress.mjs +78 -64
- package/es/where-filter-panel/where-filter-panel.mjs +15 -12
- package/lib/advance-select/advance-operation.js +50 -36
- package/lib/advance-select/advance-option.js +166 -96
- package/lib/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.js +12 -0
- package/lib/advance-select/advance-select.js +366 -308
- package/lib/application-slot/breadcrumb-item.js +19 -16
- package/lib/application-slot/header-tools-item.js +19 -16
- package/lib/breadcrumb-select/breadcrumb-select.js +133 -111
- package/lib/contextmenu/contextmenu-item.js +18 -14
- package/lib/contextmenu/contextmenu.js +71 -55
- package/lib/data-form/data-form-item.js +47 -29
- package/lib/data-form/data-form.js +212 -165
- package/lib/data-form/form-components/bwa-date-picker.js +50 -38
- package/lib/data-form/form-components/bwa-date-time-picker.js +55 -43
- package/lib/data-form/form-components/bwa-input-float.js +47 -36
- package/lib/data-form/form-components/bwa-input-integer.js +67 -49
- package/lib/data-form/form-components/bwa-input.js +42 -31
- package/lib/data-form/form-components/bwa-multi-select.js +39 -28
- package/lib/data-form/form-components/bwa-rich-text-tinymce.js +553 -217
- package/lib/data-form/form-components/bwa-rich-text.js +403 -315
- package/lib/data-form/form-components/bwa-select.js +83 -69
- package/lib/data-form/form-components/bwa-textarea.js +37 -26
- package/lib/data-form/form-components/bwa-upload.js +171 -147
- package/lib/data-form/form-components/bwa-user-multi-select.js +34 -23
- package/lib/data-form/form-components/bwa-user-select.js +85 -60
- package/lib/data-table/data-column-view.js +146 -115
- package/lib/data-table/data-table-card.js +48 -40
- package/lib/data-table/data-table-column.js +57 -44
- package/lib/data-table/data-table.js +401 -315
- package/lib/datatable-settings/datatable-settings.js +328 -253
- package/lib/date-range/date-picker.js +129 -115
- package/lib/date-range/date-range.js +214 -160
- package/lib/drag-list/drag-item.js +55 -41
- package/lib/drag-list/drag-list.js +59 -46
- package/lib/dragable/dragable-item.js +22 -17
- package/lib/dragable/dragable-operation.js +31 -23
- package/lib/dragable/dragable.js +31 -22
- package/lib/filter-panel/conditions/date-range-condition.js +49 -39
- package/lib/filter-panel/conditions/department-condition/department-condition.js +98 -71
- package/lib/filter-panel/conditions/department-condition/department-node.js +72 -58
- package/lib/filter-panel/conditions/input-condition.js +89 -75
- package/lib/filter-panel/conditions/multi-user-condition.js +66 -56
- package/lib/filter-panel/conditions/multiple-menu-condition.js +53 -34
- package/lib/filter-panel/conditions/single-menu-condition.js +64 -59
- package/lib/filter-panel/conditions/single-user-condition.js +66 -56
- package/lib/filter-panel/filter-panel-item.js +53 -38
- package/lib/filter-panel/filter-panel.js +152 -134
- package/lib/layout/layout.js +84 -77
- package/lib/menu/menu-item.js +66 -51
- package/lib/menu/menu.js +69 -52
- package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +32 -0
- package/lib/panel/panel.js +52 -39
- package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +73 -62
- package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +75 -66
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +405 -177
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +152 -137
- package/lib/pct-filter-panel/pct-filter-panel-item.js +54 -39
- package/lib/pct-filter-panel/pct-filter-panel.js +246 -226
- package/lib/progress/progress-item.js +80 -60
- package/lib/progress/progress.js +77 -63
- package/lib/where-filter-panel/where-filter-panel.js +14 -11
- package/package.json +2 -1
- package/src/advance-select/advance-option.vue +64 -13
- package/src/data-form/form-components/bwa-rich-text-tinymce.vue +1 -1
- package/src/datatable-settings/datatable-settings.vue +33 -3
- package/src/date-range/date-picker.vue +1 -1
- package/src/filter-panel/filter-panel.vue +2 -2
- package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +64 -64
- package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +61 -61
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +302 -178
- package/src/pct-filter-panel/pct-filter-panel.vue +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElementVNode,
|
|
1
|
+
import { createElementVNode, useAttrs, ref, computed, unref, watch, provide, reactive, nextTick, onUnmounted, openBlock, createElementBlock, normalizeClass, renderSlot, createVNode, mergeProps, withCtx, createBlock, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString, normalizeStyle } from 'vue';
|
|
2
2
|
import { ElMessage, ElTable, ElTableColumn, ElPagination } from 'element-plus';
|
|
3
3
|
import { useService, useGlobalConfig, dataTableKey, useNamespace, useEventDispatcher } from '@ctzy-web-client/web-base-client-vue';
|
|
4
4
|
import DynamicComponent from './dynamic-component.mjs';
|
|
@@ -8,311 +8,391 @@ import { get } from 'lodash';
|
|
|
8
8
|
import { Subject, debounceTime, Observable, filter, map, delayWhen, from, skipWhile } from 'rxjs';
|
|
9
9
|
import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
|
|
10
10
|
|
|
11
|
-
const _hoisted_1 =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
11
|
+
const _hoisted_1 = /*#__PURE__*/createElementVNode("i", { class: "ptp-icon ptp-buzhou-yidong" }, null, -1 /* HOISTED */);
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const _sfc_main = {
|
|
15
|
+
__name: 'data-table',
|
|
16
|
+
props: {
|
|
17
|
+
dataTable: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
autoLoad: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true,
|
|
24
|
+
},
|
|
25
|
+
showIndex: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
indexColumnLabel: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '编号',
|
|
32
|
+
},
|
|
33
|
+
selection: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
paginationLayout: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'sizes, prev, pager, next, jumper',
|
|
40
|
+
},
|
|
41
|
+
paginationPageSizes: {
|
|
42
|
+
type: Array,
|
|
43
|
+
default: () => [10, 20, 50, 100, 200],
|
|
44
|
+
},
|
|
45
|
+
showPagination: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
whereParamName: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
showDrag: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
border: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: true,
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
emits: ['drag'],
|
|
61
63
|
setup(__props, { emit }) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
64
|
+
|
|
65
|
+
const props = __props;
|
|
66
|
+
|
|
67
|
+
defineOptions({ name: 'BwaDataTable' });
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
const attrs = useAttrs();
|
|
72
|
+
|
|
73
|
+
const userService = useService('UserService');
|
|
74
|
+
|
|
75
|
+
const elTable = ref(null);
|
|
76
|
+
|
|
77
|
+
const dataTable = props.dataTable;
|
|
78
|
+
dataTable._userService = userService.value?.getUserList;
|
|
79
|
+
|
|
80
|
+
const dataTableEl = ref(null);
|
|
81
|
+
|
|
82
|
+
const displayColumns = computed(
|
|
83
|
+
() => unref(dataTable).getDisplayColumns() || []
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
watch(
|
|
87
|
+
computed(() => props.whereParamName),
|
|
88
|
+
(whereParamName) => {
|
|
89
|
+
dataTable.setWhereParamName(whereParamName || '');
|
|
90
|
+
},
|
|
91
|
+
{ immediate: true, flush: 'sync' }
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const searchParams = computed(() => props.searchParams);
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
const debounceDelay = useGlobalConfig('debounceDelay', 500);
|
|
99
|
+
|
|
100
|
+
//当前data table 上下文对象
|
|
101
|
+
provide(
|
|
102
|
+
dataTableKey,
|
|
103
|
+
reactive({
|
|
104
|
+
dataTable,
|
|
105
|
+
displayColumns,
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const ns = useNamespace('datatable');
|
|
110
|
+
|
|
111
|
+
const { barRectangle } = useDataTableDrag(
|
|
112
|
+
dataTableEl,
|
|
113
|
+
'.bwa-datatable__drag',
|
|
114
|
+
'.el-table__row',
|
|
115
|
+
{ emit }
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const processing = ref(false);
|
|
119
|
+
|
|
120
|
+
const data = computed(() => {
|
|
121
|
+
return props.dataTable.data;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
useEventDispatcher(dataTable, 'load-successfully', async (res) => {
|
|
125
|
+
if (res.code != 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const _userService = unref(userService);
|
|
130
|
+
|
|
131
|
+
if (!_userService) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let columns = dataTable.getColumns();
|
|
136
|
+
|
|
137
|
+
const componentNames = ['BwaUserSelect', 'BwaUserMultiSelect'];
|
|
138
|
+
|
|
139
|
+
columns = columns
|
|
140
|
+
.filter((column) => componentNames.includes(column.formComponent))
|
|
141
|
+
.filter((column) => column.visible)
|
|
142
|
+
.filter((column) => column.isExtend);
|
|
143
|
+
|
|
144
|
+
if (!columns.length) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
processing.value = true;
|
|
149
|
+
|
|
150
|
+
const data = res.data;
|
|
151
|
+
|
|
152
|
+
let ids = data
|
|
153
|
+
.reduce((result, item) => {
|
|
154
|
+
return result.concat(
|
|
155
|
+
columns.reduce((result, column) => {
|
|
156
|
+
let value = get(item, column.fullAttrName);
|
|
157
|
+
|
|
158
|
+
value = Array.isArray(value) ? value : value ? [value] : [];
|
|
159
|
+
|
|
160
|
+
return result.concat(value);
|
|
161
|
+
}, [])
|
|
162
|
+
);
|
|
163
|
+
}, [])
|
|
164
|
+
.map((id) => id + '');
|
|
165
|
+
|
|
166
|
+
ids = [...new Set(ids)];
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const userListResult = await _userService.getUserListByIds(ids);
|
|
170
|
+
|
|
171
|
+
if (userListResult.code != 0) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
for (const column of columns) {
|
|
176
|
+
column.componentProps = column.componentProps || {};
|
|
177
|
+
column.componentProps.options = (userListResult.data || []).map(
|
|
178
|
+
(item) => ({
|
|
179
|
+
label: item.label,
|
|
180
|
+
value: item.value,
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
console.log(userListResult);
|
|
186
|
+
} finally {
|
|
187
|
+
processing.value = false;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
//手动排序
|
|
192
|
+
const sortHandle = (column, prop, order) => {
|
|
193
|
+
let sortColumn = '';
|
|
194
|
+
let sortType = '';
|
|
195
|
+
if (column.order){
|
|
196
|
+
sortColumn = column.prop;
|
|
197
|
+
sortType = column.order=="descending"?0:1;
|
|
198
|
+
dataTable.setParam('sortColumn', sortColumn);
|
|
199
|
+
dataTable.setParam('sortType', sortType);
|
|
200
|
+
}else {
|
|
201
|
+
dataTable.setParam('sortColumn', sortColumn);
|
|
202
|
+
dataTable.setParam('sortType', sortType);
|
|
203
|
+
}
|
|
204
|
+
dataTable.load();
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
useEventDispatcher(dataTable, 'load-successfully', (res) => {
|
|
208
|
+
if (!elTable.value) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
unref(elTable).store.updateSelectionByRowKey();
|
|
213
|
+
|
|
214
|
+
if (res.code != 0) {
|
|
215
|
+
ElMessage.error(res.msg);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
function sortColumn(array) {
|
|
220
|
+
array.forEach((item) => {
|
|
221
|
+
item.no = item.getColumnIndex?.();
|
|
222
|
+
if (item.children?.length) {
|
|
223
|
+
sortColumn(item.children);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
array.sort((cur, pre) => cur.no - pre.no);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const tableSelectSubject = new Subject();
|
|
230
|
+
const selectionChange = tableSelectSubject.next.bind(tableSelectSubject);
|
|
231
|
+
|
|
232
|
+
const totalPage = computed(() => dataTable.getTotalPage());
|
|
233
|
+
|
|
234
|
+
const tableSelectSubscription = tableSelectSubject
|
|
235
|
+
.pipe(debounceTime(debounceDelay))
|
|
236
|
+
.subscribe(unref(dataTable).setSelection.bind(unref(dataTable)));
|
|
237
|
+
|
|
238
|
+
const selectChangeAPIObservable = new Observable((observer) =>
|
|
239
|
+
useEventDispatcher(
|
|
240
|
+
props.dataTable,
|
|
241
|
+
'select-change',
|
|
242
|
+
observer.next.bind(observer)
|
|
243
|
+
)
|
|
244
|
+
)
|
|
245
|
+
.pipe(
|
|
246
|
+
filter((selection) => {
|
|
247
|
+
if (!unref(elTable)) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const selectionRows = unref(elTable).getSelectionRows();
|
|
252
|
+
|
|
253
|
+
if (selectionRows.length !== selection.length) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const primaryKey = dataTable.primaryKey;
|
|
258
|
+
return !selectionRows.every((item) =>
|
|
259
|
+
selection.find((itm) => item[primaryKey] === item[primaryKey])
|
|
260
|
+
);
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
.subscribe((selection) => {
|
|
264
|
+
unref(elTable).clearSelection();
|
|
265
|
+
for (const item of selection) {
|
|
266
|
+
unref(elTable).toggleRowSelection(item, true);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
if (props.autoLoad) {
|
|
271
|
+
//初始化加载
|
|
272
|
+
dataTable.load();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const searchParamsSubscription = new Observable((observer) =>
|
|
276
|
+
useEventDispatcher(
|
|
277
|
+
props.dataTable.filterPanel,
|
|
278
|
+
'params-change',
|
|
279
|
+
observer.next.bind(observer)
|
|
280
|
+
)
|
|
281
|
+
)
|
|
282
|
+
.pipe(
|
|
283
|
+
filter(() => props.dataTable.filterPanel.ready),
|
|
284
|
+
debounceTime(unref(debounceDelay))
|
|
285
|
+
)
|
|
286
|
+
.subscribe(() => {
|
|
287
|
+
props.dataTable.load();
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const subscription = props.dataTable
|
|
291
|
+
.getDisplayColumnsSubject()
|
|
292
|
+
.pipe(
|
|
293
|
+
map(() => unref(elTable)),
|
|
294
|
+
delayWhen(() => from(nextTick())),
|
|
295
|
+
map((elTable) => elTable?.store),
|
|
296
|
+
skipWhile((store) => !store)
|
|
297
|
+
)
|
|
298
|
+
.subscribe((store) => {
|
|
299
|
+
sortColumn(unref(store.states._columns));
|
|
300
|
+
|
|
301
|
+
store.updateColumns();
|
|
302
|
+
store.scheduleLayout();
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
onUnmounted(() => {
|
|
306
|
+
selectChangeAPIObservable.unsubscribe();
|
|
307
|
+
subscription.unsubscribe();
|
|
308
|
+
tableSelectSubscription.unsubscribe();
|
|
309
|
+
searchParamsSubscription.unsubscribe();
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
return (_ctx, _cache) => {
|
|
313
|
+
return (openBlock(), createElementBlock("div", {
|
|
314
|
+
class: normalizeClass(unref(ns).b()),
|
|
315
|
+
ref_key: "dataTableEl",
|
|
316
|
+
ref: dataTableEl
|
|
317
|
+
}, [
|
|
318
|
+
renderSlot(_ctx.$slots, "default", { dataTable: unref(dataTable) }, () => [
|
|
319
|
+
createVNode(unref(ElTable), mergeProps({
|
|
320
|
+
class: "content",
|
|
321
|
+
height: "100%",
|
|
322
|
+
ref_key: "elTable",
|
|
323
|
+
ref: elTable,
|
|
324
|
+
data: unref(data),
|
|
325
|
+
"row-key": unref(dataTable).primaryKey,
|
|
326
|
+
"show-header": "",
|
|
327
|
+
stripe: ""
|
|
328
|
+
}, unref(attrs), {
|
|
329
|
+
onSelectionChange: unref(selectionChange),
|
|
330
|
+
onSortChange: sortHandle,
|
|
331
|
+
border: __props.border
|
|
332
|
+
}), {
|
|
333
|
+
empty: withCtx(() => [
|
|
334
|
+
renderSlot(_ctx.$slots, "empty-table")
|
|
335
|
+
]),
|
|
336
|
+
default: withCtx(() => [
|
|
337
|
+
(__props.showDrag)
|
|
338
|
+
? (openBlock(), createBlock(unref(ElTableColumn), {
|
|
265
339
|
key: 0,
|
|
266
340
|
width: "40px"
|
|
267
341
|
}, {
|
|
268
342
|
default: withCtx(() => [
|
|
269
343
|
createElementVNode("div", {
|
|
270
|
-
class: normalizeClass(unref(ns).e(
|
|
344
|
+
class: normalizeClass(unref(ns).e('drag'))
|
|
271
345
|
}, [
|
|
272
346
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
273
347
|
_hoisted_1
|
|
274
348
|
])
|
|
275
|
-
], 2)
|
|
349
|
+
], 2 /* CLASS */)
|
|
276
350
|
]),
|
|
277
|
-
_: 3
|
|
278
|
-
}))
|
|
279
|
-
|
|
351
|
+
_: 3 /* FORWARDED */
|
|
352
|
+
}))
|
|
353
|
+
: createCommentVNode("v-if", true),
|
|
354
|
+
(__props.selection)
|
|
355
|
+
? renderSlot(_ctx.$slots, "selection", { key: 1 }, () => [
|
|
280
356
|
createVNode(unref(ElTableColumn), {
|
|
281
357
|
type: "selection",
|
|
282
358
|
align: "center",
|
|
283
359
|
width: "56",
|
|
284
360
|
"reserve-selection": true
|
|
285
361
|
})
|
|
286
|
-
])
|
|
287
|
-
|
|
362
|
+
])
|
|
363
|
+
: createCommentVNode("v-if", true),
|
|
364
|
+
(__props.showIndex)
|
|
365
|
+
? renderSlot(_ctx.$slots, "index", { key: 2 }, () => [
|
|
288
366
|
createVNode(unref(ElTableColumn), {
|
|
289
367
|
type: "index",
|
|
290
368
|
width: "60",
|
|
291
369
|
align: "center",
|
|
292
370
|
label: __props.indexColumnLabel
|
|
293
|
-
}, null, 8
|
|
294
|
-
])
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
371
|
+
}, null, 8 /* PROPS */, ["label"])
|
|
372
|
+
])
|
|
373
|
+
: createCommentVNode("v-if", true),
|
|
374
|
+
renderSlot(_ctx.$slots, "table-columns", { dataTable: unref(dataTable) }, () => [
|
|
375
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayColumns), (item) => {
|
|
376
|
+
return (openBlock(), createBlock(DataTableColumn, mergeProps({
|
|
377
|
+
"column-key": item.attrName,
|
|
378
|
+
key: item.attrName,
|
|
379
|
+
label: item.title,
|
|
380
|
+
prop: item.fullAttrName,
|
|
381
|
+
"min-width": item.width,
|
|
382
|
+
align: item.align
|
|
383
|
+
}, item.componentProps, {
|
|
384
|
+
sortable: item.sortable=='custom'
|
|
385
|
+
}), {
|
|
386
|
+
header: withCtx(() => [
|
|
387
|
+
renderSlot(_ctx.$slots, `table-header-col-${item.attrName}`, {}, () => [
|
|
388
|
+
createTextVNode(toDisplayString(item.title), 1 /* TEXT */)
|
|
389
|
+
])
|
|
390
|
+
]),
|
|
391
|
+
default: withCtx(({ row, $index }) => [
|
|
392
|
+
(unref(data).length)
|
|
393
|
+
? renderSlot(_ctx.$slots, 'table-col-' + item.attrName, {
|
|
314
394
|
key: 0,
|
|
315
|
-
row,
|
|
395
|
+
row: row,
|
|
316
396
|
index: $index,
|
|
317
397
|
column: item,
|
|
318
398
|
dataTable: unref(dataTable)
|
|
@@ -320,50 +400,56 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
320
400
|
createVNode(unref(DynamicComponent), {
|
|
321
401
|
column: item,
|
|
322
402
|
record: row
|
|
323
|
-
}, null, 8
|
|
324
|
-
])
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
_: 3
|
|
333
|
-
}, 16, ["data", "row-key", "onSelectionChange", "border"])
|
|
403
|
+
}, null, 8 /* PROPS */, ["column", "record"])
|
|
404
|
+
])
|
|
405
|
+
: createCommentVNode("v-if", true)
|
|
406
|
+
]),
|
|
407
|
+
_: 2 /* DYNAMIC */
|
|
408
|
+
}, 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["column-key", "label", "prop", "min-width", "align", "sortable"]))
|
|
409
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
410
|
+
]),
|
|
411
|
+
renderSlot(_ctx.$slots, "column-append")
|
|
334
412
|
]),
|
|
335
|
-
|
|
413
|
+
_: 3 /* FORWARDED */
|
|
414
|
+
}, 16 /* FULL_PROPS */, ["data", "row-key", "onSelectionChange", "border"])
|
|
415
|
+
]),
|
|
416
|
+
(__props.showPagination)
|
|
417
|
+
? (openBlock(), createElementBlock("div", {
|
|
336
418
|
key: 0,
|
|
337
|
-
class: normalizeClass(unref(ns).e(
|
|
419
|
+
class: normalizeClass(unref(ns).e('pagination'))
|
|
338
420
|
}, [
|
|
339
421
|
createElementVNode("div", {
|
|
340
|
-
class: normalizeClass(unref(ns).e(
|
|
341
|
-
}, "
|
|
422
|
+
class: normalizeClass(unref(ns).e('pagination-info'))
|
|
423
|
+
}, " 共" + toDisplayString(unref(totalPage)) + "页," + toDisplayString(unref(dataTable).totalRecCount) + "条 ", 3 /* TEXT, CLASS */),
|
|
342
424
|
createVNode(unref(ElPagination), {
|
|
343
425
|
currentPage: unref(dataTable).pageNum,
|
|
344
426
|
"page-sizes": __props.paginationPageSizes,
|
|
345
427
|
"page-size": unref(dataTable).pageSize,
|
|
346
428
|
layout: __props.paginationLayout,
|
|
347
429
|
total: unref(dataTable).totalRecCount,
|
|
348
|
-
onSizeChange: _cache[0] || (_cache[0] =
|
|
349
|
-
onCurrentChange: _cache[1] || (_cache[1] =
|
|
430
|
+
onSizeChange: _cache[0] || (_cache[0] = $event => (unref(dataTable).setPageSize($event))),
|
|
431
|
+
onCurrentChange: _cache[1] || (_cache[1] = $event => (unref(dataTable).pageTo($event))),
|
|
350
432
|
teleported: false
|
|
351
|
-
}, null, 8
|
|
352
|
-
], 2
|
|
353
|
-
|
|
433
|
+
}, null, 8 /* PROPS */, ["currentPage", "page-sizes", "page-size", "layout", "total"])
|
|
434
|
+
], 2 /* CLASS */))
|
|
435
|
+
: createCommentVNode("v-if", true),
|
|
436
|
+
(unref(barRectangle))
|
|
437
|
+
? (openBlock(), createElementBlock("div", {
|
|
354
438
|
key: 1,
|
|
355
|
-
class: normalizeClass(unref(ns).e(
|
|
356
|
-
style: normalizeStyle({
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}, null, 6
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
439
|
+
class: normalizeClass(unref(ns).e('dragbar')),
|
|
440
|
+
style: normalizeStyle({
|
|
441
|
+
left: unref(barRectangle).left + 'px',
|
|
442
|
+
top: unref(barRectangle).top + 'px',
|
|
443
|
+
width: unref(barRectangle).width + 'px',
|
|
444
|
+
height: unref(barRectangle).height + 'px',
|
|
445
|
+
})
|
|
446
|
+
}, null, 6 /* CLASS, STYLE */))
|
|
447
|
+
: createCommentVNode("v-if", true)
|
|
448
|
+
], 2 /* CLASS */))
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
};
|
|
453
|
+
var DataTable = /*#__PURE__*/_export_sfc(_sfc_main, [['__file',"data-table.vue"]]);
|
|
368
454
|
|
|
369
455
|
export { DataTable as default };
|