123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- import React,{Component} from "react";
- import {Form, Input, Button, Checkbox, Select, Spin} from 'antd';
- import $ from "jquery/src/ajax";
- import {message, Modal} from "antd";
- class AddOfficialFeePrice extends Component{
- constructor(props) {
- super(props);
- this.state={
- loading: false,
- list:[]
- }
- this.getContactsOption = this.getContactsOption.bind(this);
- }
- componentDidMount() {
- this.getContactsOption();
- }
- //增加 修改
- addSoftWritingPriceFn(e) {
- e.preventDefault();
- this.props.form.validateFields((err, values) => {
- if (!err) {
- this.setState({
- loading: true
- });
- let api ;
- if(Object.keys(this.props.infor).length){
- api = '/api/admin/company/updateOfficialFeePrice';
- values.id = this.props.infor.id;
- } else {
- api = '/api/admin/company/addOfficialFeePrice';
- }
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url:globalConfig.context + api,
- data:values,
- }).done(function (data) {
- this.setState({
- loading: false
- });
- if (!data.error.length) {
- message.success(Object.keys(this.props.infor).length ? '修改成功!' : '新增成功!');
- this.props.successFn();
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this));
- }
- });
- }
- getContactsOption() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/admin/orderProject/getPatentType',
- success: function (data) {
- if (data.error.length === 0) {
- this.setState({
- list:data.data
- })
- }else{
- message.warning(data.error[0].message);
- };
- }.bind(this)
- });
- }
- render() {
- const { getFieldDecorator } = this.props.form;
- return (
- <Modal
- maskClosable={false}
- className="customeDetails"
- title={Object.keys(this.props.infor).length ? "修改" : "新增"}
- width='350px'
- visible={this.props.visible}
- onCancel={this.props.onCancel}
- footer={null}
- >
- <Spin spinning={this.state.loading}>
- <Form onSubmit={(e)=>{
- this.addSoftWritingPriceFn(e)
- }}>
- <Form.Item label="项目类型">
- {getFieldDecorator('patentType', {
- initialValue: this.props.infor.patentType,
- rules: [{ required: true, message: '请选择项目类型!' }],
- })(
- <Select style={{ width:'200px'}}>
- {
- this.state.list.map((v,k)=>(
- <Select.Option key={k} value={v.id}>{v.name}</Select.Option>
- ))
- }
- </Select>
- )}
- </Form.Item>
- <Form.Item label="专利类型">
- {getFieldDecorator('type', {
- initialValue: this.props.infor.type,
- rules: [{ required: true, message: '请选择专利类型!' }],
- })(
- <Select style={{ width:'200px'}}>
- <Select.Option value={0}>实用新型</Select.Option>
- <Select.Option value={1}>发明专利</Select.Option>
- <Select.Option value={2}>外观专利</Select.Option>
- </Select>
- )}
- </Form.Item>
- <Form.Item label="金额">
- {getFieldDecorator('amount', {
- initialValue: this.props.infor.amount,
- rules: [{ required: true, message: '请输入金额!' }],
- })(
- <Input placeholder="请输入金额" type={'number'} style={{width:'250px'}}/>
- )}
- </Form.Item>
- <Form.Item label="减缴比例85%">
- {getFieldDecorator('proportion85', {
- initialValue: this.props.infor.proportion85,
- rules: [{ required: false, message: '请输入减缴比例85%!' }],
- })(
- <Input placeholder="请输入减缴比例85%" type={'number'} style={{width:'250px'}}/>
- )}
- </Form.Item>
- <Form.Item label="备注">
- {getFieldDecorator('remarks', {
- initialValue: this.props.infor.remarks,
- rules: [{ required: false, message: '请输入备注!' }],
- })(
- <Input placeholder="请输入备注" type={'textarea'} style={{width:'250px'}}/>
- )}
- </Form.Item>
- <Form.Item>
- <Button style={{
- width: '100%',
- marginTop: '18px',
- }} type="primary" htmlType="submit">
- {
- Object.keys(this.props.infor).length ? '确定修改' : '确定添加'
- }
- </Button>
- </Form.Item>
- </Form>
- </Spin>
- </Modal>
- )
- }
- }
- const WrappedHorizontalLoginForm = Form.create()(AddOfficialFeePrice);
- export default WrappedHorizontalLoginForm
|