1178232204@qq.com 3 éve
szülő
commit
7987a5673e
1 módosított fájl, 57 hozzáadás és 63 törlés
  1. 57 63
      src/components/cdssManage/hospital/AddHospital.vue

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

@@ -238,71 +238,65 @@ export default {
       });
     },
     onSubmit() {
-      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
-              });
-            }
-            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;
+      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
+          };
+          this.form.hospitalRelationVOList.forEach((item, index) => {
+            item.errorOther = false;
+            item.errorCurrent = false;
+          });
+          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.saveDisable = false;
+          });
+        }
       });
     },
     getIndex(data, list) {