Browse Source

Merge branch 'dev' of http://192.168.2.236:10080/zhouna/platformFront into dev

zhangxc 6 years ago
parent
commit
9ba945653d
1 changed files with 29 additions and 6 deletions
  1. 29 6
      src/components/icss/AddMedicalName.vue

+ 29 - 6
src/components/icss/AddMedicalName.vue

@@ -206,7 +206,8 @@ import pinyin from '../../js/Convert_Pinyin.js';
             name:'女',
             value:2
           }
-        ]
+        ],
+        unfit:false //点确认时是否弹提示
       }
     },
     created(){
@@ -314,10 +315,12 @@ import pinyin from '../../js/Convert_Pinyin.js';
               message:'无法输入纯数字,请输入正确数据!',
               type:'warning'
             });
-            this.data.name = '';
+            // this.data.name = '';
+            this.unfit = true;
           }else{
             let data = this.data;
             data.spell = pinyin.getCamelChars(data.name);
+            this.unfit = false;
           }
         }else if(type==2){
           // 修改时术语名称、拼音和类型均不能修改
@@ -328,10 +331,12 @@ import pinyin from '../../js/Convert_Pinyin.js';
                 message:'无法输入纯数字,请输入正确数据!',
                 type:'warning'
               });
-              this.synonymous[index-1].name = '';
+              // this.synonymous[index-1].name = '';
+              this.unfit = true;
             }else{
               let current = this.synonymous[index-1];
               current.spell = pinyin.getCamelChars(current.name);
+              this.unfit = false;
             }
           }else{
             if(this.synonymous[index].name && !pattern.test(this.synonymous[index].name)){
@@ -339,10 +344,12 @@ import pinyin from '../../js/Convert_Pinyin.js';
                 message:'无法输入纯数字,请输入正确数据!',
                 type:'warning'
               });
-              this.synonymous[index].name = '';
+              // this.synonymous[index].name = '';
+              this.unfit = true;
             }else{
               let current = this.synonymous[index];
               current.spell = pinyin.getCamelChars(current.name);
+              this.unfit = false;
             }
           }
         }
@@ -394,7 +401,7 @@ import pinyin from '../../js/Convert_Pinyin.js';
           this.warning('请输入标准词');
           return
         }
-        if(!this.data.type){
+        if(!this.data.type && !this.unfit){
           this.warning('请选择术语类型');
           return
         }
@@ -444,6 +451,22 @@ import pinyin from '../../js/Convert_Pinyin.js';
           realData[i].type = this.data.type;
           detailList.push(realData[i]);
         }
+        // 校验是否有名称全为数字
+        const pattern = /[^0-9]/g;
+        for(let i=0; i<detailList.length; i++){
+          if(detailList[i].name && !pattern.test(detailList[i].name)){
+            if(!this.unfit){
+              this.$message({
+                message:'无法输入纯数字,请输入正确数据!',
+                type:'warning'
+              });
+            }
+            this.unfit = false;
+            return false;
+            break
+          }
+        }
+        
         let params;
         if(this.showMore==1){
           // 下拉文字转code
@@ -488,7 +511,7 @@ import pinyin from '../../js/Convert_Pinyin.js';
         })
       },
       inputAge(){
-        console.log("输入年龄")
+        // console.log("输入年龄")
       },
       selectType(e){
         this.typeList.map((v,i)=>{