83 lines
2.5 KiB
JavaScript
83 lines
2.5 KiB
JavaScript
import React from 'react'
|
|
import { Button, Modal, Row, Col, message } from 'antd';
|
|
import { WeaTextarea, WeaInput } from "ecCom";
|
|
import { logColumns, dataSource } from "../../common/columns"
|
|
import RequiredLabelTip from "../../components/requiredLabelTip"
|
|
|
|
export default class EditModal extends React.Component {
|
|
constructor(props) {
|
|
super(props)
|
|
this.state = {
|
|
name: "",
|
|
remark: ""
|
|
}
|
|
}
|
|
|
|
componentWillMount() { // 初始化渲染页面
|
|
this.setState({
|
|
name: this.props.name,
|
|
remark: this.props.remark
|
|
})
|
|
}
|
|
|
|
validate() {
|
|
if(this.state.name == "") {
|
|
message.warning("个税扣缴义务人名称不能为空");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
submitAdd() {
|
|
if(this.validate()) {
|
|
this.props.onSubmitAdd({name: this.state.name, description: this.state.remark})
|
|
}
|
|
}
|
|
|
|
submitUpdate() {
|
|
if(this.validate) {
|
|
this.props.onSubmitUpdate({id: this.props.currentId, name: this.state.name, description: this.state.remark})
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Modal title={this.props.title} visible={this.props.visible}
|
|
onOk={() => {
|
|
this.props.operate == "add" ? this.submitAdd() : this.submitUpdate();
|
|
}} onCancel={this.props.onCancel}
|
|
>
|
|
<Row gutter={16}>
|
|
<Col span={6}>
|
|
<div className="formLabel">名称:<RequiredLabelTip /></div>
|
|
</Col>
|
|
<Col span={18}>
|
|
<WeaInput
|
|
id="name"
|
|
value={this.state.name}
|
|
onChange={(v) => {this.setState({
|
|
name: v
|
|
})}}
|
|
/>
|
|
</Col>
|
|
</Row>
|
|
|
|
<Row gutter={16} style={{ marginTop: "16px" }}>
|
|
<Col span={6}>
|
|
<div className="formLabel">备注:</div>
|
|
</Col>
|
|
<Col span={18}>
|
|
<WeaTextarea value={this.state.remark} onChange={
|
|
(v) => {
|
|
this.setState({
|
|
remark: v
|
|
})
|
|
}
|
|
} />
|
|
</Col>
|
|
</Row>
|
|
</Modal>
|
|
)
|
|
}
|
|
}
|