取消保存
- `; - nextDom.appendChild(addipt); if(disbtn=='companyBtn'){ this.setState({companyBtn:false}); }else if(disbtn=='departmentBtn'){ @@ -179,22 +170,52 @@ export default class station extends React.Component{ }else if(disbtn=='postBtn'){ this.setState({postBtn:false}); } - let netList=document.querySelectorAll('.'+disbtn); - netList.forEach((item,i)=>{ - item.className=disbtn+" newitem"; - netList.forEach((item2,i2)=>{ - netList[netList.length-1].className="newitem focusactive"; - console.log(netList[netList.length-1].children[0].focus()); - }) - }) + // let data=JSON.parse(JSON.stringify(this.state.company)); + let obj={id:'',name:''} + // data.unshift(obj); + + // this.setState({company:data}); + + + let data = [...this.state.company] + + data.unshift(obj); + this.setState({company:data}); + + + + // setTimeout(()=>{ + // let netList=document.querySelectorAll('.companyBtn'); + // console.log(netList) + // netList.forEach((item,i)=>{ + // console.log(item); + // item.className=disbtn+" newitem"; + // netList.forEach((item2,i2)=>{ + // netList[0].className="newitem focusactive"; + // netList[0].children[0].focus(); + // }) + // }) + // },200) + + + + }else{ Notify.clear() Notify.warn(`请先操作新增的${place}名`); } - } - + changeval(e,item){ + let index=this.hasVal(this.state.company,item); + let changeVal=_.cloneDeepWith(this.state.company, []); + if(index==-1){ + changeVal[0].name=e.target.value; + this.setState({company:changeVal}); + } + } render(){ + // let netList=document.querySelectorAll('.companyBtn'); + // console.log('netList',netList); const { current, pageSize } = this.state; return(this.addItem(event,'companyBtn')}>+新建公司
-编辑
+ " onClick={(e)=>this.saveFn(e,'公司')}>删除this.editFn(e,'公司')} style={{marginLeft:'15px'}}>取消this.editFn(e,'公司')} style={{marginLeft:'15px'}}>保存