|
@@ -29,25 +29,32 @@ export const getSearchResult = (value) =>{
|
|
|
}
|
|
|
json(url, param).then((data)=>{
|
|
|
const searchRes = data.data.data;
|
|
|
+ console.log('searchRes',searchRes)
|
|
|
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
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ dispatch({
|
|
|
+ type: GET_SEARCH_RESULT,
|
|
|
+ searchResult: []
|
|
|
+ })
|
|
|
}
|
|
|
- dispatch({
|
|
|
- type: GET_SEARCH_RESULT,
|
|
|
- searchResult: searchResult
|
|
|
- })
|
|
|
+
|
|
|
}).catch((e)=>{
|
|
|
console.log(e)
|
|
|
})
|