| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470 | 
							- import React from 'react';
 
- import { Icon, Form, Button, Input, Select, Spin, Table, DatePicker, message, Modal, Checkbox, Upload } from 'antd';
 
- import { cognizanceStateList } from '../../../dataDic.js';
 
- import { getCognizanceState, beforeUpload, getBase64 } from '../../../tools.js';
 
- import ajax from 'jquery/src/ajax/xhr.js';
 
- import $ from 'jquery/src/ajax';
 
- class Avatar extends React.Component {
 
-     constructor(props) {
 
-         super(props);
 
-         this.state = {
 
-             imageUrl: ''
 
-         }
 
-     }
 
-     handleChange(info) {
 
-         if (!this.props.oid || this.props.oid === "") {
 
-             message.warning('请先选择公司!');
 
-             return;
 
-         };
 
-         if (info.file.status === 'done') {
 
-             // Get this url from response in real world.
 
-             getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
 
-             this.props.urlData(info.file.response.data);
 
-         }
 
-     }
 
-     render() {
 
-         const imageUrl = this.state.imageUrl;
 
-         return (
 
-             <Upload
 
-                 className="avatar-uploader"
 
-                 name="avatar"
 
-                 showUploadList={false}
 
-                 action={globalConfig.context + "/techservice/patent/patentFile"}
 
-                 data={{ 'sign': this.props.name, 'oid': this.props.oid }}
 
-                 beforeUpload={beforeUpload}
 
-                 onChange={this.handleChange.bind(this)}
 
-             >
 
-                 {
 
-                     imageUrl ?
 
-                         <img src={imageUrl} role="presentation" className="avatar" /> :
 
-                         <Icon type="plus" className="avatar-uploader-trigger" />
 
-                 }
 
-             </Upload>
 
-         );
 
-     }
 
- };
 
