mooho-base-admin-plus 2.10.34 → 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
@@ -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.34",
4
+ "version": "2.10.36",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -368,7 +368,7 @@
368
368
  />
369
369
  </FormItem>
370
370
  </Col>
371
- <Col v-bind="grid8" v-if="viewType == 'TableView' && data.controlType == 'Label'">
371
+ <Col v-bind="grid8" v-if="viewType == 'TableView'">
372
372
  <FormItem label="固定在最前" key="isFixed" prop="isFixed">
373
373
  <Switch
374
374
  :model-value="!!data.isFixed"
@@ -60,93 +60,16 @@
60
60
  autoWrapCol: true,
61
61
  autoWrapRow: true,
62
62
  manualColumnResize: true,
63
- minSpareRows: 1,
64
- contextMenu: {
65
- items: {
66
- row_above: {
67
- name: '上方插入行'
68
- },
69
- row_below: {
70
- name: '下方插入行'
71
- },
72
- separator1: ContextMenu.SEPARATOR,
73
- move_up: {
74
- name: '整行上移',
75
- callback: (key, selection, clickEvent) => {
76
- let index = selection[0].start.row;
77
- if (index > 0) {
78
- let data = this.$refs.table.hotInstance.getSourceData();
79
- let delRows = data.splice(index, 1);
80
- data.splice(index - 1, 0, delRows[0]);
81
- this.$refs.table.hotInstance.loadData(data);
82
- }
83
- }
84
- },
85
- move_down: {
86
- name: '整行下移',
87
- callback: (key, selection, clickEvent) => {
88
- let index = selection[0].start.row;
89
- let data = this.$refs.table.hotInstance.getSourceData();
90
- if (index < data.length - 1) {
91
- let delRows = data.splice(index, 1);
92
- data.splice(index + 1, 0, delRows[0]);
93
- this.$refs.table.hotInstance.loadData(data);
94
- }
95
- }
96
- },
97
- remove_row: {
98
- name: '整行删除',
99
- callback: (key, selection, clickEvent) => {
100
- let delArr = [];
101
- let ids = [];
102
- let rows = [];
103
-
104
- let data = this.$refs.table.hotInstance.getSourceData();
105
-
106
- for (const sels of selection) {
107
- let startRowIndex = sels.start.row;
108
- let endRowIndex = sels.end.row;
109
-
110
- delArr.push([startRowIndex, endRowIndex - startRowIndex + 1]);
111
-
112
- for (let i = startRowIndex; i <= endRowIndex; i++) {
113
- rows.push(i);
114
- }
115
-
116
- for (let i = startRowIndex; i < endRowIndex; i++) {
117
- if (data[i].id) {
118
- ids.push(data[i].id);
119
- }
120
- }
121
- }
122
-
123
- this.confirm('确定要删除该行吗?', async () => {
124
- // if (ids.length > 0) {
125
- // await modelApi.delete(this.viewCode, ids);
126
- // }
127
- let b = true;
128
-
129
- this.$emit('on-remove', rows, val => {
130
- b = val;
131
- });
132
- console.log(b);
133
- if (b) {
134
- this.$refs.table.hotInstance.alter('remove_row', delArr);
135
- }
136
- });
137
- }
138
- }
139
- // separator2: ContextMenu.SEPARATOR
140
- // cut: { name: '剪切' },
141
- // copy: { name: '复制' }
142
- // 'paste': {
143
- // name: '粘贴',
144
- // callback: (key, selection, clickEvent) => {
145
- // document.execCommand('paste');
146
- // }
147
- // }
148
- }
149
- },
63
+ // columnSummary: [
64
+ // {
65
+ // sourceColumn: 2,
66
+ // type: 'sum',
67
+ // destinationRow: 3,
68
+ // destinationColumn: 2
69
+ // }
70
+ // ],
71
+ // minSpareRows: 1,
72
+ contextMenu: { items: {} },
150
73
  licenseKey: 'non-commercial-and-evaluation'
