| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480 | 
							- import React from 'react';
 
- import { Icon, Modal, message, Spin, Input, Select, DatePicker, Button, Row, Col, Table, Form, Upload } from 'antd';
 
- import './comprehensive.less';
 
- import ajax from 'jquery/src/ajax/xhr.js';
 
- import $ from 'jquery/src/ajax';
 
- import { copyrightStateList } from '../../../dataDic.js';
 
- import { getCopyrightState, getTime, copyrightDownloadFile, beforeUploadFile } from '../../../tools.js';
 
- const CopyrightDescForm = Form.create()(React.createClass({
 
-     getInitialState() {
 
-         return {
 
-             visible: false,
 
-             loading: false,
 
-             stateOption: [],
 
-             stateTable: [],
 
-             contactsOption: [],
 
-             stateColumns: [{
 
-                 title: '申请状态',
 
-                 dataIndex: 'status',
 
-                 key: 'status',
 
-                 render: (text) => { return getCopyrightState(text) }
 
-             }, {
 
-                 title: '处理时间',
 
-                 dataIndex: 'recordTimeFormattedDate',
 
-                 key: 'recordTimeFormattedDate',
 
-             }, {
 
-                 title: '负责人',
 
-                 dataIndex: 'principal',
 
-                 key: 'principal',
 
-             }, {
 
-                 title: '操作人',
 
-                 dataIndex: 'operator',
 
-                 key: 'operator',
 
-             }, {
 
-                 title: '备注',
 
-                 dataIndex: 'comment',
 
-                 key: 'comment',
 
-             }]
 
-         };
 
-     },
 
-     componentWillMount() {
 
-         let _me = this;
 
-         copyrightStateList.map(function (item) {
 
-             _me.state.stateOption.push(
 
-                 <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
 
-             )
 
-         });
 
-         this.loadData();
 
-     },
 
-     loadData(uid, id) {
 
-         this.setState({
 
-             loading: true
 
-         });
 
-         $.when($.ajax({
 
-             method: "get",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             cache: false,
 
-             url: globalConfig.context + "/api/admin/copyright/logs",
 
-             data: {
 
-                 id: id || this.props.data.id
 
-             }
 
-         }), $.ajax({
 
-             method: "post",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             cache: false,
 
-             url: globalConfig.context + "/api/admin/getContacts",
 
-             data: {
 
-                 uid: uid || this.props.data.uid
 
-             }
 
-         }), $.ajax({
 
-             method: "get",
 
-             dataType: "json",
 
-             crossDomain: false,
 
-             cache: false,
 
-             url: globalConfig.context + "/api/admin/copyright/detail",
 
-             data: {
 
-                 id: id || this.props.data.id
 
-             }
 
-         })).done((data1, data2, data3) => {
 
-             let _me = this;
 
-             //状态流转table
 
-             if (data1[0].error && data1[0].error.length) {
 
-                 message.warning(data1[0].error[0].message);
 
-                 return;
 
-             };
 
-             this.state.stateTable = [];
 
-             data1[0].data.map(function (item, i) {
 
-                 _me.state.stateTable.push({
 
-                     key: i,
 
-                     recordTimeFormattedDate: item.recordTimeFormattedDate,
 
-                     status: item.status,
 
-                     principal: item.principal,
 
-                     operator: item.operator,
 
-                     comment: item.comment
 
-                 });
 
-             });
 
-             //获取联系人
 
-             if (data2[0].error && data2[0].error.length) {
 
-                 message.warning(data2[0].error[0].message);
 
-                 return;
 
-             };
 
-             this.state.contactsOption = [];
 
-             for (let item in data2[0].data) {
 
-                 let theData = data2[0].data[item];
 
-                 _me.state.contactsOption.push(
 
-                     <Select.Option value={item} key={theData}>{theData}</Select.Option>
 
-                 );
 
-             };
 
-             //获取详细数据
 
-             if (!data3[0].data && data3[0].error && data3[0].error.length) {
 
-                 message.warning(data3[0].error[0].message);
 
-                 return;
 
-             };
 
-             let detailData = data3[0].data;
 
-             this.setState({
 
-                 id: detailData.id,
 
-                 province: detailData.province,
 
-                 unitName: detailData.unitName,
 
-                 serialNumber: detailData.serialNumber,
 
-                 createTime: detailData.createTime,
 
-                 acceptTime: detailData.acceptTime,
 
-                 principal: detailData.principal,
 
-                 contact: detailData.contact,
 
-                 copyrightName: detailData.copyrightName,
 
-                 copyrightNumber: detailData.copyrightNumber,
 
-                 status: detailData.status,
 
-                 comment: detailData.comment,
 
-                 workIssue: detailData.workIssue,
 
-                 outsource: detailData.outsource,
 
-                 inUrgent: detailData.inUrgent,
 
-                 authorizedDate: detailData.authorizedDate,
 
-                 fisrtContact: detailData.fisrtContact,
 
-                 secondContact: detailData.secondContact,
 
-                 thirdContact: detailData.thirdContact,
 
-                 city: detailData.city,
 
-                 area: detailData.area,
 
-                 postcode: detailData.postcode,
 
-                 certificateUrl: detailData.certificateUrl,
 
-                 applicationUrl: detailData.applicationUrl,
 
-                 certificateUrlDownloadFileName: detailData.certificateUrlDownloadFileName,
 
-                 applicationUrlDownloadFileName: detailData.applicationUrlDownloadFileName,
 
-                 authorizedDateFormattedDate: detailData.authorizedDateFormattedDate,
 
-                 createTimeFormattedDate: detailData.createTimeFormattedDate,
 
-                 acceptTimeFormattedDate: detailData.acceptTimeFormattedDate,
 
-                 expectTime: [detailData.acceptTime, detailData.inUrgent]
 
-             });
 
-         }).always(function () {
 
-             this.setState({
 
-                 loading: false
 
-             });
 
-         }.bind(this));
 
-     },
 
-     componentWillReceiveProps(nextProps) {
 
-         if (!this.props.visible && nextProps.visible) {
 
-             this.loadData(nextProps.data.uid, nextProps.data.id);
 
-         };
 
-     },
 
-     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/copyright/modify",
 
-                     data: {
 
-                         "id": this.props.data.id,
 
-                         "contact": values.contact, // 联系人, 1,2,3
 
-                         //"copyrightInfo": values.copyrightInfo, // 软著简介,size 0-255
 
-                         "copyrightName": values.copyrightName, // 软著名称, size 0-60
 
-                         "copyrightNumber": values.copyrightNumber,
 
-                         "outsource": values.outsource, // 外包公司, size 0-60
 
-                         "workIssue": values.workIssue, // 派单信息, size 0-128
 
-                         "inUrgent": values.inUrgent, //  加急天数,
 
-                         "status": values.status, // 状态
 
-                         "comment": values.comment, // 备注 size 0-128
 
-                         "recordTime": values.recordTime ? values.recordTime.format("YYYY-MM-DD HH:mm:ss") : undefined, // 状态修改时间 yyyy-MM-dd HH:mm:ss
 
-                         "principal": values.principal // 负责人id
 
-                     }
 
-                 }).done(function (data) {
 
-                     if (!data.error.length) {
 
-                         message.success('保存成功!');
 
-                         this.props.clickOk();
 
-                         this.props.form.resetFields();
 
-                         this.props.spinState(false);
 
-                     } else {
 
-                         message.warning(data.error[0].message);
 
-                         this.props.spinState(false);
 
-                     }
 
-                 }.bind(this));
 
-             }
 
