mooho-base-admin-plus 2.4.48 → 2.4.50

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.4.48",
4
+ "version": "2.4.50",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -68,11 +68,15 @@
68
68
  // 导入成功
69
69
  importFileSuccess(res) {
70
70
  this.end();
71
- /**
72
- * 成功
73
- * @property {object} res 返回数据
74
- */
75
- this.$emit('on-success', res);
71
+ if (res.code == 0) {
72
+ /**
73
+ * 成功
74
+ * @property {object} res 返回数据
75
+ */
76
+ this.$emit('on-success', res);
77
+ } else {
78
+ this.error(res.message);
79
+ }
76
80
  },
77
81
  // 导入失败
78
82
  importFileError(error) {
@@ -115,7 +115,14 @@
115
115
  this.defaultList = list;
116
116
  },
117
117
  // 上传之前
118
- beforeUpload() {
118
+ beforeUpload(file) {
119
+ if (this.maxSize != null) {
120
+ if (file.size > this.maxSize * 1024 * 1024) {
121
+ this.error('Front_Msg_Max_Quantity|' + this.maxSize);
122
+ return false;
123
+ }
124
+ }
125
+
119
126
  if (this.maxCount != null) {
120
127
  let list = this.fileList;
121
128
  if (list.length >= this.maxCount) {
@@ -372,6 +372,11 @@
372
372
  id: parseFloat(key),
373
373
  name: value
374
374
  });
375
+ } else if (column.dataType == 'Boolean') {
376
+ column.dataSource.push({
377
+ id: key.toUpperCase() == 'TRUE',
378
+ name: value
379
+ });
375
380
  } else {
376
381
  column.dataSource.push({
377
382
  id: key,
@@ -389,6 +394,11 @@
389
394
  id: parseFloat(item),
390
395
  name: item
391
396
  });
397
+ } else if (column.dataType == 'Boolean') {
398
+ column.dataSource.push({
399
+ id: item.toUpperCase() == 'TRUE',
400
+ name: item
401
+ });
392
402
  } else {
393
403
  column.dataSource.push({
394
404
  id: item,
@@ -737,6 +747,9 @@
737
747
  case 'Year':
738
748
  key = 'y_' + key; // 年
739
749
  break;
750
+ case 'DateRange':
751
+ key = key + '_c'; // 日期范围
752
+ return key;
740
753
  }
741
754
  //}
742
755
 
@@ -757,7 +770,7 @@
757
770
  key = key + '_n'; // 不等于
758
771
  break;
759
772
  case 'Contains':
760
- key = key + '_c'; // 模糊匹配
773
+ key = key + '_c'; // 文字包含
761
774
  break;
762
775
  }
763
776
 
@@ -447,29 +447,29 @@
447
447
  });
448
448
  }
449
449
 
