|
@@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
|
import style from './index.less';
|
|
import style from './index.less';
|
|
import delIcon from '@common/images/del_nor.png';
|
|
import delIcon from '@common/images/del_nor.png';
|
|
import {windowEventHandler,getCurrentDate,getWindowInnerHeight} from '@utils/tools'
|
|
import {windowEventHandler,getCurrentDate,getWindowInnerHeight} from '@utils/tools'
|
|
|
|
+import Filters from './Filters';
|
|
|
|
|
|
class MedicalInfo extends Component {
|
|
class MedicalInfo extends Component {
|
|
constructor(props) {
|
|
constructor(props) {
|
|
@@ -12,20 +13,22 @@ class MedicalInfo extends Component {
|
|
this.state={
|
|
this.state={
|
|
val:'',
|
|
val:'',
|
|
hasSearch: false,
|
|
hasSearch: false,
|
|
- msg:''
|
|
|
|
|
|
+ msg:'',
|
|
|
|
+ typeChecks:['0'],
|
|
};
|
|
};
|
|
this.search = this.search.bind(this);
|
|
this.search = this.search.bind(this);
|
|
this.handleChange = this.handleChange.bind(this);
|
|
this.handleChange = this.handleChange.bind(this);
|
|
this.clear = this.clear.bind(this);
|
|
this.clear = this.clear.bind(this);
|
|
this.getSearchList = this.getSearchList.bind(this);
|
|
this.getSearchList = this.getSearchList.bind(this);
|
|
this.handleEnter = this.handleEnter.bind(this);
|
|
this.handleEnter = this.handleEnter.bind(this);
|
|
|
|
+ this.handleTypeCheck = this.handleTypeCheck.bind(this);
|
|
}
|
|
}
|
|
getSearchList() {
|
|
getSearchList() {
|
|
const { getAllConceptDetail,searchResult } = this.props;
|
|
const { getAllConceptDetail,searchResult } = this.props;
|
|
const that = this;
|
|
const that = this;
|
|
if(searchResult&&searchResult.length>0){
|
|
if(searchResult&&searchResult.length>0){
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
- that.$ul.current.style.height = getWindowInnerHeight()-248+'px';
|
|
|
|
|
|
+ that.$ul.current.style.height = getWindowInnerHeight()-278+'px';
|
|
},100);
|
|
},100);
|
|
}
|
|
}
|
|
return searchResult && searchResult.map((item) => {
|
|
return searchResult && searchResult.map((item) => {
|
|
@@ -48,7 +51,7 @@ class MedicalInfo extends Component {
|
|
}
|
|
}
|
|
const {handleChangeValue} = this.props;
|
|
const {handleChangeValue} = this.props;
|
|
const val = this.$inp.current.value;
|
|
const val = this.$inp.current.value;
|
|
- handleChangeValue&&handleChangeValue(val);
|
|
|
|
|
|
+ handleChangeValue&&handleChangeValue(val,this.state.typeChecks);
|
|
}
|
|
}
|
|
handleChange(){
|
|
handleChange(){
|
|
const value = this.$inp.current.value;
|
|
const value = this.$inp.current.value;
|
|
@@ -82,16 +85,37 @@ class MedicalInfo extends Component {
|
|
this.$inp.current.focus();
|
|
this.$inp.current.focus();
|
|
clearResult&&clearResult();
|
|
clearResult&&clearResult();
|
|
}
|
|
}
|
|
|
|
+ handleTypeCheck(val){
|
|
|
|
+ let {typeChecks} = this.state;
|
|
|
|
+ //const allChecked = typeChecks.includes('0');
|
|
|
|
+ const alli = typeChecks.findIndex((it)=>it==='0');
|
|
|
|
+ const allChecked = alli!==-1;
|
|
|
|
+ if(val==='0'){ //全部与其他互斥
|
|
|
|
+ !allChecked?typeChecks=['0']:typeChecks.splice(alli,1);
|
|
|
|
+ }else{
|
|
|
|
+ allChecked&&typeChecks.splice(alli,1);
|
|
|
|
+ if(!typeChecks.includes(val)){
|
|
|
|
+ typeChecks.push(val);
|
|
|
|
+ }else{
|
|
|
|
+ const i = typeChecks.findIndex((it)=>val===it);
|
|
|
|
+ typeChecks.splice(i,1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.setState({
|
|
|
|
+ typeChecks:typeChecks
|
|
|
|
+ });
|
|
|
|
+ }
|
|
componentDidMount(){
|
|
componentDidMount(){
|
|
const height = getWindowInnerHeight()-148;
|
|
const height = getWindowInnerHeight()-148;
|
|
this.$cont.current.style.height = height+"px";
|
|
this.$cont.current.style.height = height+"px";
|
|
|
|
+ this.props.getFilters();
|
|
windowEventHandler('resize', ()=>{
|
|
windowEventHandler('resize', ()=>{
|
|
if(this.$cont.current){
|
|
if(this.$cont.current){
|
|
const height = getWindowInnerHeight()-148;
|
|
const height = getWindowInnerHeight()-148;
|
|
this.$cont.current.style.height = height+"px";
|
|
this.$cont.current.style.height = height+"px";
|
|
}
|
|
}
|
|
if(this.$ul.current){
|
|
if(this.$ul.current){
|
|
- const height = getWindowInnerHeight()-248;
|
|
|
|
|
|
+ const height = getWindowInnerHeight()-278;
|
|
this.$ul.current.style.height = height+"px";
|
|
this.$ul.current.style.height = height+"px";
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -102,8 +126,8 @@ class MedicalInfo extends Component {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
render() {
|
|
render() {
|
|
- const {searchResult} = this.props;
|
|
|
|
- const {val, hasSearch,msg} = this.state;
|
|
|
|
|
|
+ const {searchResult,filterList} = this.props;
|
|
|
|
+ const {val, hasSearch,msg,typeChecks} = this.state;
|
|
return (
|
|
return (
|
|
<div className={style['search-cont']} ref={this.$cont}>
|
|
<div className={style['search-cont']} ref={this.$cont}>
|
|
<div className={style['search-box']}>
|
|
<div className={style['search-box']}>
|
|
@@ -112,6 +136,7 @@ class MedicalInfo extends Component {
|
|
{val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
|
|
{val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
|
|
<button onClick={this.search}>搜索</button>
|
|
<button onClick={this.search}>搜索</button>
|
|
</p>
|
|
</p>
|
|
|
|
+ <Filters data ={filterList} checkeds={typeChecks} handleCheck={this.handleTypeCheck}></Filters>
|
|
</div>
|
|
</div>
|
|
{searchResult&&searchResult.length>0?<div className={style['result']}>
|
|
{searchResult&&searchResult.length>0?<div className={style['result']}>
|
|
<p className={style['title']}>查询内容</p>
|
|
<p className={style['title']}>查询内容</p>
|