cloud-web-corejs 1.0.54-dev.195 → 1.0.54-dev.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/excelExport/mixins.js +3 -1
- package/src/components/table/index.js +3 -3
- package/src/components/table/index2.js +1371 -0
- package/src/components/table/util/index.js +328 -0
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +4 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +7 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +8 -2
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +6 -0
- package/src/layout/components/AppMain.vue +5 -1
- package/src/layout/components/watermark/index.vue +77 -0
- package/src/views/bd/setting/bd_attach_setting/edit.vue +7 -7
- package/src/views/bd/setting/bd_attach_setting/list.vue +28 -55
- package/src/views/bd/setting/bd_attach_setting/mixins/edit.js +4 -5
- package/src/views/bd/setting/bd_attach_setting/mixins/list.js +219 -1
- package/src/views/bd/setting/form_script/edit.vue +2 -2
- package/src/views/bd/setting/form_script/edit1.vue +2 -2
- package/src/views/bd/setting/form_script/form_list.vue +1 -1
- package/src/views/bd/setting/form_script/mixins/form_list.js +283 -1
- package/src/views/bd/setting/form_script/mixins/list.js +191 -1
- package/src/views/bd/setting/form_script/mixins/list1.js +347 -1
- package/src/views/bd/setting/form_template/edit.vue +2 -2
- package/src/views/bd/setting/form_template/mixins/list.js +600 -1
- package/src/views/bd/setting/table_model/mixins/list.js +365 -1
- package/src/views/user/login/default.vue +11 -1
- package/src/views/user/login/indexMixin.js +90 -1
- package/src/views/user/project_tag/list.vue +9 -4
@@ -0,0 +1,1371 @@
|
|
1
|
+
/**version-1.0*/
|
2
|
+
let modules = {};
|
3
|
+
import Sortable from "sortablejs";
|
4
|
+
import tableConfig from "./config.js";
|
5
|
+
import customConfig from "./customConfig.js";
|
6
|
+
import Vue from "vue";
|
7
|
+
import CellSlot from "../../components/table/CellSlot.vue";
|
8
|
+
import {extendDeeply} from "../../utils/index.js";
|
9
|
+
import corejsConfig from "@/corejsConfig";
|
10
|
+
import settingConfig from "@/settings.js";
|
11
|
+
|
12
|
+
let configUtil = {
|
13
|
+
Sortable,
|
14
|
+
extendDeeply,
|
15
|
+
tableConfig,
|
16
|
+
Vue,
|
17
|
+
CellSlot,
|
18
|
+
};
|
19
|
+
|
20
|
+
function getGrid(that, tableRef) {
|
21
|
+
var $grid;
|
22
|
+
if (Array.isArray(that.$refs[tableRef])) {
|
23
|
+
$grid = that.$refs[tableRef][0];
|
24
|
+
} else {
|
25
|
+
$grid = that.$refs[tableRef];
|
26
|
+
}
|
27
|
+
return $grid;
|
28
|
+
}
|
29
|
+
|
30
|
+
async function initVxeTable(option) {
|
31
|
+
let tableName = option.tableName;
|
32
|
+
if (
|
33
|
+
!configUtil.tableConfig.disableTableName
|
34
|
+
&& option.tableNameRequired !== false
|
35
|
+
&& !tableName
|
36
|
+
&& settingConfig.tableStorageDisabled !== true
|
37
|
+
) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
var that = option.vue;
|
41
|
+
if (!that.$refs[option.tableRef]) {
|
42
|
+
await that.$nextTick();
|
43
|
+
}
|
44
|
+
var $grid = getGrid(that, option.tableRef);
|
45
|
+
if (!$grid) {
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
delete option.vue;
|
49
|
+
|
50
|
+
//操作列自动补全
|
51
|
+
handleCustomAlign(option);
|
52
|
+
|
53
|
+
$grid.originOption = that.$baseLodash.cloneDeep(option);
|
54
|
+
$grid.originOption.vue = that;
|
55
|
+
option.vue = that;
|
56
|
+
|
57
|
+
var isQueryAllPage = true;
|
58
|
+
if (option.isQueryAllPage != null) {
|
59
|
+
isQueryAllPage = option.isQueryAllPage;
|
60
|
+
}
|
61
|
+
|
62
|
+
if (tableName) {
|
63
|
+
$grid.tableName = tableName;
|
64
|
+
if (option.path) {
|
65
|
+
await getTableData(that, option.tableRef, "isQueryAllPage", (res1) => {
|
66
|
+
let result = res1.objx ? res1.objx.data : null;
|
67
|
+
if (result != null) {
|
68
|
+
if (result === "false" || result == false) {
|
69
|
+
isQueryAllPage = false;
|
70
|
+
} else {
|
71
|
+
isQueryAllPage = true;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
await getTableJson(tableName, that, (resultMsg) => {
|
77
|
+
var objx = resultMsg.objx;
|
78
|
+
if (objx != null) {
|
79
|
+
let jsonStr = objx.data;
|
80
|
+
if (jsonStr) {
|
81
|
+
let json = JSON.parse(decodeURIComponent(jsonStr));
|
82
|
+
let columnData = json.columns ? json.columns : json;
|
83
|
+
if (columnData) {
|
84
|
+
option.columns = initColumn(option, columnData);
|
85
|
+
}
|
86
|
+
$grid.searchColumns = initSearchColumns(option, json.searchColumns);
|
87
|
+
initExportColumns($grid, json);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
if (!$grid.searchColumns || !$grid.searchColumns.length) {
|
91
|
+
$grid.searchColumns = initSearchColumns(option);
|
92
|
+
}
|
93
|
+
});
|
94
|
+
} else {
|
95
|
+
$grid.searchColumns = initSearchColumns(option);
|
96
|
+
}
|
97
|
+
|
98
|
+
$grid.$refs.xTable.getCellValue = getCellValue;
|
99
|
+
$grid.getCellValue = getCellValue;
|
100
|
+
$grid.$refs.xTable.createParams = createParams;
|
101
|
+
$grid.createParams = createParams;
|
102
|
+
|
103
|
+
option.isQueryAllPage = isQueryAllPage;
|
104
|
+
let nOption = initOption(option);
|
105
|
+
|
106
|
+
$grid.isQueryAllPage = isQueryAllPage;
|
107
|
+
|
108
|
+
if (tableName) {
|
109
|
+
nOption.tableName = tableName;
|
110
|
+
}
|
111
|
+
|
112
|
+
nOption.vue = that;
|
113
|
+
//绑定列位置拖拽
|
114
|
+
columnDrop(that, tableName, option.tableRef);
|
115
|
+
|
116
|
+
//自动绑定toobar
|
117
|
+
handleToolbar($grid, option);
|
118
|
+
|
119
|
+
return nOption;
|
120
|
+
}
|
121
|
+
|
122
|
+
//自动绑定toobar
|
123
|
+
function handleToolbar($grid, option) {
|
124
|
+
let selfConfig = getSelfConfig();
|
125
|
+
if (
|
126
|
+
option.bindToolbar
|
127
|
+
|| (option.bindToolbar !== false && selfConfig.bindToolbar)
|
128
|
+
) {
|
129
|
+
let loopDo = function (children) {
|
130
|
+
if (children && children.length) {
|
131
|
+
children.forEach((item) => {
|
132
|
+
if (item.$options.name == "VxeToolbar") {
|
133
|
+
$grid.connect(item);
|
134
|
+
} else {
|
135
|
+
loopDo(item.$children);
|
136
|
+
}
|
137
|
+
});
|
138
|
+
}
|
139
|
+
};
|
140
|
+
that.$nextTick(() => {
|
141
|
+
loopDo($grid.$children);
|
142
|
+
});
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
//操作列自动补全
|
147
|
+
function handleCustomAlign(option) {
|
148
|
+
let selfConfig = getSelfConfig();
|
149
|
+
// let customAlign = option.customAlign || selfConfig.customAlign || "right";
|
150
|
+
let customAlign
|
151
|
+
= selfConfig.customAlign === false
|
152
|
+
? false
|
153
|
+
: selfConfig.customAlign || "right";
|
154
|
+
customAlign
|
155
|
+
= option.customAlign === false ? false : option.customAlign || customAlign;
|
156
|
+
|
157
|
+
let customColumnWidth
|
158
|
+
= option.customColumnWidth || selfConfig.customColumnWidth || 47;
|
159
|
+
let checkBoxColumnWidth
|
160
|
+
= option.checkBoxColumnWidth || selfConfig.checkBoxColumnWidth || 48;
|
161
|
+
|
162
|
+
let checkBoxRequired = selfConfig.checkBoxRequired !== false;
|
163
|
+
if (option.checkBoxRequired === false) {
|
164
|
+
checkBoxRequired = false;
|
165
|
+
}
|
166
|
+
|
167
|
+
let columnSize = option.columns.length;
|
168
|
+
if (columnSize > 0) {
|
169
|
+
if (checkBoxRequired) {
|
170
|
+
let firstColumn = option.columns[0];
|
171
|
+
if (firstColumn.type != "checkbox") {
|
172
|
+
option.columns.splice(0, 0, {
|
173
|
+
type: "checkbox",
|
174
|
+
width: checkBoxColumnWidth,
|
175
|
+
resizable: false,
|
176
|
+
fixed: "left",
|
177
|
+
});
|
178
|
+
}
|
179
|
+
}
|
180
|
+
if (customAlign !== false) {
|
181
|
+
let lastColumn = option.columns[columnSize - 1];
|
182
|
+
if (customAlign == "left") {
|
183
|
+
if (!lastColumn.field && lastColumn.fixed == "right") {
|
184
|
+
option.columns.splice(columnSize - 1, 1);
|
185
|
+
lastColumn.fixed = "left";
|
186
|
+
option.columns.splice(1, 0, lastColumn);
|
187
|
+
} else if (columnSize > 1) {
|
188
|
+
if (option.columns[1].field) {
|
189
|
+
option.columns.splice(1, 0, {
|
190
|
+
width: customColumnWidth,
|
191
|
+
fixed: "left",
|
192
|
+
title: "",
|
193
|
+
sortable: false,
|
194
|
+
});
|
195
|
+
}
|
196
|
+
}
|
197
|
+
} else if (customAlign == "right") {
|
198
|
+
let column1 = option.columns[1];
|
199
|
+
if (!column1.field && column1.fixed == "left") {
|
200
|
+
option.columns.splice(1, 1);
|
201
|
+
column1.fixed = "right";
|
202
|
+
option.columns.push(column1);
|
203
|
+
} else if (lastColumn.field || lastColumn.fixed != "right") {
|
204
|
+
option.columns.push({
|
205
|
+
width: customColumnWidth,
|
206
|
+
fixed: "right",
|
207
|
+
title: "",
|
208
|
+
sortable: false,
|
209
|
+
});
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
//列位置拖拽
|
217
|
+
function columnDrop(t, tableName, tableRef) {
|
218
|
+
var that = t;
|
219
|
+
const $table = getGrid(that, tableRef);
|
220
|
+
if (!$table) {
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
if ($table.sortable) {
|
224
|
+
$table.sortable.destroy();
|
225
|
+
}
|
226
|
+
$table.sortable = configUtil.Sortable.create(
|
227
|
+
$table.$el.querySelector(
|
228
|
+
".body--wrapper>.vxe-table--header .vxe-header--row"
|
229
|
+
),
|
230
|
+
{
|
231
|
+
handle: ".vxe-header--column:not(.col--fixed)",
|
232
|
+
onEnd: ({item, newIndex, oldIndex}) => {
|
233
|
+
const {fullColumn, tableColumn} = $table.getTableColumn();
|
234
|
+
const targetThElem = item;
|
235
|
+
const wrapperElem = targetThElem.parentNode;
|
236
|
+
const newColumn = fullColumn[newIndex];
|
237
|
+
if (newColumn.fixed) {
|
238
|
+
// 错误的移动
|
239
|
+
if (newIndex > oldIndex) {
|
240
|
+
wrapperElem.insertBefore(
|
241
|
+
targetThElem,
|
242
|
+
wrapperElem.children[oldIndex]
|
243
|
+
);
|
244
|
+
} else {
|
245
|
+
wrapperElem.insertBefore(
|
246
|
+
wrapperElem.children[oldIndex],
|
247
|
+
targetThElem
|
248
|
+
);
|
249
|
+
}
|
250
|
+
return;
|
251
|
+
/* return that.$XModal.message({
|
252
|
+
content: '固定列不允许拖动!',
|
253
|
+
status: 'error'
|
254
|
+
}) */
|
255
|
+
}
|
256
|
+
// 转换真实索引
|
257
|
+
const oldColumnIndex = $table.getColumnIndex(tableColumn[oldIndex]);
|
258
|
+
const newColumnIndex = $table.getColumnIndex(tableColumn[newIndex]);
|
259
|
+
// 移动到目标列
|
260
|
+
const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
|
261
|
+
fullColumn.splice(newColumnIndex, 0, currRow);
|
262
|
+
|
263
|
+
$table.loadColumn(fullColumn);
|
264
|
+
addTableJson(that, $table, tableName, fullColumn);
|
265
|
+
},
|
266
|
+
}
|
267
|
+
);
|
268
|
+
}
|
269
|
+
|
270
|
+
function getSelfConfig() {
|
271
|
+
let tableConfig = configUtil.tableConfig || {};
|
272
|
+
let selfConfig = tableConfig.selfConfig || {};
|
273
|
+
return selfConfig;
|
274
|
+
}
|
275
|
+
|
276
|
+
function initColumnDefaulAttrs(columns, opts) {
|
277
|
+
if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
|
278
|
+
for (let i = 0; i < columns.length; i++) {
|
279
|
+
if (columns[i].title && columns[i].sortable == null) {
|
280
|
+
columns[i].sortable = true;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
}
|
284
|
+
|
285
|
+
let tableConfig = configUtil.tableConfig || {};
|
286
|
+
let selfConfig = getSelfConfig();
|
287
|
+
if (opts.filterType !== false && !opts.treeNodeUrl) {
|
288
|
+
let filterType
|
289
|
+
= opts.filterType || selfConfig.filterType || "filterContent";
|
290
|
+
if (filterType) {
|
291
|
+
columns.forEach((column) => {
|
292
|
+
if (column.title && column.field) {
|
293
|
+
if (
|
294
|
+
column.filterType == "filterContent"
|
295
|
+
|| (column.filterType == null && filterType == "filterContent")
|
296
|
+
) {
|
297
|
+
if (!column.filters) {
|
298
|
+
column.filters = [
|
299
|
+
{
|
300
|
+
data: {},
|
301
|
+
},
|
302
|
+
];
|
303
|
+
}
|
304
|
+
if (!column.filterRender) {
|
305
|
+
column.filterRender = {
|
306
|
+
name: "FilterContent",
|
307
|
+
};
|
308
|
+
}
|
309
|
+
} else if (
|
310
|
+
column.filterType === "filterInput"
|
311
|
+
|| (column.filterType == null && filterType == "filterInput")
|
312
|
+
) {
|
313
|
+
if (!column.filters) {
|
314
|
+
column.filters = [
|
315
|
+
{
|
316
|
+
data: "",
|
317
|
+
},
|
318
|
+
];
|
319
|
+
}
|
320
|
+
if (!column.filterRender) {
|
321
|
+
column.filterRender = {
|
322
|
+
name: "FilterInput",
|
323
|
+
};
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
});
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
//设置复选框列的锁定宽度
|
332
|
+
if (opts.lockCheckboxWidth !== false) {
|
333
|
+
let lockCheckboxWidth
|
334
|
+
= opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
|
335
|
+
if (lockCheckboxWidth) {
|
336
|
+
columns.forEach((column) => {
|
337
|
+
if (column.type == "checkbox") {
|
338
|
+
column.width = lockCheckboxWidth;
|
339
|
+
}
|
340
|
+
});
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
|
345
|
+
function initOption(opts) {
|
346
|
+
let result = {};
|
347
|
+
var that = opts.vue;
|
348
|
+
var $grid = getGrid(that, opts.tableRef);
|
349
|
+
|
350
|
+
let path = opts.path || "";
|
351
|
+
// let columns = JSON.parse(JSON.stringify(opts.columns || []));
|
352
|
+
let columns = opts.columns || [];
|
353
|
+
let isQueryAllPage = opts.isQueryAllPage;
|
354
|
+
var pagerLayouts = getPagerConfigLayouts(opts);
|
355
|
+
|
356
|
+
let config = opts.config || {};
|
357
|
+
|
358
|
+
initColumnDefaulAttrs(columns, opts);
|
359
|
+
/*if (opts.sortAll == true || (opts.sortAll !== false && !opts.treeNodeUrl)) {
|
360
|
+
for (let i = 0; i < columns.length; i++) {
|
361
|
+
if (columns[i].title && columns[i].sortable == null) {
|
362
|
+
columns[i].sortable = true;
|
363
|
+
}
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
let tableConfig = configUtil.tableConfig || {};
|
368
|
+
let selfConfig = getSelfConfig();
|
369
|
+
if (opts.filterType !== false && !opts.treeNodeUrl) {
|
370
|
+
let filterType
|
371
|
+
= opts.filterType || selfConfig.filterType || "filterContent";
|
372
|
+
if (filterType) {
|
373
|
+
columns.forEach((column) => {
|
374
|
+
if (column.title && column.field) {
|
375
|
+
if (
|
376
|
+
column.filterType == "filterContent"
|
377
|
+
|| (column.filterType == null && filterType == "filterContent")
|
378
|
+
) {
|
379
|
+
if (!column.filters) {
|
380
|
+
column.filters = [
|
381
|
+
{
|
382
|
+
data: {},
|
383
|
+
},
|
384
|
+
];
|
385
|
+
}
|
386
|
+
if (!column.filterRender) {
|
387
|
+
column.filterRender = {
|
388
|
+
name: "FilterContent",
|
389
|
+
};
|
390
|
+
}
|
391
|
+
} else if (
|
392
|
+
column.filterType === "filterInput"
|
393
|
+
|| (column.filterType == null && filterType == "filterInput")
|
394
|
+
) {
|
395
|
+
if (!column.filters) {
|
396
|
+
column.filters = [
|
397
|
+
{
|
398
|
+
data: "",
|
399
|
+
},
|
400
|
+
];
|
401
|
+
}
|
402
|
+
if (!column.filterRender) {
|
403
|
+
column.filterRender = {
|
404
|
+
name: "FilterInput",
|
405
|
+
};
|
406
|
+
}
|
407
|
+
}
|
408
|
+
}
|
409
|
+
});
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
413
|
+
//设置复选框列的锁定宽度
|
414
|
+
if (opts.lockCheckboxWidth !== false) {
|
415
|
+
let lockCheckboxWidth = opts.lockCheckboxWidth || selfConfig.lockCheckboxWidth;
|
416
|
+
if (lockCheckboxWidth) {
|
417
|
+
columns.forEach((column) => {
|
418
|
+
if (column.type == 'checkbox') {
|
419
|
+
column.width = lockCheckboxWidth;
|
420
|
+
}
|
421
|
+
});
|
422
|
+
}
|
423
|
+
}*/
|
424
|
+
|
425
|
+
let defaultOptions = {
|
426
|
+
columnKey: true,
|
427
|
+
resizable: true,
|
428
|
+
showOverflow: true,
|
429
|
+
showHeaderOverflow: true,
|
430
|
+
showFooterOverflow: true,
|
431
|
+
highlightHoverRow: true,
|
432
|
+
border: "inner",
|
433
|
+
height: "auto",
|
434
|
+
// maxHeight:"1000px",
|
435
|
+
// rowId: 'id',
|
436
|
+
emptyText: " ",
|
437
|
+
sortConfig: {
|
438
|
+
trigger: "cell",
|
439
|
+
remote: false,
|
440
|
+
},
|
441
|
+
filterConfig: {
|
442
|
+
remote: false,
|
443
|
+
},
|
444
|
+
pagerConfig: {
|
445
|
+
autoHidden: true,
|
446
|
+
perfect: true,
|
447
|
+
pageSize: 200,
|
448
|
+
pageSizes: [50, 100, 200, 500],
|
449
|
+
layouts: pagerLayouts,
|
450
|
+
slots: {
|
451
|
+
left: (obj, b, c) => {
|
452
|
+
var $grid = obj.$grid;
|
453
|
+
let k = $grid.$data;
|
454
|
+
let tableDataInfo = $grid.getTableData();
|
455
|
+
let data = tableDataInfo.fullData;
|
456
|
+
let h = $grid.$createElement;
|
457
|
+
|
458
|
+
let proxyInfo = $grid.getProxyInfo();
|
459
|
+
let pager = proxyInfo ? proxyInfo.pager : null;
|
460
|
+
|
461
|
+
let celems = [
|
462
|
+
h("span", $grid.$t2("本页记录数", "components.table.currentNum")),
|
463
|
+
h(
|
464
|
+
"span",
|
465
|
+
{
|
466
|
+
attrs: {
|
467
|
+
class: "f-red",
|
468
|
+
},
|
469
|
+
},
|
470
|
+
" " + tableDataInfo.visibleData.length + " "
|
471
|
+
),
|
472
|
+
];
|
473
|
+
if (pager && $grid.isQueryAllPage) {
|
474
|
+
celems.push(
|
475
|
+
h(
|
476
|
+
"span",
|
477
|
+
"," + $grid.$t2("总记录数", "components.table.totalNum")
|
478
|
+
)
|
479
|
+
);
|
480
|
+
celems.push(
|
481
|
+
h(
|
482
|
+
"span",
|
483
|
+
{
|
484
|
+
attrs: {
|
485
|
+
class: "f-red",
|
486
|
+
},
|
487
|
+
},
|
488
|
+
" " + pager.total + " "
|
489
|
+
)
|
490
|
+
);
|
491
|
+
}
|
492
|
+
let elem = h("span", {}, celems);
|
493
|
+
return [elem];
|
494
|
+
},
|
495
|
+
},
|
496
|
+
},
|
497
|
+
exportConfig: {
|
498
|
+
// 默认选中类型
|
499
|
+
type: "xlsx",
|
500
|
+
// 局部自定义类型
|
501
|
+
types: ["xlsx", "csv", "html", "xml", "txt"],
|
502
|
+
// 自定义数据量列表
|
503
|
+
modes: ["current", "all"],
|
504
|
+
},
|
505
|
+
radioConfig: {
|
506
|
+
labelField: "id",
|
507
|
+
reserve: true,
|
508
|
+
highlight: true,
|
509
|
+
},
|
510
|
+
checkboxConfig: {
|
511
|
+
highlight: true,
|
512
|
+
},
|
513
|
+
customConfig: {
|
514
|
+
storage: false,
|
515
|
+
},
|
516
|
+
scrollX: {
|
517
|
+
// enabled: true,
|
518
|
+
gt: 10,
|
519
|
+
// oSize: 5
|
520
|
+
},
|
521
|
+
/*loadingConfig: {
|
522
|
+
icon: "vxe-loading--spinner",
|
523
|
+
text: ' '
|
524
|
+
},*/
|
525
|
+
columns: columns,
|
526
|
+
};
|
527
|
+
let tableDefaultConfig
|
528
|
+
= corejsConfig?.componentConfig?.table?.defaultConfig || {};
|
529
|
+
defaultOptions = configUtil.extendDeeply(defaultOptions, tableConfig);
|
530
|
+
defaultOptions = configUtil.extendDeeply(defaultOptions, customConfig);
|
531
|
+
defaultOptions = configUtil.extendDeeply(defaultOptions, tableDefaultConfig);
|
532
|
+
|
533
|
+
if (opts.path) {
|
534
|
+
// defaultOptions.filterInput = true;
|
535
|
+
defaultOptions.pagerConfig.autoHidden = false;
|
536
|
+
defaultOptions.proxyConfig = {
|
537
|
+
seq: true, // 启用动态序号代理
|
538
|
+
sort: true, // 启用排序代理
|
539
|
+
filter: true, // 启用筛选代理
|
540
|
+
props: {
|
541
|
+
result: "objx.records", // 配置响应结果列表字段
|
542
|
+
total: "objx.total", // 配置响应结果总页数字段
|
543
|
+
},
|
544
|
+
ajax: {
|
545
|
+
// 接收 Promise 对象
|
546
|
+
query: ({page, sorts, filters, form}) => {
|
547
|
+
if (!opts.path) {
|
548
|
+
return;
|
549
|
+
}
|
550
|
+
return new Promise((resolve, reject) => {
|
551
|
+
let toDo = () => {
|
552
|
+
let formData = opts.param ? opts.param() || {} : {};
|
553
|
+
const queryParams = Object.assign({}, formData);
|
554
|
+
|
555
|
+
// 处理排序条件
|
556
|
+
/*const firstSort = sorts[0];
|
557
|
+
if (firstSort) {
|
558
|
+
queryParams.sort = firstSort.property;
|
559
|
+
queryParams.order = firstSort.order;
|
560
|
+
}*/
|
561
|
+
// 处理筛选条件
|
562
|
+
filters.forEach(({property, values}) => {
|
563
|
+
queryParams[property] = values.join(",");
|
564
|
+
});
|
565
|
+
if (page.pageSize !== undefined) {
|
566
|
+
queryParams["size"] = page.pageSize;
|
567
|
+
queryParams["current"] = page.currentPage;
|
568
|
+
}
|
569
|
+
|
570
|
+
var $grid = getGrid(that, opts.tableRef);
|
571
|
+
let isQueryAllPage = $grid.isQueryAllPage;
|
572
|
+
let pathStr1 = "";
|
573
|
+
if (isQueryAllPage === false) {
|
574
|
+
queryParams.searchCount = false;
|
575
|
+
}
|
576
|
+
|
577
|
+
var reqPath = typeof path == "function" ? path() : path;
|
578
|
+
let addUserForTableEnabled
|
579
|
+
= settingConfig.addUserForTableDisabled !== true;
|
580
|
+
let addCreateInfo
|
581
|
+
= opts.addCreateInfo === true || addUserForTableEnabled;
|
582
|
+
let queryCreateInfo
|
583
|
+
= opts.queryCreateInfo === true || addUserForTableEnabled;
|
584
|
+
that.$commonHttp({
|
585
|
+
aes: opts.aes || false,
|
586
|
+
url: reqPath,
|
587
|
+
method: "post",
|
588
|
+
data: queryParams,
|
589
|
+
addCreateInfo: addCreateInfo,
|
590
|
+
queryCreateInfo: queryCreateInfo,
|
591
|
+
callback: (res) => {
|
592
|
+
resolve(res);
|
593
|
+
if (res.type == "success") {
|
594
|
+
let rows = res.objx
|
595
|
+
? res.objx.records || res.objx || []
|
596
|
+
: [];
|
597
|
+
if (opts.treeNodeUrl) {
|
598
|
+
if (rows.length > 0) {
|
599
|
+
let $t = getGrid(that, opts.tableRef);
|
600
|
+
var treeConditions = $t.originOption.treeConditions || [
|
601
|
+
"enabled",
|
602
|
+
];
|
603
|
+
let treeFiled = Object.keys(formData).some((key) => {
|
604
|
+
return (
|
605
|
+
!treeConditions.includes(key)
|
606
|
+
&& formData[key] != null
|
607
|
+
&& formData[key] != ""
|
608
|
+
);
|
609
|
+
});
|
610
|
+
if (treeFiled) {
|
611
|
+
that.$nextTick(() => {
|
612
|
+
setTimeout(function () {
|
613
|
+
let isLazy = $t.treeConfig.lazy;
|
614
|
+
$t.treeConfig.lazy = false;
|
615
|
+
$t.setAllTreeExpand(true).then(() => {
|
616
|
+
let fullAllDataRowMap
|
617
|
+
= $t.$refs.xTable.fullAllDataRowMap;
|
618
|
+
let fullData = $t.getTableData().fullData;
|
619
|
+
fullData.forEach((lineData) => {
|
620
|
+
if (
|
621
|
+
$t.$refs.xTable.isTreeExpandByRow(lineData)
|
622
|
+
) {
|
623
|
+
var rest = fullAllDataRowMap.get(lineData);
|
624
|
+
rest.treeLoaded = true;
|
625
|
+
}
|
626
|
+
});
|
627
|
+
$t.treeConfig.lazy = isLazy;
|
628
|
+
});
|
629
|
+
}, 0);
|
630
|
+
});
|
631
|
+
} else {
|
632
|
+
let row = rows[0];
|
633
|
+
if (row[result.treeConfig.hasChild]) {
|
634
|
+
that.$nextTick(() => {
|
635
|
+
setTimeout(function () {
|
636
|
+
$t.setTreeExpand(row, true);
|
637
|
+
}, 0);
|
638
|
+
});
|
639
|
+
}
|
640
|
+
}
|
641
|
+
}
|
642
|
+
}
|
643
|
+
if (opts.callback) {
|
644
|
+
that.$nextTick(() => {
|
645
|
+
setTimeout(function () {
|
646
|
+
opts.callback(rows);
|
647
|
+
}, 0);
|
648
|
+
});
|
649
|
+
}
|
650
|
+
}
|
651
|
+
},
|
652
|
+
error: (error) => {
|
653
|
+
reject(error);
|
654
|
+
},
|
655
|
+
});
|
656
|
+
};
|
657
|
+
let index = 0;
|
658
|
+
let loopHandle = () => {
|
659
|
+
if (index < 500 && $grid.tableFormStop === true) {
|
660
|
+
//阻塞列表查询,或者次数达到500时,自动释放
|
661
|
+
index++;
|
662
|
+
setTimeout(() => {
|
663
|
+
loopHandle();
|
664
|
+
}, 10);
|
665
|
+
} else {
|
666
|
+
if ($grid.tableFormStop) $grid.tableFormStop = false;
|
667
|
+
toDo();
|
668
|
+
}
|
669
|
+
};
|
670
|
+
loopHandle();
|
671
|
+
});
|
672
|
+
},
|
673
|
+
// 被某些特殊功能所触发,例如:导出数据 mode=all 时,会触发该方法并对返回的数据进行导出
|
674
|
+
queryAll: () => fetch(path || "").then((response) => response.json()),
|
675
|
+
},
|
676
|
+
};
|
677
|
+
/*defaultOptions.scrollX = {
|
678
|
+
enabled: true,
|
679
|
+
gt: 20
|
680
|
+
};*/
|
681
|
+
defaultOptions.scrollY = {
|
682
|
+
// enabled: false,
|
683
|
+
gt: 20,
|
684
|
+
oSize: 20,
|
685
|
+
};
|
686
|
+
} else {
|
687
|
+
if (!$grid.height && (!opts.config || !opts.config.height)) {
|
688
|
+
defaultOptions.maxHeight = "528px";
|
689
|
+
}
|
690
|
+
defaultOptions.scrollY = {
|
691
|
+
// enabled: false,
|
692
|
+
gt: 20,
|
693
|
+
oSize: 20,
|
694
|
+
};
|
695
|
+
}
|
696
|
+
|
697
|
+
if (opts.editSaveUrl) {
|
698
|
+
(defaultOptions.keepSource = true),
|
699
|
+
(defaultOptions.editConfig = {
|
700
|
+
trigger: "manual",
|
701
|
+
mode: "row",
|
702
|
+
showStatus: true,
|
703
|
+
autoClear: false,
|
704
|
+
});
|
705
|
+
}
|
706
|
+
if (opts.treeNodeUrl) {
|
707
|
+
defaultOptions.proxyConfig.props.result = "objx";
|
708
|
+
defaultOptions.pagerConfig.autoHidden = true;
|
709
|
+
defaultOptions.treeConfig = {
|
710
|
+
lazy: true,
|
711
|
+
children: "children",
|
712
|
+
hasChild: "hasChild", // 设置是否有子节点标识
|
713
|
+
parentField: "parent",
|
714
|
+
transform: true,
|
715
|
+
loadMethod({$table, row}) {
|
716
|
+
// 模拟后台接口
|
717
|
+
return new Promise((resolve, reject) => {
|
718
|
+
let treeNodeParam = opts.treeNodeParam
|
719
|
+
? opts.treeNodeParam(row) || {}
|
720
|
+
: {
|
721
|
+
parent: row.id,
|
722
|
+
};
|
723
|
+
that.$http({
|
724
|
+
aes: opts.aes || false,
|
725
|
+
url: opts.treeNodeUrl,
|
726
|
+
method: "post",
|
727
|
+
data: treeNodeParam,
|
728
|
+
callback: (res) => {
|
729
|
+
if (res.type == "success") {
|
730
|
+
// let rows = res.objx || [];
|
731
|
+
let rows = res.objx ? res.objx.records || res.objx || [] : [];
|
732
|
+
let hasChildField = $grid.treeConfig.hasChild;
|
733
|
+
if (row[hasChildField] && !rows.length) {
|
734
|
+
row[hasChildField] = false;
|
735
|
+
}
|
736
|
+
resolve(rows);
|
737
|
+
if (opts.treeCallback) {
|
738
|
+
that.$nextTick(() => {
|
739
|
+
setTimeout(function () {
|
740
|
+
opts.treeCallback(rows);
|
741
|
+
}, 0);
|
742
|
+
});
|
743
|
+
}
|
744
|
+
} else {
|
745
|
+
reject(res);
|
746
|
+
}
|
747
|
+
},
|
748
|
+
});
|
749
|
+
});
|
750
|
+
},
|
751
|
+
};
|
752
|
+
}
|
753
|
+
|
754
|
+
result = configUtil.extendDeeply(defaultOptions, config);
|
755
|
+
|
756
|
+
let pageSize = result.pagerConfig.pageSize;
|
757
|
+
let pageSizes = result.pagerConfig.pageSizes;
|
758
|
+
if (pageSizes && !pageSizes.includes(pageSize)) {
|
759
|
+
for (let i = 0; i < pageSizes.length; i++) {
|
760
|
+
let item = pageSizes[i];
|
761
|
+
if (item > pageSize) {
|
762
|
+
pageSizes.splice(i, 0, pageSize);
|
763
|
+
break;
|
764
|
+
}
|
765
|
+
}
|
766
|
+
}
|
767
|
+
|
768
|
+
return result;
|
769
|
+
}
|
770
|
+
|
771
|
+
function getTableJson(tableName, that, success) {
|
772
|
+
if (
|
773
|
+
configUtil.tableConfig.disableTableName
|
774
|
+
|| settingConfig.tableStorageDisabled
|
775
|
+
)
|
776
|
+
return false;
|
777
|
+
if (!tableName) return;
|
778
|
+
var url = USER_PREFIX + "/table_column/getTableJson";
|
779
|
+
var data = {
|
780
|
+
tableName: tableName,
|
781
|
+
};
|
782
|
+
var json = null;
|
783
|
+
return that.$http({
|
784
|
+
url: url,
|
785
|
+
method: "post",
|
786
|
+
data: data,
|
787
|
+
success: success,
|
788
|
+
});
|
789
|
+
}
|
790
|
+
|
791
|
+
function addTableExportJson() {
|
792
|
+
}
|
793
|
+
|
794
|
+
function addTableJson(that, $grid, tableName, columns, success) {
|
795
|
+
if (
|
796
|
+
configUtil.tableConfig.disableTableName
|
797
|
+
|| settingConfig.tableStorageDisabled
|
798
|
+
)
|
799
|
+
return false;
|
800
|
+
if (!tableName) return;
|
801
|
+
if (!columns) {
|
802
|
+
columns = $grid.getTableColumn().fullColumn;
|
803
|
+
}
|
804
|
+
let saveColumn = [];
|
805
|
+
columns.forEach(function (item, index) {
|
806
|
+
saveColumn.push({
|
807
|
+
field: item.field || item.property,
|
808
|
+
title: item.title,
|
809
|
+
visible: item.visible,
|
810
|
+
width: item.renderWidth || item.width,
|
811
|
+
});
|
812
|
+
});
|
813
|
+
|
814
|
+
let searchColumns = $grid.searchColumns || [];
|
815
|
+
let jsonData = {
|
816
|
+
columns: saveColumn,
|
817
|
+
searchColumns: searchColumns,
|
818
|
+
};
|
819
|
+
if ($grid.exportColumns && $grid.exportColumns.length) {
|
820
|
+
jsonData.exportColumns = $grid.exportColumns;
|
821
|
+
}
|
822
|
+
let json = encodeURIComponent(JSON.stringify(jsonData));
|
823
|
+
|
824
|
+
var url = USER_PREFIX + "/table_column/addTableJson";
|
825
|
+
var data = {
|
826
|
+
tableName: tableName,
|
827
|
+
// json: encodeURIComponent(JSON.stringify(saveColumn)),
|
828
|
+
json: json,
|
829
|
+
};
|
830
|
+
that.$http({
|
831
|
+
url: url,
|
832
|
+
method: "post",
|
833
|
+
data: data,
|
834
|
+
success: success,
|
835
|
+
});
|
836
|
+
}
|
837
|
+
|
838
|
+
function initColumn(option, syncColumns) {
|
839
|
+
let oldColumns = option.columns;
|
840
|
+
let newColumns = [];
|
841
|
+
if (syncColumns) {
|
842
|
+
let fields = [];
|
843
|
+
syncColumns.forEach(function (syncColumn) {
|
844
|
+
let field = syncColumn.field;
|
845
|
+
if (field) {
|
846
|
+
oldColumns.some(function (oldColumn) {
|
847
|
+
let flag = oldColumn.field === field;
|
848
|
+
if (flag) {
|
849
|
+
let visibleSync
|
850
|
+
= option.visibleSync !== false && oldColumn.visibleSync !== false;
|
851
|
+
if (visibleSync) {
|
852
|
+
oldColumn.visible = syncColumn.visible;
|
853
|
+
}
|
854
|
+
if (syncColumn.width) oldColumn.width = syncColumn.width;
|
855
|
+
newColumns.push(oldColumn);
|
856
|
+
fields.push(field);
|
857
|
+
}
|
858
|
+
return flag;
|
859
|
+
});
|
860
|
+
}
|
861
|
+
});
|
862
|
+
oldColumns.forEach(function (oldColumn, index) {
|
863
|
+
let field = oldColumn.field;
|
864
|
+
if (field) {
|
865
|
+
if (!fields.includes(field)) {
|
866
|
+
newColumns.splice(index, 0, oldColumn);
|
867
|
+
}
|
868
|
+
} else {
|
869
|
+
newColumns.splice(index, 0, oldColumn);
|
870
|
+
}
|
871
|
+
});
|
872
|
+
} else {
|
873
|
+
newColumns = oldColumns;
|
874
|
+
}
|
875
|
+
return newColumns;
|
876
|
+
}
|
877
|
+
|
878
|
+
function initExportColumns($grid, json) {
|
879
|
+
if (json?.exportColumns?.length) {
|
880
|
+
$grid.exportColumns = json.exportColumns;
|
881
|
+
}
|
882
|
+
}
|
883
|
+
|
884
|
+
function initSearchColumns(option, syncColumns) {
|
885
|
+
let oldColumns = option.searchColumns || [];
|
886
|
+
let newColumns = [];
|
887
|
+
if (syncColumns) {
|
888
|
+
let fields = [];
|
889
|
+
syncColumns.forEach(function (syncColumn) {
|
890
|
+
let field = syncColumn.field;
|
891
|
+
if (field) {
|
892
|
+
oldColumns.some(function (oldColumn) {
|
893
|
+
let flag = oldColumn.field === field && !oldColumn.fixed;
|
894
|
+
if (flag) {
|
895
|
+
oldColumn.common = syncColumn.common || false;
|
896
|
+
if (syncColumn.defaultValue !== undefined) {
|
897
|
+
oldColumn.defaultValue = syncColumn.defaultValue;
|
898
|
+
}
|
899
|
+
newColumns.push(oldColumn);
|
900
|
+
fields.push(field);
|
901
|
+
}
|
902
|
+
return flag;
|
903
|
+
});
|
904
|
+
}
|
905
|
+
});
|
906
|
+
oldColumns.forEach(function (oldColumn, index) {
|
907
|
+
let field = oldColumn.field;
|
908
|
+
if (field && !oldColumn.fixed) {
|
909
|
+
if (!fields.includes(field)) {
|
910
|
+
newColumns.splice(index, 0, oldColumn);
|
911
|
+
}
|
912
|
+
} else {
|
913
|
+
newColumns.splice(index, 0, oldColumn);
|
914
|
+
}
|
915
|
+
});
|
916
|
+
} else {
|
917
|
+
newColumns = oldColumns;
|
918
|
+
}
|
919
|
+
return newColumns.length ? newColumns : oldColumns;
|
920
|
+
}
|
921
|
+
|
922
|
+
function onColumnWitchChange(option) {
|
923
|
+
var that = option.$grid.$parent;
|
924
|
+
var $grid = option.$grid;
|
925
|
+
var originOption = $grid.originOption;
|
926
|
+
let tableName = originOption.tableName;
|
927
|
+
if (tableName) {
|
928
|
+
// let columns = $grid.columns;
|
929
|
+
const {fullColumn, tableColumn} = $grid.getTableColumn();
|
930
|
+
addTableJson(that, $grid, tableName);
|
931
|
+
}
|
932
|
+
}
|
933
|
+
|
934
|
+
function customHandle(option) {
|
935
|
+
if (option.type == "confirm" || option.type == "reset") {
|
936
|
+
let that = option.$grid.$parent;
|
937
|
+
let $grid = option.$grid;
|
938
|
+
var originOption = $grid.originOption;
|
939
|
+
let tableName = originOption.tableName;
|
940
|
+
if (option.type == "reset") {
|
941
|
+
let columns = that.$baseLodash.cloneDeep(originOption.columns);
|
942
|
+
initColumnDefaulAttrs(columns, originOption);
|
943
|
+
$grid.columns = columns;
|
944
|
+
// $grid.columns = originOption.columns;
|
945
|
+
}
|
946
|
+
if (tableName) {
|
947
|
+
setTimeout(() => {
|
948
|
+
const {fullColumn, tableColumn} = $grid.getTableColumn();
|
949
|
+
addTableJson(that, $grid, tableName);
|
950
|
+
}, 200);
|
951
|
+
}
|
952
|
+
if (option && option.$event && option.$event.preventDefault) {
|
953
|
+
option.$event.preventDefault(); // 取消事件的默认行为
|
954
|
+
}
|
955
|
+
}
|
956
|
+
}
|
957
|
+
|
958
|
+
function changeSelectCount(checked) {
|
959
|
+
var checkedLength = checked.records.length;
|
960
|
+
}
|
961
|
+
|
962
|
+
function getTableData(that, tableRef, type, success) {
|
963
|
+
if (
|
964
|
+
configUtil.tableConfig.disableTableName
|
965
|
+
|| settingConfig.tableStorageDisabled
|
966
|
+
)
|
967
|
+
return false;
|
968
|
+
var $grid = getGrid(that, tableRef);
|
969
|
+
var tableName = $grid.tableName;
|
970
|
+
var url = USER_PREFIX + "/table_column/getTableData";
|
971
|
+
var param = {
|
972
|
+
tableName: tableName,
|
973
|
+
type: type,
|
974
|
+
};
|
975
|
+
var data = null;
|
976
|
+
return that.$http({
|
977
|
+
async: false,
|
978
|
+
url: url,
|
979
|
+
method: "post",
|
980
|
+
data: param,
|
981
|
+
success: success,
|
982
|
+
});
|
983
|
+
}
|
984
|
+
|
985
|
+
function addTableData(that, tableRef, value, success) {
|
986
|
+
if (
|
987
|
+
configUtil.tableConfig.disableTableName
|
988
|
+
|| settingConfig.tableStorageDisabled
|
989
|
+
)
|
990
|
+
return false;
|
991
|
+
var $grid = getGrid(that, tableRef);
|
992
|
+
var tableName = $grid.tableName;
|
993
|
+
if (tableName) {
|
994
|
+
that.$http({
|
995
|
+
method: "post",
|
996
|
+
url: USER_PREFIX + "/table_column/addTableData",
|
997
|
+
data: {
|
998
|
+
tableName: tableName,
|
999
|
+
type: "isQueryAllPage",
|
1000
|
+
data: value,
|
1001
|
+
success: success,
|
1002
|
+
},
|
1003
|
+
});
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
function checkQueryTotal(that, tableRef, value) {
|
1008
|
+
var $grid = getGrid(that, tableRef);
|
1009
|
+
$grid.isQueryAllPage = value;
|
1010
|
+
var tableName = $grid.tableName;
|
1011
|
+
var option = $grid.getProxyInfo();
|
1012
|
+
var pagerConfig = $grid.pagerConfig;
|
1013
|
+
|
1014
|
+
$grid.pagerConfig.layouts = pagerConfig.layouts || [];
|
1015
|
+
addTableData(that, tableRef, value);
|
1016
|
+
$grid.commitProxy("query");
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
function getPagerConfigLayouts(opts) {
|
1020
|
+
if (opts.showPageSizes !== false) {
|
1021
|
+
return ["Sizes", "PrevPage", "JumpNumber", "NextPage"];
|
1022
|
+
} else {
|
1023
|
+
return ["PrevPage", "JumpNumber", "NextPage"];
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
function getCellValue(obj) {
|
1028
|
+
let {column, $table} = obj;
|
1029
|
+
let params = createParams(obj);
|
1030
|
+
let h = $table.$createElement;
|
1031
|
+
let that = $table.$xegrid.originOption.vue;
|
1032
|
+
|
1033
|
+
let cellValue;
|
1034
|
+
if (column.slots && column.slots.filterVal) {
|
1035
|
+
cellValue = column.slots.filterVal(params);
|
1036
|
+
} else {
|
1037
|
+
let result = column.renderCell(h, params);
|
1038
|
+
cellValue = vNodeRender(result);
|
1039
|
+
}
|
1040
|
+
return cellValue;
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
function createParams(obj) {
|
1044
|
+
let $xetable = obj.$table;
|
1045
|
+
let {column, row} = obj;
|
1046
|
+
let fixedType = $xetable.$refs.tableBody.fixedType,
|
1047
|
+
afterFullData = $xetable.afterFullData,
|
1048
|
+
tableData = $xetable.tableData;
|
1049
|
+
var columnIndex = $xetable.getColumnIndex(column);
|
1050
|
+
let items = tableData;
|
1051
|
+
|
1052
|
+
var _columnIndex = $xetable.getVTColumnIndex(column);
|
1053
|
+
|
1054
|
+
let overflowX = $xetable.overflowX;
|
1055
|
+
var fixedHiddenColumn = fixedType
|
1056
|
+
? column.fixed !== fixedType
|
1057
|
+
: column.fixed && overflowX;
|
1058
|
+
|
1059
|
+
let tableColumn = $xetable.tableColumn,
|
1060
|
+
scrollXLoad = $xetable.scrollXLoad,
|
1061
|
+
scrollYLoad = $xetable.scrollYLoad,
|
1062
|
+
allColumnOverflow = $xetable.showOverflow,
|
1063
|
+
isAllOverflow = $xetable.isAllOverflow,
|
1064
|
+
mergeList = $xetable.mergeList,
|
1065
|
+
spanMethod = $xetable.spanMethod,
|
1066
|
+
keyboardConfig = $xetable.keyboardConfig,
|
1067
|
+
keyboardOpts = $xetable.keyboardOpts,
|
1068
|
+
fixedColumn = $xetable.$refs.tableBody.fixedColumn,
|
1069
|
+
visibleColumn = $xetable.visibleColumn;
|
1070
|
+
|
1071
|
+
if (obj.tableColumn == null) {
|
1072
|
+
if (fixedType) {
|
1073
|
+
if (
|
1074
|
+
scrollXLoad
|
1075
|
+
|| scrollYLoad
|
1076
|
+
|| (allColumnOverflow ? isAllOverflow : allColumnOverflow)
|
1077
|
+
) {
|
1078
|
+
if (
|
1079
|
+
!mergeList.length
|
1080
|
+
&& !spanMethod
|
1081
|
+
&& !(keyboardConfig && keyboardOpts.isMerge)
|
1082
|
+
) {
|
1083
|
+
tableColumn = fixedColumn;
|
1084
|
+
} else {
|
1085
|
+
tableColumn = visibleColumn; // 检查固定列是否被合并,合并范围是否超出固定列
|
1086
|
+
// if (mergeList.length && !isMergeLeftFixedExceeded && fixedType === 'left') {
|
1087
|
+
// tableColumn = fixedColumn
|
1088
|
+
// } else if (mergeList.length && !isMergeRightFixedExceeded && fixedType === 'right') {
|
1089
|
+
// tableColumn = fixedColumn
|
1090
|
+
// } else {
|
1091
|
+
// tableColumn = visibleColumn
|
1092
|
+
// }
|
1093
|
+
}
|
1094
|
+
} else {
|
1095
|
+
tableColumn = visibleColumn;
|
1096
|
+
}
|
1097
|
+
}
|
1098
|
+
} else {
|
1099
|
+
tableColumn = obj.tableColumn;
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
var rowid = $xetable.getRowid(row);
|
1103
|
+
let fullAllDataRowIdData = $xetable.fullAllDataRowIdData;
|
1104
|
+
var rest = fullAllDataRowIdData[rowid];
|
1105
|
+
var rowLevel = rest ? rest.level : 0;
|
1106
|
+
var seq = rest ? rest.seq : -1;
|
1107
|
+
var renderType = "body";
|
1108
|
+
|
1109
|
+
let $rowIndex = obj.$rowIndex;
|
1110
|
+
if ($rowIndex == null) {
|
1111
|
+
tableData.some(function (item, index) {
|
1112
|
+
let flag = rowid == $xetable.getRowid(item);
|
1113
|
+
if (flag) {
|
1114
|
+
$rowIndex = index;
|
1115
|
+
}
|
1116
|
+
return flag;
|
1117
|
+
});
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
let $columnIndex = obj.$columnIndex;
|
1121
|
+
if ($columnIndex == null) {
|
1122
|
+
tableColumn.some(function (item, index) {
|
1123
|
+
let flag = column.id == item.id;
|
1124
|
+
if (flag) {
|
1125
|
+
$columnIndex = index;
|
1126
|
+
}
|
1127
|
+
return flag;
|
1128
|
+
});
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
var _rowIndex = $xetable.getVTRowIndex(row); // 确保任何情况下 rowIndex 都精准指向真实 data 索引
|
1132
|
+
var rowIndex = $xetable.getRowIndex(row); // 事件绑定
|
1133
|
+
var params = {
|
1134
|
+
$table: $xetable,
|
1135
|
+
seq: seq,
|
1136
|
+
rowid: rowid,
|
1137
|
+
row: row,
|
1138
|
+
rowIndex: rowIndex,
|
1139
|
+
$rowIndex: $rowIndex,
|
1140
|
+
_rowIndex: _rowIndex,
|
1141
|
+
column: column,
|
1142
|
+
columnIndex: columnIndex,
|
1143
|
+
$columnIndex: $columnIndex,
|
1144
|
+
_columnIndex: _columnIndex,
|
1145
|
+
fixed: fixedType,
|
1146
|
+
type: renderType,
|
1147
|
+
isHidden: fixedHiddenColumn,
|
1148
|
+
level: rowLevel,
|
1149
|
+
visibleData: afterFullData,
|
1150
|
+
data: tableData,
|
1151
|
+
items: items,
|
1152
|
+
};
|
1153
|
+
return params;
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
let TempSoltConstructor = Vue.extend(CellSlot);
|
1157
|
+
|
1158
|
+
let instance = null;
|
1159
|
+
function initTempSoltConstructorInstance() {
|
1160
|
+
if (!instance) {
|
1161
|
+
instance = new TempSoltConstructor();
|
1162
|
+
}
|
1163
|
+
return instance;
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
function destroyTempSoltConstructorInstance() {
|
1167
|
+
if (instance) {
|
1168
|
+
instance.$destroy();
|
1169
|
+
instance = null;
|
1170
|
+
}
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
function vNodeRender(vNodes) {
|
1174
|
+
if (vNodes === null || vNodes === undefined) {
|
1175
|
+
return null;
|
1176
|
+
}
|
1177
|
+
let type = typeof vNodes;
|
1178
|
+
if (type == "string" || type == "number") {
|
1179
|
+
return vNodes;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
let cellValue = "";
|
1183
|
+
let contents = [];
|
1184
|
+
// let instance = null;
|
1185
|
+
let loop = function (item) {
|
1186
|
+
if (item && item.children && item.children.length > 0) {
|
1187
|
+
let arr = [];
|
1188
|
+
item.children.forEach(function (child) {
|
1189
|
+
if (child.componentOptions) {
|
1190
|
+
initTempSoltConstructorInstance();
|
1191
|
+
instance.$slots.default = child;
|
1192
|
+
instance.$mount();
|
1193
|
+
cellValue = "";
|
1194
|
+
if (child.componentInstance && child.componentInstance.$el) {
|
1195
|
+
cellValue = domRender(child.componentInstance.$el);
|
1196
|
+
}
|
1197
|
+
arr.push(cellValue);
|
1198
|
+
instance.$slots.default = null;
|
1199
|
+
} else {
|
1200
|
+
let text = loop(child);
|
1201
|
+
if (text != null) {
|
1202
|
+
arr.push(text);
|
1203
|
+
}
|
1204
|
+
}
|
1205
|
+
});
|
1206
|
+
return arr.join("");
|
1207
|
+
} else {
|
1208
|
+
if (item.text != null) {
|
1209
|
+
return item.text;
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
};
|
1213
|
+
|
1214
|
+
vNodes.forEach(function (vNode) {
|
1215
|
+
if (vNode !== undefined && vNode !== null) {
|
1216
|
+
if (vNode.componentOptions) {
|
1217
|
+
initTempSoltConstructorInstance();
|
1218
|
+
instance.$slots.default = vNode;
|
1219
|
+
instance.$mount();
|
1220
|
+
cellValue = "";
|
1221
|
+
if (vNode.componentInstance && vNode.componentInstance.$el) {
|
1222
|
+
cellValue = domRender(vNode.componentInstance.$el);
|
1223
|
+
}
|
1224
|
+
contents.push(cellValue);
|
1225
|
+
// instance.$destroy();
|
1226
|
+
instance.$slots.default = null;
|
1227
|
+
// instance = null;
|
1228
|
+
} else {
|
1229
|
+
if (vNode && vNode.children && vNode.children.length > 0) {
|
1230
|
+
let text = loop(vNode);
|
1231
|
+
if (text != null) {
|
1232
|
+
contents.push(text);
|
1233
|
+
}
|
1234
|
+
} else {
|
1235
|
+
let type1 = typeof vNode;
|
1236
|
+
if (type1 == "string" || type1 == "number") {
|
1237
|
+
contents.push(vNode);
|
1238
|
+
} else if (vNode.text != null) {
|
1239
|
+
contents.push(vNode.text);
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
}
|
1243
|
+
}
|
1244
|
+
});
|
1245
|
+
destroyTempSoltConstructorInstance();
|
1246
|
+
// instance = null;
|
1247
|
+
return contents.join("").trim();
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
function groupDomRender(dom) {
|
1251
|
+
let contents = [];
|
1252
|
+
let loop = function (item) {
|
1253
|
+
if (item && item.children && item.children.length > 0) {
|
1254
|
+
let arr = [];
|
1255
|
+
Array.from(item.children).forEach((child) => {
|
1256
|
+
let text = loop(child);
|
1257
|
+
if (text != null) {
|
1258
|
+
arr.push(text);
|
1259
|
+
}
|
1260
|
+
});
|
1261
|
+
return arr.join("");
|
1262
|
+
} else {
|
1263
|
+
var style = window.getComputedStyle(item); //el即DOM元素
|
1264
|
+
let classList = Array.from(item.classList);
|
1265
|
+
if (style.display === "none") {
|
1266
|
+
} else if (item.nodeName == "INPUT") {
|
1267
|
+
if (item.type == "radio") {
|
1268
|
+
if (item.checked && classList.includes("el-radio__original")) {
|
1269
|
+
let value = item.parentNode.parentNode.innerText || "";
|
1270
|
+
if (value) {
|
1271
|
+
contents.push(value);
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
} else if (item.type == "checkbox") {
|
1275
|
+
if (item.checked && classList.includes("el-checkbox__original")) {
|
1276
|
+
let value = item.parentNode.parentNode.innerText || "";
|
1277
|
+
if (value) {
|
1278
|
+
contents.push(value);
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
}
|
1282
|
+
}
|
1283
|
+
}
|
1284
|
+
};
|
1285
|
+
loop(dom);
|
1286
|
+
return contents.join(",");
|
1287
|
+
}
|
1288
|
+
|
1289
|
+
function selectGroupRender(dom) {
|
1290
|
+
let ul = dom.querySelector(".el-select-dropdown__list");
|
1291
|
+
if (ul) {
|
1292
|
+
let lis = ul.children;
|
1293
|
+
if (lis) {
|
1294
|
+
return Array.from(lis)
|
1295
|
+
.filter((li) => {
|
1296
|
+
let classList = Array.from(li.classList);
|
1297
|
+
return classList.includes("selected");
|
1298
|
+
})
|
1299
|
+
.map((li) => {
|
1300
|
+
return li.innerText;
|
1301
|
+
})
|
1302
|
+
.join(",");
|
1303
|
+
} else {
|
1304
|
+
return "";
|
1305
|
+
}
|
1306
|
+
} else {
|
1307
|
+
return "";
|
1308
|
+
}
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
function domRender(dom) {
|
1312
|
+
let loop = function (item) {
|
1313
|
+
if(item?.nodeName=="#comment")return "";
|
1314
|
+
var style = window.getComputedStyle(item); //el即DOM元素
|
1315
|
+
let role = item.getAttribute("role");
|
1316
|
+
let classList = Array.from(item.classList);
|
1317
|
+
|
1318
|
+
if (style.display === "none") {
|
1319
|
+
return "";
|
1320
|
+
} else if (role == "group") {
|
1321
|
+
return groupDomRender(item);
|
1322
|
+
} else if (role == "radiogroup") {
|
1323
|
+
return groupDomRender(item);
|
1324
|
+
} else if (
|
1325
|
+
classList.includes("el-select")
|
1326
|
+
&& item["@@clickoutsideContext"]
|
1327
|
+
) {
|
1328
|
+
return selectGroupRender(item);
|
1329
|
+
} else if (item && item.children && item.children.length > 0) {
|
1330
|
+
let arr = [];
|
1331
|
+
Array.from(item.children).forEach((child) => {
|
1332
|
+
let text = loop(child);
|
1333
|
+
if (text != null) {
|
1334
|
+
arr.push(text);
|
1335
|
+
}
|
1336
|
+
});
|
1337
|
+
return arr.join("");
|
1338
|
+
} else {
|
1339
|
+
if (item.nodeName == "INPUT") {
|
1340
|
+
return item.value;
|
1341
|
+
} else if (item.innerText != null && item.innerText != "") {
|
1342
|
+
return item.innerText;
|
1343
|
+
} else {
|
1344
|
+
return "";
|
1345
|
+
}
|
1346
|
+
}
|
1347
|
+
};
|
1348
|
+
let res = loop(dom).trim();
|
1349
|
+
return res;
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
modules = {
|
1353
|
+
initVxeTable,
|
1354
|
+
columnDrop,
|
1355
|
+
initOption,
|
1356
|
+
getTableJson,
|
1357
|
+
addTableJson,
|
1358
|
+
onColumnWitchChange,
|
1359
|
+
customHandle,
|
1360
|
+
changeSelectCount,
|
1361
|
+
getTableData,
|
1362
|
+
addTableData,
|
1363
|
+
checkQueryTotal,
|
1364
|
+
getCellValue,
|
1365
|
+
createParams,
|
1366
|
+
};
|
1367
|
+
|
1368
|
+
if (!configUtil.Vue.prototype.$vxeTableUtil)
|
1369
|
+
configUtil.Vue.prototype.$vxeTableUtil = modules;
|
1370
|
+
|
1371
|
+
export default modules;
|