This commit is contained in:
姜棚 2021-12-09 18:29:48 +08:00
parent 98c71ab171
commit 71bc0eed61
4 changed files with 16 additions and 9 deletions

View File

@ -646,7 +646,8 @@ export default class acclist extends React.Component{
} }
onQuantityChange(e,row,rowIndex){ onQuantityChange(e,row,rowIndex){
this.state.tempdata[rowIndex].quantity =e.target.value; this.state.tempdata[rowIndex].quantity =e.target.value == "" ? 0 : e.target.value;
this.state.tempdata[rowIndex].stock = e.target.value == "" ? 0 : e.target.value;
this.setState({tempdata:this.state.tempdata}) this.setState({tempdata:this.state.tempdata})
} }
onPriceChange(e,row,rowIndex){ onPriceChange(e,row,rowIndex){

View File

@ -355,9 +355,12 @@ export default class exchangedit extends React.Component{
this.setState({tempdata:this.state.tempdata}) this.setState({tempdata:this.state.tempdata})
} }
onQuantityChange(e,row){ onQuantityChange(e,row){
this.setState({tempdata:this.state.tempdata})
let value = e.target.value == "" ? 0 : e.target.value;
let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id}) let rowIndex =this.state.tempdata.findIndex((o)=>{return o.product_id == row.product_id})
this.state.tempdata[rowIndex].quantity =e.target.value; this.state.tempdata[rowIndex].quantity = value;
this.state.tempdata[rowIndex].stock =e.target.value - this.state.tempdata[rowIndex].usage ; this.state.tempdata[rowIndex].stock = value - this.state.tempdata[rowIndex].usage ;
this.setState({tempdata:this.state.tempdata}) this.setState({tempdata:this.state.tempdata})
} }
onPriceChange(e,row){ onPriceChange(e,row){

View File

@ -231,6 +231,7 @@ export default class acclist extends React.Component{
sum += parseInt( o.quantity); sum += parseInt( o.quantity);
}) })
console.log("sum",sum) console.log("sum",sum)
if(sum < this.state.codeInfo.issued) if(sum < this.state.codeInfo.issued)
{ {
@ -487,9 +488,8 @@ export default class acclist extends React.Component{
} }
onQuantityChange(e,row,rowIndex){ onQuantityChange(e,row,rowIndex){
this.state.tempdata[rowIndex].quantity =e.target.value == "" ? 0 : e.target.value;
this.state.tempdata[rowIndex].quantity =e.target.value; this.state.tempdata[rowIndex].stock = e.target.value == "" ? 0 : e.target.value;
this.state.tempdata[rowIndex].stock = e.target.value;
this.setState({tempdata:this.state.tempdata}) this.setState({tempdata:this.state.tempdata})
} }
onPriceChange(e,row,rowIndex){ onPriceChange(e,row,rowIndex){

View File

@ -525,9 +525,12 @@ export default class acclist extends React.Component{
this.setState({tempdata:this.state.tempdata}) this.setState({tempdata:this.state.tempdata})
} }
onQuantityChange(e,row,rowIndex){ onQuantityChange(e,row,rowIndex){
let value = e.target.value == "" ? 0 : e.target.value;
this.state.tempdata[rowIndex].stock = e.target.value - this.state.tempdata[rowIndex].usage;
this.state.tempdata[rowIndex].quantity =e.target.value;
this.state.tempdata[rowIndex].stock = value - this.state.tempdata[rowIndex].usage;
this.state.tempdata[rowIndex].quantity =value;
this.setState({tempdata:this.state.tempdata}) this.setState({tempdata:this.state.tempdata})
} }
onPriceChange(e,row,rowIndex){ onPriceChange(e,row,rowIndex){