450
- if (column.maxValue != null) {
450
+ if (column.maxValue != null && (column.controlType == 'NumberInput' || column.controlType == 'Slider')) {
451
451
  rules.push({
452
452
  type: this.getDataType(column),
453
453
  max: column.maxValue,
454
- message: this.$t('Front_Msg_Validation_Max_Value|' + column.maxValue),
454
+ message: this.tParam('Front_Msg_Validation_Max_Value|' + column.maxValue),
455
455
  trigger: 'blur,change'
456
456
  });
457
457
  }
458
458
 
459
- if (column.minValue != null) {
459
+ if (column.minValue != null && (column.controlType == 'NumberInput' || column.controlType == 'Slider')) {
460
460
  rules.push({
461
461
  type: this.getDataType(column),
462
462
  min: column.minValue,
463
- message: this.$t('Front_Msg_Validation_Min_Value|' + column.minValue),
463
+ message: this.tParam('Front_Msg_Validation_Min_Value|' + column.minValue),
464
464
  trigger: 'blur,change'
465
465
  });
466
466
  }
467
467
 
468
- if (column.maxLength != null) {
468
+ if (column.maxLength != null && (column.controlType == 'TextInput' || column.controlType == 'TextArea')) {
469
469
  rules.push({
470
470
  type: this.getDataType(column),
471
471
  length: column.maxLength,
472
- message: this.$t('Front_Msg_Validation_Max_Length|' + column.maxLength),
472
+ message: this.tParam('Front_Msg_Validation_Max_Length|' + column.maxLength),
473
473
  trigger: 'blur,change'
474
474
  });
475
475
  }
@@ -565,6 +565,11 @@
565
565
  id: parseFloat(key),
566
566
  name: value
567
567
  });
568
+ } else if (column.dataType == 'Boolean') {
569
+ column.dataSource.push({
570
+ id: key.toUpperCase() == 'TRUE',
571
+ name: value
572
+ });
568
573
  } else {
569
574
  column.dataSource.push({
570
575
  id: key,
@@ -582,6 +587,11 @@
582
587
  id: parseFloat(item),
583
588
  name: item
584
589
  });
590
+ } else if (column.dataType == 'Boolean') {
591
+ column.dataSource.push({
592
+ id: item.toUpperCase() == 'TRUE',
593
+ name: item
594
+ });
585
595
  } else {
586
596
  column.dataSource.push({
587
597
  id: item,
@@ -732,7 +742,7 @@
732
742
  },
733
743
  // 获取数据源
734
744
  getDataSource(data, column) {
735
- if (!column.isStaticItem && column.dataType && column.dataType.startsWith('Enum:')) {
745
+ if (!column.isStaticItem && column.dataType.startsWith('Enum:')) {
736
746
  // 枚举
737
747
  return this.getEnumList(column.dataType.split(':')[1]);
738
748
  } else {
@@ -742,17 +752,22 @@
742
752
  // 数据变化事件
743
753
  async onDataChange(sender) {
744
754
  // 计算需要刷新的字段
745
- if (sender == null || sender.triggers !== []) {
755
+ if (sender == null || (sender.triggers && sender.triggers !== [])) {
746
756
  this.columns.forEach(function (column) {
747
757
  if (
758
+ !column.isStaticItem &&
748
759
  !!(column.source || '').trim() &&
749
760
  !(column.dataType && column.dataType.startsWith('Enum:')) &&
750
761
  (sender == null ||
751
762
  sender.triggers.some(item => {
752
- return item.id === column.id;
763
+ return item.code == column.code;
753
764
  }))
754
765
  ) {
755
766
  column.needRefresh = true;
767
+ // if (column.controlType == 'Table') {
768
+ // this.$refs['table_' + sender.code][0];
769
+ // } else {
770
+ // }
756
771
  }
757
772
  });
758
773
  }
@@ -918,7 +918,7 @@
918
918
  rules.push({
919
919
  type: this.getDataType(column),
920
920
  max: column.maxValue,
921
- message: this.$t('Front_Msg_Validation_Max_Value|' + column.maxValue),
921
+ message: this.tParam('Front_Msg_Validation_Max_Value|' + column.maxValue),
922
922
  trigger: 'blur,change'
923
923
  });
924
924
  }
@@ -927,7 +927,7 @@
927
927
  rules.push({
928
928
  type: this.getDataType(column),
929
929
  min: column.minValue,
930
- message: this.$t('Front_Msg_Validation_Min_Value|' + column.minValue),
930
+ message: this.tParam('Front_Msg_Validation_Min_Value|' + column.minValue),
931
931
  trigger: 'blur,change'
932
932
  });
933
933
  }
@@ -936,7 +936,7 @@
936
936
  rules.push({
937
937
  type: this.getDataType(column),
938
938
  length: column.maxLength,
939
- message: this.$t('Front_Msg_Validation_Max_Length|' + column.maxLength),
939
+ message: this.tParam('Front_Msg_Validation_Max_Length|' + column.maxLength),
940
940
  trigger: 'blur,change'
941
941
  });
942
942
  }
@@ -983,6 +983,11 @@
983
983
  id: parseFloat(key),
984
984
  name: value
985
985
  });
986
+ } else if (column.dataType == 'Boolean') {
987
+ column.dataSource.push({
988
+ id: key.toUpperCase() == 'TRUE',
989
+ name: value
990
+ });
986
991
  } else {
987
992
  column.dataSource.push({
988
993
  id: key,
@@ -1000,6 +1005,11 @@
1000
1005
  id: parseFloat(item),
1001
1006
  name: item
1002
1007
  });
1008
+ } else if (column.dataType == 'Boolean') {
1009
+ column.dataSource.push({
1010
+ id: item.toUpperCase() == 'TRUE',
1011
+ name: item
1012
+ });
1003
1013
  } else {
1004
1014
  column.dataSource.push({
1005
1015
  id: item,
@@ -1730,15 +1730,50 @@
1730
1730
  if (item.split(':').length > 1) {
1731
1731
  let key = item.split(':')[0];
1732
1732
  let value = item.split(':')[1];
1733
- row._dataSource[column.code].push({
1734
- id: key,
1735
- name: value
1736
- });
1733
+
1734
+ if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
1735
+ row._dataSource[column.code].push({
1736
+ id: parseInt(key),
1737
+ name: value
1738
+ });
1739
+ } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
1740
+ row._dataSource[column.code].push({
1741
+ id: parseFloat(key),
1742
+ name: value
1743
+ });
1744
+ } else if (column.dataType == 'Boolean') {
1745
+ row._dataSource[column.code].push({
1746
+ id: key.toUpperCase() == 'TRUE',
1747
+ name: value
1748
+ });
1749
+ } else {
1750
+ row._dataSource[column.code].push({
1751
+ id: key,
1752
+ name: value
1753
+ });
1754
+ }
1737
1755
  } else {
1738
- row._dataSource[column.code].push({
1739
- id: item,
1740
- name: item
1741
- });
1756
+ if (column.dataType == 'Integer' || column.dataType == 'BigInteger') {
1757
+ row._dataSource[column.code].push({
1758
+ id: parseInt(item),
1759
+ name: item
1760
+ });
1761
+ } else if (column.dataType == 'Decimal' || column.dataType == 'Float' || column.dataType == 'Double') {
1762
+ row._dataSource[column.code].push({
1763
+ id: parseFloat(item),
1764
+ name: item
1765
+ });
1766
+ } else if (column.dataType == 'Boolean') {
1767
+ row._dataSource[column.code].push({
1768
+ id: item.toUpperCase() == 'TRUE',
1769
+ name: item
1770
+ });
1771
+ } else {
1772
+ row._dataSource[column.code].push({
1773
+ id: item,
1774
+ name: item
1775
+ });
1776
+ }
1742
1777
  }
1743
1778
  }
1744
1779
  });
