| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 | 
							- import React from 'react';
 
- import { Icon, Modal, Button, Form, message, Input, Spin, Checkbox, Select, Row, Col } from 'antd';
 
- import './comprehensive.less';
 
- import ajax from 'jquery/src/ajax/xhr.js'
 
- import $ from 'jquery/src/ajax';
 
- const PatentAddFrom = Form.create()(React.createClass({
 
-     getCompanyList() {
 
-         this.setState({
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "get",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + "/techservice/patent/getUnitNames",
 
-             success: function (data) {
 
-                 if (data.error.length || !data.data) {
 
-                     return;
 
-                 };
 
-                 let _me = this;
 
-                 for (var item in data.data) {
 
-                     _me.state.companyOption.push(
 
-                         <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
 
-                     )
 
-                 };
 
-             }.bind(this),
 
-         }).always(function () {
 
-             this.setState({
 
-                 loading: false
 
-             });
 
-         }.bind(this));
 
-     },
 
-     getInitialState() {
 
-         return {
 
-             loading: false,
 
-             companyOption: [],
 
-             firstCheck: 0,
 
-             secondCheck: 0,
 
-             thirdCheck: 0,
 
-             accelerated: 0,
 
-             acceleratedDate: 0,
 
-             visible:"visible"
 
-         };
 
-     },
 
-     componentWillMount() {
 
-         this.getCompanyList();
 
-     },
 
-     handleSubmit(e) {
 
-         e.preventDefault();
 
-         if ( !this.state.companyName || this.state.companyName === "") {
 
-             message.warning('请先选择公司!');
 
-             return;
 
-         };
 
-         this.props.form.validateFields((err, values) => {
 
-             if (!err) {
 
-                 this.props.spinState(true);
 
-                 $.ajax({
 
-                     method: "POST",
 
-                     dataType: "json",
 
-                     crossDomain: false,
 
-                     url: globalConfig.context + "/techservice/patent/manageApplyPatent",
 
-                     data: {
 
-                         'uid':this.state.companyName,
 
-                         'firstInventorIdNumber': values.firstInventorID,
 
-                         'firstInventorName': values.firstInventorName,
 
-                         'patentDes': values.intro,
 
-                         'secondInventorName': values.secondInventorName,
 
-                         'thirdInventorName': values.thirdInventorName,
 
-                         'firstInventorIsPublish': this.state.firstCheck,
 
-                         'secondInventorIsPublish': this.state.secondCheck,
 
-                         'thirdInventorIsPublish': this.state.thirdCheck,
 
-                         'patentProryStatementUrl': this.state.avatarUrl
 
-                     }
 
-                 }).done(function (data) {
 
-                     if (!data.error.length) {
 
-                         message.success('保存成功!');
 
-                     } else {
 
-                         message.warning(data.error[0].message);
 
-                     }
 
-                 }.bind(this)).always(function () {
 
-                     this.props.spinState(false);
 
-                     this.props.closeModal();
 
-                     this.props.form.resetFields();
 
-                 }.bind(this));
 
-             }
 
-         });
 
-     },
 
-     acceleratedCheck(e) {
 
-         if (e.target.checked == true) {
 
-             this.state.accelerated = 1;
 
-        		this.state.visible = "show";
 
-         } else if (e.target.checked == false) {
 
-             this.state.accelerated = 0;
 
-         	this.state.visible = "visible";
 
-         }
 
-     },
 
-     acceleratedSelect(value) {
 
- 		this.state.acceleratedDate = value;
 
- 	},
 
-     avatarUrl(e) {
 
-         this.state.avatarUrl = e;
 
-     },
 
-     render() {
 
-         const FormItem = Form.Item;
 
-         const { getFieldDecorator } = this.props.form;
 
-         const formItemLayout = {
 
-             labelCol: { span: 3 },
 
-             wrapperCol: { span: 14 },
 
-         };
 
-         const _me = this;
 
-         return (
 
-             <Form horizontal onSubmit={this.handleSubmit} className="person-form">
 
- 				<FormItem
 
- 	              	wrapperCol={{ span: 24 }}
 
- 	          	>
 
- 					<Row>
 
- 						<Col span={ 12 }>
 
- 		                    <Select placeholder="选择公司" 
 
- 			                filterOption={(input, option) => { 
 
- 			                    this.setState({companyId : option.key});
 
- 			                    option.props.value.indexOf(input) >= 0;
 
- 			                }}
 
- 			                onChange={(e)=>{ this.state.companyName = e;}}
 
- 			                showSearch={true} style={{ width: 200 }} >{this.state.companyOption}</Select>
 
- 		                </Col>
 
- 	                	<Col span={ 12 }>
 
- 		                	<Select placeholder="选择联系人" 
 
- 			                filterOption={(input, option) => { 
 
- 			                    this.setState({contactsId : option.key});
 
- 			                    option.props.value.indexOf(input) >= 0;
 
- 			                }}
 
- 			                onChange={(e)=>{ this.state.companyName = e;}}
 
- 			                showSearch={true} style={{ width: 200 }} >{this.state.companyOption}</Select>
 
- 		                </Col>
 
- 		         	</Row>
 
- 				</FormItem>
 
-                 <FormItem
 
-                     labelCol={{ span: 24 }}
 
-                     wrapperCol={{ span: 18 }}
 
-                     label="派单信息"
 
-                 >
 
-                     {getFieldDecorator('intro', {
 
-                         initialValue: this.state.intro || null
 
-                     })(
 
-                         <Input type="textarea"
 
-                             placeholder="多行输入"
 
-                             rows={6} />
 
-                         )}
 
-                 </FormItem>
 
-                 <Row>
 
- 					<Col span={ 12 }>
 
- 						<span>是否加急</span>
 
- 						<Checkbox onChange={this.acceleratedCheck}></Checkbox>
 
- 			          	<Select className={this.state.visible} defaultValue="请选择" style={{ width: 120 }} onChange={this.acceleratedSelect}>
 
- 							<Option value="3">3天</Option>
 
- 							<Option value="5">5天</Option>
 
- 							<Option value="10">10天</Option>
 
- 							<Option value="20">20天</Option>
 
- 						</Select>
 
- 		         	</Col>
 
- 		        </Row>
 
-                 <FormItem
 
-                     {...formItemLayout}
 
-                     label="选择咨询师"
 
-                 >
 
-                     <Select placeholder="选择一个咨询师" 
 
- 			                filterOption={(input, option) => { 
 
- 			                    this.setState({companyId : option.key});
 
- 			                    option.props.value.indexOf(input) >= 0;
 
- 			                }}
 
- 			                onChange={(e)=>{ this.state.companyName = e;}}
 
- 			                showSearch={true} style={{ width: 200 }} >{this.state.companyOption}</Select>
 
-                 </FormItem>
 
-                 <FormItem
 
-                     {...formItemLayout}
 
-                     label="外包公司"
 
-                 >
 
-                     <Select placeholder="外包公司名" 
 
- 			                filterOption={(input, option) => { 
 
- 			                    this.setState({companyId : option.key});
 
- 			                    option.props.value.indexOf(input) >= 0;
 
- 			                }}
 
- 			                onChange={(e)=>{ this.state.companyName = e;}}
 
- 			                showSearch={true} style={{ width: 200 }} >{this.state.companyOption}</Select>
 
-                 </FormItem>
 
-                 
 
-                 <FormItem>
 
-                     <Button className="set-submit" type="primary" htmlType="submit">确认</Button>
 
-                     <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
 
-                 </FormItem>
 
-             </Form >
 
-         );
 
-     },
 
- }));
 