-         });
 
-     },
 
-     render() {
 
-         const FormItem = Form.Item;
 
-         const { getFieldDecorator } = this.props.form;
 
-         const theData = this.state;
 
-         const formItemLayout = {
 
-             labelCol: { span: 6 },
 
-             wrapperCol: { span: 12 },
 
-         };
 
-         const _me = this;
 
-         return (
 
-             <Form onSubmit={this.handleSubmit} id="CopyrightDesc-form">
 
-                 <Row className="express-desc-row">
 
-                     <Col span={4}>公司名称</Col>
 
-                     <Col span={6}>{theData.unitName}</Col>
 
-                     <Col span={4}>公司组织机构代码</Col>
 
-                     <Col span={6}>{theData.unitNumber}</Col>
 
-                 </Row>
 
-                 <Row className="express-desc-row">
 
-                     <Col span={4}>公司地址</Col>
 
-                     <Col span={6}>{theData.province}/{theData.city}/{theData.area}</Col>
 
-                     <Col span={4}>联系人</Col>
 
-                     <Col span={6}>
 
-                         {getFieldDecorator('contact', {
 
-                             rules: [{ required: true, message: '此项为必填项!' }],
 
-                             initialValue: theData.contact
 
-                         })(
 
-                             <Select
 
-                                 style={{ display: 'inline-block', width: '200px' }}
 
-                                 placeholder='选择一个联系人'>
 
-                                 {this.state.contactsOption}
 
-                             </Select>
 
-                             )}
 
-                     </Col>
 
-                 </Row>
 
-                 <Row className="express-desc-row">
 
-                     <Col span={4}>编号</Col>
 
-                     <Col span={6}>{theData.serialNumber}</Col>
 
-                     <Col span={4}>外包公司</Col>
 
-                     <Col span={6}>
 
-                         {getFieldDecorator('outsource', {
 
-                             initialValue: theData.outsource
 
-                         })(
 
-                             <Input placeholder="请输入外包公司" />
 
-                             )}
 
-                     </Col>
 
-                 </Row>
 
-                 <Row className="express-desc-row">
 
-                     <Col span={4}>派单详情</Col>
 
-                     <Col span={16}>
 
-                         {getFieldDecorator('workIssue', {
 
-                             initialValue: theData.workIssue
 
-                         })(
 
-                             <Input type="textarea"
 
-                                 placeholder="多行输入"
 
-                                 rows={6} />
 
-                             )}
 
-                     </Col>
 
-                 </Row>
 
-                 <Row className="express-desc-row">
 
-                     <Col span={4}>软著名称</Col>
 
-                     <Col span={6}>
 
-                         {getFieldDecorator('copyrightName', {
 
-                             initialValue: theData.copyrightName
 
-                         })(
 
-                             <Input style={{ width: 160 }} placeholder="请输入软著名称" />
 
-                             )}
 
-                     </Col>
 
-                     <Col span={4}>软著编号</Col>
 
-                     <Col span={6}>
 
-                         {getFieldDecorator('copyrightNumber', {
 
-                             initialValue: theData.copyrightNumber
 
-                         })(
 
-                             <Input placeholder="请输入软著编号" />
 
-                             )}
 
-                     </Col>
 
-                 </Row>
 
-                 <Row className="express-desc-row">
 
-                     <Col span={4}>加急天数</Col>
 
-                     <Col span={6}>
 
-                         {getFieldDecorator('inUrgent', {
 
-                             initialValue: theData.inUrgent ? String(theData.inUrgent) : undefined
 
-                         })(
 
-                             <Select
 
-                                 placeholder="请选择加急时间"
 
-                                 style={{ width: 160 }}>
 
-                                 <Select.Option value="0">不加急</Select.Option>
 
-                                 <Select.Option value="3">3天</Select.Option>
 
-                                 <Select.Option value="5">5天</Select.Option>
 
-                                 <Select.Option value="10">6-10天</Select.Option>
 
-                                 <Select.Option value="15">11-15天</Select.Option>
 
-                                 <Select.Option value="20">16-20天</Select.Option>
 
-                                 <Select.Option value="25">21-25天</Select.Option>
 
-                                 <Select.Option value="30">26-30天</Select.Option>
 
-                             </Select>
 
-                             )}
 
-                     </Col>
 
-                 </Row>
 
-                 {theData.authorizedDateFormattedDate ? <Row className="express-desc-row">
 
-                     <Col span={3}>下证时间</Col>
 
-                     <Col span={6}>{theData.authorizedDateFormattedDate}</Col>
 
-                 </Row> :
 
-                     <Row className="express-desc-row">
 
-                         <Col span={3}>下证时间(预计)</Col>
 
-                         <Col span={6}>
 
-                             {(() => {
 
-                                 if (theData.expectTime && theData.expectTime[0]) {
 
-                                     if (theData.expectTime[1]) {
 
-                                         return getTime(getInUrgentTime(moment(theData.expectTime[0]), theData.expectTime[1]))
 
-                                     } else {
 
-                                         return getTime(getInUrgentTime(moment(theData.expectTime[0]), 45))
 
-                                     };
 
-                                 };
 
-                             })()}
 
-                         </Col>
 
-                     </Row>}
 
-                 <div className="hrSituation-roster">
 
-                     <Upload
 
-                         name="copyright_apply"
 
-                         action={globalConfig.context + "/api/admin/copyright/upload"}
 
-                         data={{ 'sign': 'copyright_apply', id: this.props.data.id }}
 
-                         beforeUpload={beforeUploadFile}
 
-                         showUploadList={false}
 
-                         onChange={(info) => {
 
-                             if (info.file.status !== 'uploading') {
 
-                                 console.log(info.file, info.fileList);
 
-                             }
 
-                             if (info.file.status === 'done') {
 
-                                 if (!info.file.response.error.length) {
 
-                                     message.success(`${info.file.name} 文件上传成功!`);
 
-                                 } else {
 
-                                     message.warning(info.file.response.error[0].message);
 
-                                     return;
 
-                                 };
 
-                                 this.state.copyrightApplyUrl = info.file.response.data;
 
-                             } else if (info.file.status === 'error') {
 
-                                 message.error(`${info.file.name} 文件上传失败。`);
 
-                             }
 
-                         }}
 
-                     >
 
-                         <Button><Icon type="upload" /> 上传软著申请书 </Button>
 
-                     </Upload>
 
-                     <p style={{ margin: '10px 0' }}>{theData.applicationUrl ? <a onClick={copyrightDownloadFile.bind(null, theData.id, 'copyright_apply', '/api/admin/copyright/download')}>{theData.applicationUrlDownloadFileName}</a> : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
 
-                 </div>
 
-                 <div className="hrSituation-roster">
 
-                     <Upload
 
-                         name="copyright_auth"
 
-                         action={globalConfig.context + "/api/admin/copyright/upload"}
 
-                         data={{ 'sign': 'copyright_auth', id: this.props.data.id }}
 
-                         beforeUpload={beforeUploadFile}
 
-                         showUploadList={false}
 
-                         onChange={(info) => {
 
-                             if (info.file.status !== 'uploading') {
 
-                                 console.log(info.file, info.fileList);
 
-                             }
 
-                             if (info.file.status === 'done') {
 
-                                 if (!info.file.response.error.length) {
 
-                                     message.success(`${info.file.name} 文件上传成功!`);
 
-                                 } else {
 
-                                     message.warning(info.file.response.error[0].message);
 
-                                     return;
 
-                                 };
 
-                                 this.state.copyrightAuthUrl = info.file.response.data;
 
-                             } else if (info.file.status === 'error') {
 
-                                 message.error(`${info.file.name} 文件上传失败。`);
 
-                             }
 
-                         }}
 
-                     >
 
-                         <Button><Icon type="upload" /> 上传软著证书 </Button>
 
-                     </Upload>
 
-                     <p style={{ margin: '10px 0' }}>{theData.certificateUrl ? <a onClick={copyrightDownloadFile.bind(null, theData.id, 'copyright_auth', '/api/admin/copyright/download')}>{theData.certificateUrlDownloadFileName}</a> : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
 
-                 </div>
 
-                 <p>状态流转记录: </p>
 
-                 <Table style={{ margin: '10px 0' }}
 
-                     pagination={false}
 
-                     dataSource={this.state.stateTable}
 
-                     columns={this.state.stateColumns} />
 
-                 <div className="clearfix">
 
-                     <FormItem className="third-item"
 
-                         {...formItemLayout}
 
-                         label="状态流转"
 
-                     >
 
-                         {getFieldDecorator('status')(
 
-                             <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>
 
-         );
 
-     }
 
- }));
 
- const CopyrightDesc = 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, true);
 
-     },
 
-     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='800px'
 
-                         footer=''
 
-                     >
 
-                         <CopyrightDescForm
 
-                             visible={this.state.visible}
 
-                             authorOption={this.props.authorOption}
 
-                             data={this.props.data}
 
-                             spinState={this.spinChange}
 
-                             closeModal={this.handleCancel}
 
-                             clickOk={this.handleOk} />
 
-                     </Modal>
 
-                 </Spin>
 
-             </div>
 
-         );
 
-     }
 
- });
 
- export default CopyrightDesc;
 
 
  |