| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671 | import React from 'react';import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message, DatePicker, Upload, Form ,Modal,Tabs} from 'antd';import ajax from 'jquery/src/ajax/xhr.js';import $ from 'jquery/src/ajax';import moment from 'moment';import TechAchievementDesc from '@/manageCenter/achievement/crmAchievement.jsx';import { citySelect, provinceList ,areaSelect} from '@/NewDicProvinceList';import { socialAttribute, industry, auditStatusL, lvl, currentMember ,slcRedit,dataGrade,cityArr,patentTypeList} from '@/dataDic.js';import { getSocialAttribute, beforeUploadFile,splitUrl ,getSlcRedit,getDataGrade,getAchievementCategory,getTechAuditStatus,getboutique,getPatentType,getcityArr,getPatentTypeva} from '@/tools.js';import './customer.less';const Option = AutoComplete.Option;//图片组件const PicturesWall = React.createClass({    getInitialState() {        return {            previewVisible: false,            previewImage: '',            fileList: this.props.pictureUrl,        }    },    getDefaultProps(){    	return{    		changeClick:this.modifyChange    	}    },    handleCancel() {        this.setState({ previewVisible: false })    },    handlePreview(file) {        this.setState({            previewImage: file.url || file.thumbUrl,            previewVisible: true,        });    },    handleChange(info) {        let fileList = info.fileList;        this.setState({ fileList });        this.props.fileList(fileList);    },    componentWillReceiveProps(nextProps) {        this.state.fileList = nextProps.pictureUrl;     },    render() {        const { previewVisible, previewImage, fileList } = this.state;        const uploadButton = (            <div>                <Icon type="plus" />                <div className="ant-upload-text">点击上传</div>            </div>        );        return (            <div style={{display:"inline-block"}}>                <Upload                	beforeUpload={beforeUploadFile}                    action={globalConfig.context + "/api/admin/patentNew/uploadFile"}                    data={{ 'sign': '' }}                    listType="picture-card"                    fileList={fileList}                    onPreview={this.handlePreview}                    onChange={this.handleChange} >                    {fileList.length >= 18 ? null : uploadButton}                </Upload>                <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>                    <img alt="example" style={{ width: '100%' }} src={previewImage} />                </Modal>            </div>        );    }});const PatentPayment = Form.create()(React.createClass({	loadData(pageNo){		this.setState({			loading: true		}),		$.ajax({			method: "get",			dataType: "json",			crossDomain: false,			url: globalConfig.context + '/api/admin/patentNew/selectPatentNew',			data: {				pageNo: pageNo || 1,				pageSize: this.state.pagination.pageSize,			},			success:function (data) {				let theArr = [];				if(!data.data) {					if(data.error && data.error.length) {						message.warning(data.error[0].message);					};				} else {					for(let i = 0; i < data.data.list.length; i++) {						let thisdata = data.data.list[i];						theArr.push({							id:thisdata.id,							province:thisdata.province,							status:thisdata.status,							patentNo:thisdata.patentNo,							name:thisdata.name,							type:thisdata.type,							applyDates:thisdata.applyDates,							authorizationDates:thisdata.authorizationDates,							patentAmount:thisdata.patentAmount,							applicant:thisdata.applicant,							contactMobile:thisdata.contactMobile,							email:thisdata.email,							certificateUrl:thisdata.certificateUrl,						});					};					this.state.pagination.current = data.data.pageNo;					this.state.pagination.total = data.data.totalCount;				};				if(!data.data.list.length) {					this.state.pagination.current = 0					this.state.pagination.total = 0				}				this.setState({					pageNo: pageNo,					dataSource: theArr,					pagination: this.state.pagination,				});			}.bind(this)		}).always(function() {			this.setState({				loading: false			});		}.bind(this));	},	getInitialState(){		return {			loading:false,			visible:false,			orgCodeUrl:[],			fileList:[],			pagination: {				defaultCurrent: 1,				defaultPageSize: 10,				showQuickJumper: true,				pageSize: 10,				onChange: function(page) {					this.loadData(page);				}.bind(this),				showTotal: function(total) {					return '共' + total + '条数据';				}			},			dataSource:[],			columns:[{				title: '专利号',				dataIndex: 'patentNo',				key: 'patentNo'			},{				title: '专利名称',				dataIndex: 'name',				key: 'name'			},{				title: '专利类型',				dataIndex: 'type',				key: 'type',				render:text=>{					return getPatentType(text)				}			},{				title: '申请日期',				dataIndex: 'applyDates',				key: 'applyDates'			},{				title: '授权日期',				dataIndex: 'authorizationDates',				key: 'authorizationDates'			},{				title: '费用',				dataIndex: 'patentAmount',				key: 'patentAmount'			},{				title: '申请人',				dataIndex: 'applicant',				key: 'applicant'			},{				title: '联系电话',				dataIndex: 'contactMobile',				key: 'contactMobile'			},{				title: '电子邮箱',				dataIndex: 'email',				key: 'email'			},{				title: '状态',				dataIndex: 'status',				key: 'status',				render:text=>{					if (text === 1) {						return '已提醒'					}else{						return '待提醒'					}				}			}]		}	},	componentWillMount(){		this.loadData()		let data=localStorage.getItem('newData');		if(data!='{}'&&data){			var newData = JSON.parse(data);			this.tableRowClick(newData);		};	},	new(){		this.reset();		this.setState({			visible:true		})	},	visitCancel(){		this.state.fileList = [];		this.setState({			visible:false		})	},	onSure(){		let theorgCodeUrl = [];		if (this.state.orgCodeUrl.length) {		    let picArr = [];		    this.state.orgCodeUrl.map(function (item) {				if ( item.response && item.response.data && item.response.data.length ){					picArr.push(item.response.data);				}		    });		    theorgCodeUrl = picArr.join(",");		};		console.log(typeof theorgCodeUrl)		if (!this.state.patentNo) {			message.warning('专利号不能为空')			return		}		if (!this.state.patentName) {			message.warning('专利名称不能为空')			return		}		if(this.state.patentType === ''){		    message.warning('专利类型不能为空');		    return 		}		$.ajax({			method: "POST",			dataType: "json",			crossDomain: false,			url: globalConfig.context +'/api/admin/patentNew/addPatentNew' ,			data: {				patentNo:this.state.patentNo,				name:this.state.patentName,				type:this.state.patentType,				applyDates:this.state.appDate,				authorizationDates:this.state.authDate,				applicant:this.state.proposer,				province:this.state.province,				contactMobile:this.state.contactPhone,				email:this.state.email,				certificateUrl:theorgCodeUrl.length?theorgCodeUrl:'',			}		}).done(function(data) {			this.setState({				loading: false			});			if(!data.error.length) {				message.success('保存成功!');				this.onCal()				this.loadData()			} else {				message.warning(data.error[0].message);			}		}.bind(this));	},	tableRowClick(record,index){		this.state.RowData = record		this.setState({			avisible:true,			patentNo:record.patentNo,			patentName:record.name,			province:record.province,			status:record.status,			patentType:record.type,			appDate:record.applyDates,			authDate:record.authorizationDates,			proposer:record.applicant,			contactPhone:record.contactMobile,			email:record.email,			certificateUrl:record.certificateUrl,			orgCodeUrl: record.certificateUrl ? splitUrl(record.certificateUrl, ',', globalConfig.avatarHost + '/upload') : [],		})		localStorage.setItem('newData','{}');	},	xiugai(record){		let theorgCodeUrl = [];		if (this.state.orgCodeUrl.length) {		    let picArr = [];		    this.state.orgCodeUrl.map(function (item) {				if ( item.response && item.response.data && item.response.data.length ){					picArr.push(item.response.data);				}		    });		    theorgCodeUrl = picArr.join(",");		};		console.log(typeof this.state.patentType)		if (!this.state.patentNo) {			message.warning('专利号不能为空')			return		}		if (!this.state.patentName) {			message.warning('专利名称不能为空')			return		}		if(this.state.patentType === ''){		    message.warning('专利类型不能为空');		    return 		}		$.ajax({			method: "POST",			dataType: "json",			crossDomain: false,			url: globalConfig.context +'/api/admin/patentNew/updatePatentNew' ,			data: {				id:record.id,				patentNo:this.state.patentNo,				name:this.state.patentName,				type:this.state.patentType,				applyDates:this.state.appDate,				authorizationDates:this.state.authDate,				applicant:this.state.proposer,				province:this.state.province,				contactMobile:this.state.contactPhone,				email:this.state.email,				status:this.state.status,				certificateUrl:theorgCodeUrl.length?theorgCodeUrl:'',			},			success: function (data) {			}.bind(this),		}).done(function(data) {			this.setState({				loading: false			});			if(!data.error.length) {				message.success('修改成功!');				this.avisitCancel()				this.loadData(this.state.pageNo)			} else {				message.warning(data.error[0].message);			}		}.bind(this));	},		baocunxiugai(){		this.xiugai(this.state.RowData)	},		avisitCancel(){		this.setState({			avisible:false		})	},	reset(){		this.setState({			patentNo:'',			patentName:'',			patentType:undefined,			appDate:undefined,			authDate:undefined,			orgCodeUrl:'',			proposer:'',			province:undefined,			contactPhone:'',			email:''		})	},	onCal(){		this.setState({			visible:false		})	},	getOrgCodeUrl(e) {	    this.setState({ orgCodeUrl: e });	},	chongzhi(){		this.loadData()	},		render(){		const theData = this.state.RowData || {};		const FormItem = Form.Item;		const formItemLayout = {			labelCol: { span: 8 },			wrapperCol: { span: 14 },		};							return(			<div className="user-content" >			    <div className="content-title">			    	<span style={{fontSize:'16px'}}>客户专利提醒</span>				        <div className="user-search">						<Button type="primary" onClick={this.chongzhi} style={{marginLeft:'10px'}}>重置</Button>			            <Button type="primary" onClick={this.new} style={{marginRight:'10px',float:'right'}}>新建</Button>			            {/*<Button onClick={this.reset}>导出</Button>*/}			        </div>			        			        <div className="patent-table">			            <Spin spinning={this.state.loading}>			                <Table columns={this.state.columns}			                    dataSource={this.state.dataSource}			                    pagination={this.state.pagination}			                    onRowClick={this.tableRowClick} />			            </Spin>			        </div>					<Modal maskClosable={false} visible={this.state.avisible}						onCancel={this.avisitCancel}						width='800px'						title='修改详情'						footer=''						className="admin-desc-content">						<div className="clearfix">						<FormItem className="half-item"						    {...formItemLayout}						    label={						    	<span>						    		<strong style={{ color: '#f00' }}>*</strong>专利号						    	</span> 						    } >  						    {<Input placeholder="请输入专利号" value={this.state.patentNo}						        	onChange={(e)=>{this.setState({patentNo:e.target.value})}} style={{width:'240px'}} />}						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label={						    	<span>						    		<strong style={{ color: '#f00' }}>*</strong>专利名称						    	</span> 						    } >  						    {<Input placeholder="请输入专利名称" value={this.state.patentName}						        	onChange={(e)=>{this.setState({patentName:e.target.value})}} style={{width:'240px'}} />}						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label="专利类型" >  						    {<Select placeholder="请选择专利类型"						        style={{ width:'240px'}}						        value={getPatentType(this.state.patentType)}						        onChange={(e)=>{this.setState({patentType:e})}}>						            {						                patentTypeList.map(function (item) {						                    return <Select.Option key={item.value} >{item.key}</Select.Option>						                })						            }						    </Select>}						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label="申请日期" >  						    <DatePicker 						    	style={{marginTop:"2px",width: '240px',height:"32px" }}						        showTime						        format="YYYY-MM-DD" 						        onOk={(e)=>{}}						        value={this.state.appDate ? moment(this.state.appDate) : null}						        onChange={(data, dataString) => { this.setState({ appDate: dataString }); }} />						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label="授权日期" >  						    <DatePicker 						    	style={{marginTop:"2px",width: '240px',height:"32px" }}						        showTime						        format="YYYY-MM-DD"						        onOk={(e)=>{}}						        value={this.state.authDate ? moment(this.state.authDate) : null}						        onChange={(data, dataString) => { this.setState({ authDate: dataString }); }} />						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label="费用" >  						    <span>{theData.patentAmount}</span>						</FormItem>						<div className="clearfix">						<FormItem						    labelCol={{ span: 4 }}						    wrapperCol={{ span: 18 }}						    label={						    	<span>									<strong style={{ color: '#f00' }}>*</strong>合同扫描件								</span> 						    }						    >													    <PicturesWall						        fileList={this.getOrgCodeUrl}						        pictureUrl={this.state.orgCodeUrl} />						        <p>图片建议:要清晰。</p>						</FormItem>						</div>						<FormItem className="half-item"						    {...formItemLayout}						    label="申请人" >  						    {<Input placeholder="请输入申请人/公司" value={this.state.proposer}						        	onChange={(e)=>{this.setState({proposer:e.target.value})}} style={{width:'240px'}} />}						</FormItem>						<FormItem className="half-item"						        {...formItemLayout}						        label="省份" >								<Select placeholder="请选择省份"								    style={{ width:'240px'}}								    value={getcityArr(this.state.province)}								    onChange={(e)=>{this.setState({province:e})}}>								        {								            cityArr.map(function (item) {								                 return <Select.Option key={item.value} >{item.key}</Select.Option>								            })								        }								</Select>							 						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label="联系电话" >  						    {<Input placeholder="请输入联系手机" value={this.state.contactPhone}						        	onChange={(e)=>{this.setState({contactPhone:e.target.value})}} style={{width:'240px'}} />}						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label="电子邮箱" >  						    {<Input placeholder="请输入电子邮箱" value={this.state.email}						        	onChange={(e)=>{this.setState({email:e.target.value})}} style={{width:'240px'}} />}						</FormItem>						<FormItem className="half-item"						    {...formItemLayout}						    label={'状态'} >  						    <span>{this.state.status?'已提醒':'待提醒'}</span>						</FormItem>						</div>						<div style={{overflow:'hidden'}}>							<Button style={{float:'right'}} onClick={this.avisitCancel}>取消</Button>							<Button type="primary" style={{float:'right',marginRight:'10px'}} onClick={this.baocunxiugai}>保存</Button>						</div>					</Modal>											<Modal maskClosable={false} visible={this.state.visible}			            onOk={this.visitOk} onCancel={this.visitCancel}			            width='1000px'			            title='专利资料'			            footer=''			            className="admin-desc-content">						<div className="clearfix">							<FormItem className="half-item"							        {...formItemLayout}							        label={							        	<span>							        		<strong style={{ color: '#f00' }}>*</strong>专利号							        	</span> 							        } >                             							        {<Input placeholder="请输入专利号" value={this.state.patentNo}							            	onChange={(e)=>{this.setState({patentNo:e.target.value})}} style={{width:'240px'}} />}							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label={							        	<span>							        		<strong style={{ color: '#f00' }}>*</strong>专利名称							        	</span> 							        } >                             							        {<Input placeholder="请输入专利名称" value={this.state.patentName}							            	onChange={(e)=>{this.setState({patentName:e.target.value})}} style={{width:'240px'}} />}							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label="申请日期" >                             							        <DatePicker 							        	style={{marginTop:"2px",width: '240px',height:"32px" }}							            showTime							            format="YYYY-MM-DD"							            onOk={(e)=>{}}							            value={this.state.appDate ? moment(this.state.appDate) : null}							            onChange={(data, dataString) => { this.setState({ appDate: dataString }); }} />							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label={							        	<span>							        		<strong style={{ color: '#f00' }}>*</strong>专利类型							        	</span> 							        } >                             							        {<Select placeholder="请选择专利类型"									    style={{ width:'240px'}}									    value={this.state.patentType}									    onChange={(e)=>{this.setState({patentType:e})}}>									        {								                patentTypeList.map(function (item) {								                    return <Select.Option key={item.value} >{item.key}</Select.Option>								                })								            }									</Select>}							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label="授权日期" >                             							        <DatePicker 							        	style={{marginTop:"2px",width: '240px',height:"32px" }}							            showTime							            format="YYYY-MM-DD"							            onOk={(e)=>{}}							            value={this.state.authDate ? moment(this.state.authDate) : null}							            onChange={(data, dataString) => { this.setState({ authDate: dataString }); }} />							</FormItem>							<div className="clearfix">								<FormItem								    labelCol={{ span: 4 }}								    wrapperCol={{ span: 18 }}								    label='合同扫描件'								    >																	    <PicturesWall								        fileList={this.getOrgCodeUrl}								        pictureUrl={this.state.orgCodeUrl} />								        <p>图片建议:要清晰。</p>								</FormItem>							</div>							<div>								<span style={{marginLeft:'50px',fontSize:'20px'}}>申请人资料</span>							</div>							<FormItem className="half-item"							        {...formItemLayout}							        label="申请人/公司" >                             							        {<Input placeholder="请输入申请人/公司" value={this.state.proposer}							            	onChange={(e)=>{this.setState({proposer:e.target.value})}} style={{width:'240px'}} />}							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label="省份" >									<Select placeholder="请选择省份"									    style={{ width:'240px'}}									    value={this.state.province}									    onChange={(e)=>{this.setState({province:e})}}>									        {									            cityArr.map(function (item) {									                 return <Select.Option key={item.value} >{item.key}</Select.Option>									            })									        }									</Select>							 							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label="联系手机" >                             							        {<Input placeholder="请输入联系手机" value={this.state.contactPhone}							            	onChange={(e)=>{this.setState({contactPhone:e.target.value})}} style={{width:'240px'}} />}							</FormItem>							<FormItem className="half-item"							        {...formItemLayout}							        label="电子邮箱" >                             							        {<Input placeholder="请输入电子邮箱" value={this.state.email}							            	onChange={(e)=>{this.setState({email:e.target.value})}} style={{width:'240px'}} />}							</FormItem>						</div>						<div style={{overflow:'hidden'}}>							<Button style={{float:'right'}} onClick={this.onCal}>取消</Button>							<Button type="primary" style={{float:'right',marginRight:'10px'}} onClick={this.onSure}>保存</Button>						</div>						</Modal>			    </div >			</div>		)	}}))export default PatentPayment;
 |