morphone1995 4 vuotta sitten
vanhempi
commit
b4d8f7bcb2
1 muutettua tiedostoa jossa 10 lisäystä ja 4 poistoa
  1. 10 4
      src/components/cdssManage/knowledge/AddKnowledge.vue

+ 10 - 4
src/components/cdssManage/knowledge/AddKnowledge.vue

@@ -32,6 +32,7 @@
                 v-model.trim="form.name"
                 placeholder="请输入术语名称"
                 @blur="handlePinyin($event)"
+                @input="handleInput"
                 :disabled="form.labelType===''"
               ></el-input>
             </el-form-item>
@@ -195,7 +196,8 @@ export default {
       terminologyData: [], // 术语分类
       nameFlag: '', // 判断术语名称是否被修改
       isValidate: true,
-      id: ''
+      id: '',
+      isTrans: true   // 拼音是否转换成功
     };
   },
   watch: {},
@@ -362,7 +364,7 @@ export default {
         numberpage = currentPage;
       }
       // console.log(this.isValidate);
-      if (this.isValidate === false) return; // 术语名称已存在
+      if (this.isValidate === false || this.isTrans === false) return; // 术语名称已存在
       let goOn = true;
       if (this.form.labelType === '药物过敏原') {
         this.$refs.drugAllergensForm.$refs.drugAllergensForm &&
@@ -445,6 +447,10 @@ export default {
       });
     },
 
+    handleInput(val){
+      this.isTrans = false
+    },
+
     // 处理拼音转换&验证唯一性
     handlePinyin(e) {
       if (this.nameFlag === e.target.value) {
@@ -477,14 +483,14 @@ export default {
               this.rules.name = this.rules.name.slice(0, 1); // 删除校验
             } else {
               this.isValidate = true; // 校验通过
+              this.isTrans = true
               // 不存在
               this.form.pycode = pinyin.getCamelChars(e.target.value);
             }
           }
         });
       }
-
-      // this.form.pycode = pinyin.getCamelChars(e.target.value);
+      
     }
   }
 };