- const ApplyChangeFrom = Form.create()(React.createClass({
 
-     loadData() {
 
-         this.setState({
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "post",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + "/api/admin/cognizanceDetail",
 
-             data: {
 
-                 cid: this.props.data.cid,
 
-                 uid: this.props.data.uid,
 
-                 year: this.props.data.year
 
-             },
 
-             success: function (data) {
 
-                 if (data.error.length || !data.data) {
 
-                     message.warning(data.error[0].message);
 
-                     return;
 
-                 };
 
-                 this.state.data = data.data;
 
-                 this.state.cid = this.props.data.cid;
 
-                 this.state.moneyTable = [{
 
-                     key: 1,
 
-                     year: '第一年',
 
-                     netAsset: data.data.netAsset1,
 
-                     salesRevenue: data.data.salesRevenue1,
 
-                     grossProfit: data.data.grossProfit1
 
-                 }, {
 
-                     key: 2,
 
-                     year: '第二年',
 
-                     netAsset: data.data.netAsset2,
 
-                     salesRevenue: data.data.salesRevenue2,
 
-                     grossProfit: data.data.grossProfit2
 
-                 }, {
 
-                     key: 3,
 
-                     year: '第三年',
 
-                     netAsset: data.data.netAsset3,
 
-                     salesRevenue: data.data.salesRevenue3,
 
-                     grossProfit: data.data.grossProfit3
 
-                 }];
 
-             }.bind(this),
 
-         }).always(function () {
 
-             this.setState({
 
-                 loading: false
 
-             });
 
-         }.bind(this));
 
-     },
 
-     getStateData() {
 
-         this.setState({
 
-             loading: true
 
-         });
 
-         $.ajax({
 
-             method: "post",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             url: globalConfig.context + "/api/admin/cognizanceLog",
 
-             data: {
 
-                 cid: this.props.data.cid
 
-             },
 
-             success: function (data) {
 
-                 if (data.error.length || !data.data) {
 
-                     message.warning(data.error[0].message);
 
-                     return;
 
-                 };
 
-                 this.state.stateTable = [];
 
-                 for (let i = 0; i < data.data.length; i++) {
 
-                     this.state.stateTable.push({
 
-                         key: i,
 
-                         recordTimeFormattedDate: data.data[i].recordTimeFormattedDate,
 
-                         state: data.data[i].state,
 
-                         principal: data.data[i].principal,
 
-                         comment: data.data[i].comment
 
-                     });
 
-                 };
 
-             }.bind(this),
 
-         }).always(function () {
 
-             this.setState({
 
-                 loading: false
 
-             });
 
-         }.bind(this));
 
-     },
 
-     getInitialState() {
 
-         return {
 
-             loading: false,
 
-             stateOption: [],
 
-             introduce:'',
 
-             projectCheck: 0,
 
-             subsidy: 0,
 
-             stateColumns: [{
 
-                 title: '专利状态',
 
-                 dataIndex: 'state',
 
-                 key: 'state',
 
-                 render: (text) => { return getCognizanceState(text) }
 
-             }, {
 
-                 title: '处理时间',
 
-                 dataIndex: 'recordTimeFormattedDate',
 
-                 key: 'recordTimeFormattedDate',
 
-             }, {
 
-                 title: '负责人',
 
-                 dataIndex: 'principal',
 
-                 key: 'principal',
 
-             }, {
 
-                 title: '备注',
 
-                 dataIndex: 'comment',
 
-                 key: 'comment',
 
-             }],
 
-             stateTable: []
 
-         };
 
-     },
 
-     componentWillMount() {
 
-         let _me = this;
 
-         cognizanceStateList.map(function (item) {
 
-             _me.state.stateOption.push(
 
-                 <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
 
-             )
 
-         });
 
-         this.loadData();
 
-         this.getStateData();
 
-     },
 
-     handleSubmit(e) {
 
-         e.preventDefault();
 
-         this.props.form.validateFields((err, values) => {
 
-             if (values.state || values.principal || values.recordTime || values.comment) {
 
-                 if (!values.state && !values.principal && !values.recordTime) {
 
-                     message.warning("请填写完整的状态流转信息!");
 
-                     return;
 
-                 };
 
-             };
 
-             if (!err) {
 
-                 this.props.spinState(true);
 
-                 $.ajax({
 
-                     method: "POST",
 
-                     dataType: "json",
 
-                     crossDomain: false,
 
-                     url: globalConfig.context + "/api/admin/disposeCognizanceDetail",
 
-                     data: {
 
-                         id: this.props.data.cid,
 
-                         technicalField: values.technicalField,
 
-                         basicResearchCost: values.basicResearchCost,
 
-                         accident: values.accident,
 
-                         recordTimeFormattedDate: values.recordTime ? values.recordTime.format("YYYY-MM-DD") : undefined,
 
-                         state: values.state,
 
-                         principal: values.principal,
 
-                         comment: values.comment,
 
-                     }
 
-                 }).done(function (data) {
 
-                     if (!data.error.length) {
 
-                         message.success('保存成功!');
 
-                         this.props.closeModal();
 
-                         this.props.form.resetFields();
 
-                         this.state.targetKeys = [];
 
-                         this.state.selectedKeys = [];
 
-                         this.props.spinState(false);
 
-                     } else {
 
-                         message.warning(data.error[0].message);
 
-                         this.props.spinState(false);
 
-                     }
 
-                 }.bind(this));
 
-             }
 
-         });
 
-     },
 
-     componentWillReceiveProps(nextProps) {
 
-         if (!this.props.visible && nextProps.visible) {
 
-             this.getStateData();
 
-             this.loadData();
 
-         };
 
-         if (nextProps.data) {
 
-             this.state.xid = nextProps.data.pid;
 
-         }
 
-     },
 
-     projectEstablishmentCheck(e) {
 
-         if (e.target.checked == true) {
 
-             this.state.projectCheck = 1;
 
-         } else if (e.target.checked == false) {
 
-             this.state.projectCheck = 0;
 
-         };
 
-     },
 
-     subsidyCheck(e) {
 
-         if (e.target.checked == true) {
 
-             this.state.subsidy = 1;
 
-         } else if (e.target.checked == false) {
 
-             this.state.subsidy = 0;
 
-         };
 
-     },
 
-     avatarUrl(e) {
 
-         this.state.avatarUrl = e;
 
-     },
 
-     render() {
 
-         const FormItem = Form.Item;
 
-         const { getFieldDecorator } = this.props.form;
 
-         const theData = this.state.data;
 
-         const formItemLayout = {
 
-             labelCol: { span: 6 },
 
-             wrapperCol: { span: 12 },
 
-         };
 
-         const _me = this;
 
-         if (this.state.data) {
 
-             return (
 
-                 <Form onSubmit={this.handleSubmit} id="highTechApply-form">
 
-                     <div className="clearfix">
 
-                         <div className="half-item">
 
-                             <span className="item-title">公司名称: </span>
 
-                             <span>{theData.unitName}</span>
 
-                         </div>
 
-                         <div className="half-item">
 
-                             <span className="item-title">公司组织机构代码: </span>
 
-                             <span>{theData.orgCode}</span>
 
-                         </div>
 
-                         <div className="half-item">
 
-                             <span className="item-title">公司地址: </span>
 
-                             <span>{theData.postalAddress}</span>
 
-                         </div>
 
-                         <div className="half-item">
 
-                             <span className="item-title">联系人: </span>
 
-                             <span>{theData.contacts}</span>
 
-                         </div>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                         <FormItem className="third-item"
 
-                             {...formItemLayout}
 
- 	                            label="科技部门"
 
- 	                        >
 
- 	                            {getFieldDecorator('technicalDepartment')(
 
- 	                                <Select placeholder="选择科技部门">{this.props.authorOption}</Select>
 
- 	                            )}
 
- 	                 	</FormItem>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                         <div className="half-item">
 
-                             <span className="item-title">派单信息: </span>
 
-                             <span>{theData.firmTotal}</span>
 
-                         </div>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                     	<div className="half-item">
 
- 	                        <FormItem
 
- 		                        labelCol={{ span: 4 }}
 
-                         		wrapperCol={{ span: 12 }}
 
- 		                        label="项目名称"
 
- 		                    >
 
- 		                        {getFieldDecorator('projectName')(
 
- 		                            <Input />
 
- 		                        )}
 
- 		                    </FormItem>
 
- 	                    </div>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                     	<div className="half-item">
 
- 	                        <FormItem
 
- 		                        labelCol={{ span: 4 }}
 
- 	                        	wrapperCol={{ span: 12 }}
 
- 		                        label="项目类型"
 
- 		                    >
 
- 		                        {getFieldDecorator('projectType')(
 
- 		                            <Input />
 
- 		                        )}
 
- 		                    </FormItem>
 
- 	                    </div>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                     	<div className="half-item">
 
- 	                        <FormItem
 
- 		                        labelCol={{ span: 4 }}
 
- 	                        	wrapperCol={{ span: 12 }}
 
- 		                        label="技术领域"
 
- 		                    >
 
- 		                        {getFieldDecorator('technicalField')(
 
- 		                            <Input />
 
- 		                        )}
 
- 		                    </FormItem>
 
- 		                </div>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                      	<span className="item-title">项目简介: </span>
 
-                       	<Input type="textarea"
 
-                           	placeholder="多行输入"
 
-                          	value={this.state.introduce}
 
-                           	onChange={(e) => { this.setState({ introduce: e.target.value }); } }
 
-                           	rows={6} />
 
-                     </div>
 
-                     <div className="clearfix">
 
-                         <div className="half-item">
 
-                             <span className="item-title">是否立项: </span>
 
-                             <Checkbox onChange={this.projectEstablishmentCheck}></Checkbox>
 
-                         </div>
 
-                         <div className="half-item">
 
-                             <FormItem
 
- 			                    {...formItemLayout}
 
- 			                    label="立项金额"
 
- 			                >
 
- 			                    {getFieldDecorator('projectAmounts')(
 
- 			                        <Input className="mini-input" />
 
- 			                    )}
 
- 			                </FormItem>
 
-                         </div>
 
-                     </div>
 
-                     <div className="clearfix">
 
-                         <div className="half-item">
 
-                             <span className="item-title">是否后补助: </span>
 
-                             <Checkbox onChange={this.subsidyCheck}></Checkbox>
 
-                         </div>
 
-                     </div>
 
-                     <div>
 
-                     	<FormItem
 
- 			             	{...formItemLayout}
 
- 			              	label="项目材料上传"
 
- 			             	labelCol={{ span: 24 }}
 
- 			           		wrapperCol={{ span: 12 }}
 
- 			          	>
 
- 			           		{getFieldDecorator('avatar')(
 
- 			                 	<Avatar urlData={this.avatarUrl} name='patent_prory_statement' oid={theData.unitName} />
 
- 			            	)}
 
- 			          	</FormItem>
 
-                     </div>
 
-                     <div className="form-title">状态流转记录: </div>
 
-                     <Table pagination={false} dataSource={this.state.stateTable} columns={this.state.stateColumns} />
 
-                     <div className="clearfix">
 
-                         <FormItem className="third-item"
 
-                             {...formItemLayout}
 
-                             label="状态流转"
 
-                         >
 
-                             {getFieldDecorator('state')(
 
-                                 <Select placeholder="选择一个状态">{this.state.stateOption}</Select>
 
-                             )}
 
-                         </FormItem>
 
-                         <FormItem className="third-item"
 
-                             labelCol={{ span: 6 }}
 
-                             wrapperCol={{ span: 12 }}
 
-                             label="处理时间"
 
-                         >
 
-                             {getFieldDecorator('recordTime')(
 
-                                 <DatePicker />
 
-                             )}
 
-                         </FormItem>
 
-                         <FormItem className="third-item"
 
-                             {...formItemLayout}
 
-                             label="负责人"
 
-                         >
 
-                             {getFieldDecorator('principal')(
 
-                                 <Select placeholder="选择负责人">{this.props.authorOption}</Select>
 
-                             )}
 
-                         </FormItem>
 
-                     </div>
 
-                     <FormItem
 
-                         labelCol={{ span: 2 }}
 
-                         wrapperCol={{ span: 12 }}
 
-                         label="备注"
 
-                     >
 
-                         {getFieldDecorator('comment')(
 
-                             <Input />
 
-                         )}
 
-                     </FormItem>
 
-                     <FormItem style={{ marginTop: '20px' }}>
 
-                         <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
 
-                         <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
 
-                     </FormItem>
 
-                 </Form >
 
-             );
 
-         } else {
 
-             return (<div></div>)
 
-         };
 
-     },
 
- }));
 
