|
@@ -5,6 +5,7 @@ import style from './index.less';
|
|
|
import {setPosition,deepClone,filterArr,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate} from '@utils/tools.js';
|
|
|
import {Notify} from '@commonComp';
|
|
|
import ScrollArea from 'react-scrollbar';
|
|
|
+import SearchBox from '@containers/SearchBox'
|
|
|
import $ from 'jquery';
|
|
|
/****
|
|
|
* 标签组合下拉,选中的项目展开
|
|
@@ -200,7 +201,7 @@ class SpreadDrop extends Component{
|
|
|
this.clearState();
|
|
|
}
|
|
|
handleConfirm(e){
|
|
|
- e.stopPropagation();
|
|
|
+ // e.stopPropagation();
|
|
|
const {handleConfirm,ikey,type,tagType,order,mainSaveText,copyType,value,mainData} = this.props;
|
|
|
const params = Object.assign({},this.state,{ikey,type,tagType,order,mainSaveText,copyType,value,mainData});
|
|
|
delete params.tmpDom; //避免上面deepClone selecteds报错
|
|
@@ -209,7 +210,7 @@ class SpreadDrop extends Component{
|
|
|
//点确定后隐藏弹窗
|
|
|
this.props.handleHide();
|
|
|
}
|
|
|
- handleSelect(item,isExclu,joint,listIndex,selected){//console.log(item,selected)
|
|
|
+ handleSelect(item,isExclu,joint,listIndex,selected){
|
|
|
let {withOn,withs,noneOn,exclusion,exists,nowOn,nones,noneIds,ban} = this.state;
|
|
|
/*if(this.props.selecteds)
|
|
|
console.log(exists,this.props.selecteds.exists,exists===this.props.selecteds.exists)*/
|
|
@@ -359,8 +360,9 @@ class SpreadDrop extends Component{
|
|
|
}
|
|
|
}*/
|
|
|
render(){
|
|
|
- const {placeholder,value,show,data,order} = this.props;
|
|
|
+ const {placeholder,value,show,data,order,type,tagType,ikey,pos} = this.props;
|
|
|
const {tmpDom,left} = this.state
|
|
|
+ const clickIndx = ikey.split('-')[1];//展开下拉的index
|
|
|
if(!show&&tmpDom){
|
|
|
$(tmpDom).parent().prev().attr({"contentEditable":true})
|
|
|
}
|
|
@@ -379,7 +381,7 @@ class SpreadDrop extends Component{
|
|
|
onInput={this.onChange}
|
|
|
onkeydown={handleEnter}
|
|
|
>{value||placeholder}</div>
|
|
|
- <ListItems parDiv={this.$list} data={data} order={order} left={left}
|
|
|
+ <ListItems parDiv={this.$list} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
|
|
|
show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
|
|
|
</div>
|
|
|
}
|
|
@@ -389,6 +391,7 @@ class ListItems extends Component{
|
|
|
constructor(props){
|
|
|
super(props);
|
|
|
this.$cont = React.createRef();
|
|
|
+ this.clickConfirm = this.clickConfirm.bind(this);
|
|
|
}
|
|
|
getLabels(){
|
|
|
const {data,handleSelect} = this.props;
|
|
@@ -396,6 +399,7 @@ class ListItems extends Component{
|
|
|
let isSpecialPos = false; //是否特殊位置(单行在上面,如无殊)
|
|
|
let isExclu = false; //是否与其他互斥
|
|
|
let isRadio; //是否为单选列,默认多选列
|
|
|
+ let isSingle = data.length == 1?true:false; //是否为单列,无伴的情况
|
|
|
const list = data&&data.map((it,i)=>{
|
|
|
isSpecialPos = (+it.formPosition === 1);
|
|
|
isExclu = (+it.exclusionType===1);
|
|
@@ -407,6 +411,7 @@ class ListItems extends Component{
|
|
|
}
|
|
|
return <ListItem datas={detail}
|
|
|
isRadio={isRadio}
|
|
|
+ isSingle={isSingle}
|
|
|
joint={it.joint}
|
|
|
listIndex={i}
|
|
|
isSpecialPos={isSpecialPos}
|
|
@@ -416,6 +421,11 @@ class ListItems extends Component{
|
|
|
});
|
|
|
return list;
|
|
|
}
|
|
|
+ clickConfirm(){
|
|
|
+ const {handleConfirm} = this.props;
|
|
|
+ this.child&&this.child.reset();//重置搜索框中的数据
|
|
|
+ handleConfirm();
|
|
|
+ }
|
|
|
getStyle(){
|
|
|
const {show,left} = this.props;
|
|
|
return {
|
|
@@ -423,14 +433,34 @@ class ListItems extends Component{
|
|
|
left:left
|
|
|
}
|
|
|
}
|
|
|
+ searchSelect(item){
|
|
|
+ const {handleSelect,handleConfirm} = this.props;
|
|
|
+ //添加id字段,用于调尾巴
|
|
|
+ const it = Object.assign({id:item.questionId},item);
|
|
|
+ handleSelect&&handleSelect(it); //添加到大数据推送一起选中
|
|
|
+ handleConfirm&&handleConfirm(); //确定事件
|
|
|
+ }
|
|
|
+ getPushItemIds(list){ //获取推送症状的id数组,去重用
|
|
|
+ return list&&list.map((it)=>{
|
|
|
+ return it.conceptId;
|
|
|
+ })||[];
|
|
|
+ }
|
|
|
render (){
|
|
|
- const {handleClear,handleConfirm,order,parDiv} = this.props;
|
|
|
+ const {handleClear,order,parDiv,boxMark,tagType,show,data,pos} = this.props;
|
|
|
+ const pushUl = data.find((it)=>it.controlType===99);
|
|
|
+ const pushList = pushUl&&pushUl.questionDetailList;
|
|
|
+ //推送标签没有推送结果时不显示顺序说明
|
|
|
+ const noPush = tagType===11&&(!pushList||pushList.length===0);
|
|
|
+ const noSearch = boxMark==1 && tagType==11 && !pos; //非第一病程添加症状标签不显示搜索
|
|
|
return <div className={style["drop-list"]} ref={parDiv} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
|
|
|
- <p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>
|
|
|
+ {noPush?'':<p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>}
|
|
|
{this.getLabels()}
|
|
|
+ {noSearch && <div className="search">
|
|
|
+ <SearchBox show={show} pushIds={this.getPushItemIds(pushList)} onSelect={this.searchSelect.bind(this)} onRef={(child)=>{this.child = child;}}/>
|
|
|
+ </div>}
|
|
|
<div className="oper clearfix">
|
|
|
<span className={style['clear']} onClick={handleClear}>清空选项</span>
|
|
|
- <span className={style['confirm']} onClick={handleConfirm}>确定</span>
|
|
|
+ <span className={style['confirm']} onClick={this.clickConfirm}>确定</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
}
|
|
@@ -502,6 +532,9 @@ class ListItem extends Component{
|
|
|
width:'6px',
|
|
|
background:'#f1f1f1'};
|
|
|
const barStyle={background:'#777',width:'100%'};
|
|
|
+ if(!datas||datas.length===0){
|
|
|
+ return <li className={style['no-push-data']}>暂无推送</li>
|
|
|
+ }
|
|
|
if(datas&&datas.length>11){
|
|
|
return <ScrollArea speed={0.8}
|
|
|
horizontal={false}
|
|
@@ -526,11 +559,30 @@ class ListItem extends Component{
|
|
|
return <li onClick={(e)=>this.handleClick(e,it,i)} className={this.getClass(it.id)} title={it.name.length>8?it.name:''}>{it.name&&it.name.length>8?it.name.slice(0,8)+'...':it.name}</li>
|
|
|
});
|
|
|
}
|
|
|
- render(){
|
|
|
+
|
|
|
+ getMainData(){//主诉添加症状-带搜索框
|
|
|
const {datas,isSpecialPos} = this.props;
|
|
|
- const pos = isSpecialPos?style['independent']:'';
|
|
|
- return <ul className={classNames(style['row'],pos)} onBlur={(e)=>e.stopPropagation()}>
|
|
|
- {this.getData()}
|
|
|
+ if(!datas||datas.length===0){
|
|
|
+ return <li className={style['no-push-data']}>暂无推送数据,可通过搜索查找更多内容~ </li>
|
|
|
+ }
|
|
|
+ return datas&&datas.map((it,i)=>{
|
|
|
+ return <li onClick={(e)=>this.handleClick(e,it,i)}
|
|
|
+ className={this.getClass(it.id)}
|
|
|
+ title={it.name.length>4?it.name:''}
|
|
|
+ style={{'width':'55px','display':'inline-block'}}>
|
|
|
+ {it.name&&it.name.length>4?it.name.slice(0,4)+'...':it.name}
|
|
|
+ </li>
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ render(){
|
|
|
+ const {datas,isSpecialPos,boxMark,tagType,listIndex,isSingle,pos} = this.props;
|
|
|
+ const posit = isSpecialPos?style['independent']:'';
|
|
|
+ const ifMainSear = boxMark==1 && tagType==11 && !pos?true:false;
|
|
|
+ // 单列直接设置宽度,多列则第二列设置(伴字ul不设置宽度)
|
|
|
+ const main = ifMainSear&&!isSingle&&listIndex==1?style['mainUl']:(ifMainSear&&isSingle?style['mainUl']:'');
|
|
|
+ return <ul className={classNames(style['row'],posit,main)} onBlur={(e)=>e.stopPropagation()}>
|
|
|
+ {ifMainSear?this.getMainData():this.getData()}
|
|
|
</ul>
|
|
|
}
|
|
|
}
|