liucf 6 år sedan
förälder
incheckning
04ae023f0e
1 ändrade filer med 13 tillägg och 4 borttagningar
  1. 13 4
      src/components/icss/AddMedicalName.vue

+ 13 - 4
src/components/icss/AddMedicalName.vue

@@ -24,7 +24,7 @@
               <input v-else type="text" v-model="data.name" placeholder="请输入术语" maxlength="50" @blur="handleBlur(1)">
             </td>
             <td>
-              <input type="text" v-model="data.spell" placeholder="请输入拼音" maxlength="50"  @input="handlePinyin">
+              <input type="text" v-model="data.spell" placeholder="请输入拼音" maxlength="50"  @input="handlePinyin($event,1)">
             </td>
             <td>
               <!-- <el-select v-if="!id" v-model="data.type" filterable placeholder="请选择" size="small" @change="selectType">
@@ -79,7 +79,7 @@
               </td>
               <td v-else> -->
               <td>
-                <input type="text" v-model="item.spell" placeholder="请输入拼音" maxlength="50"  @input="handlePinyin" class="spell">
+                <input type="text" v-model="item.spell" placeholder="请输入拼音" maxlength="50"  @input="handlePinyin($event,2,index)" class="spell">
               </td>
               <td>
                 <!-- {{data.type}} -->
@@ -145,7 +145,7 @@
               <input type="text" v-model="item.name" placeholder="请输入术语" maxlength="50" @blur="handleBlur(2,index)">
             </td>
             <td>
-              <input type="text" v-model="item.spell" placeholder="请输入拼音" maxlength="50"  @input="handlePinyin">
+              <input type="text" v-model="item.spell" placeholder="请输入拼音" maxlength="50"  @input="handlePinyin($event,3,index)">
             </td>
             <td>
               {{data.type}}
@@ -410,8 +410,17 @@ import pinyin from '../../js/Convert_Pinyin.js';
           }
         }
       },
-      handlePinyin(e){//只能输入英文
+      handlePinyin(e,flag,index){//只能输入英文
         e.target.value = e.target.value.replace(/[^a-zA-Z]/g,'');
+        // 解决输入数字不触发更新
+        if(flag==1){//标准词
+          this.data.spell = e.target.value;
+        }else if(flag==2){//同义词-修改
+          this.allwords[index].spell = e.target.value;
+        }else if(flag==3){//同义词-新增
+          this.synonymous[index].spell = e.target.value;
+        }
+        // e.target.value = e.target.value.replace(/[^a-zA-Z]/g,'');
       },
       addSpan(type){
         let singleSpan = {