Ver código fonte

修改校验顺序(2514)

zhangxc 5 anos atrás
pai
commit
305ef80033
1 arquivos alterados com 31 adições e 13 exclusões
  1. 31 13
      src/components/diagBase/AddDiagBase.vue

+ 31 - 13
src/components/diagBase/AddDiagBase.vue

@@ -582,15 +582,31 @@
                 this.isReady = true
             }
             if(labArr.length > 0) {
-                this.hasNoUniqueName = false
-                return this.labVerifyData(labArr,type).then(() =>{
-                    if(this.hasNoUniqueName) {
-                    }else {
-                         return this.verifyDiagBase(type)
+                const hasErrorData =  this.errorDataVerify()
+                 if(!hasErrorData) {
+                    return false
+                } else {
+                    this.hasNoUniqueName = false
+                    const labVerifyData = this.labVerifyData(labArr,type)
+                    console.log('labVerifyData', labVerifyData)
+                    if(labVerifyData) {
+                         return labVerifyData.then(() =>{
+                            if(this.hasNoUniqueName) {
+                            }else {
+                                return this.verifyDiagBase(type)
+                            }
+                        })
                     }
-                })
+                   
+                }
+                
             } else {
-                 return this.verifyDiagBase(type)
+                const hasErrorData =  this.errorDataVerify()
+                if(!hasErrorData) {
+                    return false
+                } else {
+                    return this.verifyDiagBase(type)
+                }   
             }
         },
         errorDataVerify() {
@@ -768,6 +784,7 @@
                 spinner: 'el-icon-loading',
                 background: 'rgba(0, 0, 0, 0.7)'
             });
+
             return api.getUniqueNameWithList(labArrParam).then((res) => {
                 this.isReady=false
                 loading.close();
@@ -777,6 +794,8 @@
                     for (let i = 0; i < data.length; i++ ) {
                         if(!data[i].uniqueName) { //判断是否存在公表项
                             if(!this.hasNoUniqueName) {
+                               
+
                                 this.hasNoUniqueName = true
                             }
                             errorStr +=`<p>第${+data[i].index+1}行化验公表项不存在</p>`
@@ -802,12 +821,14 @@
                        return this.errorTips(errorStr);
                         
                     }
+                     console.log('bbbbbbbbb')
+
                     this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureListResult))
                     this.disFeatureListResult = JSON.parse(JSON.stringify(this.disFeatureListResult))
                     
                 } else {
                     this.warning(res.data.msg)
-                    return
+                    return false
                 }
             }).catch(()=>{ this.isReady=false;loading.close()})
         },
@@ -821,10 +842,7 @@
             }
             
             
-            const hasErrorData =  this.errorDataVerify()
-            if(!hasErrorData) {
-                return false
-            } else {
+           
                 const loading = this.$loading({
                     lock: true,
                     text: 'Loading',
@@ -833,6 +851,7 @@
                 });
         
                 const diagBaseVerifyDataResult =  api.diagBaseVerifyData(param)
+
                 return diagBaseVerifyDataResult.then((res) => {
                     if(+res.data.code === 0) {
                         const data = res.data.data
@@ -875,7 +894,6 @@
                     }).catch(()=>{ this.hasQuestion = false; this.isReady=false; loading.close()})
 
 
-            }
             
             
         },