Browse Source

诊断搜索增加搜索值为空情况

zhangxc 6 years ago
parent
commit
a4f1c2776e
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/store/async-actions/diagnosticSearch.js

+ 8 - 0
src/store/async-actions/diagnosticSearch.js

@@ -19,6 +19,14 @@ export const getSearchResult = (value) =>{
                 type: SET_SEARCH_VALUE,
                 searchValue: value
             })
+            //如果搜索值为空,则直接将搜索结果设为空
+            if(value === '') {
+                dispatch({
+                    type: GET_SEARCH_RESULT,
+                    searchResult: []
+                })
+                return
+            }
             json(url, param).then((data)=>{
                 const searchRes = data.data.data;
                 const diagList = state.diagnosticList.diagnosticList;