@@ -2147,8 +2182,11 @@
2147
2182
 
2148
2183
  for (let key in filter) {
2149
2184
  if (this.isJSON(filter[key])) {
2150
- // 数组转换为逗号分隔的字符串
2185
+ // JSON数组,转换为逗号分隔的字符串
2151
2186
  filter[key] = JSON.parse(filter[key]).join(',');
2187
+ } else if (Object.prototype.toString.call(filter[key]) === '[object Array]') {
2188
+ // 数组转换为逗号分隔的字符串
2189
+ filter[key] = filter[key].join(',');
2152
2190
  } else if (typeof filter[key] == 'object' && !(filter[key] instanceof Date)) {
2153
2191
  delete filter[key];
2154
2192
  }
@@ -280,7 +280,6 @@
280
280
  document.addEventListener('scroll', this.handleScroll, { passive: true });
281
281
 
282
282
  // 非移动端,根据系统缩放比率调整界面大小
283
- //console.log('navigator.userAgent', navigator.userAgent);
284
283
  if (
285
284
  Setting.layout.autoFixRatio == true &&
286
285
  window.screen.width < 1920 &&
@@ -244,7 +244,6 @@ export default {
244
244
  // 设置侧边栏菜单
245
245
  const menuSiderList = getNativeMenuSider();
246
246
 
247
- //console.log('setMenuList', to, to.matched, to.matched.length);
248
247
  //let path = to.matched[to.matched.length - 1].path;
249
248
 
250
249
  //let headerName = getHeaderName(path, menuSiderList);