patentPayment.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. import React from 'react';
  2. import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message, DatePicker, Upload, Form ,Modal,Tabs} from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import moment from 'moment';
  6. import TechAchievementDesc from '@/manageCenter/achievement/crmAchievement.jsx';
  7. import { citySelect, provinceList ,areaSelect} from '@/NewDicProvinceList';
  8. import { socialAttribute, industry, auditStatusL, lvl, currentMember ,slcRedit,dataGrade,cityArr,patentTypeList} from '@/dataDic.js';
  9. import { getSocialAttribute, beforeUploadFile,splitUrl ,getSlcRedit,getDataGrade,getAchievementCategory,getTechAuditStatus,getboutique,getPatentType,getcityArr,getPatentTypeva} from '@/tools.js';
  10. import './customer.less';
  11. const Option = AutoComplete.Option;
  12. //图片组件
  13. const PicturesWall = React.createClass({
  14. getInitialState() {
  15. return {
  16. previewVisible: false,
  17. previewImage: '',
  18. fileList: this.props.pictureUrl,
  19. }
  20. },
  21. getDefaultProps(){
  22. return{
  23. changeClick:this.modifyChange
  24. }
  25. },
  26. handleCancel() {
  27. this.setState({ previewVisible: false })
  28. },
  29. handlePreview(file) {
  30. this.setState({
  31. previewImage: file.url || file.thumbUrl,
  32. previewVisible: true,
  33. });
  34. },
  35. handleChange(info) {
  36. let fileList = info.fileList;
  37. this.setState({ fileList });
  38. this.props.fileList(fileList);
  39. },
  40. componentWillReceiveProps(nextProps) {
  41. this.state.fileList = nextProps.pictureUrl;
  42. },
  43. render() {
  44. const { previewVisible, previewImage, fileList } = this.state;
  45. const uploadButton = (
  46. <div>
  47. <Icon type="plus" />
  48. <div className="ant-upload-text">点击上传</div>
  49. </div>
  50. );
  51. return (
  52. <div style={{display:"inline-block"}}>
  53. <Upload
  54. beforeUpload={beforeUploadFile}
  55. action={globalConfig.context + "/api/admin/patentNew/uploadFile"}
  56. data={{ 'sign': '' }}
  57. listType="picture-card"
  58. fileList={fileList}
  59. onPreview={this.handlePreview}
  60. onChange={this.handleChange} >
  61. {fileList.length >= 18 ? null : uploadButton}
  62. </Upload>
  63. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  64. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  65. </Modal>
  66. </div>
  67. );
  68. }
  69. });
  70. const PatentPayment = Form.create()(React.createClass({
  71. loadData(pageNo){
  72. this.setState({
  73. loading: true
  74. }),
  75. $.ajax({
  76. method: "get",
  77. dataType: "json",
  78. crossDomain: false,
  79. url: globalConfig.context + '/api/admin/patentNew/selectPatentNew',
  80. data: {
  81. pageNo: pageNo || 1,
  82. pageSize: this.state.pagination.pageSize,
  83. },
  84. success:function (data) {
  85. let theArr = [];
  86. if(!data.data) {
  87. if(data.error && data.error.length) {
  88. message.warning(data.error[0].message);
  89. };
  90. } else {
  91. for(let i = 0; i < data.data.list.length; i++) {
  92. let thisdata = data.data.list[i];
  93. theArr.push({
  94. id:thisdata.id,
  95. province:thisdata.province,
  96. status:thisdata.status,
  97. patentNo:thisdata.patentNo,
  98. name:thisdata.name,
  99. type:thisdata.type,
  100. applyDates:thisdata.applyDates,
  101. authorizationDates:thisdata.authorizationDates,
  102. patentAmount:thisdata.patentAmount,
  103. applicant:thisdata.applicant,
  104. contactMobile:thisdata.contactMobile,
  105. email:thisdata.email,
  106. certificateUrl:thisdata.certificateUrl,
  107. });
  108. };
  109. this.state.pagination.current = data.data.pageNo;
  110. this.state.pagination.total = data.data.totalCount;
  111. };
  112. if(!data.data.list.length) {
  113. this.state.pagination.current = 0
  114. this.state.pagination.total = 0
  115. }
  116. this.setState({
  117. pageNo: pageNo,
  118. dataSource: theArr,
  119. pagination: this.state.pagination,
  120. });
  121. }.bind(this)
  122. }).always(function() {
  123. this.setState({
  124. loading: false
  125. });
  126. }.bind(this));
  127. },
  128. getInitialState(){
  129. return {
  130. loading:false,
  131. visible:false,
  132. orgCodeUrl:[],
  133. fileList:[],
  134. pagination: {
  135. defaultCurrent: 1,
  136. defaultPageSize: 10,
  137. showQuickJumper: true,
  138. pageSize: 10,
  139. onChange: function(page) {
  140. this.loadData(page);
  141. }.bind(this),
  142. showTotal: function(total) {
  143. return '共' + total + '条数据';
  144. }
  145. },
  146. dataSource:[],
  147. columns:[{
  148. title: '专利号',
  149. dataIndex: 'patentNo',
  150. key: 'patentNo'
  151. },{
  152. title: '专利名称',
  153. dataIndex: 'name',
  154. key: 'name'
  155. },{
  156. title: '专利类型',
  157. dataIndex: 'type',
  158. key: 'type',
  159. render:text=>{
  160. return getPatentType(text)
  161. }
  162. },{
  163. title: '申请日期',
  164. dataIndex: 'applyDates',
  165. key: 'applyDates'
  166. },{
  167. title: '授权日期',
  168. dataIndex: 'authorizationDates',
  169. key: 'authorizationDates'
  170. },{
  171. title: '费用',
  172. dataIndex: 'patentAmount',
  173. key: 'patentAmount'
  174. },{
  175. title: '申请人',
  176. dataIndex: 'applicant',
  177. key: 'applicant'
  178. },{
  179. title: '联系电话',
  180. dataIndex: 'contactMobile',
  181. key: 'contactMobile'
  182. },{
  183. title: '电子邮箱',
  184. dataIndex: 'email',
  185. key: 'email'
  186. },{
  187. title: '状态',
  188. dataIndex: 'status',
  189. key: 'status',
  190. render:text=>{
  191. if (text === 1) {
  192. return '已提醒'
  193. }else{
  194. return '待提醒'
  195. }
  196. }
  197. }]
  198. }
  199. },
  200. componentWillMount(){
  201. this.loadData()
  202. let data=localStorage.getItem('newData');
  203. if(data!='{}'&&data){
  204. var newData = JSON.parse(data);
  205. this.tableRowClick(newData);
  206. };
  207. },
  208. new(){
  209. this.reset();
  210. this.setState({
  211. visible:true
  212. })
  213. },
  214. visitCancel(){
  215. this.state.fileList = [];
  216. this.setState({
  217. visible:false
  218. })
  219. },
  220. onSure(){
  221. let theorgCodeUrl = [];
  222. if (this.state.orgCodeUrl.length) {
  223. let picArr = [];
  224. this.state.orgCodeUrl.map(function (item) {
  225. if ( item.response && item.response.data && item.response.data.length ){
  226. picArr.push(item.response.data);
  227. }
  228. });
  229. theorgCodeUrl = picArr.join(",");
  230. };
  231. console.log(typeof theorgCodeUrl)
  232. if (!this.state.patentNo) {
  233. message.warning('专利号不能为空')
  234. return
  235. }
  236. if (!this.state.patentName) {
  237. message.warning('专利名称不能为空')
  238. return
  239. }
  240. if(typeof theorgCodeUrl !== 'string'){
  241. message.warning('未上传图片');
  242. return
  243. }
  244. $.ajax({
  245. method: "POST",
  246. dataType: "json",
  247. crossDomain: false,
  248. url: globalConfig.context +'/api/admin/patentNew/addPatentNew' ,
  249. data: {
  250. patentNo:this.state.patentNo,
  251. name:this.state.patentName,
  252. type:this.state.patentType,
  253. applyDates:this.state.appDate,
  254. authorizationDates:this.state.authDate,
  255. applicant:this.state.proposer,
  256. province:this.state.province,
  257. contactMobile:this.state.contactPhone,
  258. email:this.state.email,
  259. certificateUrl:theorgCodeUrl.length?theorgCodeUrl:'',
  260. }
  261. }).done(function(data) {
  262. this.setState({
  263. loading: false
  264. });
  265. if(!data.error.length) {
  266. message.success('保存成功!');
  267. this.onCal()
  268. this.loadData()
  269. } else {
  270. message.warning(data.error[0].message);
  271. }
  272. }.bind(this));
  273. },
  274. tableRowClick(record,index){
  275. this.state.RowData = record
  276. this.setState({
  277. avisible:true,
  278. patentNo:record.patentNo,
  279. patentName:record.name,
  280. province:record.province,
  281. status:record.status,
  282. patentType:record.type,
  283. appDate:record.applyDates,
  284. authDate:record.authorizationDates,
  285. proposer:record.applicant,
  286. contactPhone:record.contactMobile,
  287. email:record.email,
  288. certificateUrl:record.certificateUrl,
  289. orgCodeUrl: record.certificateUrl ? splitUrl(record.certificateUrl, ',', globalConfig.avatarHost + '/upload') : [],
  290. })
  291. localStorage.setItem('newData','{}');
  292. },
  293. xiugai(record){
  294. let theorgCodeUrl = [];
  295. if (this.state.orgCodeUrl.length) {
  296. let picArr = [];
  297. this.state.orgCodeUrl.map(function (item) {
  298. if ( item.response && item.response.data && item.response.data.length ){
  299. picArr.push(item.response.data);
  300. }
  301. });
  302. theorgCodeUrl = picArr.join(",");
  303. };
  304. if (!this.state.patentNo) {
  305. message.warning('专利号不能为空')
  306. return
  307. }
  308. if (!this.state.patentName) {
  309. message.warning('专利名称不能为空')
  310. return
  311. }
  312. if(typeof theorgCodeUrl !== 'string'){
  313. message.warning('未上传图片');
  314. return
  315. }
  316. $.ajax({
  317. method: "POST",
  318. dataType: "json",
  319. crossDomain: false,
  320. url: globalConfig.context +'/api/admin/patentNew/updatePatentNew' ,
  321. data: {
  322. id:record.id,
  323. patentNo:this.state.patentNo,
  324. name:this.state.patentName,
  325. type:this.state.patentType,
  326. applyDates:this.state.appDate,
  327. authorizationDates:this.state.authDate,
  328. applicant:this.state.proposer,
  329. province:this.state.province,
  330. contactMobile:this.state.contactPhone,
  331. email:this.state.email,
  332. status:this.state.status,
  333. certificateUrl:theorgCodeUrl.length?theorgCodeUrl:'',
  334. },
  335. success: function (data) {
  336. }.bind(this),
  337. }).done(function(data) {
  338. this.setState({
  339. loading: false
  340. });
  341. if(!data.error.length) {
  342. message.success('修改成功!');
  343. this.avisitCancel()
  344. this.loadData(this.state.pageNo)
  345. } else {
  346. message.warning(data.error[0].message);
  347. }
  348. }.bind(this));
  349. },
  350. baocunxiugai(){
  351. this.xiugai(this.state.RowData)
  352. },
  353. avisitCancel(){
  354. this.setState({
  355. avisible:false
  356. })
  357. },
  358. reset(){
  359. this.setState({
  360. patentNo:'',
  361. patentName:'',
  362. patentType:undefined,
  363. appDate:undefined,
  364. authDate:undefined,
  365. orgCodeUrl:'',
  366. proposer:'',
  367. province:undefined,
  368. contactPhone:'',
  369. email:''
  370. })
  371. },
  372. onCal(){
  373. this.setState({
  374. visible:false
  375. })
  376. },
  377. getOrgCodeUrl(e) {
  378. this.setState({ orgCodeUrl: e });
  379. },
  380. chongzhi(){
  381. this.loadData()
  382. },
  383. render(){
  384. const theData = this.state.RowData || {};
  385. const FormItem = Form.Item;
  386. const formItemLayout = {
  387. labelCol: { span: 8 },
  388. wrapperCol: { span: 14 },
  389. };
  390. return(
  391. <div className="user-content" >
  392. <div className="content-title">
  393. <span style={{fontSize:'16px'}}>客户专利提醒</span>
  394. <div className="user-search">
  395. <Button type="primary" onClick={this.chongzhi} style={{marginLeft:'10px'}}>重置</Button>
  396. <Button type="primary" onClick={this.new} style={{marginRight:'10px',float:'right'}}>新建</Button>
  397. {/*<Button onClick={this.reset}>导出</Button>*/}
  398. </div>
  399. <div className="patent-table">
  400. <Spin spinning={this.state.loading}>
  401. <Table columns={this.state.columns}
  402. dataSource={this.state.dataSource}
  403. pagination={this.state.pagination}
  404. onRowClick={this.tableRowClick} />
  405. </Spin>
  406. </div>
  407. <Modal maskClosable={false} visible={this.state.avisible}
  408. onCancel={this.avisitCancel}
  409. width='800px'
  410. title='修改详情'
  411. footer=''
  412. className="admin-desc-content">
  413. <div className="clearfix">
  414. <FormItem className="half-item"
  415. {...formItemLayout}
  416. label={
  417. <span>
  418. <strong style={{ color: '#f00' }}>*</strong>专利号
  419. </span>
  420. } >
  421. {<Input placeholder="请输入专利号" value={this.state.patentNo}
  422. onChange={(e)=>{this.setState({patentNo:e.target.value})}} style={{width:'240px'}} />}
  423. </FormItem>
  424. <FormItem className="half-item"
  425. {...formItemLayout}
  426. label={
  427. <span>
  428. <strong style={{ color: '#f00' }}>*</strong>专利名称
  429. </span>
  430. } >
  431. {<Input placeholder="请输入专利名称" value={this.state.patentName}
  432. onChange={(e)=>{this.setState({patentName:e.target.value})}} style={{width:'240px'}} />}
  433. </FormItem>
  434. <FormItem className="half-item"
  435. {...formItemLayout}
  436. label="专利类型" >
  437. {<Select placeholder="请选择专利类型"
  438. style={{ width:'240px'}}
  439. value={getPatentType(this.state.patentType)}
  440. onChange={(e)=>{this.setState({patentType:e})}}>
  441. {
  442. patentTypeList.map(function (item) {
  443. return <Select.Option key={item.value} >{item.key}</Select.Option>
  444. })
  445. }
  446. </Select>}
  447. </FormItem>
  448. <FormItem className="half-item"
  449. {...formItemLayout}
  450. label="申请日期" >
  451. <DatePicker
  452. style={{marginTop:"2px",width: '240px',height:"32px" }}
  453. showTime
  454. format="YYYY-MM-DD"
  455. onOk={(e)=>{}}
  456. value={this.state.appDate ? moment(this.state.appDate) : null}
  457. onChange={(data, dataString) => { this.setState({ appDate: dataString }); }} />
  458. </FormItem>
  459. <FormItem className="half-item"
  460. {...formItemLayout}
  461. label="授权日期" >
  462. <DatePicker
  463. style={{marginTop:"2px",width: '240px',height:"32px" }}
  464. showTime
  465. format="YYYY-MM-DD"
  466. onOk={(e)=>{}}
  467. value={this.state.authDate ? moment(this.state.authDate) : null}
  468. onChange={(data, dataString) => { this.setState({ authDate: dataString }); }} />
  469. </FormItem>
  470. <FormItem className="half-item"
  471. {...formItemLayout}
  472. label="费用" >
  473. <span>{theData.patentAmount}</span>
  474. </FormItem>
  475. <div className="clearfix">
  476. <FormItem
  477. labelCol={{ span: 4 }}
  478. wrapperCol={{ span: 18 }}
  479. label={
  480. <span>
  481. <strong style={{ color: '#f00' }}>*</strong>合同扫描件
  482. </span>
  483. }
  484. >
  485. <PicturesWall
  486. fileList={this.getOrgCodeUrl}
  487. pictureUrl={this.state.orgCodeUrl} />
  488. <p>图片建议:要清晰。</p>
  489. </FormItem>
  490. </div>
  491. <FormItem className="half-item"
  492. {...formItemLayout}
  493. label="申请人" >
  494. {<Input placeholder="请输入申请人/公司" value={this.state.proposer}
  495. onChange={(e)=>{this.setState({proposer:e.target.value})}} style={{width:'240px'}} />}
  496. </FormItem>
  497. <FormItem className="half-item"
  498. {...formItemLayout}
  499. label="省份" >
  500. <Select placeholder="请选择省份"
  501. style={{ width:'240px'}}
  502. value={getcityArr(this.state.province)}
  503. onChange={(e)=>{this.setState({province:e})}}>
  504. {
  505. cityArr.map(function (item) {
  506. return <Select.Option key={item.value} >{item.key}</Select.Option>
  507. })
  508. }
  509. </Select>
  510. </FormItem>
  511. <FormItem className="half-item"
  512. {...formItemLayout}
  513. label="联系电话" >
  514. {<Input placeholder="请输入联系手机" value={this.state.contactPhone}
  515. onChange={(e)=>{this.setState({contactPhone:e.target.value})}} style={{width:'240px'}} />}
  516. </FormItem>
  517. <FormItem className="half-item"
  518. {...formItemLayout}
  519. label="电子邮箱" >
  520. {<Input placeholder="请输入电子邮箱" value={this.state.email}
  521. onChange={(e)=>{this.setState({email:e.target.value})}} style={{width:'240px'}} />}
  522. </FormItem>
  523. <FormItem className="half-item"
  524. {...formItemLayout}
  525. label={'状态'} >
  526. <span>{this.state.status?'已提醒':'待提醒'}</span>
  527. </FormItem>
  528. </div>
  529. <div style={{overflow:'hidden'}}>
  530. <Button style={{float:'right'}} onClick={this.avisitCancel}>取消</Button>
  531. <Button type="primary" style={{float:'right',marginRight:'10px'}} onClick={this.baocunxiugai}>保存</Button>
  532. </div>
  533. </Modal>
  534. <Modal maskClosable={false} visible={this.state.visible}
  535. onOk={this.visitOk} onCancel={this.visitCancel}
  536. width='1000px'
  537. title='专利资料'
  538. footer=''
  539. className="admin-desc-content">
  540. <div className="clearfix">
  541. <FormItem className="half-item"
  542. {...formItemLayout}
  543. label="专利号" >
  544. {<Input placeholder="请输入专利号" value={this.state.patentNo}
  545. onChange={(e)=>{this.setState({patentNo:e.target.value})}} style={{width:'240px'}} />}
  546. </FormItem>
  547. <FormItem className="half-item"
  548. {...formItemLayout}
  549. label="专利名称" >
  550. {<Input placeholder="请输入专利名称" value={this.state.patentName}
  551. onChange={(e)=>{this.setState({patentName:e.target.value})}} style={{width:'240px'}} />}
  552. </FormItem>
  553. <FormItem className="half-item"
  554. {...formItemLayout}
  555. label="申请日期" >
  556. <DatePicker
  557. style={{marginTop:"2px",width: '240px',height:"32px" }}
  558. showTime
  559. format="YYYY-MM-DD"
  560. onOk={(e)=>{}}
  561. value={this.state.appDate ? moment(this.state.appDate) : null}
  562. onChange={(data, dataString) => { this.setState({ appDate: dataString }); }} />
  563. </FormItem>
  564. <FormItem className="half-item"
  565. {...formItemLayout}
  566. label="专利类型" >
  567. {<Select placeholder="请选择专利类型"
  568. style={{ width:'240px'}}
  569. value={this.state.patentType}
  570. onChange={(e)=>{this.setState({patentType:e})}}>
  571. {
  572. patentTypeList.map(function (item) {
  573. return <Select.Option key={item.value} >{item.key}</Select.Option>
  574. })
  575. }
  576. </Select>}
  577. </FormItem>
  578. <FormItem className="half-item"
  579. {...formItemLayout}
  580. label="授权日期" >
  581. <DatePicker
  582. style={{marginTop:"2px",width: '240px',height:"32px" }}
  583. showTime
  584. format="YYYY-MM-DD"
  585. onOk={(e)=>{}}
  586. value={this.state.authDate ? moment(this.state.authDate) : null}
  587. onChange={(data, dataString) => { this.setState({ authDate: dataString }); }} />
  588. </FormItem>
  589. <div className="clearfix">
  590. <FormItem
  591. labelCol={{ span: 4 }}
  592. wrapperCol={{ span: 18 }}
  593. label={
  594. <span>
  595. <strong style={{ color: '#f00' }}>*</strong>合同扫描件
  596. </span>
  597. }
  598. >
  599. <PicturesWall
  600. fileList={this.getOrgCodeUrl}
  601. pictureUrl={this.state.orgCodeUrl} />
  602. <p>图片建议:要清晰。</p>
  603. </FormItem>
  604. </div>
  605. <div>
  606. <span style={{marginLeft:'50px',fontSize:'20px'}}>申请人资料</span>
  607. </div>
  608. <FormItem className="half-item"
  609. {...formItemLayout}
  610. label="申请人/公司" >
  611. {<Input placeholder="请输入申请人/公司" value={this.state.proposer}
  612. onChange={(e)=>{this.setState({proposer:e.target.value})}} style={{width:'240px'}} />}
  613. </FormItem>
  614. <FormItem className="half-item"
  615. {...formItemLayout}
  616. label="省份" >
  617. <Select placeholder="请选择省份"
  618. style={{ width:'240px'}}
  619. value={this.state.province}
  620. onChange={(e)=>{this.setState({province:e})}}>
  621. {
  622. cityArr.map(function (item) {
  623. return <Select.Option key={item.value} >{item.key}</Select.Option>
  624. })
  625. }
  626. </Select>
  627. </FormItem>
  628. <FormItem className="half-item"
  629. {...formItemLayout}
  630. label="联系手机" >
  631. {<Input placeholder="请输入联系手机" value={this.state.contactPhone}
  632. onChange={(e)=>{this.setState({contactPhone:e.target.value})}} style={{width:'240px'}} />}
  633. </FormItem>
  634. <FormItem className="half-item"
  635. {...formItemLayout}
  636. label="电子邮箱" >
  637. {<Input placeholder="请输入电子邮箱" value={this.state.email}
  638. onChange={(e)=>{this.setState({email:e.target.value})}} style={{width:'240px'}} />}
  639. </FormItem>
  640. </div>
  641. <div style={{overflow:'hidden'}}>
  642. <Button style={{float:'right'}} onClick={this.onCal}>取消</Button>
  643. <Button type="primary" style={{float:'right',marginRight:'10px'}} onClick={this.onSure}>保存</Button>
  644. </div>
  645. </Modal>
  646. </div >
  647. </div>
  648. )
  649. }
  650. }))
  651. export default PatentPayment;