|
@@ -229,9 +229,15 @@ class SpreadDrop extends Component{
|
|
|
const linkStr = joint||'';
|
|
|
const name = item.name+linkStr;
|
|
|
if(isExclu){ //操作“互斥项”
|
|
|
- if([...noneIds,...exists,...withs].length>0){ //已选非互斥项,互斥项不可操作
|
|
|
+ if([...noneIds,...exists,...withs].length>0){ //已选非互斥项,清空已选项,选中该互斥项
|
|
|
+ this.clearState();
|
|
|
+ this.setState({
|
|
|
+ exclusion:id,
|
|
|
+ excluName:name
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
+ //未选中互斥项,直接选中该互斥项
|
|
|
let temp = '';
|
|
|
if(exclusion==''){
|
|
|
temp = id;
|
|
@@ -262,8 +268,11 @@ class SpreadDrop extends Component{
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- if(exclusion!==''){ //互斥项被选中,其他不可操作
|
|
|
- return;
|
|
|
+ if(exclusion!==''){ //互斥项已选中,清空互斥项
|
|
|
+ this.setState({
|
|
|
+ exclusion:'',
|
|
|
+ excluName:''
|
|
|
+ });
|
|
|
}
|
|
|
if(+item.code===1){ //操作“伴”类型
|
|
|
this.setState({
|
|
@@ -356,7 +365,7 @@ class SpreadDrop extends Component{
|
|
|
}
|
|
|
|
|
|
render(){
|
|
|
- const {placeholder,value,show,data} = this.props;
|
|
|
+ const {placeholder,value,show,data,order} = this.props;
|
|
|
const {editable,boxLeft,boxTop} = this.state;
|
|
|
return <div className={style['container']}
|
|
|
onFocus={(e)=>e.stopPropagation()}
|
|
@@ -372,7 +381,7 @@ class SpreadDrop extends Component{
|
|
|
onInput={this.onChange}
|
|
|
onkeydown={handleEnter}
|
|
|
>{value||placeholder}</div>
|
|
|
- <ListItems data={data} left={boxLeft}
|
|
|
+ <ListItems data={data} left={boxLeft} order={order}
|
|
|
top={boxTop} show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
|
|
|
</div>
|
|
|
}
|
|
@@ -417,10 +426,11 @@ class ListItems extends Component{
|
|
|
}
|
|
|
}
|
|
|
render (){
|
|
|
- const {handleClear,handleConfirm} = this.props;
|
|
|
+ const {handleClear,handleConfirm,order} = this.props;
|
|
|
const domNode = document.getElementById('root');
|
|
|
return ReactDom.createPortal(
|
|
|
<div className={style["drop-list"]} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
|
|
|
+ <p className={style['orderTips']}>按{order?'从左到右列':'点选'}顺序成文</p>
|
|
|
{this.getLabels()}
|
|
|
<div className="oper">
|
|
|
<span className={style['clear']} onClick={handleClear}>清空选项</span>
|