Update step2.js
This commit is contained in:
parent
c95fc91ea4
commit
2147063834
|
@ -449,26 +449,33 @@ export default class acclist extends React.Component{
|
|||
|
||||
}
|
||||
|
||||
onNameChange(e,row){
|
||||
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
|
||||
|
||||
this.state.tempdata[rowIndex].product_name =e.target.value;
|
||||
this.setState({tempdata:this.state.tempdata})
|
||||
onNameChange(e,row,rowIndex){
|
||||
|
||||
this.state.tempdata[rowIndex].product_name =e.target.value;
|
||||
|
||||
let arr = _.map(this.state.tempdata,(res)=>{
|
||||
let obj = {};
|
||||
obj.key = res.product_id;
|
||||
obj.text= res.product_name;
|
||||
return obj;
|
||||
})
|
||||
this.setState({rankoptions:arr})
|
||||
this.setState({rank:arr})
|
||||
this.setState({tempdata:this.state.tempdata})
|
||||
|
||||
}
|
||||
onQuantityChange(e,row){
|
||||
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
|
||||
|
||||
onQuantityChange(e,row,rowIndex){
|
||||
|
||||
this.state.tempdata[rowIndex].quantity =e.target.value;
|
||||
this.setState({tempdata:this.state.tempdata})
|
||||
}
|
||||
onPriceChange(e,row){
|
||||
onPriceChange(e,row,rowIndex){
|
||||
|
||||
let str = e.target.value;
|
||||
let value= str.replace(/[^\d^\.]+/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')
|
||||
|
||||
|
||||
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
|
||||
|
||||
|
||||
this.state.tempdata[rowIndex].contract_price = value;
|
||||
this.setState({tempdata:this.state.tempdata})
|
||||
}
|
||||
|
@ -927,18 +934,18 @@ export default class acclist extends React.Component{
|
|||
|
||||
|
||||
}}
|
||||
ComponentHandler={(com,rowData)=>{
|
||||
ComponentHandler={(com,rowData,rowIndex)=>{
|
||||
if(com=="product_name")
|
||||
{
|
||||
return <Input width={140} placeholder="请输入商品名称" value={rowData.product_name} onChange={(e)=>{this.onNameChange(e,rowData)}} />
|
||||
return <Input width={140} placeholder="请输入商品名称" value={rowData.product_name} onChange={(e)=>{this.onNameChange(e,rowData,rowIndex)}} />
|
||||
}
|
||||
if(com=="quantity")
|
||||
{
|
||||
return <Input width={140} placeholder="请输入数量" type="number" value={rowData.quantity} onChange={(e)=>{this.onQuantityChange(e,rowData)}} />
|
||||
return <Input width={140} placeholder="请输入数量" type="number" value={rowData.quantity} onChange={(e)=>{this.onQuantityChange(e,rowData,rowIndex)}} />
|
||||
}
|
||||
if(com =="contract_price" )
|
||||
{
|
||||
return <Input width={140} placeholder="请输入合同价" value={rowData.contract_price} onChange={(e)=>{this.onPriceChange(e,rowData)}} />
|
||||
return <Input width={140} placeholder="请输入合同价" value={rowData.contract_price} onChange={(e)=>{this.onPriceChange(e,rowData,rowIndex)}} />
|
||||
}
|
||||
|
||||
if(com == "show_url")
|
||||
|
|
Loading…
Reference in New Issue