patentPayment.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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(this.state.patentType === ''){
  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. console.log(typeof this.state.patentType)
  305. if (!this.state.patentNo) {
  306. message.warning('专利号不能为空')
  307. return
  308. }
  309. if (!this.state.patentName) {
  310. message.warning('专利名称不能为空')
  311. return
  312. }
  313. if(this.state.patentType === ''){
  314. message.warning('专利类型不能为空');
  315. return
  316. }
  317. $.ajax({
  318. method: "POST",
  319. dataType: "json",
  320. crossDomain: false,
  321. url: globalConfig.context +'/api/admin/patentNew/updatePatentNew' ,
  322. data: {
  323. id:record.id,
  324. patentNo:this.state.patentNo,
  325. name:this.state.patentName,
  326. type:this.state.patentType,
  327. applyDates:this.state.appDate,
  328. authorizationDates:this.state.authDate,
  329. applicant:this.state.proposer,
  330. province:this.state.province,
  331. contactMobile:this.state.contactPhone,
  332. email:this.state.email,
  333. status:this.state.status,
  334. certificateUrl:theorgCodeUrl.length?theorgCodeUrl:'',
  335. },
  336. success: function (data) {
  337. }.bind(this),
  338. }).done(function(data) {
  339. this.setState({
  340. loading: false
  341. });
  342. if(!data.error.length) {
  343. message.success('修改成功!');
  344. this.avisitCancel()
  345. this.loadData(this.state.pageNo)
  346. } else {
  347. message.warning(data.error[0].message);
  348. }
  349. }.bind(this));
  350. },
  351. baocunxiugai(){
  352. this.xiugai(this.state.RowData)
  353. },
  354. avisitCancel(){
  355. this.setState({
  356. avisible:false
  357. })
  358. },
  359. reset(){
  360. this.setState({
  361. patentNo:'',
  362. patentName:'',
  363. patentType:undefined,
  364. appDate:undefined,
  365. authDate:undefined,
  366. orgCodeUrl:'',
  367. proposer:'',
  368. province:undefined,
  369. contactPhone:'',
  370. email:''
  371. })
  372. },
  373. onCal(){
  374. this.setState({
  375. visible:false
  376. })
  377. },
  378. getOrgCodeUrl(e) {
  379. this.setState({ orgCodeUrl: e });
  380. },
  381. chongzhi(){
  382. this.loadData()
  383. },
  384. render(){
  385. const theData = this.state.RowData || {};
  386. const FormItem = Form.Item;
  387. const formItemLayout = {
  388. labelCol: { span: 8 },
  389. wrapperCol: { span: 14 },
  390. };
  391. return(
  392. <div className="user-content" >
  393. <div className="content-title">
  394. <span style={{fontSize:'16px'}}>客户专利提醒</span>
  395. <div className="user-search">
  396. <Button type="primary" onClick={this.chongzhi} style={{marginLeft:'10px'}}>重置</Button>
  397. <Button type="primary" onClick={this.new} style={{marginRight:'10px',float:'right'}}>新建</Button>
  398. {/*<Button onClick={this.reset}>导出</Button>*/}
  399. </div>
  400. <div className="patent-table">
  401. <Spin spinning={this.state.loading}>
  402. <Table columns={this.state.columns}
  403. dataSource={this.state.dataSource}
  404. pagination={this.state.pagination}
  405. onRowClick={this.tableRowClick} />
  406. </Spin>
  407. </div>
  408. <Modal maskClosable={false} visible={this.state.avisible}
  409. onCancel={this.avisitCancel}
  410. width='800px'
  411. title='修改详情'
  412. footer=''
  413. className="admin-desc-content">
  414. <div className="clearfix">
  415. <FormItem className="half-item"
  416. {...formItemLayout}
  417. label={
  418. <span>
  419. <strong style={{ color: '#f00' }}>*</strong>专利号
  420. </span>
  421. } >
  422. {<Input placeholder="请输入专利号" value={this.state.patentNo}
  423. onChange={(e)=>{this.setState({patentNo:e.target.value})}} style={{width:'240px'}} />}
  424. </FormItem>
  425. <FormItem className="half-item"
  426. {...formItemLayout}
  427. label={
  428. <span>
  429. <strong style={{ color: '#f00' }}>*</strong>专利名称
  430. </span>
  431. } >
  432. {<Input placeholder="请输入专利名称" value={this.state.patentName}
  433. onChange={(e)=>{this.setState({patentName:e.target.value})}} style={{width:'240px'}} />}
  434. </FormItem>
  435. <FormItem className="half-item"
  436. {...formItemLayout}
  437. label="专利类型" >
  438. {<Select placeholder="请选择专利类型"
  439. style={{ width:'240px'}}
  440. value={getPatentType(this.state.patentType)}
  441. onChange={(e)=>{this.setState({patentType:e})}}>
  442. {
  443. patentTypeList.map(function (item) {
  444. return <Select.Option key={item.value} >{item.key}</Select.Option>
  445. })
  446. }
  447. </Select>}
  448. </FormItem>
  449. <FormItem className="half-item"
  450. {...formItemLayout}
  451. label="申请日期" >
  452. <DatePicker
  453. style={{marginTop:"2px",width: '240px',height:"32px" }}
  454. showTime
  455. format="YYYY-MM-DD"
  456. onOk={(e)=>{}}
  457. value={this.state.appDate ? moment(this.state.appDate) : null}
  458. onChange={(data, dataString) => { this.setState({ appDate: dataString }); }} />
  459. </FormItem>
  460. <FormItem className="half-item"
  461. {...formItemLayout}
  462. label="授权日期" >
  463. <DatePicker
  464. style={{marginTop:"2px",width: '240px',height:"32px" }}
  465. showTime
  466. format="YYYY-MM-DD"
  467. onOk={(e)=>{}}
  468. value={this.state.authDate ? moment(this.state.authDate) : null}
  469. onChange={(data, dataString) => { this.setState({ authDate: dataString }); }} />
  470. </FormItem>
  471. <FormItem className="half-item"
  472. {...formItemLayout}
  473. label="费用" >
  474. <span>{theData.patentAmount}</span>
  475. </FormItem>
  476. <div className="clearfix">
  477. <FormItem
  478. labelCol={{ span: 4 }}
  479. wrapperCol={{ span: 18 }}
  480. label={
  481. <span>
  482. <strong style={{ color: '#f00' }}>*</strong>合同扫描件
  483. </span>
  484. }
  485. >
  486. <PicturesWall
  487. fileList={this.getOrgCodeUrl}
  488. pictureUrl={this.state.orgCodeUrl} />
  489. <p>图片建议:要清晰。</p>
  490. </FormItem>
  491. </div>
  492. <FormItem className="half-item"
  493. {...formItemLayout}
  494. label="申请人" >
  495. {<Input placeholder="请输入申请人/公司" value={this.state.proposer}
  496. onChange={(e)=>{this.setState({proposer:e.target.value})}} style={{width:'240px'}} />}
  497. </FormItem>
  498. <FormItem className="half-item"
  499. {...formItemLayout}
  500. label="省份" >
  501. <Select placeholder="请选择省份"
  502. style={{ width:'240px'}}
  503. value={getcityArr(this.state.province)}
  504. onChange={(e)=>{this.setState({province:e})}}>
  505. {
  506. cityArr.map(function (item) {
  507. return <Select.Option key={item.value} >{item.key}</Select.Option>
  508. })
  509. }
  510. </Select>
  511. </FormItem>
  512. <FormItem className="half-item"
  513. {...formItemLayout}
  514. label="联系电话" >
  515. {<Input placeholder="请输入联系手机" value={this.state.contactPhone}
  516. onChange={(e)=>{this.setState({contactPhone:e.target.value})}} style={{width:'240px'}} />}
  517. </FormItem>
  518. <FormItem className="half-item"
  519. {...formItemLayout}
  520. label="电子邮箱" >
  521. {<Input placeholder="请输入电子邮箱" value={this.state.email}
  522. onChange={(e)=>{this.setState({email:e.target.value})}} style={{width:'240px'}} />}
  523. </FormItem>
  524. <FormItem className="half-item"
  525. {...formItemLayout}
  526. label={'状态'} >
  527. <span>{this.state.status?'已提醒':'待提醒'}</span>
  528. </FormItem>
  529. </div>
  530. <div style={{overflow:'hidden'}}>
  531. <Button style={{float:'right'}} onClick={this.avisitCancel}>取消</Button>
  532. <Button type="primary" style={{float:'right',marginRight:'10px'}} onClick={this.baocunxiugai}>保存</Button>
  533. </div>
  534. </Modal>
  535. <Modal maskClosable={false} visible={this.state.visible}
  536. onOk={this.visitOk} onCancel={this.visitCancel}
  537. width='1000px'
  538. title='专利资料'
  539. footer=''
  540. className="admin-desc-content">
  541. <div className="clearfix">
  542. <FormItem className="half-item"
  543. {...formItemLayout}
  544. label={
  545. <span>
  546. <strong style={{ color: '#f00' }}>*</strong>专利号
  547. </span>
  548. } >
  549. {<Input placeholder="请输入专利号" value={this.state.patentNo}
  550. onChange={(e)=>{this.setState({patentNo:e.target.value})}} style={{width:'240px'}} />}
  551. </FormItem>
  552. <FormItem className="half-item"
  553. {...formItemLayout}
  554. label={
  555. <span>
  556. <strong style={{ color: '#f00' }}>*</strong>专利名称
  557. </span>
  558. } >
  559. {<Input placeholder="请输入专利名称" value={this.state.patentName}
  560. onChange={(e)=>{this.setState({patentName:e.target.value})}} style={{width:'240px'}} />}
  561. </FormItem>
  562. <FormItem className="half-item"
  563. {...formItemLayout}
  564. label="申请日期" >
  565. <DatePicker
  566. style={{marginTop:"2px",width: '240px',height:"32px" }}
  567. showTime
  568. format="YYYY-MM-DD"
  569. onOk={(e)=>{}}
  570. value={this.state.appDate ? moment(this.state.appDate) : null}
  571. onChange={(data, dataString) => { this.setState({ appDate: dataString }); }} />
  572. </FormItem>
  573. <FormItem className="half-item"
  574. {...formItemLayout}
  575. label={
  576. <span>
  577. <strong style={{ color: '#f00' }}>*</strong>专利类型
  578. </span>
  579. } >
  580. {<Select placeholder="请选择专利类型"
  581. style={{ width:'240px'}}
  582. value={this.state.patentType}
  583. onChange={(e)=>{this.setState({patentType:e})}}>
  584. {
  585. patentTypeList.map(function (item) {
  586. return <Select.Option key={item.value} >{item.key}</Select.Option>
  587. })
  588. }
  589. </Select>}
  590. </FormItem>
  591. <FormItem className="half-item"
  592. {...formItemLayout}
  593. label="授权日期" >
  594. <DatePicker
  595. style={{marginTop:"2px",width: '240px',height:"32px" }}
  596. showTime
  597. format="YYYY-MM-DD"
  598. onOk={(e)=>{}}
  599. value={this.state.authDate ? moment(this.state.authDate) : null}
  600. onChange={(data, dataString) => { this.setState({ authDate: dataString }); }} />
  601. </FormItem>
  602. <div className="clearfix">
  603. <FormItem
  604. labelCol={{ span: 4 }}
  605. wrapperCol={{ span: 18 }}
  606. label='合同扫描件'
  607. >
  608. <PicturesWall
  609. fileList={this.getOrgCodeUrl}
  610. pictureUrl={this.state.orgCodeUrl} />
  611. <p>图片建议:要清晰。</p>
  612. </FormItem>
  613. </div>
  614. <div>
  615. <span style={{marginLeft:'50px',fontSize:'20px'}}>申请人资料</span>
  616. </div>
  617. <FormItem className="half-item"
  618. {...formItemLayout}
  619. label="申请人/公司" >
  620. {<Input placeholder="请输入申请人/公司" value={this.state.proposer}
  621. onChange={(e)=>{this.setState({proposer:e.target.value})}} style={{width:'240px'}} />}
  622. </FormItem>
  623. <FormItem className="half-item"
  624. {...formItemLayout}
  625. label="省份" >
  626. <Select placeholder="请选择省份"
  627. style={{ width:'240px'}}
  628. value={this.state.province}
  629. onChange={(e)=>{this.setState({province:e})}}>
  630. {
  631. cityArr.map(function (item) {
  632. return <Select.Option key={item.value} >{item.key}</Select.Option>
  633. })
  634. }
  635. </Select>
  636. </FormItem>
  637. <FormItem className="half-item"
  638. {...formItemLayout}
  639. label="联系手机" >
  640. {<Input placeholder="请输入联系手机" value={this.state.contactPhone}
  641. onChange={(e)=>{this.setState({contactPhone:e.target.value})}} style={{width:'240px'}} />}
  642. </FormItem>
  643. <FormItem className="half-item"
  644. {...formItemLayout}
  645. label="电子邮箱" >
  646. {<Input placeholder="请输入电子邮箱" value={this.state.email}
  647. onChange={(e)=>{this.setState({email:e.target.value})}} style={{width:'240px'}} />}
  648. </FormItem>
  649. </div>
  650. <div style={{overflow:'hidden'}}>
  651. <Button style={{float:'right'}} onClick={this.onCal}>取消</Button>
  652. <Button type="primary" style={{float:'right',marginRight:'10px'}} onClick={this.onSure}>保存</Button>
  653. </div>
  654. </Modal>
  655. </div >
  656. </div>
  657. )
  658. }
  659. }))
  660. export default PatentPayment;