123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import React,{Component} from "react";
- import {Form, Input, Button, Checkbox, Select} from 'antd';
- import $ from "jquery/src/ajax";
- import {message, Modal} from "antd";
- class AddSoftWritingPrice extends Component{
- constructor(props) {
- super(props);
- this.state={
- }
- }
- //增加
- addSoftWritingPriceFn(e) {
- e.preventDefault();
- this.props.form.validateFields((err, values) => {
- if (!err) {
- this.setState({
- loading: true
- });
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url:globalConfig.context + '/api/admin/company/addSoftWritingPrice',
- data:values,
- }).done(function (data) {
- this.setState({
- loading: false
- });
- if (!data.error.length) {
- message.success('新增成功!');
- this.props.successFn();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- }
- });
- }
- render() {
- const { getFieldDecorator } = this.props.form;
- return (
- <Modal
- className="customeDetails"
- title="新增"
- width='350px'
- visible={this.props.visible}
- onCancel={this.props.onCancel}
- footer={null}
- >
- <Form onSubmit={(e)=>{
- this.addSoftWritingPriceFn(e)
- }}>
- <Form.Item label="公司名称">
- {getFieldDecorator('companyName', {
- rules: [{ required: true, message: '请输入公司名称!' }],
- })(
- <Input placeholder="请输入公司名称" style={{width:'250px'}}/>
- )}
- </Form.Item>
- <Form.Item label="单价">
- {getFieldDecorator('unitPrice', {
- rules: [{ required: true, message: '请输入单价!' }],
- })(
- <Input placeholder="请输入单价" type={'number'} style={{width:'250px'}}/>
- )}
- </Form.Item>
- <Form.Item label="材料">
- {getFieldDecorator('material', {
- rules: [{ required: true, message: '请选择是否有材料!' }],
- })(
- <Select style={{ width:'200px'}}>
- <Select.Option value={0}>无</Select.Option>
- <Select.Option value={1}>有</Select.Option>
- </Select>
- )}
- </Form.Item>
- <Form.Item label="加急天数">
- {getFieldDecorator('urgent', {
- rules: [{ required: true, message: '请选择加急天数!' }],
- })(
- <Select style={{ width:'200px'}}>
- <Select.Option value={0}>无加急</Select.Option>
- <Select.Option value={1}>加急3天</Select.Option>
- <Select.Option value={2}>加急4天</Select.Option>
- <Select.Option value={3}>加急5-10天</Select.Option>
- <Select.Option value={4}>加急11-15天</Select.Option>
- <Select.Option value={5}>加急16-20天</Select.Option>
- <Select.Option value={6}>加急21-25天</Select.Option>
- <Select.Option value={7}>加急26-30天</Select.Option>
- </Select>
- )}
- </Form.Item>
- <Form.Item label="备注">
- {getFieldDecorator('remarks', {
- rules: [{ required: true, message: '请输入备注!' }],
- })(
- <Input placeholder="请输入备注" type={'textarea'} style={{width:'250px'}}/>
- )}
- </Form.Item>
- <Form.Item>
- <Button style={{
- width: '100%',
- marginTop: '18px',
- }} type="primary" htmlType="submit">确定添加</Button>
- </Form.Item>
- </Form>
- </Modal>
- )
- }
- }
- const WrappedHorizontalLoginForm = Form.create()(AddSoftWritingPrice);
- export default WrappedHorizontalLoginForm
|