addSoftWritingPrice.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import React,{Component} from "react";
  2. import {Form, Input, Button, Checkbox, Select} from 'antd';
  3. import $ from "jquery/src/ajax";
  4. import {message, Modal} from "antd";
  5. class AddSoftWritingPrice extends Component{
  6. constructor(props) {
  7. super(props);
  8. this.state={
  9. }
  10. }
  11. //增加
  12. addSoftWritingPriceFn(e) {
  13. e.preventDefault();
  14. this.props.form.validateFields((err, values) => {
  15. if (!err) {
  16. this.setState({
  17. loading: true
  18. });
  19. $.ajax({
  20. method: "post",
  21. dataType: "json",
  22. crossDomain: false,
  23. url:globalConfig.context + '/api/admin/company/addSoftWritingPrice',
  24. data:values,
  25. }).done(function (data) {
  26. this.setState({
  27. loading: false
  28. });
  29. if (!data.error.length) {
  30. message.success('新增成功!');
  31. this.props.successFn();
  32. } else {
  33. message.warning(data.error[0].message);
  34. }
  35. }.bind(this));
  36. }
  37. });
  38. }
  39. render() {
  40. const { getFieldDecorator } = this.props.form;
  41. return (
  42. <Modal
  43. className="customeDetails"
  44. title="新增"
  45. width='350px'
  46. visible={this.props.visible}
  47. onCancel={this.props.onCancel}
  48. footer={null}
  49. >
  50. <Form onSubmit={(e)=>{
  51. this.addSoftWritingPriceFn(e)
  52. }}>
  53. <Form.Item label="公司名称">
  54. {getFieldDecorator('companyName', {
  55. rules: [{ required: true, message: '请输入公司名称!' }],
  56. })(
  57. <Input placeholder="请输入公司名称" style={{width:'250px'}}/>
  58. )}
  59. </Form.Item>
  60. <Form.Item label="单价">
  61. {getFieldDecorator('unitPrice', {
  62. rules: [{ required: true, message: '请输入单价!' }],
  63. })(
  64. <Input placeholder="请输入单价" type={'number'} style={{width:'250px'}}/>
  65. )}
  66. </Form.Item>
  67. <Form.Item label="材料">
  68. {getFieldDecorator('material', {
  69. rules: [{ required: true, message: '请选择是否有材料!' }],
  70. })(
  71. <Select style={{ width:'200px'}}>
  72. <Select.Option value={0}>无</Select.Option>
  73. <Select.Option value={1}>有</Select.Option>
  74. </Select>
  75. )}
  76. </Form.Item>
  77. <Form.Item label="加急天数">
  78. {getFieldDecorator('urgent', {
  79. rules: [{ required: true, message: '请选择加急天数!' }],
  80. })(
  81. <Select style={{ width:'200px'}}>
  82. <Select.Option value={0}>无加急</Select.Option>
  83. <Select.Option value={1}>加急3天</Select.Option>
  84. <Select.Option value={2}>加急4天</Select.Option>
  85. <Select.Option value={3}>加急5-10天</Select.Option>
  86. <Select.Option value={4}>加急11-15天</Select.Option>
  87. <Select.Option value={5}>加急16-20天</Select.Option>
  88. <Select.Option value={6}>加急21-25天</Select.Option>
  89. <Select.Option value={7}>加急26-30天</Select.Option>
  90. </Select>
  91. )}
  92. </Form.Item>
  93. <Form.Item label="备注">
  94. {getFieldDecorator('remarks', {
  95. rules: [{ required: true, message: '请输入备注!' }],
  96. })(
  97. <Input placeholder="请输入备注" type={'textarea'} style={{width:'250px'}}/>
  98. )}
  99. </Form.Item>
  100. <Form.Item>
  101. <Button style={{
  102. width: '100%',
  103. marginTop: '18px',
  104. }} type="primary" htmlType="submit">确定添加</Button>
  105. </Form.Item>
  106. </Form>
  107. </Modal>
  108. )
  109. }
  110. }
  111. const WrappedHorizontalLoginForm = Form.create()(AddSoftWritingPrice);
  112. export default WrappedHorizontalLoginForm