|
@@ -104,7 +104,10 @@ class SpreadDrop extends Component{
|
|
|
labelVal:text,
|
|
|
editable:true
|
|
|
});
|
|
|
- e.target.focus();
|
|
|
+ //失焦关闭编辑状态
|
|
|
+ setTimeout(()=>{
|
|
|
+ e.target.focus();
|
|
|
+ })
|
|
|
handleDbclick && handleDbclick({value,id,placeholder});
|
|
|
}
|
|
|
}
|
|
@@ -197,7 +200,7 @@ class SpreadDrop extends Component{
|
|
|
//点确定后隐藏弹窗
|
|
|
this.props.handleHide();
|
|
|
}
|
|
|
- handleSelect(item,isExclu,joint,listIndex,selected){
|
|
|
+ handleSelect(item,isExclu,joint,listIndex,selected){//console.log(item,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)*/
|
|
@@ -222,9 +225,9 @@ class SpreadDrop extends Component{
|
|
|
}
|
|
|
//操作单选项
|
|
|
if(selected){
|
|
|
- const tIndex= exists.findIndex((it)=>it.id===selected.id);
|
|
|
+ const tIndex= exists.findIndex((it)=>it.questionId===item.questionId);
|
|
|
if(tIndex!=-1){
|
|
|
- exists.splice(tIndex,1,{id,name,listIndex});
|
|
|
+ exists.splice(tIndex,1,item);
|
|
|
this.setState({
|
|
|
exists,
|
|
|
})
|
|
@@ -286,7 +289,7 @@ class SpreadDrop extends Component{
|
|
|
}else if(nowOn=='with'){
|
|
|
withs.push({id:id,name:name});
|
|
|
}else{
|
|
|
- exists.push({id:id,name:name,listIndex});
|
|
|
+ exists.push({id:id,name:name,listIndex,questionId:item.questionId});
|
|
|
}
|
|
|
}
|
|
|
this.setState({
|
|
@@ -407,9 +410,16 @@ class ListItem extends Component{
|
|
|
const index=listIndex+''+i;
|
|
|
//列单选处理
|
|
|
if(isRadio){
|
|
|
- const selected = data.find((it)=>{
|
|
|
- return exists.findIndex((i)=>i.id===it.id)!==-1||noneIds.includes(it.id)||withs.findIndex((i)=>i.id===it.id)!==-1;
|
|
|
+ let selected = exists.find((i)=>{
|
|
|
+ return i.questionId===item.questionId;
|
|
|
+ })||withs.find((i)=>{
|
|
|
+ return i.questionId===item.questionId;
|
|
|
+ })||noneIds.find((i)=>{
|
|
|
+ return i.id===item.questionId;
|
|
|
});
|
|
|
+ /*const selected = data.find((it)=>{console.log(exists)
|
|
|
+ return exists.findIndex((i)=>i.questionId===it.id)!==-1||noneIds.includes(it.id)||withs.findIndex((i)=>i.questionId===it.id)!==-1;
|
|
|
+ });*/
|
|
|
if(selected&&selected.id!=item.id){ //该列已有选中项,传回已选中的id,name取消选中
|
|
|
handleClick&&handleClick(item,isExclu,joint,index,{id:selected.id,name:selected.name});
|
|
|
}else{
|
|
@@ -428,7 +438,7 @@ class ListItem extends Component{
|
|
|
return style['exclusion'];
|
|
|
}
|
|
|
}else{
|
|
|
- if(isExclu&&[...noneIds,...exists,...withs].length>0){
|
|
|
+ if(isExclu&&([...noneIds,...exists,...withs].length>0||ban.id)){
|
|
|
return style['exclusion'];
|
|
|
}
|
|
|
if(noneIds.includes(id)){
|