mooho-base-admin-plus 2.10.46 → 2.10.48

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.46",
4
+ "version": "2.10.48",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -1335,8 +1335,6 @@
1335
1335
  },
1336
1336
  // 数据变化事件
1337
1337
  async onDataChange(sender, selected, tableRow, tableSender, tableSelected) {
1338
- console.log('onDataChange', sender, selected, tableRow, tableSender, tableSelected);
1339
-
1340
1338
  for (let column of this.columns) {
1341
1339
  // 判断是否需要显示
1342
1340
  if (!!(column.showJson || '').trim()) {
@@ -109,7 +109,7 @@
109
109
 
110
110
  if (column.controlType === 'DialogSelect' && !column.readonly) {
111
111
  this.$refs.dialogTable.init(column.source, () => {
112
- this.$refs.dialogTable.open(this.getParam(data[coords.row], column));
112
+ this.$refs.dialogTable.open(this.getParam(data[coords.row], column, this.parentData));
113
113
  });
114
114
  }
115
115
  }
@@ -227,7 +227,7 @@
227
227
  column.readOnly = true;
228
228
  } else if (item.controlType === 'NumberInput') {
229
229
  column.type = 'numeric';
230
- column.numericFormat = '0%';
230
+ // column.validator = 'numeric';
231
231
  } else if (item.controlType === 'Check') {
232
232
  column.type = 'checkbox';
233
233
  } else if (item.controlType === 'Select') {
@@ -505,7 +505,7 @@
505
505
  this.$emit('on-remove', rows, val => {
506
506
  b = val;
507
507
  });
508
- console.log(b);
508
+
509
509
  if (b) {
510
510
  this.$refs.table.hotInstance.alter('remove_row', delArr);
511
511
  }
@@ -517,23 +517,62 @@
517
517
 
518
518
  // 变更事件
519
519
  this.$refs.table.hotInstance.addHook('afterChange', changes => {
520
+ //console.log('afterChange', changes);
520
521
  if (changes) {
521
522
  changes.forEach(([row, property, oldValue, newValue]) => {
522
523
  if (!this.readonly && this.tableView.createEnable && row == this.data.length - 1 && (oldValue ?? '') != (newValue ?? '')) {
523
524
  this.data.push(this.getDefaultData());
524
- this.$refs.table.hotInstance.loadData(this.data);
525
525
  }
526
526
 
527
- if (this.columns.find(item => item.code == property).controlType != 'DialogSelect') {
528
- this.onDataChange(
529
- this.data[row],
530
- this.columns.find(item => item.code == property)
531
- );
527
+ let column = this.columns.find(item => item.code == property);
528
+
529
+ if (column.controlType != 'DialogSelect') {
530
+ // 弹出框控件不触发数据变更事件,此处手动触发
531
+ this.onDataChange(this.data[row], column);
532
+ }
533
+
534
+ if (column.controlType == 'Select') {
535
+ // 校验下拉框选项是否在列表中
536
+ if (!column.selectOptions.some(item => item == newValue)) {
537
+ this.data[row][column.code] = null;
538
+ }
532
539
  }
540
+
541
+ this.calc(this.data[row]);
542
+ this.$refs.table.hotInstance.updateData(this.data);
533
543
  });
544
+ }
545
+ });
534
546
 
535
- this.loadData();
547
+ // 粘贴事件
548
+ this.$refs.table.hotInstance.addHook('beforePaste', (data, coords) => {
549
+ //console.log('beforePaste', data, coords);
550
+ // 不含父级表头
551
+ let columns = this.columns.filter(item => {
552
+ return (
553
+ !!(item.parentCode || '').trim() ||
554
+ this.columns.filter(i => {
555
+ return i.parentCode == item.code;
556
+ }).length == 0
557
+ );
558
+ });
559
+
560
+ for (let col = coords[0].startCol; col < coords[0].startCol + data[0].length; col++) {
561
+ for (let row = coords[0].startRow; row < coords[0].startRow + data.length; row++) {
562
+ if (data[row - coords[0].startRow][col - coords[0].startCol] != null) {
563
+ // 去除前后空格
564
+ data[row - coords[0].startRow][col - coords[0].startCol] = data[row - coords[0].startRow][col - coords[0].startCol].trim();
565
+
566
+ if (columns[col].controlType == 'NumberInput') {
567
+ // 数字类型,去掉逗号
568
+ data[row - coords[0].startRow][col - coords[0].startCol] = data[row - coords[0].startRow][col - coords[0].startCol].replace(/,/g, '');
569
+ // this.$refs.table.hotInstance.updateData(this.data);
570
+ }
571
+ }
572
+ }
536
573
  }
574
+
575
+ // return data;
537
576
  });
538
577
 
539
578
  this.loadData([]);
@@ -629,27 +668,23 @@
629
668
  * @public
630
669
  */
631
670
  validate() {
632
- for (let i = 0; i < this.staticData.length; i++) {
671
+ for (let i = 0; i < this.staticData.length - 1; i++) {
633
672
  let row = this.staticData[i];
634
673
 
635
674
  for (let j = 0; j < this.columns.length; j++) {
636
675
  let column = this.columns[j];
637
676
  let value = this.parseData(row, column.code);
638
677
 
639
- if (column.slot != 'normal') {
640
- continue;
641
- }
642
-
643
678
  // 不显示的不验证
644
- if (row._isShow && row._isShow[column.code] == false) {
645
- continue;
646
- } else if (column.isShow == false) {
679
+ if (column.isShow == false) {
647
680
  continue;
648
681
  }
649
682
 
683
+ //let name = column.name.replaceAll('<font style="color: red">*</font>', '');
684
+
650
685
  if (column.isRequired) {
651
686
  if (value == null || !(String(value) || '').trim()) {
652
- this.error('Front_Msg_Row_Column_Required|' + (i + 1) + '|' + name);
687
+ this.error('Front_Msg_Row_Column_Required|' + (i + 1) + '|' + column.name);
653
688
  return false;
654
689
  }
655
690
  }
@@ -660,17 +695,17 @@
660
695
  // }
661
696
 
662
697
  if (column.maxValue != null && !isNaN(value) && value > column.maxValue) {
663
- this.error('Front_Msg_Row_Validation_Max_Value|' + (i + 1) + '|' + name + '|' + column.maxValue.toString());
698
+ this.error('Front_Msg_Row_Validation_Max_Value|' + (i + 1) + '|' + column.name + '|' + column.maxValue.toString());
664
699
  return false;
665
700
  }
666
701
 
667
702
  if (column.minValue != null && !isNaN(value) && value < column.minValue) {
668
- this.error('Front_Msg_Row_Validation_Min_Value|' + (i + 1) + '|' + name + '|' + column.minValue.toString());
703
+ this.error('Front_Msg_Row_Validation_Min_Value|' + (i + 1) + '|' + column.name + '|' + column.minValue.toString());
669
704
  return false;
670
705
  }
671
706
 
672
707
  if (!!(column.pattern || '').trim() && value != null && new RegExp(column.pattern).test(value) == false) {
673
- this.error('Front_Msg_Row_Validation_Pattern|' + (i + 1) + '|' + name + '|' + column.pattern);
708
+ this.error('Front_Msg_Row_Validation_Pattern|' + (i + 1) + '|' + column.name + '|' + column.pattern);
674
709
  return false;
675
710
  }
676
711
  }
@@ -272,8 +272,11 @@ export default {
272
272
  // return $filter('date')(value, 'yyyy-MM-dd');
273
273
  }
274
274
  } else if (dataType === 'Integer') {
275
- // 日期
276
- if (!!(format || '').trim()) {
275
+ if (format === 'Thousand') {
276
+ // 千分位
277
+ return this.formatThousand(value);
278
+ } else if (!!(format || '').trim()) {
279
+ // 日期
277
280
  let result = null;
278
281
  try {
279
282
  result = dateFormat(new Date(value * 1000), format);