|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message,Calendar , DatePicker, Upload, Form ,Modal,Tabs,Card } from 'antd';
|
|
|
import ajax from 'jquery/src/ajax/xhr.js';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
+import Jquery from 'jquery/dist/jquery.js';
|
|
|
import moment from 'moment';
|
|
|
import {Document,Page}from 'react-pdf';
|
|
|
import PDF from 'react-pdf';
|
|
@@ -13,8 +14,6 @@ import { getSocialAttribute, beforeUploadFile,splitUrl ,getSlcRedit,getDataGrade
|
|
|
import './customer.less';
|
|
|
const TabPane = Tabs.TabPane;
|
|
|
const Dragger = Upload.Dragger;
|
|
|
-console.log(Document);
|
|
|
-//onDocumentLoad
|
|
|
//图片组件
|
|
|
const PicturesWall = React.createClass({
|
|
|
getInitialState() {
|
|
@@ -327,8 +326,8 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
modalVisible:false,
|
|
|
numPages: null,
|
|
|
pageNumber: 1,
|
|
|
- pagec:1,
|
|
|
- pages:2,
|
|
|
+ pagec:0,
|
|
|
+ pages:18,
|
|
|
isXin:1,
|
|
|
pagination: {
|
|
|
defaultCurrent: 1,
|
|
@@ -775,7 +774,6 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
- console.log(this.state.isXin);
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
@@ -812,7 +810,6 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
- console.log(this.state.isXin);
|
|
|
$.ajax({
|
|
|
method: "post",
|
|
|
dataType: "json",
|
|
@@ -1017,9 +1014,7 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
|
|
|
//PDF打开
|
|
|
visitOk1(e) {
|
|
|
- alert(1)
|
|
|
this.getPrevie(this.state.uid, 'techProject', 'organization_application');
|
|
|
-// this.showPdf(this.state.pdfUrl);
|
|
|
this.setState({
|
|
|
visitModul1: true
|
|
|
});
|
|
@@ -1029,26 +1024,9 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
visitCancel1(e) {
|
|
|
this.setState({
|
|
|
visitModul1: false,
|
|
|
+ loading:false,
|
|
|
});
|
|
|
},
|
|
|
-// showPdf(url) {
|
|
|
-// PDFJS.workerSrc = 'pdf.worker.js';
|
|
|
-// PDFJS.getDocument(url).then(function getPdfHelloWorld(pdf) {
|
|
|
-// pdf.getPage(1).then(function getPageHelloWorld(page) {
|
|
|
-// var scale = 1;
|
|
|
-// var viewport = page.getViewport(scale);
|
|
|
-// var canvas = document.getElementById('the-canvas');
|
|
|
-// var context = canvas.getContext('2d');
|
|
|
-// canvas.height = viewport.height;
|
|
|
-// canvas.width = viewport.width;
|
|
|
-// var renderContext = {
|
|
|
-// canvasContext: context,
|
|
|
-// viewport: viewport
|
|
|
-// };
|
|
|
-// page.render(renderContext);
|
|
|
-// });
|
|
|
-// });
|
|
|
-// },
|
|
|
//获取PDF地址
|
|
|
getPrevie(id,url,sign){
|
|
|
$.ajax({
|
|
@@ -1066,7 +1044,6 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
message.warning(data.error[0].message);
|
|
|
};
|
|
|
};
|
|
|
- alert(2)
|
|
|
this.setState({
|
|
|
pdfUrl: location.origin + globalConfig.context + "/open/preview?" + data.data,
|
|
|
});
|
|
@@ -1074,29 +1051,33 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
});
|
|
|
},
|
|
|
//PDF分页
|
|
|
+ //一开始就加载这个函数
|
|
|
onDocumentComplete (pages) {
|
|
|
- alert(222)
|
|
|
- this.setState({ page: 1, pages:8 });
|
|
|
+ this.setState({
|
|
|
+ loading: true,
|
|
|
+ });
|
|
|
+ this.setState({ pagec:0, pages:pages.total });
|
|
|
},
|
|
|
-
|
|
|
+ //随后
|
|
|
+ onPageComplete (pagec) {
|
|
|
+ this.setState({ pagec });
|
|
|
+ },
|
|
|
handlePrevious (){
|
|
|
- alert(this.state.page)
|
|
|
- this.setState({ page: this.state.page - 1 });
|
|
|
+ this.setState({ pagec: this.state.pagec - 1 });
|
|
|
},
|
|
|
|
|
|
handleNext (){
|
|
|
- alert(this.state.page)
|
|
|
- this.setState({ page: this.state.page + 1 });
|
|
|
+ this.setState({ pagec: this.state.pagec + 1 });
|
|
|
},
|
|
|
- renderPagination (page,pages) {
|
|
|
- let previousButton = <li className="previous" onClick={this.handlePrevious}><a href="#"><i className="fa fa-arrow-left">上一页</i> </a></li>;
|
|
|
- if (page === 1) {
|
|
|
- previousButton = <li className="previous disabled"><a href="#"><i className="fa fa-arrow-left">上一页1</i> </a></li>;
|
|
|
- }
|
|
|
- let nextButton = <li className="next" onClick={this.handleNext}><a href="#"> <i className="fa fa-arrow-right">下一页</i></a></li>;
|
|
|
- if (page === pages) {
|
|
|
- nextButton = <li className="next disabled"><a href="#"> <i className="fa fa-arrow-right">下一页1</i></a></li>;
|
|
|
- }
|
|
|
+ renderPagination (pagec,pages) {
|
|
|
+ let previousButton = <li className="previous" onClick={this.handlePrevious}><a href="#"><span className="fa fa-arrow-left">上一页</span> </a></li>;
|
|
|
+ if (pagec==0) {
|
|
|
+ previousButton = <li className="previous disabled"><a href="#"><span className="fa fa-arrow-left">上一页</span> </a></li>;
|
|
|
+ }
|
|
|
+ let nextButton = <li className="next" onClick={this.handleNext}><a href="#"> <span className="fa fa-arrow-right">下一页</span></a></li>;
|
|
|
+ if (pagec==pages) {
|
|
|
+ nextButton = <li className="next disabled"><a href="#"> <span className="fa fa-arrow-right">下一页</span></a></li>;
|
|
|
+ }
|
|
|
return (
|
|
|
<nav>
|
|
|
<ul className="pager">
|
|
@@ -1223,9 +1204,7 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- onDocumentLoad () {
|
|
|
- this.setState({ numPages });
|
|
|
- },
|
|
|
+
|
|
|
//删除财务信息
|
|
|
deltalc(record){
|
|
|
this.setState({
|
|
@@ -1278,8 +1257,8 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
},
|
|
|
render() {
|
|
|
let paginationss = null;
|
|
|
- if (this.state.pages) {
|
|
|
- paginationss = this.renderPagination(this.state.page, this.state.pages);
|
|
|
+ if (this.state.pagec>=0) {
|
|
|
+ paginationss = this.renderPagination(this.state.pagec, this.state.pages);
|
|
|
}
|
|
|
const {
|
|
|
RangePicker,
|
|
@@ -1334,7 +1313,6 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
|
|
|
};
|
|
|
let pdfUrl =this.state.pdfUrl||'';
|
|
|
- console.log(pdfUrl)
|
|
|
return(
|
|
|
<div className="user-content" >
|
|
|
<div className="content-title">
|
|
@@ -1679,7 +1657,7 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
labelCol={{ span:4 }}
|
|
|
wrapperCol={{ span: 19 }}
|
|
|
label="项目申请书" >
|
|
|
- <Upload
|
|
|
+ <Upload style={{display:"inlineBlock"}}
|
|
|
name="avatar"
|
|
|
action={globalConfig.context + "/api/admin/customer/upload"}
|
|
|
data={{
|
|
@@ -1694,7 +1672,16 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
}
|
|
|
if (info.file.status === 'done') {
|
|
|
if (!info.file.response.error.length) {
|
|
|
- message.success(`${info.file.name} 文件上传成功!`);
|
|
|
+ let isPDF=this.state.fileList[0].originFileObj.name.split('.');
|
|
|
+ let isIndex=isPDF.length-1;
|
|
|
+ if(isPDF[isIndex]=="pdf"){
|
|
|
+ message.success(`${info.file.name} 文件上传成功!`);
|
|
|
+ }else{
|
|
|
+ message.success("请上传pdf文件!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
message.warning(info.file.response.error[0].message);
|
|
|
return;
|
|
@@ -1709,17 +1696,19 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
this.setState({ fileList: info.fileList.slice(-1) });
|
|
|
}}
|
|
|
>
|
|
|
+ {/*<a onClick={
|
|
|
+ () => {var newTab = window.open('about:blank'); getPreviews(this.state.uid, 'techProject', 'organization_application', function (data) { newTab.location.href = data; });
|
|
|
+ }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>*/}
|
|
|
<Button><Icon type="upload" /> 项目材料上传 </Button>
|
|
|
+ </Upload>
|
|
|
<span style={{ marginTop: '10px' ,marginLeft:"20px"}}>{this.state.pojectApplicationUrl ?
|
|
|
<span className="download-file">
|
|
|
- <a onClick={() => {
|
|
|
- var newTab = window.open('about:blank'); getPreviews(this.state.uid, 'techProject', 'organization_application', function (data) { newTab.location.href = data; });
|
|
|
- }}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
|
|
|
+ <a onClick={this.visitOk1}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </a>
|
|
|
</span>
|
|
|
: <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}
|
|
|
</span>
|
|
|
- </Upload>
|
|
|
- <Button onClick={this.visitOk1}><Icon style={{ fontSize: '16px' }} type="eye-o" /> </Button>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
</FormItem>
|
|
|
</div>
|
|
@@ -1765,19 +1754,29 @@ const IntentionCustomer = Form.create()(React.createClass({
|
|
|
<Modal
|
|
|
className="customeDetails"
|
|
|
footer=''
|
|
|
- title="客户资料"
|
|
|
- width='100%'
|
|
|
+ title="项目申请书"
|
|
|
+ width='800px'
|
|
|
visible={this.state.visitModul1}
|
|
|
onOk={this.visitOk1}
|
|
|
onCancel={this.visitCancel1}
|
|
|
>
|
|
|
<div>
|
|
|
- <a href={pdfUrl} target="_blank">点击看预览</a>
|
|
|
+
|
|
|
+ {/*<Button type="primary" onClick={this.pdfShows(pdfUrl)}>点击查看</Button>
|
|
|
+
|
|
|
+ <div id="pdfContent" style={{height:"500px",width:"500px",marginLeft:"300px"}} >
|
|
|
+ </div>
|
|
|
+ onDocumentLoad={this.onDocumentComplete}
|
|
|
+ onLoadSuccess={this.onDocumentComplete}
|
|
|
+ onDocumentComplete={this.onDocumentComplete}
|
|
|
+ onPageRender={this.onPageComplete}
|
|
|
+ // "http://s.jishutao.com/upload/achievement/achievement/34576808907162737_achievement_maturity_text_file.pdf"//{pdfUrl}
|
|
|
+ */}
|
|
|
<PDF
|
|
|
- file={pdfUrl}
|
|
|
- onDocumentComplete={this.onDocumentComplete}
|
|
|
+ file={pdfUrl}
|
|
|
onDocumentLoad={this.onDocumentComplete}
|
|
|
- Page={this.state.page}
|
|
|
+ pageIndex={parseInt(this.state.pagec)}
|
|
|
+ scale={1.2}
|
|
|
/>
|
|
|
{paginationss}
|
|
|
</div>
|