mooho-base-admin-plus 2.10.41 → 2.10.42

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "2.10.41",
4
+ "version": "2.10.42",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -60,6 +60,7 @@
60
60
  autoWrapCol: true,
61
61
  autoWrapRow: true,
62
62
  manualColumnResize: true,
63
+ readOnly: this.readonly,
63
64
  // columnSummary: [
64
65
  // {
65
66
  // sourceColumn: 2,
@@ -69,7 +70,7 @@
69
70
  // }
70
71
  // ],
71
72
  // minSpareRows: 1,
72
- contextMenu: { items: {} },
73
+ contextMenu: this.readonly ? false : { items: {} },
73
74
  licenseKey: 'non-commercial-and-evaluation'
74
75
  },
75
76
  coords: {},
@@ -221,9 +222,7 @@
221
222
  controlType: item.controlType
222
223
  };
223
224
 
224
- if (this.readonly) {
225
- column.readOnly = true;
226
- } else {
225
+ if (!this.readonly) {
227
226
  if (item.controlType === 'Label' || item.isReadonly == true) {
228
227
  column.readOnly = true;
229
228
  } else if (item.controlType === 'NumberInput') {
@@ -433,85 +432,87 @@
433
432
  // });
434
433
  // }
435
434
 
436
- // 右键菜单 新增
437
- if (this.tableView.createEnable) {
438
- this.hotSetting.contextMenu.items.row_above = { name: '上方插入行' };
439
- this.hotSetting.contextMenu.items.row_below = { name: '下方插入行' };
440
- this.hotSetting.contextMenu.items.separator1 = ContextMenu.SEPARATOR;
441
- }
435
+ if (!this.readonly) {
436
+ // 右键菜单 新增
437
+ if (this.tableView.createEnable) {
438
+ this.hotSetting.contextMenu.items.row_above = { name: '上方插入行' };
439
+ this.hotSetting.contextMenu.items.row_below = { name: '下方插入行' };
440
+ this.hotSetting.contextMenu.items.separator1 = ContextMenu.SEPARATOR;
441
+ }
442
442
 
443
- // 右键菜单 调整
444
- if (this.tableView.adjustEnable) {
445
- this.hotSetting.contextMenu.items.move_up = {
446
- name: '整行上移',
447
- callback: (key, selection, clickEvent) => {
448
- let index = selection[0].start.row;
449
- if (index > 0) {
450
- let data = this.$refs.table.hotInstance.getSourceData();
451
- let delRows = data.splice(index, 1);
452
- data.splice(index - 1, 0, delRows[0]);
453
- this.$refs.table.hotInstance.loadData(data);
443
+ // 右键菜单 调整
444
+ if (this.tableView.adjustEnable) {
445
+ this.hotSetting.contextMenu.items.move_up = {
446
+ name: '整行上移',
447
+ callback: (key, selection, clickEvent) => {
448
+ let index = selection[0].start.row;
449
+ if (index > 0) {
450
+ let data = this.$refs.table.hotInstance.getSourceData();
451
+ let delRows = data.splice(index, 1);
452
+ data.splice(index - 1, 0, delRows[0]);
453
+ this.$refs.table.hotInstance.loadData(data);
454
+ }
454
455
  }
455
- }
456
- };
457
- this.hotSetting.contextMenu.items.move_down = {
458
- name: '整行下移',
459
- callback: (key, selection, clickEvent) => {
460
- let index = selection[0].start.row;
461
- let data = this.$refs.table.hotInstance.getSourceData();
462
- if (index < data.length - 1) {
463
- let delRows = data.splice(index, 1);
464
- data.splice(index + 1, 0, delRows[0]);
465
- this.$refs.table.hotInstance.loadData(data);
456
+ };
457
+ this.hotSetting.contextMenu.items.move_down = {
458
+ name: '整行下移',
459
+ callback: (key, selection, clickEvent) => {
460
+ let index = selection[0].start.row;
461
+ let data = this.$refs.table.hotInstance.getSourceData();
462
+ if (index < data.length - 1) {
463
+ let delRows = data.splice(index, 1);
464
+ data.splice(index + 1, 0, delRows[0]);
465
+ this.$refs.table.hotInstance.loadData(data);
466
+ }
466
467
  }
467
- }
468
- };
469
- }
468
+ };
469
+ }
470
470
 
471
- // 右键菜单 删除
472
- if (this.tableView.removeEnable) {
473
- this.hotSetting.contextMenu.items.remove_row = {
474
- name: '整行删除',
475
- callback: (key, selection, clickEvent) => {
476
- let delArr = [];
477
- let ids = [];
478
- let rows = [];
471
+ // 右键菜单 删除
472
+ if (this.tableView.removeEnable) {
473
+ this.hotSetting.contextMenu.items.remove_row = {
474
+ name: '整行删除',
475
+ callback: (key, selection, clickEvent) => {
476
+ let delArr = [];
477
+ let ids = [];
478
+ let rows = [];
479
479
 
480
- let data = this.$refs.table.hotInstance.getSourceData();
480
+ let data = this.$refs.table.hotInstance.getSourceData();
481
481
 
482
- for (const sels of selection) {
483
- let startRowIndex = sels.start.row;
484
- let endRowIndex = sels.end.row;
482
+ for (const sels of selection) {
483
+ let startRowIndex = sels.start.row;
484
+ let endRowIndex = sels.end.row;
485
485
 
486
- delArr.push([startRowIndex, endRowIndex - startRowIndex + 1]);
486
+ delArr.push([startRowIndex, endRowIndex - startRowIndex + 1]);
487
487
 
488
- for (let i = startRowIndex; i <= endRowIndex; i++) {
489
- rows.push(i);
490
- }
488
+ for (let i = startRowIndex; i <= endRowIndex; i++) {
489
+ rows.push(i);
490
+ }
491
491
 
492
- for (let i = startRowIndex; i < endRowIndex; i++) {
493
- if (data[i].id) {
494
- ids.push(data[i].id);
492
+ for (let i = startRowIndex; i < endRowIndex; i++) {
493
+ if (data[i].id) {
494
+ ids.push(data[i].id);
495
+ }
495
496
  }
496
497
  }
497
- }
498
-
499
- this.confirm('确定要删除该行吗?', async () => {
500
- // if (ids.length > 0) {
501
- // await modelApi.delete(this.viewCode, ids);
502
- // }
503
- let b = true;
504
498
 
505
- this.$emit('on-remove', rows, val => {
506
- b = val;
499
+ this.confirm('确定要删除该行吗?', async () => {
500
+ // if (ids.length > 0) {
501
+ // await modelApi.delete(this.viewCode, ids);
502
+ // }
503
+ let b = true;
504
+
505
+ this.$emit('on-remove', rows, val => {
506
+ b = val;
507
+ });
508
+ console.log(b);
509
+ if (b) {
510
+ this.$refs.table.hotInstance.alter('remove_row', delArr);
511
+ }
507
512
  });
508
- console.log(b);
509
- if (b) {
510
- this.$refs.table.hotInstance.alter('remove_row', delArr);
511
- }
512
- });
513
- }
514
- };
513
+ }
514
+ };
515
+ }
515
516
  }
516
517
 
517
518
  // 变更事件