mooho-base-admin-plus 2.10.53 → 2.10.54

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.53",
4
+ "version": "2.10.54",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -843,8 +843,17 @@
843
843
  *
844
844
  * @public
845
845
  */
846
- validate() {
847
- return this.$refs.form.validate();
846
+ async validate() {
847
+ let isOk = await this.$refs.form.validate();
848
+
849
+ for (let column of this.columns) {
850
+ if (column.controlType == 'ExcelTable' && !column.isReadonly && column.isShow) {
851
+ let tableOk = await this.$refs['table_' + column.code][0].validate();
852
+ isOk = isOk && tableOk;
853
+ }
854
+ }
855
+
856
+ return isOk;
848
857
  },
849
858
  /**
850
859
  * 获取完整数据
@@ -868,10 +877,12 @@
868
877
  return false;
869
878
  }
870
879
 
871
- if (!this.$refs['table_' + column.code][0].validate()) {
872
- console.log('invalid', 'table_' + column.code);
880
+ if (column.controlType == 'Table') {
881
+ let isOk = this.$refs['table_' + column.code][0].validate();
873
882
 
874
- return false;
883
+ if (!isOk) {
884
+ return false;
885
+ }
875
886
  }
876
887
 
877
888
  if (column.tableStoreType == 'Inner') {
@@ -719,69 +719,20 @@
719
719
  *
720
720
  * @public
721
721
  */
722
- validate() {
722
+ async validate() {
723
723
  let rows = [];
724
724
 
725
725
  for (let i = 0; i < this.staticData.length - 1; i++) {
726
726
  rows.push(i);
727
727
  }
728
728
 
729
- let valid = this.$refs.table.hotInstance.validateRows(rows, valid => {
730
- console.log('valid', valid);
729
+ return new Promise(resolve => {
730
+ this.$refs.table.hotInstance.validateRows(rows, valid => {
731
+ resolve(valid);
732
+ });
731
733
  });
732
-
733
- if (!valid) {
734
- this.error('Front_Msg_Form_Validate_Fail');
735
- return false;
736
- } else {
737
- return true;
738
- }
739
-
740
- // for (let i = 0; i < this.staticData.length - 1; i++) {
741
- // let row = this.staticData[i];
742
-
743
- // for (let j = 0; j < this.columns.length; j++) {
744
- // let column = this.columns[j];
745
- // let value = this.parseData(row, column.code);
746
-
747
- // // 不显示的不验证
748
- // if (column.isShow == false) {
749
- // continue;
750
- // }
751
-
752
- // //let name = column.name.replaceAll('<font style="color: red">*</font>', '');
753
-
754
- // if (column.isRequired) {
755
- // if (value == null || !(String(value) || '').trim()) {
756
- // this.error('Front_Msg_Row_Column_Required|' + (i + 1) + '|' + column.name);
757
- // return false;
758
- // }
759
- // }
760
-
761
- // // if (column.maxLength != null && value != null && String(value).length > column.maxLength) {
762
- // // this.error('Front_Msg_Row_Validation_Max_Length|' + (i + 1) + '|' + column.name + '|' + column.maxLength.toString());
763
- // // return false;
764
- // // }
765
-
766
- // if (column.maxValue != null && !isNaN(value) && value > column.maxValue) {
767
- // this.error('Front_Msg_Row_Validation_Max_Value|' + (i + 1) + '|' + column.name + '|' + column.maxValue.toString());
768
- // return false;
769
- // }
770
-
771
- // if (column.minValue != null && !isNaN(value) && value < column.minValue) {
772
- // this.error('Front_Msg_Row_Validation_Min_Value|' + (i + 1) + '|' + column.name + '|' + column.minValue.toString());
773
- // return false;
774
- // }
775
-
776
- // if (!!(column.pattern || '').trim() && value != null && new RegExp(column.pattern).test(value) == false) {
777
- // this.error('Front_Msg_Row_Validation_Pattern|' + (i + 1) + '|' + column.name + '|' + column.pattern);
778
- // return false;
779
- // }
780
- // }
781
- // }
782
-
783
- //return true;
784
734
  },
735
+
785
736
  /**
786
737
  * 获取数据
787
738
  *