1178232204@qq.com 3 år sedan
förälder
incheckning
dc2cbe23f2
1 ändrade filer med 63 tillägg och 60 borttagningar
  1. 63 60
      src/components/cdssManage/hospital/AddHospital.vue

+ 63 - 60
src/components/cdssManage/hospital/AddHospital.vue

@@ -238,68 +238,71 @@ 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);
-          }
-          item.errorOther = false;
-          item.errorCurrent = false;
-        });
-        if (valid) {
-          this.saveDisable = true;
-          let params = {
-            connect: 1,
-            address: this.form.address,
-            name: this.form.hospitalName,
-            spell: this.form.spell,
-            hospitalRelationVOList: this.form.hospitalRelationVOList
-            // code: this.form.hospitalCode
-          };
-          if (this.isEdit) {
-            params = Object.assign({}, params, {
-              id: this.hospitalId
-            });
-          }
-          api.saveOrUpdateHosRecordCDSS(params).then(res => {
-            if (res.data.code === '0') {
-              this.$message({
-                showClose: true,
-                message: '保存成功',
-                type: 'success',
-                duration: 1000
-              });
-              this.isSaveSuccess = true; // 保存成功,可正常退出
-              this.$router.push({
-                name: 'HospitalCDSS',
-                params: Object.assign({}, this.$route.params, {
-                  currentPage: 1
-                })
-              });
-            } else if (res.data.code === '20020009') {
-              const data = res.data.data;
-              this.dialogVisible = true;
-              let errorOtherList = [];
-              let errorCurrentList = [];
-              this.getIndex(data.errorOther, errorOtherList);
-              this.getIndex(data.errorCurrent, errorCurrentList);
-              errorOtherList.forEach(i => {
-                this.form.hospitalRelationVOList[i].errorOther = true;
-              });
-              errorCurrentList.forEach(i => {
-                this.form.hospitalRelationVOList[i].errorCurrent = true;
-              });
-            } else {
-              this.$message({
-                showClose: true,
-                message: res.data.msg,
-                type: 'error',
-                duration: 1000
+      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 = {
+              connect: 1,
+              address: this.form.address,
+              name: this.form.hospitalName,
+              spell: this.form.spell,
+              hospitalRelationVOList: this.form.hospitalRelationVOList
+              // code: this.form.hospitalCode
+            };
+            if (this.isEdit) {
+              params = Object.assign({}, params, {
+                id: this.hospitalId
               });
             }
-            this.saveDisable = false;
-          });
-        }
+            api.saveOrUpdateHosRecordCDSS(params).then(res => {
+              if (res.data.code === '0') {
+                this.$message({
+                  showClose: true,
+                  message: '保存成功',
+                  type: 'success',
+                  duration: 1000
+                });
+                this.isSaveSuccess = true; // 保存成功,可正常退出
+                this.$router.push({
+                  name: 'HospitalCDSS',
+                  params: Object.assign({}, this.$route.params, {
+                    currentPage: 1
+                  })
+                });
+              } else if (res.data.code === '20020009') {
+                const data = res.data.data;
+                this.dialogVisible = true;
+                let errorOtherList = [];
+                let errorCurrentList = [];
+                this.getIndex(data.errorOther, errorOtherList);
+                this.getIndex(data.errorCurrent, errorCurrentList);
+                errorOtherList.forEach(i => {
+                  this.form.hospitalRelationVOList[i].errorOther = true;
+                });
+                errorCurrentList.forEach(i => {
+                  this.form.hospitalRelationVOList[i].errorCurrent = true;
+                });
+              } else {
+                this.$message({
+                  showClose: true,
+                  message: res.data.msg,
+                  type: 'error',
+                  duration: 1000
+                });
+              }
+              this.saveDisable = false;
+            });
+          }
+        });
       });
     },
     getIndex(data, list) {