mh_jy_safe_web/src/components/CustomPages/ED/EditQtyModal.js
2025-08-25 10:08:30 +08:00

88 lines
1.9 KiB
JavaScript

import React from 'react'
import { connect } from 'dva'
import { Modal, Form, InputNumber , message } from 'antd'
import CustomPage from '../../Custom/CustomPage'
class EditQtyModal extends React.Component {
constructor(props) {
super(props)
this.state = {
visible: false,
loading: false,
nodeId: "",
product: "",
energyClass: "",
qty: 0,
}
}
componentDidMount () {
if (this.props.onRef) {
this.props.onRef(this)
}
}
showModal = (value) => {
this.setState({
node: value[0],
product: value[1],
energyClass: value[2],
visible: true
})
}
onChange = (value) => {
this.setState({
qty: value
})
}
setQty = () => {
const { qty, node, product, energyClass } = this.state
const json = {
OrgId: this.props.login.OrgId,
Parameter1: node,
Parameter2: product,
Parameter3: energyClass,
Parameter4: qty,
}
this.props.dispatch({
type: 'app/getDataByPost',
url: 'ED/EDUnitUse/EditQty',
payload: json,
onlyData: false,
onComplete: (re) => {
if (re && re.IsSuccessful) {
if (re.Data.IsSucceed === true)
message.success("执行成功")
else
message.error(re.Data.Msg)
}
}
})
}
handleCancel = () => {
this.setState({
visible: false,
})
}
render () {
const { qty } = this.state
return (
<Modal
title='修改定额单耗'
onOk={this.setQty}
maskClosable={false}
onCancel={this.handleCancel}
visible={this.state.visible}
>
<Form.Item label="定额单耗">
<InputNumber value={qty} maxLength={9} onChange={this.onChange} ></InputNumber>
</Form.Item>
</Modal>
)
}
}
export default connect(({ app, editPage, loading, login }) => ({ app, editPage, loading, login }))(Form.create()(EditQtyModal))