mooho-base-admin-plus 2.10.35 → 2.10.36
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
CHANGED
|
@@ -69,92 +69,7 @@
|
|
|
69
69
|
// }
|
|
70
70
|
// ],
|
|
71
71
|
// minSpareRows: 1,
|
|
72
|
-
contextMenu: {
|
|
73
|
-
items: {
|
|
74
|
-
row_above: {
|
|
75
|
-
name: '上方插入行'
|
|
76
|
-
},
|
|
77
|
-
row_below: {
|
|
78
|
-
name: '下方插入行'
|
|
79
|
-
},
|
|
80
|
-
separator1: ContextMenu.SEPARATOR,
|
|
81
|
-
move_up: {
|
|
82
|
-
name: '整行上移',
|
|
83
|
-
callback: (key, selection, clickEvent) => {
|
|
84
|
-
let index = selection[0].start.row;
|
|
85
|
-
if (index > 0) {
|
|
86
|
-
let data = this.$refs.table.hotInstance.getSourceData();
|
|
87
|
-
let delRows = data.splice(index, 1);
|
|
88
|
-
data.splice(index - 1, 0, delRows[0]);
|
|
89
|
-
this.$refs.table.hotInstance.loadData(data);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
move_down: {
|
|
94
|
-
name: '整行下移',
|
|
95
|
-
callback: (key, selection, clickEvent) => {
|
|
96
|
-
let index = selection[0].start.row;
|
|
97
|
-
let data = this.$refs.table.hotInstance.getSourceData();
|
|
98
|
-
if (index < data.length - 1) {
|
|
99
|
-
let delRows = data.splice(index, 1);
|
|
100
|
-
data.splice(index + 1, 0, delRows[0]);
|
|
101
|
-
this.$refs.table.hotInstance.loadData(data);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
remove_row: {
|
|
106
|
-
name: '整行删除',
|
|
107
|
-
callback: (key, selection, clickEvent) => {
|
|
108
|
-
let delArr = [];
|
|
109
|
-
let ids = [];
|
|
110
|
-
let rows = [];
|
|
111
|
-
|
|
112
|
-
let data = this.$refs.table.hotInstance.getSourceData();
|
|
113
|
-
|
|
114
|
-
for (const sels of selection) {
|
|
115
|
-
let startRowIndex = sels.start.row;
|
|
116
|
-
let endRowIndex = sels.end.row;
|
|
117
|
-
|
|
118
|
-
delArr.push([startRowIndex, endRowIndex - startRowIndex + 1]);
|
|
119
|
-
|
|
120
|
-
for (let i = startRowIndex; i <= endRowIndex; i++) {
|
|
121
|
-
rows.push(i);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
for (let i = startRowIndex; i < endRowIndex; i++) {
|
|
125
|
-
if (data[i].id) {
|
|
126
|
-
ids.push(data[i].id);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
this.confirm('确定要删除该行吗?', async () => {
|
|
132
|
-
// if (ids.length > 0) {
|
|
133
|
-
// await modelApi.delete(this.viewCode, ids);
|
|
134
|
-
// }
|
|
135
|
-
let b = true;
|
|
136
|
-
|
|
137
|
-
this.$emit('on-remove', rows, val => {
|
|
138
|
-
b = val;
|
|
139
|
-
});
|
|
140
|
-
console.log(b);
|
|
141
|
-
if (b) {
|
|
142
|
-
this.$refs.table.hotInstance.alter('remove_row', delArr);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// separator2: ContextMenu.SEPARATOR
|
|
148
|
-
// cut: { name: '剪切' },
|
|
149
|
-
// copy: { name: '复制' }
|
|
150
|
-
// 'paste': {
|
|
151
|
-
// name: '粘贴',
|
|
152
|
-
// callback: (key, selection, clickEvent) => {
|
|
153
|
-
// document.execCommand('paste');
|
|
154
|
-
// }
|
|
155
|
-
// }
|
|
156
|
-
}
|
|
157
|
-
},
|
|
72
|
+
contextMenu: { items: {} },
|
|
158
73
|
licenseKey: 'non-commercial-and-evaluation'
|
|
159
74
|
},
|
|
160
75
|
coords: {},
|
|
@@ -455,10 +370,12 @@
|
|
|
455
370
|
);
|
|
456
371
|
});
|
|
457
372
|
|
|
373
|
+
// 冻结列
|
|
458
374
|
this.hotSetting.fixedColumnsStart = this.columns.filter(item => {
|
|
459
375
|
return item.isFixed == true;
|
|
460
376
|
}).length;
|
|
461
377
|
|
|
378
|
+
// 多级表头
|
|
462
379
|
if (
|
|
463
380
|
this.columns.filter(item => {
|
|
464
381
|
return !!(item.parentCode || '').trim();
|
|
@@ -516,10 +433,94 @@
|
|
|
516
433
|
// });
|
|
517
434
|
// }
|
|
518
435
|
|
|
436
|
+
console.log('xxx', 'view', view);
|
|
437
|
+
|
|
438
|
+
// 右键菜单 新增
|
|
439
|
+
if (this.tableView.createEnable) {
|
|
440
|
+
this.hotSetting.contextMenu.items.row_above = { name: '上方插入行' };
|
|
441
|
+
this.hotSetting.contextMenu.items.row_below = { name: '下方插入行' };
|
|
442
|
+
this.hotSetting.contextMenu.items.separator1 = ContextMenu.SEPARATOR;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// 右键菜单 调整
|
|
446
|
+
if (this.tableView.adjustEnable) {
|
|
447
|
+
this.hotSetting.contextMenu.items.move_up = {
|
|
448
|
+
name: '整行上移',
|
|
449
|
+
callback: (key, selection, clickEvent) => {
|
|
450
|
+
let index = selection[0].start.row;
|
|
451
|
+
if (index > 0) {
|
|
452
|
+
let data = this.$refs.table.hotInstance.getSourceData();
|
|
453
|
+
let delRows = data.splice(index, 1);
|
|
454
|
+
data.splice(index - 1, 0, delRows[0]);
|
|
455
|
+
this.$refs.table.hotInstance.loadData(data);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
this.hotSetting.contextMenu.items.move_down = {
|
|
460
|
+
name: '整行下移',
|
|
461
|
+
callback: (key, selection, clickEvent) => {
|
|
462
|
+
let index = selection[0].start.row;
|
|
463
|
+
let data = this.$refs.table.hotInstance.getSourceData();
|
|
464
|
+
if (index < data.length - 1) {
|
|
465
|
+
let delRows = data.splice(index, 1);
|
|
466
|
+
data.splice(index + 1, 0, delRows[0]);
|
|
467
|
+
this.$refs.table.hotInstance.loadData(data);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// 右键菜单 删除
|
|
474
|
+
if (this.tableView.removeEnable) {
|
|
475
|
+
this.hotSetting.contextMenu.items.remove_row = {
|
|
476
|
+
name: '整行删除',
|
|
477
|
+
callback: (key, selection, clickEvent) => {
|
|
478
|
+
let delArr = [];
|
|
479
|
+
let ids = [];
|
|
480
|
+
let rows = [];
|
|
481
|
+
|
|
482
|
+
let data = this.$refs.table.hotInstance.getSourceData();
|
|
483
|
+
|
|
484
|
+
for (const sels of selection) {
|
|
485
|
+
let startRowIndex = sels.start.row;
|
|
486
|
+
let endRowIndex = sels.end.row;
|
|
487
|
+
|
|
488
|
+
delArr.push([startRowIndex, endRowIndex - startRowIndex + 1]);
|
|
489
|
+
|
|
490
|
+
for (let i = startRowIndex; i <= endRowIndex; i++) {
|
|
491
|
+
rows.push(i);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
for (let i = startRowIndex; i < endRowIndex; i++) {
|
|
495
|
+
if (data[i].id) {
|
|
496
|
+
ids.push(data[i].id);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
this.confirm('确定要删除该行吗?', async () => {
|
|
502
|
+
// if (ids.length > 0) {
|
|
503
|
+
// await modelApi.delete(this.viewCode, ids);
|
|
504
|
+
// }
|
|
505
|
+
let b = true;
|
|
506
|
+
|
|
507
|
+
this.$emit('on-remove', rows, val => {
|
|
508
|
+
b = val;
|
|
509
|
+
});
|
|
510
|
+
console.log(b);
|
|
511
|
+
if (b) {
|
|
512
|
+
this.$refs.table.hotInstance.alter('remove_row', delArr);
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// 变更事件
|
|
519
520
|
this.$refs.table.hotInstance.addHook('afterChange', changes => {
|
|
520
521
|
if (changes) {
|
|
521
522
|
changes.forEach(([row, property, oldValue, newValue]) => {
|
|
522
|
-
if (row == this.data.length - 1 && (oldValue ?? '') != (newValue ?? '')) {
|
|
523
|
+
if (this.tableView.createEnable && row == this.data.length - 1 && (oldValue ?? '') != (newValue ?? '')) {
|
|
523
524
|
this.data.push(this.getDefaultData());
|
|
524
525
|
this.$refs.table.hotInstance.loadData(this.data);
|
|
525
526
|
}
|
|
@@ -569,7 +570,9 @@
|
|
|
569
570
|
|
|
570
571
|
this.data = this.staticData;
|
|
571
572
|
|
|
572
|
-
this.
|
|
573
|
+
if (this.tableView.createEnable) {
|
|
574
|
+
this.data.push(this.getDefaultData());
|
|
575
|
+
}
|
|
573
576
|
|
|
574
577
|
//this.hotSetting.data = this.data;
|
|
575
578
|
|