Update step2.js

This commit is contained in:
姜棚 2021-11-29 21:36:32 +08:00
parent 836f093790
commit 133d7f235e
1 changed files with 9 additions and 11 deletions

View File

@ -260,6 +260,7 @@ export default class acclist extends React.Component{
begin_time:this.state.codeInfo.date_time[0], begin_time:this.state.codeInfo.date_time[0],
end_time:this.state.codeInfo.date_time[1], end_time:this.state.codeInfo.date_time[1],
quantity:this.state.codeInfo.issued, quantity:this.state.codeInfo.issued,
restrict:this.state.codeInfo.restrict,
range : rank.toString(), range : rank.toString(),
} }
@ -287,6 +288,7 @@ export default class acclist extends React.Component{
console.log("编辑") console.log("编辑")
this.state.distdata[this.state.rowIndex] = temp; this.state.distdata[this.state.rowIndex] = temp;
this.setState({distdata:this.state.distdata}) this.setState({distdata:this.state.distdata})
console.log(this.state.distdata)
} }
else{ else{
console.log("新增") console.log("新增")
@ -301,17 +303,11 @@ export default class acclist extends React.Component{
addNewKey(){ addNewKey(){
this.props.addNewkey() this.props.addNewkey()
} }
onRestrict(e,rowdata){ onRestrict(e,rowdata,index){
let text = e.target.value; let text = e.target.value;
text = text.replace(/[^\d]/g,'') text = text.replace(/[^\d]/g,'')
this.state.distdata[index].restrict =text;
let rowIndex =this.state.distdata.findIndex((o)=>{return o.title == rowdata.title})
this.state.distdata[rowIndex].restrict =text;
this.setState({distdata:this.state.distdata}) this.setState({distdata:this.state.distdata})
} }
@ -547,7 +543,8 @@ export default class acclist extends React.Component{
issued:row.quantity,//发放总量 issued:row.quantity,//发放总量
describe:row.describe, describe:row.describe,
date_time:[row.begin_time,row.end_time], date_time:[row.begin_time,row.end_time],
range:row.range range:row.range,
restrict:row.restrict,
} }
let arr = _.map(row.product,(res)=>{ let arr = _.map(row.product,(res)=>{
@ -568,6 +565,7 @@ export default class acclist extends React.Component{
}) })
this.setState({tempdata:temp}) this.setState({tempdata:temp})
this.setState({drawerVisible:true}) this.setState({drawerVisible:true})
@ -846,11 +844,11 @@ export default class acclist extends React.Component{
if(com == "restrict") if(com == "restrict")
{ {
return <Input placeholder="请输入数量" type="number" width={120} value={rowData.restrict} onChange={(e)=>{this.onRestrict(e,rowData)}} /> return <Input placeholder="请输入数量" type="number" width={120} value={rowData.restrict} onChange={(e)=>{this.onRestrict(e,rowData,rowIndex)}} />
} }
if(com == "edit") if(com == "edit")
{ {
return <Button type="primary" onClick={(e)=>{this.rowItemClick(rowData,rowIndex)}}>编辑</Button> return <span onClick={(e)=>{this.rowItemClick(rowData,rowIndex)}} style={{color:"#2B66F2"}} >编辑</span>
} }