151
74
  },
152
75
  coords: {},
@@ -291,7 +214,7 @@
291
214
  view.viewColumns.map(async item => {
292
215
  let column = {
293
216
  ...item,
294
- title: item.name,
217
+ title: item.isRequired ? item.name + '<font style="color: red">*</font>' : item.name,
295
218
  data: item.code,
296
219
  width: item.controlWidth || 80,
297
220
  className: item.align ? item.align.toLowerCase() : 'htCenter',
@@ -421,7 +344,15 @@
421
344
  })
422
345
  );
423
346
 
424
- console.log('this.columns', this.columns);
347
+ this.columns = this.columns
348
+ .filter(item => {
349
+ return item.isFixed == true;
350
+ })
351
+ .concat(
352
+ this.columns.filter(item => {
353
+ return item.isFixed != true;
354
+ })
355
+ );
425
356
 
426
357
  // .filter(item => {
427
358
  // return !(item.parentCode || '').trim();
@@ -430,13 +361,62 @@
430
361
  // return getColumns(view, item, this.static);
431
362
  // });
432
363
 
433
- this.hotSetting.columns = this.columns;
434
-
435
- this.columns.forEach(column => {
436
- //column.name = this.getNameI18n(column) + (column.isRequired ? ' <font color="red">*</font>' : '');
437
- //column.fixed = column.isFixed ? 'left' : null;
364
+ this.hotSetting.columns = this.columns.filter(item => {
365
+ return (
366
+ !!(item.parentCode || '').trim() ||
367
+ this.columns.filter(i => {
368
+ return i.parentCode == item.code;
369
+ }).length == 0
370
+ );
438
371
  });
439
372
 
373
+ // 冻结列
374
+ this.hotSetting.fixedColumnsStart = this.columns.filter(item => {
375
+ return item.isFixed == true;
376
+ }).length;
377
+
378
+ // 多级表头
379
+ if (
380
+ this.columns.filter(item => {
381
+ return !!(item.parentCode || '').trim();
382
+ }).length > 0
383
+ ) {
384
+ let lv1 = this.columns
385
+ .filter(item => {
386
+ return !(item.parentCode || '').trim();
387
+ })
388
+ .map(item => {
389
+ return {
390
+ label: item.title,
391
+ colspan:
392
+ this.columns.filter(i => {
393
+ return i.parentCode == item.code;
394
+ }).length == 0
395
+ ? 1
396
+ : this.columns.filter(i => {
397
+ return i.parentCode == item.code;
398
+ }).length
399
+ };
400
+ });
401
+
402
+ let lv2 = this.columns
403
+ .filter(item => {
404
+ return (
405
+ !!(item.parentCode || '').trim() ||
406
+ this.columns.filter(i => {
407
+ return i.parentCode == item.code;
408
+ }).length == 0
409
+ );
410
+ })
411
+ .map(item => {
412
+ return {
413
+ label: !!(item.parentCode || '').trim() ? item.title : ''
414
+ };
415
+ });
416
+
417
+ this.hotSetting.nestedHeaders = [lv1, lv2];
418
+ }
419
+
440
420
  // this.columns.unshift({
441
421
  // tree: true,
442
422
  // display: 'inline',
@@ -453,6 +433,106 @@
453
433
  // });
454
434
  // }
455
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
+ // 变更事件
520
+ this.$refs.table.hotInstance.addHook('afterChange', changes => {
521
+ if (changes) {
522
+ changes.forEach(([row, property, oldValue, newValue]) => {
523
+ if (this.tableView.createEnable && row == this.data.length - 1 && (oldValue ?? '') != (newValue ?? '')) {
524
+ this.data.push(this.getDefaultData());
525
+ this.$refs.table.hotInstance.loadData(this.data);
526
+ }
527
+
528
+ this.onDataChange(
529
+ this.data[row],
530
+ this.columns.find(item => item.code == property)
531
+ );
532
+ });
533
+ }
534
+ });
535
+
456
536
  this.inited = true;
457
537
 
458
538
  setTimeout(() => {
@@ -490,6 +570,10 @@
490
570
 
491
571
  this.data = this.staticData;
492
572
 
573
+ if (this.tableView.createEnable) {
574
+ this.data.push(this.getDefaultData());
575
+ }
576
+
493
577
  //this.hotSetting.data = this.data;
494
578
 
495
579
  this.$refs.table.hotInstance.loadData(this.data);
@@ -498,8 +582,6 @@
498
582
  this.$refs.table.hotInstance.render();
499
583
  });
500
584
 
501
- console.log('this.data', this.data);
502
-
503
585
  // 设置数据的可见性和只读属性
504
586
  this.data.forEach(item => {
505
587
  //this.setShowStatus(item);
@@ -618,52 +700,6 @@
618
700
 
619
701
  return data;
620
702
  },
621
- onSelectDataChange(data, sender, selected) {
622
- let code;
623
- if (sender.code.endsWith('ID')) {
624
- code = sender.code.substr(0, sender.code.length - 2);
625
- }
626
-
627
- let model = null;
628
-
629
- if (typeof selected == 'object') {
630
- if (selected instanceof Array) {
631
- model = [];
632
-
633
- for (let item of selected) {
634
- if (typeof item == 'object') {
635
- model.push(item);
636
- } else {
637
- if (data._rawData && data._rawData[sender.code]) {
638
- model.push(
639
- data._rawData[sender.code].find(rawData => {
640
- return this.parseData(rawData, sender.sourceDataCode) == item;
641
- })
642
- );
643
- } else {
644
- model.push(item);
645
- }
646
- }
647
- }
648
- } else {
649
- model = selected;
650
- }
651
- } else {
652
- if (data._rawData && data._rawData[sender.code]) {
653
- model = data._rawData[sender.code].find(rawData => {
654
- return this.parseData(rawData, sender.sourceDataCode) == selected;
655
- });
656
- } else {
657
- model = selected;
658
- }
659
- }
660
-
661
- if (code) {
662
- this.setData(data, code, model);
663
- }
664
-
665
- this.onDataChange(data, sender, model);
666
- },
667
703
  // 数据变化事件
668
704
  onDataChange(data, sender, selected) {
669
705
  //this.setShowStatus(data);
@@ -680,25 +716,6 @@
680
716
  * @property {object} selected 选中对象(弹出选择框等有效)
681
717
  */
682
718
  this.$emit('on-change', data, sender, selected);
683
-
684
- // 计算需要刷新的字段
685
- if (sender == null || sender.triggers !== []) {
686
- this.columns.forEach(function (column) {
687
- if (
688
- !column.isStaticItem &&
689
- !!(column.source || '').trim() &&
690
- !(column.dataType && column.dataType.startsWith('Enum:')) &&
691
- (sender == null ||
692
- sender.triggers.some(item => {
693
- return item.code == column.code;
694
- }))
695
- ) {
696
- if (data._needRefresh) {
697
- data._needRefresh[column.code] = true;
698
- }
699
- }
700
- });
701
- }
702
719
  },
703
720
  // 公式计算
704
721
  calc(data, sender) {
@@ -1 +1 @@
1
- import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
1
+ import{s as e}from"./lang.js";const t={i:{locale:"en-US",select:{placeholder:"Select",noMatch:"No matching data",loading:"Loading"},table:{noDataText:"No Data",noFilteredDataText:"No filter data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},datepicker:{selectDate:"Select date",selectTime:"Select time",startTime:"Start Time",endTime:"End Time",clear:"Clear",ok:"OK",datePanelLabel:"[mmmm] [yyyy]",month:"Month",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",year:"Year",weekStartDay:"0",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},months:{m1:"Jan",m2:"Feb",m3:"Mar",m4:"Apr",m5:"May",m6:"Jun",m7:"Jul",m8:"Aug",m9:"Sep",m10:"Oct",m11:"Nov",m12:"Dec"}},transfer:{titles:{source:"Source",target:"Target"},filterPlaceholder:"Search here",notFoundText:"Not Found"},modal:{okText:"OK",cancelText:"Cancel"},poptip:{okText:"OK",cancelText:"Cancel"},page:{prev:"Previous Page",next:"Next Page",total:"Total",item:"item",items:"items",prev5:"Previous 5 Pages",next5:"Next 5 Pages",page:"/page",goto:"Goto",p:""},rate:{star:"Star",stars:"Stars"},time:{before:" ago",after:" after",just:"just now",seconds:" seconds",minutes:" minutes",hours:" hours",days:" days"},tree:{emptyText:"No Data"}}};e(t);export{t as default};
@@ -1 +1 @@
1
- const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
1
+ const e=typeof window!="undefined";function n(i){e&&typeof window.viewuiplus!="undefined"&&("langs"in viewuiplus||(viewuiplus.langs={}),viewuiplus.langs[i.i.locale]=i)}export{n as s};
@@ -1 +1 @@
1
- import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};
1
+ import{s as e}from"./lang.js";const t={i:{locale:"zh-CN",select:{placeholder:"\u8BF7\u9009\u62E9",noMatch:"\u65E0\u5339\u914D\u6570\u636E",loading:"\u52A0\u8F7D\u4E2D"},table:{noDataText:"\u6682\u65E0\u6570\u636E",noFilteredDataText:"\u6682\u65E0\u7B5B\u9009\u7ED3\u679C",confirmFilter:"\u7B5B\u9009",resetFilter:"\u91CD\u7F6E",clearFilter:"\u5168\u90E8",sumText:"\u5408\u8BA1"},datepicker:{selectDate:"\u9009\u62E9\u65E5\u671F",selectTime:"\u9009\u62E9\u65F6\u95F4",startTime:"\u5F00\u59CB\u65F6\u95F4",endTime:"\u7ED3\u675F\u65F6\u95F4",clear:"\u6E05\u7A7A",ok:"\u786E\u5B9A",datePanelLabel:"[yyyy\u5E74] [m\u6708]",month:"\u6708",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",year:"\u5E74",weekStartDay:"0",weeks:{sun:"\u65E5",mon:"\u4E00",tue:"\u4E8C",wed:"\u4E09",thu:"\u56DB",fri:"\u4E94",sat:"\u516D"},months:{m1:"1\u6708",m2:"2\u6708",m3:"3\u6708",m4:"4\u6708",m5:"5\u6708",m6:"6\u6708",m7:"7\u6708",m8:"8\u6708",m9:"9\u6708",m10:"10\u6708",m11:"11\u6708",m12:"12\u6708"}},transfer:{titles:{source:"\u6E90\u5217\u8868",target:"\u76EE\u7684\u5217\u8868"},filterPlaceholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",notFoundText:"\u5217\u8868\u4E3A\u7A7A"},modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},poptip:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88"},page:{prev:"\u4E0A\u4E00\u9875",next:"\u4E0B\u4E00\u9875",total:"\u5171",item:"\u6761",items:"\u6761",prev5:"\u5411\u524D 5 \u9875",next5:"\u5411\u540E 5 \u9875",page:"\u6761/\u9875",goto:"\u8DF3\u81F3",p:"\u9875"},rate:{star:"\u661F",stars:"\u661F"},time:{before:"\u524D",after:"\u540E",just:"\u521A\u521A",seconds:"\u79D2",minutes:"\u5206\u949F",hours:"\u5C0F\u65F6",days:"\u5929"},tree:{emptyText:"\u6682\u65E0\u6570\u636E"}}};e(t);export{t as default};