|
@@ -169,9 +169,9 @@ class SpreadDrop extends Component{
|
|
|
});
|
|
|
}
|
|
|
getInitExclu(){
|
|
|
- const {defaulted,data,value} = this.props;
|
|
|
+ const {defaulted,labelDefault,data,value} = this.props;
|
|
|
let excluId = '',excName='';
|
|
|
- if(defaulted&&value===undefined){
|
|
|
+ if(labelDefault&&defaulted&&value===undefined){
|
|
|
const it = data[0];
|
|
|
excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
|
|
|
excName = it.exclusionType===1?it.questionDetailList[0].name:'';
|
|
@@ -201,8 +201,6 @@ class SpreadDrop extends Component{
|
|
|
this.setState({
|
|
|
nones:'',
|
|
|
exists:[],
|
|
|
- //existsName:{},
|
|
|
- //withsName:{},
|
|
|
withs:[],
|
|
|
noneIds:[],
|
|
|
noneOn:false,
|
|
@@ -282,11 +280,8 @@ class SpreadDrop extends Component{
|
|
|
if(+item.code===1){ //操作“伴”类型
|
|
|
this.setState({
|
|
|
withOn:!withOn,
|
|
|
- // withs:withOn?[]:[...withs,id], //取消“伴”选中,伴随症状全部取消选中
|
|
|
- // withs:withOn?[]:[...withs,{id:item.id,name:name}],
|
|
|
withs:withOn?[]:withs,
|
|
|
ban:withOn?{}:{id:id,name:name,value:name},
|
|
|
- //withsName:withOn?"":withsName+name, //取消“伴”选中,伴随症状全部取消选中
|
|
|
nowOn:withOn?(noneOn?'none':''):'with'
|
|
|
});
|
|
|
return;
|
|
@@ -329,10 +324,8 @@ class SpreadDrop extends Component{
|
|
|
nones += name+'、';
|
|
|
noneIds.push(id);
|
|
|
}else if(nowOn=='with'){
|
|
|
- // withs.push({id:id,name:name,questionId:item.questionId});
|
|
|
withs.push({id:id,name:name,questionId:item.questionId,conceptId:item.conceptId});
|
|
|
}else{
|
|
|
- // exists.push({id:id,name:name,listIndex,questionId:item.questionId});
|
|
|
exists.push({id:id,name:name,listIndex,questionId:item.questionId,conceptId:item.conceptId});
|
|
|
}
|
|
|
}
|
|
@@ -347,7 +340,7 @@ class SpreadDrop extends Component{
|
|
|
});
|
|
|
}
|
|
|
getClass(){
|
|
|
- const {isImports,show,value,isExtBlue} = this.props;
|
|
|
+ const {isImports,show,value,isExtBlue,defaulted,labelDefault} = this.props;
|
|
|
const blueBorder = this.state.editable?style['blue-border']:'';
|
|
|
const orgBorder = isImports&&!value?style['orange-border']:'';
|
|
|
const ext = isExtBlue?style['ext']:'';
|
|
@@ -356,7 +349,7 @@ class SpreadDrop extends Component{
|
|
|
}else{
|
|
|
$(this.$div.current).removeClass(style['borderd']);
|
|
|
}
|
|
|
- if(value){
|
|
|
+ if(value||(labelDefault&&value===undefined&&defaulted)){
|
|
|
return classNames(style['selected-tag'],blueBorder);
|
|
|
}
|
|
|
return classNames(style['tag'],orgBorder,ext);
|
|
@@ -369,16 +362,10 @@ class SpreadDrop extends Component{
|
|
|
},this);
|
|
|
}
|
|
|
}
|
|
|
- /*componentWillReceiveProps(nextProps){
|
|
|
- const {setHighter} = this.props;
|
|
|
- if(!nextProps.show){console.log(22)
|
|
|
- setHighter&&setHighter(48);
|
|
|
- }
|
|
|
- }*/
|
|
|
render(){
|
|
|
- const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted} = this.props;
|
|
|
+ const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted,labelDefault,showVal} = this.props;
|
|
|
const {tmpDom,left} = this.state;
|
|
|
- const clickIndx = ikey.split('-')[1];//展开下拉的index
|
|
|
+ let showV = labelDefault&&value===undefined?showVal:value; //未选中过值时展示默认选中
|
|
|
if(!show&&tmpDom){
|
|
|
$(tmpDom).parent().prev().attr({"contentEditable":true})
|
|
|
}
|
|
@@ -396,8 +383,8 @@ class SpreadDrop extends Component{
|
|
|
onBlur={this.handleBlur}
|
|
|
onInput={this.onChange}
|
|
|
onkeydown={handleEnter}
|
|
|
- >{value||placeholder}</div>
|
|
|
- <ListItems parDiv={this.$list} defaulted={defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
|
|
|
+ >{showV||placeholder}</div>
|
|
|
+ <ListItems parDiv={this.$list} defaulted={labelDefault&&defaulted} 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>
|
|
|
}
|