|
@@ -32,18 +32,24 @@ class CheckBody extends Component{
|
|
|
getLabels(){
|
|
|
const {data,showArr,saveText,selecteds} = this.props;
|
|
|
let arr = [],list=[];//console.log(data,saveText)
|
|
|
- const {boxMark,showAll} = this.state;
|
|
|
+ const {boxMark,showAll} = this.state;//console.log(data)
|
|
|
+ const moreNum =data.length-[...data].reverse().findIndex((it)=>it.showInCheck)-1;//被隐藏的位置
|
|
|
+ console.log(moreNum);
|
|
|
+ const moreText = filterDataArr([...saveText].splice(moreNum)); //被收起的标签中是否有有值得,有则不能再收起showMoreBtn?more:''
|
|
|
+ const more = this.props.defaultShowAll||showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
|
|
|
+ const showMoreBtn = data.length>moreNum&&!moreText;
|
|
|
let showArray = data.filter((it)=>{
|
|
|
if(it.showInCheck)
|
|
|
return it;
|
|
|
});
|
|
|
- const showData = this.props.showAll||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
|
|
|
+ const showData = moreText||this.props.defaultShowAll||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
|
|
|
if(showData){
|
|
|
list = showData;
|
|
|
arr = list.map((it,i)=>{
|
|
|
return chooseType({item:it,boxMark,i,showArr,saveText,selecteds});
|
|
|
});
|
|
|
}
|
|
|
+ showMoreBtn&&arr.push(more); //是否显示收起展开按钮
|
|
|
return arr;
|
|
|
}
|
|
|
handleClick(e){//让搜索框跟随鼠标点击移动
|
|
@@ -117,15 +123,11 @@ class CheckBody extends Component{
|
|
|
}
|
|
|
render(){
|
|
|
const {searchData,totalHide,data,boxLeft,boxTop,saveText} = this.props;
|
|
|
- const {showAll} = this.state;
|
|
|
- const moreNum =config.showCheckNum*2+1;
|
|
|
- const moreText = filterDataArr([...saveText].splice(moreNum)); //被收起的标签中是否有有值得,有则不能再收起
|
|
|
- const more = this.props.showAll||showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
|
|
|
- const showMoreBtn = data.length>moreNum&&!moreText;
|
|
|
+
|
|
|
return <div className={style['container']}>
|
|
|
<ItemBox title='查体' handleClick={this.handleClick}>
|
|
|
{this.getLabels()}
|
|
|
- {showMoreBtn?more:''}
|
|
|
+ {/*{showMoreBtn?more:''}*/}
|
|
|
{searchData && searchData.length>0?<SearchDrop data={searchData} show={!totalHide} left={boxLeft} top={boxTop} onSelect={this.handleSearchSelect}></SearchDrop>:''}
|
|
|
</ItemBox>
|
|
|
</div>
|