|
@@ -169,9 +169,10 @@ class SpreadDrop extends Component{
|
|
|
});
|
|
|
}
|
|
|
getInitExclu(){
|
|
|
- const {defaulted,labelDefault,data,value} = this.props;
|
|
|
+ const {defaulted,data,value} = this.props;
|
|
|
let excluId = '',excName='';
|
|
|
- if(labelDefault&&defaulted&&value===undefined){
|
|
|
+ let showDefaulted = this.ifDefault();
|
|
|
+ if(showDefaulted&&defaulted&&value===undefined){
|
|
|
const it = data[0];
|
|
|
excluId = it.exclusionType===1?it.questionDetailList[0].id:'';
|
|
|
excName = it.exclusionType===1?it.questionDetailList[0].name:'';
|
|
@@ -340,21 +341,26 @@ class SpreadDrop extends Component{
|
|
|
});
|
|
|
}
|
|
|
getClass(){
|
|
|
- const {isImports,show,value,isExtBlue,defaulted,labelDefault} = this.props;
|
|
|
+ const {isImports,show,value,isExtBlue,defaulted} = this.props;
|
|
|
const blueBorder = this.state.editable?style['blue-border']:'';
|
|
|
const orgBorder = isImports&&!value?style['orange-border']:'';
|
|
|
const ext = isExtBlue?style['ext']:'';
|
|
|
+ let showDefaulted = this.ifDefault();
|
|
|
if(show){
|
|
|
$(this.$div.current).addClass(style['borderd']);
|
|
|
}else{
|
|
|
$(this.$div.current).removeClass(style['borderd']);
|
|
|
}
|
|
|
- if(value||(labelDefault&&value===undefined&&defaulted)){
|
|
|
+ if(value||(showDefaulted&&value===undefined&&defaulted)){
|
|
|
return classNames(style['selected-tag'],blueBorder);
|
|
|
}
|
|
|
return classNames(style['tag'],orgBorder,ext);
|
|
|
}
|
|
|
-
|
|
|
+ ifDefault(){
|
|
|
+ const {type,otherDefault,curDefault} = this.props;
|
|
|
+ const showDefaulted = (type=='2'&&curDefault)||(type=='3'&&otherDefault);
|
|
|
+ return showDefaulted;
|
|
|
+ }
|
|
|
componentDidMount(){
|
|
|
if(isIE()){
|
|
|
$(this.$div.current).onIe8Input(function(e){
|
|
@@ -363,9 +369,10 @@ class SpreadDrop extends Component{
|
|
|
}
|
|
|
}
|
|
|
render(){
|
|
|
- const {placeholder,value,show,data,order,type,tagType,ikey,pos,defaulted,labelDefault,showVal} = this.props;
|
|
|
+ const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal} = this.props;
|
|
|
const {tmpDom,left} = this.state;
|
|
|
- let showV = labelDefault&&value===undefined?showVal:value; //未选中过值时展示默认选中
|
|
|
+ let showDefaulted = this.ifDefault();
|
|
|
+ let showV = showDefaulted&&value===undefined?showVal:value; //未选中过值时展示默认选中
|
|
|
if(!show&&tmpDom){
|
|
|
$(tmpDom).parent().prev().attr({"contentEditable":true})
|
|
|
}
|
|
@@ -384,7 +391,7 @@ class SpreadDrop extends Component{
|
|
|
onInput={this.onChange}
|
|
|
onkeydown={handleEnter}
|
|
|
>{showV||placeholder}</div>
|
|
|
- <ListItems parDiv={this.$list} defaulted={labelDefault&&defaulted} pos={pos} data={data} order={order} left={left} boxMark={type} tagType={tagType}
|
|
|
+ <ListItems parDiv={this.$list} defaulted={showDefaulted&&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>
|
|
|
}
|