Commit b0d1be16 authored by xixinzhao's avatar xixinzhao

Bug-1467

parent 7bd365f5
...@@ -18,31 +18,21 @@ class EditableCell extends Component { ...@@ -18,31 +18,21 @@ class EditableCell extends Component {
handleChange = e => { handleChange = e => {
debugger
const { num } = this.state; const { num } = this.state;
const value = e.target.value; const value = e.target.value;
if(value && !AmosValidate.isNum(value)) { if (value && !AmosValidate.isNum(value)) {
AmosAlert.warning('提示', '只能输入数字'); AmosAlert.warning('提示', '只能输入数字');
return null; return null;
}else{ } else {
if (Number(value) > Number(num)){
if(value>num){
AmosAlert.warning('提示', '不能大于剩余数量!'); AmosAlert.warning('提示', '不能大于剩余数量!');
} else {
}else{
this.setState({ value }); this.setState({ value });
if (this.props.onChange) { if (this.props.onChange) {
this.props.onChange(value); this.props.onChange(value);
} }
} }
} }
}; };
check = () => { check = () => {
......
...@@ -68,9 +68,8 @@ const fireEquipmentTableColumns = self => { ...@@ -68,9 +68,8 @@ const fireEquipmentTableColumns = self => {
dataIndex: 'single', dataIndex: 'single',
key: 'single', key: 'single',
width: '10%', width: '10%',
render: (text, record,index) => record.single === 0 ? '' : ( render: (text, record,index) =>
<EditableCell value={text} num={record.amount} onChange={(text) => self.onCellChange(record, text,index)} /> <EditableCell value={text} num={record.amount} onChange={(text) => self.onCellChange(record, text,index)} />
)
} }
]; ];
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment