Prechádzať zdrojové kódy

优化用户编辑表单数值范围校验逻辑,新增textType条件判断

yusheng 9 mesiacov pred
rodič
commit
eb42feb484

+ 17 - 14
src/views/inspectionProject/components/user-edit.vue

@@ -495,24 +495,27 @@
           const defaultValue = Number(this.form.defaultValue);
           const maxValue = Number(this.form.maxValue);
           const minValue = Number(this.form.minValue);
-          if ((defaultValue != '') & (maxValue != '')) {
-            if (defaultValue > maxValue || defaultValue == maxValue) {
-              this.loading = false;
-              return this.$message.warning('默认值应小于参数上限');
+          if (this.form.textType == 3) {
+            if ((defaultValue != '') & (maxValue != '')) {
+              if (defaultValue > maxValue || defaultValue == maxValue) {
+                this.loading = false;
+                return this.$message.warning('默认值应小于参数上限');
+              }
             }
-          }
-          if ((defaultValue != '') & (minValue != '')) {
-            if (defaultValue < minValue || defaultValue == minValue) {
-              this.loading = false;
-              return this.$message.warning('默认值应大于参数下限');
+            if ((defaultValue != '') & (minValue != '')) {
+              if (defaultValue < minValue || defaultValue == minValue) {
+                this.loading = false;
+                return this.$message.warning('默认值应大于参数下限');
+              }
             }
-          }
-          if ((maxValue != '') & (minValue != '')) {
-            if (maxValue < minValue || maxValue == minValue) {
-              this.loading = false;
-              return this.$message.warning('参数上限应大于参数下限');
+            if ((maxValue != '') & (minValue != '')) {
+              if (maxValue < minValue || maxValue == minValue) {
+                this.loading = false;
+                return this.$message.warning('参数上限应大于参数下限');
+              }
             }
           }
+
           if (this.form.textType == 5) {
             this.form.unitName = 'h';
           }