瀏覽代碼

搜索结果去除诊断中已有诊断

zhangxc 6 年之前
父節點
當前提交
e11a555129
共有 1 個文件被更改,包括 12 次插入12 次删除
  1. 12 12
      src/store/async-actions/diagnosticSearch.js

+ 12 - 12
src/store/async-actions/diagnosticSearch.js

@@ -32,20 +32,20 @@ export const getSearchResult = (value) =>{
                 const diagList = state.diagnosticList.diagnosticList;
                 let searchResult = [];
                 if(searchRes) {
-                    // for(let i = 0; i < searchRes.length; i++) {
-                    //     let repeat = false;
-                    //     for (let j = 0; j < diagList.length; j++) {
-                    //         if(searchRes[i].questionId === diagList[j].id) {
-                    //             repeat = true;
-                    //         } 
-                    //     }
-                    //     if(!repeat) {
-                    //         searchResult.push(searchRes[i])
-                    //     }
-                    // }
+                    for(let i = 0; i < searchRes.length; i++) {
+                        let repeat = false;
+                        for (let j = 0; j < diagList.length; j++) {
+                            if(searchRes[i].questionId === diagList[j].id) {
+                                repeat = true;
+                            } 
+                        }
+                        if(!repeat) {
+                            searchResult.push(searchRes[i])
+                        }
+                    }
                     dispatch({
                         type: GET_SEARCH_RESULT,
-                        searchResult: searchRes
+                        searchResult: searchResult
                     })
                 } else {
                     dispatch({