Update add.js
This commit is contained in:
parent
2147063834
commit
239294fe0c
|
@ -595,25 +595,22 @@ export default class acclist extends React.Component{
|
|||
|
||||
}
|
||||
|
||||
onNameChange(e,row){
|
||||
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
|
||||
onNameChange(e,row,rowIndex){
|
||||
|
||||
this.state.tempdata[rowIndex].product_name =e.target.value;
|
||||
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})
|
||||
|
@ -1014,18 +1011,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