patentDetails.jsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. import React,{Component} from "react";
  2. import {
  3. Modal,
  4. Form,
  5. Row,
  6. Col,
  7. Table,
  8. Spin,
  9. message,
  10. Button,
  11. Input,
  12. Select,
  13. DatePicker,
  14. Popconfirm,
  15. Tooltip
  16. } from "antd";
  17. import $ from "jquery/src/ajax";
  18. import moment from 'moment';
  19. import ReminderLog from "../../customer/NEW/crm/reminderLog";
  20. import {getPatentType} from "@/tools.js";
  21. import { patentTypeList} from '@/dataDic.js';
  22. const FormItem = Form.Item;
  23. const formItemLayout = {
  24. labelCol: { span: 10 },
  25. wrapperCol: { span: 14 },
  26. };
  27. class PatentDetails extends Component{
  28. constructor(props) {
  29. super(props);
  30. this.state={
  31. columns:[
  32. {
  33. title: "序号",
  34. dataIndex: "key",
  35. key: "key",
  36. width:'50px'
  37. },
  38. {
  39. title: "费用种类",
  40. dataIndex: "years",
  41. key: "years",
  42. width:'150px',
  43. render:(text)=>(
  44. <span>
  45. {getPatentType(this.props.detailsInfor.type)}
  46. {text}
  47. 年年费
  48. </span>
  49. )
  50. },
  51. {
  52. title: "金额",
  53. dataIndex: "patentAmount",
  54. key: "patentAmount",
  55. width:'100px'
  56. },
  57. {
  58. title: "缴费日",
  59. dataIndex: "endDate",
  60. key: "endDate",
  61. width:'100px',
  62. render:(text)=>(
  63. moment(text).format('YYYY-MM-DD')
  64. )
  65. },
  66. ],
  67. dataSource:[],
  68. loading:false,
  69. detailsInfor:{},
  70. }
  71. this.payLoadData = this.payLoadData.bind(this);
  72. this.onChange = this.onChange.bind(this);
  73. }
  74. componentDidMount() {
  75. this.payLoadData();
  76. const {detailsInfor, readOnly} = this.props;
  77. if (!readOnly) {
  78. this.setState({
  79. patentNo: detailsInfor.patentNo,
  80. tid: detailsInfor.tid,
  81. email:detailsInfor.email,
  82. name: detailsInfor.name,
  83. type: detailsInfor.type,
  84. holders: detailsInfor.holders,
  85. inventor: detailsInfor.inventor,
  86. applyDates: detailsInfor.applyDates,
  87. authorizationDates: detailsInfor.authorizationDates,
  88. annualFeeStatus: detailsInfor.annualFeeStatus,
  89. delayingAmount: detailsInfor.delayingAmount,
  90. recoveryAmount: detailsInfor.recoveryAmount,
  91. })
  92. }
  93. }
  94. payLoadData() {
  95. this.setState({
  96. loading: true,
  97. });
  98. const {detailsInfor} = this.props;
  99. $.ajax({
  100. method: "get",
  101. dataType: "json",
  102. crossDomain: false,
  103. url: globalConfig.context + "/api/admin/patentNew/patentPaymentDetails",
  104. data: {
  105. id:detailsInfor.id
  106. },
  107. success: function (data) {
  108. if(data.error.length === 0){
  109. for(let i =0;i<data.data.length;i++){
  110. data.data[i].key = i+1;
  111. }
  112. this.setState({
  113. dataSource: data.data,
  114. });
  115. }else{
  116. message.warning(data.error[0].message);
  117. }
  118. }.bind(this),
  119. }).always(
  120. function () {
  121. this.setState({
  122. loading: false,
  123. });
  124. }.bind(this)
  125. );
  126. }
  127. onChange(){
  128. if(!this.state.patentNo){
  129. message.warning('请输入专利号')
  130. return;
  131. }
  132. if(!this.state.name){
  133. message.warning('请输入专利名称')
  134. return;
  135. }
  136. if(isNaN(parseInt(this.state.type))){
  137. message.warning('请选择专利类型')
  138. return;
  139. }
  140. if(!this.state.applyDates){
  141. message.warning('请选择申请日期')
  142. return;
  143. }
  144. if(!isNaN(parseInt(this.state.delayingAmount)) && this.state.delayingAmount < 0){
  145. message.warning('滞纳金不能小于零')
  146. return;
  147. }
  148. if(!isNaN(parseInt(this.state.recoveryAmount)) && this.state.recoveryAmount < 0){
  149. message.warning('权利恢复费不能小于零')
  150. return;
  151. }
  152. this.setState({
  153. loading: true,
  154. });
  155. const {detailsInfor} = this.props;
  156. $.ajax({
  157. method: "POST",
  158. dataType: "json",
  159. crossDomain: false,
  160. url: globalConfig.context + "/api/admin/patentNew/updatePatentNew",
  161. data: {
  162. id:detailsInfor.id,
  163. patentNo: this.state.patentNo,
  164. name: this.state.name,
  165. type: this.state.type,
  166. applyDates: this.state.applyDates,
  167. tid: this.state.tid || undefined,
  168. email: this.state.email || undefined,
  169. holders: this.state.holders || undefined,
  170. inventor: this.state.inventor || undefined,
  171. authorizationDates: this.state.authorizationDates || undefined,
  172. annualFeeStatus: isNaN(parseInt(this.state.annualFeeStatus)) ? undefined : this.state.annualFeeStatus,
  173. delayingAmount: isNaN(parseInt(this.state.delayingAmount)) ? undefined : this.state.delayingAmount,
  174. recoveryAmount: isNaN(parseInt(this.state.recoveryAmount)) ? undefined : this.state.recoveryAmount,
  175. },
  176. success: function (data) {
  177. if(data.error.length === 0){
  178. message.success('修改成功');
  179. this.props.onRefresh();
  180. this.props.onCancel();
  181. }else{
  182. message.warning(data.error[0].message);
  183. }
  184. }.bind(this),
  185. }).always(
  186. function () {
  187. this.setState({
  188. loading: false,
  189. });
  190. }.bind(this)
  191. );
  192. }
  193. render() {
  194. const {detailsInfor,readOnly} = this.props;
  195. return (
  196. <Modal
  197. title='年费数据'
  198. className='payRecordComponent'
  199. width={800}
  200. maskClosable={false}
  201. footer={null}
  202. visible={this.props.visible}
  203. onCancel={this.props.onCancel}
  204. >
  205. <Button
  206. onClick={()=>{
  207. this.setState({
  208. visible:true,
  209. id:detailsInfor.id
  210. })
  211. }}
  212. style={{
  213. position: 'absolute',
  214. top: '9px',
  215. right: '49px',
  216. }}
  217. type='primary'>
  218. 查看专利日志
  219. </Button>
  220. <Form layout="horizontal">
  221. <Row gutter={40}>
  222. <Col span={8}>
  223. <FormItem
  224. required
  225. {...formItemLayout}
  226. label='专利号'
  227. >
  228. {
  229. readOnly ? detailsInfor.patentNo :
  230. <Input
  231. value={this.state.patentNo}
  232. onChange={(e)=>{
  233. this.setState({
  234. patentNo:e.target.value
  235. })
  236. }}
  237. />
  238. }
  239. </FormItem>
  240. </Col>
  241. <Col span={8}>
  242. <FormItem
  243. {...formItemLayout}
  244. label='专利名称'
  245. required
  246. >
  247. {
  248. readOnly ? detailsInfor.name :
  249. <Input
  250. value={this.state.name}
  251. onChange={(e)=>{
  252. this.setState({
  253. name:e.target.value
  254. })
  255. }}
  256. />
  257. }
  258. </FormItem>
  259. </Col>
  260. <Col span={8}>
  261. <FormItem
  262. {...formItemLayout}
  263. label='专利类型'
  264. required
  265. >
  266. {
  267. readOnly ?
  268. getPatentType(detailsInfor.type) :
  269. <Select
  270. placeholder="请选择专利类型"
  271. style={{paddingTop: '5px'}}
  272. value={getPatentType(this.state.type)}
  273. onChange={e => {
  274. this.setState({ type: e });
  275. }}
  276. >
  277. {patentTypeList.map(function(item) {
  278. return (
  279. <Select.Option key={item.value}>
  280. {item.key}
  281. </Select.Option>
  282. );
  283. })}
  284. </Select>
  285. }
  286. </FormItem>
  287. </Col>
  288. <Col span={8}>
  289. <FormItem
  290. {...formItemLayout}
  291. label='申请日期'
  292. required
  293. >
  294. {
  295. readOnly ? detailsInfor.applyDates:
  296. <DatePicker
  297. value={this.state.applyDates ? moment(this.state.applyDates) : ''}
  298. format='YYYY-MM-DD'
  299. onChange={(date)=>{
  300. this.setState({
  301. applyDates:date ? moment(date).format('YYYY-MM-DD') : '',
  302. })
  303. }}
  304. />
  305. }
  306. </FormItem>
  307. </Col>
  308. <Col span={8}>
  309. <FormItem
  310. {...formItemLayout}
  311. label='项目编号'
  312. >
  313. {
  314. readOnly ? detailsInfor.tid :
  315. <Input
  316. value={this.state.tid}
  317. onChange={(e)=>{
  318. this.setState({
  319. tid:e.target.value
  320. })
  321. }}
  322. />
  323. }
  324. </FormItem>
  325. </Col>
  326. <Col span={8}>
  327. <FormItem
  328. {...formItemLayout}
  329. label='授权日期'
  330. >
  331. {
  332. readOnly ? detailsInfor.authorizationDates:
  333. <DatePicker
  334. value={this.state.authorizationDates ? moment(this.state.authorizationDates) : ''}
  335. format='YYYY-MM-DD'
  336. onChange={(date)=>{
  337. this.setState({
  338. authorizationDates:date ? moment(date).format('YYYY-MM-DD') : '',
  339. })
  340. }}
  341. />
  342. }
  343. </FormItem>
  344. </Col>
  345. <Col span={8}>
  346. <FormItem
  347. {...formItemLayout}
  348. label='Email'
  349. >
  350. {
  351. readOnly ?
  352. <Tooltip placement="topLeft" title={detailsInfor.email}>
  353. <div style={{
  354. width:'100%',
  355. overflow: 'hidden',
  356. whiteSpace: 'nowrap',
  357. textOverflow: 'ellipsis',
  358. }}>
  359. {detailsInfor.email}
  360. </div>
  361. </Tooltip>:
  362. <Input
  363. value={this.state.email}
  364. onChange={(e)=>{
  365. this.setState({
  366. email:e.target.value
  367. })
  368. }}
  369. />
  370. }
  371. </FormItem>
  372. </Col>
  373. <Col span={8}>
  374. <FormItem
  375. {...formItemLayout}
  376. label='滞纳金'
  377. >
  378. {
  379. readOnly ? detailsInfor.delayingAmount :
  380. <Input
  381. style={{paddingTop: '5px'}}
  382. type='number'
  383. value={this.state.delayingAmount}
  384. onChange={(e)=>{
  385. this.setState({
  386. delayingAmount:e.target.value
  387. })
  388. }}
  389. />
  390. }
  391. </FormItem>
  392. </Col>
  393. <Col span={8}>
  394. <FormItem
  395. {...formItemLayout}
  396. label='权利恢复费'
  397. >
  398. {
  399. readOnly ? detailsInfor.recoveryAmount :
  400. <Input
  401. style={{paddingTop: '5px'}}
  402. type='number'
  403. value={this.state.recoveryAmount}
  404. onChange={(e)=>{
  405. this.setState({
  406. recoveryAmount:e.target.value
  407. })
  408. }}
  409. />
  410. }
  411. </FormItem>
  412. </Col>
  413. <Col span={8}>
  414. <FormItem
  415. {...formItemLayout}
  416. label='年费状态'
  417. >
  418. {
  419. readOnly ? (
  420. detailsInfor.annualFeeStatus === 0 ? '待缴费' :
  421. detailsInfor.annualFeeStatus === 1 ? '已缴费' : ''
  422. ) :
  423. <Select style={{paddingTop: '5px'}} value={this.state.annualFeeStatus} onSelect={(e)=>{this.setState({annualFeeStatus:e})}}>
  424. <Select.Option value={0}>待缴费</Select.Option>
  425. <Select.Option value={1}>已缴费</Select.Option>
  426. </Select>
  427. }
  428. </FormItem>
  429. </Col>
  430. <Col span={8}>
  431. <FormItem
  432. {...formItemLayout}
  433. label='权利人'
  434. >
  435. {
  436. readOnly ? <Tooltip title={detailsInfor.holders}>
  437. <div style={{
  438. maxWidth:'120px',
  439. overflow:'hidden',
  440. textOverflow: "ellipsis",
  441. whiteSpace:'nowrap',
  442. }}>{detailsInfor.holders}</div>
  443. </Tooltip> :
  444. <Input
  445. value={this.state.holders}
  446. onChange={(e)=>{
  447. this.setState({
  448. holders:e.target.value
  449. })
  450. }}
  451. />
  452. }
  453. </FormItem>
  454. </Col>
  455. <Col span={8}>
  456. <FormItem
  457. {...formItemLayout}
  458. label='发明人'
  459. >
  460. {
  461. readOnly ? <Tooltip title={detailsInfor.inventor}>
  462. <div style={{
  463. maxWidth:'120px',
  464. overflow:'hidden',
  465. textOverflow: "ellipsis",
  466. whiteSpace:'nowrap',
  467. }}>{detailsInfor.inventor}</div>
  468. </Tooltip> :
  469. <Input
  470. value={this.state.inventor}
  471. onChange={(e)=>{
  472. this.setState({
  473. inventor:e.target.value
  474. })
  475. }}
  476. />
  477. }
  478. </FormItem>
  479. </Col>
  480. <Col span={8}>
  481. <FormItem
  482. {...formItemLayout}
  483. label='年费'
  484. >
  485. {detailsInfor.patentAmount}
  486. </FormItem>
  487. </Col>
  488. <Col span={8}>
  489. <FormItem
  490. {...formItemLayout}
  491. label='费减状态'
  492. >
  493. {detailsInfor.tid ? (detailsInfor.costReduction === 1 ? '有费减' : detailsInfor.costReduction === 0 ? '无费减' : '') : '无'}
  494. </FormItem>
  495. </Col>
  496. <Col span={8}>
  497. <FormItem
  498. {...formItemLayout}
  499. label='通知'
  500. >
  501. <div style={{display:'flex',alignItems:'center'}}>
  502. {
  503. detailsInfor.salesmanRemind === 0 ? '未通知' :
  504. detailsInfor.salesmanRemind === 1 ? '已通知' : ''
  505. }
  506. </div>
  507. </FormItem>
  508. </Col>
  509. </Row>
  510. {!readOnly ?
  511. <div style={{
  512. margin:'30px',
  513. display:'flex',
  514. justifyContent:'center'
  515. }}>
  516. <Popconfirm placement="top" title="确定提交吗?" onConfirm={(e)=>{
  517. e.stopPropagation();
  518. this.onChange();
  519. }} okText="确定" cancelText="取消">
  520. <Button
  521. loading={this.state.loading}
  522. size='large'
  523. type="primary"
  524. onClick={(e)=>{
  525. e.stopPropagation();
  526. }}
  527. >
  528. 确定提交
  529. </Button>
  530. </Popconfirm>
  531. </div>
  532. : null}
  533. </Form>
  534. <Spin spinning={this.state.loading}>
  535. <Table
  536. scroll={{ y: 320 }}
  537. columns={this.state.columns}
  538. dataSource={this.state.dataSource}
  539. pagination={false}
  540. bordered
  541. size="small"
  542. />
  543. </Spin>
  544. {this.state.visible ? <ReminderLog
  545. id={this.state.id}
  546. visible={this.state.visible}
  547. cancel={()=>{
  548. this.setState({
  549. visible:false,
  550. id:undefined
  551. })
  552. }}
  553. /> : null}
  554. </Modal>
  555. )
  556. }
  557. }
  558. export default PatentDetails;