- const ApplyChange = React.createClass({
 
-     getInitialState() {
 
-         return {
 
-             visible: false,
 
-             loading: false
 
-         };
 
-     },
 
-     componentWillReceiveProps(nextProps) {
 
-         this.state.visible = nextProps.showDesc
 
-     },
 
-     showModal() {
 
-         this.setState({
 
-             visible: true,
 
-         });
 
-     },
 
-     handleOk() {
 
-         this.setState({
 
-             visible: false,
 
-         });
 
-         this.props.closeDesc(false);
 
-     },
 
-     handleCancel(e) {
 
-         this.setState({
 
-             visible: false,
 
-         });
 
-         this.props.closeDesc(false);
 
-     },
 
-     spinChange(e) {
 
-         this.setState({
 
-             loading: e
 
-         });
 
-     },
 
-     render() {
 
-         return (
 
-             <div className="patent-addNew">
 
-                 <Spin spinning={this.state.loading} className='spin-box'>
 
-                     <Modal title="编辑科技项目" visible={this.state.visible}
 
-                         onOk={this.handleOk} onCancel={this.handleCancel}
 
-                         width='1000px'
 
-                         footer=''
 
-                     >
 
-                         <ApplyChangeFrom
 
-                             visible={this.state.visible}
 
-                             authorOption={this.props.authorOption}
 
-                             data={this.props.data}
 
-                             spinState={this.spinChange} closeModal={this.handleCancel} />
 
-                     </Modal>
 
-                 </Spin>
 
-             </div>
 
-         );
 
-     }
 
- });
 
- export default ApplyChange;
 
 
  |