- const PatentAdd = React.createClass({
 
-     getInitialState() {
 
-         return {
 
-             visible: false,
 
-             loading: false
 
-         };
 
-     },
 
-     showModal() {
 
-         this.setState({
 
-             visible: true,
 
-         });
 
-     },
 
-     handleOk() {
 
-         this.setState({
 
-             visible: false,
 
-         });
 
-     },
 
-     handleCancel(e) {
 
-         this.setState({
 
-             visible: false,
 
-         });
 
-         this.props.closeDesc(false);
 
-     },
 
-     spinChange(e) {
 
-         this.setState({
 
-             loading: e
 
-         });
 
-     },
 
-     render() {
 
-         return (
 
-             <div className="patent-addNew">
 
-                 <Button className="patent-addNew" type="primary" onClick={this.showModal}>申请新专利<Icon type="plus" /></Button>
 
-                 <Spin spinning={this.state.loading} className='spin-box'>
 
-                     <Modal title="申请新专利" visible={this.state.visible}
 
-                         onOk={this.handleOk} onCancel={this.handleCancel}
 
-                         width='800px'
 
-                         footer=''
 
-                     >
 
-                         <PatentAddFrom spinState={this.spinChange} closeModal={this.handleCancel} />
 
-                     </Modal>
 
-                 </Spin>
 
-             </div>
 
-         );
 
-     },
 
- });
 
- export default PatentAdd;
 
 
  |