1178232204@qq.com vor 3 Jahren
Ursprung
Commit
4adf27e167
1 geänderte Dateien mit 14 neuen und 7 gelöschten Zeilen
  1. 14 7
      src/components/icss/sonhospital/SonHospital.vue

+ 14 - 7
src/components/icss/sonhospital/SonHospital.vue

@@ -54,7 +54,7 @@
                       <el-input
                         class="inp-name"
                         placeholder="请输入医院名称"
-                        maxlength="100"
+                        maxlength="50"
                         v-model.trim="form.hospitalRelationVOList[scope.$index].name"
                       ></el-input>
                     </el-form-item>
@@ -75,7 +75,7 @@
                       <el-input
                         class="inp-name"
                         placeholder="请输入编码"
-                        maxlength="100"
+                        maxlength="50"
                         v-model.trim="form.hospitalRelationVOList[scope.$index].code"
                       ></el-input>
                     </el-form-item>
@@ -156,16 +156,21 @@ export default {
       });
     },
     onSubmit() {
-      this.$refs.form.validate(valid => {
+      this.form.hospitalRelationVOList.forEach((item, index) => {
+        if (item.name == '' && item.code == '') {
+          this.form.hospitalRelationVOList.splice(index, 1);
+          this.$refs.form.clearValidate();
+        }
+        item.errorOther = false;
+        item.errorCurrent = false;
+      });
+      this.$nextTick(() => {
+        this.$refs.form.validate(valid => {
         if (valid) {
           this.saveDisable = true;
           let params = {
             hospitalRelationVOList: this.form.hospitalRelationVOList
           };
-          this.form.hospitalRelationVOList.forEach((item, index) => {
-            item.errorOther = false;
-            item.errorCurrent = false;
-          });
           api.saveHospitalRelation(params).then(res => {
             if (res.data.code === '0') {
               this.$message({
@@ -201,6 +206,8 @@ export default {
           });
         }
       });
+      });
+      
     },
     getIndex(data, list) {
       let arr2Map = {};