diff --git a/src/pages/plan/add/step2.js b/src/pages/plan/add/step2.js index 0466111a..fc8f2985 100644 --- a/src/pages/plan/add/step2.js +++ b/src/pages/plan/add/step2.js @@ -260,6 +260,7 @@ export default class acclist extends React.Component{ begin_time:this.state.codeInfo.date_time[0], end_time:this.state.codeInfo.date_time[1], quantity:this.state.codeInfo.issued, + restrict:this.state.codeInfo.restrict, range : rank.toString(), } @@ -287,6 +288,7 @@ export default class acclist extends React.Component{ console.log("编辑") this.state.distdata[this.state.rowIndex] = temp; this.setState({distdata:this.state.distdata}) + console.log(this.state.distdata) } else{ console.log("新增") @@ -301,17 +303,11 @@ export default class acclist extends React.Component{ addNewKey(){ this.props.addNewkey() } - onRestrict(e,rowdata){ + onRestrict(e,rowdata,index){ let text = e.target.value; text = text.replace(/[^\d]/g,'') - - - let rowIndex =this.state.distdata.findIndex((o)=>{return o.title == rowdata.title}) - - - - this.state.distdata[rowIndex].restrict =text; + this.state.distdata[index].restrict =text; this.setState({distdata:this.state.distdata}) } @@ -547,7 +543,8 @@ export default class acclist extends React.Component{ issued:row.quantity,//发放总量 describe:row.describe, date_time:[row.begin_time,row.end_time], - range:row.range + range:row.range, + restrict:row.restrict, } let arr = _.map(row.product,(res)=>{ @@ -568,6 +565,7 @@ export default class acclist extends React.Component{ }) + this.setState({tempdata:temp}) this.setState({drawerVisible:true}) @@ -846,11 +844,11 @@ export default class acclist extends React.Component{ if(com == "restrict") { - return {this.onRestrict(e,rowData)}} /> + return {this.onRestrict(e,rowData,rowIndex)}} /> } if(com == "edit") { - return + return {this.rowItemClick(rowData,rowIndex)}} style={{color:"#2B66F2"}} >编辑 }