morphone1995 %!s(int64=4) %!d(string=hai) anos
pai
achega
4ee5e411e8

+ 1 - 1
src/common/components/SearchOption/index.jsx

@@ -57,7 +57,7 @@ class SearchOption extends React.Component {
             val:'',
             show:false
         });
-        handleChangeValue('');
+        handleChangeValue('','clear');
     }
     detailClick(val,txt){
         const { detailClick,handleChangeValue } = this.props;

+ 6 - 5
src/components/DiagResultSearch/index.jsx

@@ -41,8 +41,10 @@ class DiagResultSearch extends Component {
     });
   }
 
-  getSearchList(searchResult) {
-    // console.log(searchResult,'=searchResult=====');
+  getSearchList(searchResult, isShowNoDataInfo) {
+    if (isShowNoDataInfo === true && searchResult.length === 0 ){
+      return <div className={style['search-result-noItem']}>暂无筛选项</div>
+    }
     return <div className={style['search-result']}>
       {
         searchResult.length !== 0  && searchResult.map((item,idx) => {
@@ -55,8 +57,7 @@ class DiagResultSearch extends Component {
   }
 
   render() {
-    const { show, searchResult, refreshScroller, handleChangeValue,pageTop,windowHeight } = this.props;
-
+    const { show, searchResult, refreshScroller, handleChangeValue, pageTop, windowHeight, isShowNoDataInfo } = this.props;
     const contStyle={
       opacity:'0.4',
       right:'0',
@@ -76,7 +77,7 @@ class DiagResultSearch extends Component {
                       verticalContainerStyle={contStyle}
                       verticalScrollbarStyle={barStyle}
                       contentClassName="content">
-          {this.getSearchList(searchResult)}
+            {this.getSearchList(searchResult, isShowNoDataInfo)}
           </ScrollArea>
         </SearchOption>
       </div>

+ 8 - 0
src/components/DiagResultSearch/index.less

@@ -55,4 +55,12 @@
 
 .search-result-item:hover {
     border: 1px solid @blue;
+}
+
+.search-result-noItem{
+    position: relative;
+    color: #bfbfbf;
+    top: 8px;
+    left: 27px;
+    height: 50px;
 }

+ 19 - 7
src/containers/DiagResultSearch.js

@@ -1,15 +1,21 @@
 import React from 'react';
 import { connect } from 'react-redux';
-import { SHOW_SEARCH,  HIDE_SEARCH, GET_SEARCH_RESULT } from '@store/types/diagnosticSearch';
+import {
+  SHOW_SEARCH,
+  HIDE_SEARCH,
+  GET_SEARCH_RESULT,
+  SHOWNODATATEXT,
+} from '@store/types/diagnosticSearch';
 import { getSearchResult, getSearchList } from '@store/async-actions/diagnosticSearch';
 import DiagResultSearch from '@components/DiagResultSearch';
 
 function mapStateToProps(state) {
-    return{
-        show: state.diagnosticSearch.show,
-        searchValue: state.diagnosticSearch.searchValue,
-        searchResult: state.diagnosticSearch.searchResult,
-    }
+    return {
+      show: state.diagnosticSearch.show,
+      searchValue: state.diagnosticSearch.searchValue,
+      searchResult: state.diagnosticSearch.searchResult,
+      isShowNoDataInfo: state.diagnosticSearch.isShowNoDataInfo,
+    };
 }
 
 function mapDispatchToProps(dispatch) {
@@ -30,7 +36,13 @@ function mapDispatchToProps(dispatch) {
                 searchResult: []
             })
         },
-        handleChangeValue: (val)=>{
+        handleChangeValue: (val, isClear)=>{
+            if(isClear === 'clear') {
+              dispatch({
+                type: SHOWNODATATEXT,
+                isShowNoDataInfo: false
+              });  
+            }
             dispatch(getSearchList(val))
         }
     }

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

@@ -28,3 +28,11 @@ export const getSearchResult= (state, action) => {
     res.searchResult = searchResult;
     return res;
 }
+
+
+export const showText = (state, action) => {
+  const res = Object.assign({}, state);
+//   console.log(action,'action===============');
+  res.isShowNoDataInfo = action.isShowNoDataInfo;
+  return res;
+};

+ 7 - 1
src/store/async-actions/diagnosticSearch.js

@@ -1,5 +1,5 @@
 import { json } from "@utils/ajax";
-import { GET_SEARCH_RESULT } from '@store/types/diagnosticSearch';
+import { GET_SEARCH_RESULT, SHOWNODATATEXT } from '@store/types/diagnosticSearch';
 import { GET_SEARCH } from '@store/types/emergencyHis';
 import {  Notify } from '@commonComp';
 import { formatFormParmas } from '@utils/tools';
@@ -39,6 +39,7 @@ export const getSearchList = (val,flag) => {
         .then((res)=>{
             if(res.data.code==0){
                 const data = res.data.data;let curDate=[];
+
                 let arr = data.diseaseNames;
                     for (var key in arr) {
                         let obj = {}
@@ -56,6 +57,11 @@ export const getSearchList = (val,flag) => {
                         type: GET_SEARCH_RESULT,
                         searchResult: curDate
                     })
+                    // 是否进行过搜索
+                    dispatch({
+                        type: SHOWNODATATEXT,
+                        isShowNoDataInfo: true
+                    });
                 }
             }else{
                 Notify.error(res.data.msg)

+ 9 - 6
src/store/reducers/diagnosticSearch.js

@@ -1,11 +1,12 @@
-import { SHOW_SEARCH,  HIDE_SEARCH, SET_SEARCH_VALUE, GET_SEARCH_RESULT } from '../types/diagnosticSearch'; 
-import { showSearch,  hideSearch, setSearchValue, getSearchResult } from '../actions/diagnosticSearch'; 
+import { SHOW_SEARCH,  HIDE_SEARCH, SET_SEARCH_VALUE, GET_SEARCH_RESULT,SHOWNODATATEXT } from '../types/diagnosticSearch'; 
+import { showSearch,  hideSearch, setSearchValue, getSearchResult,showText } from '../actions/diagnosticSearch'; 
 
 const initState = {
-    show: false,
-    searchValue: '',
-    searchResult: []
-}
+  show: false,
+  searchValue: '',
+  searchResult: [],
+  isShowNoDataInfo: false
+};
 
 export default function (state=initState, action) {
     switch(action.type) {
@@ -17,6 +18,8 @@ export default function (state=initState, action) {
             return setSearchValue(state, action);
         case GET_SEARCH_RESULT: 
             return getSearchResult(state, action);
+        case SHOWNODATATEXT: 
+            return showText(state, action);
         default: 
             return state;
     }

+ 2 - 1
src/store/types/diagnosticSearch.js

@@ -1,4 +1,5 @@
 export const SHOW_SEARCH = 'SHOW_SEARCH';
 export const HIDE_SEARCH = 'HIDE_SEARCH';
 export const SET_SEARCH_VALUE = 'SET_SEARCH_VALUE';
-export const GET_SEARCH_RESULT = 'GET_SEARCH_RESULT';
+export const GET_SEARCH_RESULT = 'GET_SEARCH_RESULT';
+export const SHOWNODATATEXT = 'SHOWNODATATEXT';