瀏覽代碼

搜索页bug

Luolei 5 年之前
父節點
當前提交
01a71b36fe
共有 2 個文件被更改,包括 19 次插入13 次删除
  1. 8 2
      src/components/Search.vue
  2. 11 11
      src/components/Symptom.vue

+ 8 - 2
src/components/Search.vue

@@ -47,7 +47,8 @@ export default {
   data() {
     return {
       searchVal: '',
-      searchLis: []
+      searchLis: [],
+      tmpItem:{}
     }
   },
   watch:{
@@ -64,7 +65,12 @@ export default {
   },
   methods: {
     showDetil(item) {
-      this.$emit('showDetil', item,true)
+      let flg = false;
+      if(JSON.stringify(this.tmpItem)==JSON.stringify(item)){//eg:重复点击胸痛bug
+        flg = true
+      }
+      this.tmpItem = item
+      this.$emit('showDetil',item,flg)
       // this.$emit('search', false)
     },
     search() {

+ 11 - 11
src/components/Symptom.vue

@@ -148,12 +148,8 @@ export default {
 
     },
     showDetil(item,flg) {
-      if(!flg){
-        this.chooseSymp.push(item);
-      }else{
-        this.tmpItem=item
-        this.isSearch=flg
-      }
+      this.tmpItem=item
+      this.isSearch=flg||false
       this.questId = item.questionId || item.id || item.conceptId;
       const id = item.questionId || item.id; //常见症状questionId,推送id,两者均有可能没有
       //将选中的name存到store中的text
@@ -172,13 +168,21 @@ export default {
             this.$store.commit('setOrigin', { type: moduleCP['symp'], data: result.data });
             if (mapping && mapping.length > 0) {
               this.show = true;
+              if(flg){
+                return
+              }
+              this.chooseSymp.push(item);
             } else { //没有详情,推送
               const sympText = this.getSympText();
               this.getPush(sympText);
+              this.chooseSymp.push(item);
+              this.searchShow = false
+              // this.complete()
             }
           }
         })
       } else {//没有questionId或id 则直接调推送
+        this.chooseSymp.push(item);
         const sympText = this.getSympText();
         this.getPush(sympText);
         this.checkText = this.$store.state.symptom.text;
@@ -243,11 +247,7 @@ export default {
       this.delText = "是否删除该信息?<br/>(已填内容将清除)";
     },
     complete() {//明细填写完成
-      if(this.isSearch){
-        this.chooseSymp.push(this.tmpItem);
-        this.searchShow = false
-      }
-      this.isSearch = false; //重置,否则每次点开都会叠加
+      this.searchShow = false;
       this.checkText = this.$store.state.symptom.text;
       this.show = false;
       this.questId = null;