app-base-web
Version:
web development common base package.
112 lines (109 loc) • 4.05 kB
JavaScript
import React from 'react'
import {Form, Row, Col, Button, Input, message} from 'antd'
import api from '../../../library/util-axios'
import UtilDate from '../../../library/util-date'
import Attachment from '../../../library/attachment'
import Select from '../../../library/select'
const title = "业务咨询"
const url = "Advisory/"
const StateReply = {
"0": "未回复",
"1": "已回复"
}
export default class FormEdit extends React.Component {
constructor(props) {
super(props)
this.state = {
...props.values
}
this.formRef = React.createRef()
}
onSave = (values) => {
let me = this
values.id = this.state.id
api.post(url + "save", values).then(function (rs) {
if (rs.success) {
message.info(rs.msg)
me.props.onSave(values)
} else {
message.error(rs.msg)
}
})
}
render() {
return (
<Form ref={this.formRef} onFinish={this.onSave} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} className="form-view">
<div className="form-title">
<i> {title} - {this.state.id ? "编辑" : "录入"}</i>
{this.state.id ? <span><Button className="btn-return" onClick={this.props.onEditReturn}><i
className="iconfont icon-return"></i>返回</Button></span> : ""}
</div>
<div className="form-content" style={{height: this.props.height}}>
<Row>
<Col xs={{span: 10, offset: 2}}><label>会员名称</label><span>{this.state.userName}</span></Col>
<Col xs={12}>
<Form.Item
labelCol={{span: 6}}
wrapperCol={{span: 18}}
name="expertId"
label="专家名称"
initialValue={String(this.state.expertId || "")}
>
<Select url="User/options" params={{isExpert: 1}}/>
</Form.Item>
</Col>
</Row>
<Row>
<Col xs={{span: 10, offset: 2}}><label>回复状态</label><span>{StateReply[this.state.reply]}</span></Col>
</Row>
<Row>
<Col
xs={{
span: 10,
offset: 2
}}><label>预约时间</label><span>{UtilDate.getDate(this.state.reservationTime)}</span></Col>
<Col
xs={{span: 10, offset: 2}}><label>创建时间</label><span>{UtilDate.getDateTime(this.state.createTime)}</span></Col>
</Row>
<Row>
<Col xs={{span: 10, offset: 2}}><label>主题</label><span>{this.state.subject}</span></Col>
</Row>
<Row>
<Col xs={{span: 10, offset: 2}}><label>专利号</label><span>{this.state.ano}</span></Col>
</Row>
<Row>
<Col xs={{span: 10, offset: 2}}> <Attachment type="img" style={{height: "40px", width: "40px"}}
url={this.state.fileUrl}/></Col>
</Row>
<Row>
<Col xs={{span: 22, offset: 2}}><label>内容</label><span>{this.state.content}</span></Col>
</Row>
<Row>
<Col
xs={{
span: 10,
offset: 2
}}><label>专家回复时间</label><span>{UtilDate.getDateTime(this.state.replyTime)}</span></Col>
</Row>
<Row>
<Col xs={24}>
<Form.Item
labelCol={{span: 4}}
wrapperCol={{span: 20}}
name="replyContent"
label="回复内容"
initialValue={this.state.replyContent}
>
<Input/>
</Form.Item>
</Col>
</Row>
</div>
<div className="form-toolbar">
<Button className="btn-cancel" onClick={this.props.onCancel}><i className="iconfont icon-cancel"></i>取消</Button>
<Button className="btn-submit" htmlType="submit"><i className="iconfont icon-submit"></i>提交</Button>
</div>
</Form>
)
}
}