Bläddra i källkod

几个数字输入框的空校验问题

reaper 4 år sedan
förälder
incheckning
ff053f7e7b

+ 20 - 2
src/components/knowledgeExtra/AddAssess/ScoreResultsTable.vue

@@ -149,7 +149,16 @@
                   <el-input
                     type="number"
                     :id="`scoreresultsdatas[${scope.$index}].content.min`"
-                    @input="handleInput($event, scope.$index)"
+                    @input="
+                      handleInput($event, scope.$index);
+                      value = scope.row.content.min + '';
+                      if (value.length > 6) value = value.slice(0, 6);
+                      if (value.length == 0) {
+                        scope.row.content.min = null;
+                        return;
+                      }
+                      scope.row.content.min = parseFloat(value);
+                    "
                     v-model.number="scope.row.content.min"
                     clearable
                     placeholder="请输入"
@@ -173,7 +182,16 @@
                   <el-input
                     type="number"
                     :id="`scoreresultsdatas[${scope.$index}].content.max`"
-                    @input="handleInput($event, scope.$index)"
+                    @input="
+                      handleInput($event, scope.$index);
+                      value = scope.row.content.max + '';
+                      if (value.length > 6) value = value.slice(0, 6);
+                      if (value.length == 0) {
+                        scope.row.content.max = null;
+                        return;
+                      }
+                      scope.row.content.max = parseFloat(value);
+                    "
                     v-model.number="scope.row.content.max"
                     clearable
                     placeholder="请输入"

+ 8 - 0
src/components/knowledgeExtra/AddAssess/index.vue

@@ -237,6 +237,10 @@ it .ql-editor,
                     @input="
                       value = table.factor + '';
                       if (value.length > 6) value = value.slice(0, 6);
+                      if (value.length == 0) {
+                        table.factor = null;
+                        return;
+                      }
                       table.factor = parseFloat(value);
                     "
                   />
@@ -257,6 +261,10 @@ it .ql-editor,
                     @input="
                       value = table.constant + '';
                       if (value.length > 6) value = value.slice(0, 6);
+                      if (value.length == 0) {
+                        table.constant = null;
+                        return;
+                      }
                       table.constant = parseFloat(value);
                     "
                   />

+ 13 - 1
src/components/knowledgeExtra/AddAssess/scale-table.vue

@@ -289,6 +289,10 @@
                     );
                     value = scope.row.two_factor + '';
                     if (value.length > 6) value = value.slice(0, 6);
+                    if (value.length == 0) {
+                      scope.row.two_factor = null;
+                      return;
+                    }
                     scope.row.two_factor = parseFloat(value);
                   "
                 ></el-input>
@@ -323,6 +327,10 @@
                     );
                     value = scope.row.two_constant + '';
                     if (value.length > 6) value = value.slice(0, 6);
+                    if (value.length == 0) {
+                      scope.row.two_constant = null;
+                      return;
+                    }
                     scope.row.two_constant = parseFloat(value);
                   "
                 ></el-input>
@@ -452,6 +460,10 @@
                 @input="
                   value = scope.row.score + '';
                   if (value.length > 6) value = value.slice(0, 6);
+                  if (value.length == 0) {
+                    scope.row.score = null;
+                    return;
+                  }
                   scope.row.score = parseFloat(value);
                 "
                 v-model.number="scope.row.score"
@@ -540,7 +552,7 @@ export default {
       });
     },
     resizeTable() {
-      console.log('???????');
+      console.log("???????");
       setTimeout(() => {
         this.tableData.forEach((item, index) => {
           this.$refs[

+ 1 - 1
src/components/knowledgeExtra/AddDevKnow.vue

@@ -843,7 +843,7 @@ export default {
           this.tabActive = "two";
           this.$message({
             showClose: true,
-            message: "评估内容",
+            message: `"评估内容"标签内有未填写项目,请填写完整或者删除该标签!`,
             type: "warning"
           });
           let cErrArr = resArr.filter((item) => item.type == "c");