patentSchedule.jsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. import React,{ Component } from 'react';
  2. import {Button, DatePicker, Select, Table, Input, Modal, Spin, message} from "antd";
  3. import moment from "moment";
  4. import $ from "jquery";
  5. const { Option } = Select;
  6. const confirm = Modal.confirm;
  7. class PatentSchedule extends Component{
  8. constructor(props) {
  9. super(props);
  10. this.state={
  11. columns: [
  12. {
  13. title: '批次',
  14. dataIndex: 'key',
  15. key: 'key',
  16. render: (text, record,index) => {
  17. return index+1;
  18. }
  19. },
  20. {
  21. title: props.bpType === 6 ? '商标号' : '专利号',
  22. dataIndex: 'patentNo',
  23. key: 'patentNo',
  24. render: (text, record,index) => {
  25. return !record.isChange ? text : <Input
  26. value={text}
  27. size={'small'}
  28. style={{
  29. width: '100px'
  30. }}
  31. onChange={(e)=>{
  32. this.changeEvidence(e.target.value,index,'patentNo')
  33. }}/>
  34. }
  35. },
  36. {
  37. title: props.bpType === 6 ? '商标名称' : '专利名称',
  38. dataIndex: 'patentName',
  39. key: 'patentName',
  40. render: (text, record,index) => {
  41. return !record.isChange ? text : <Input
  42. value={text}
  43. style={{width: '100px'}}
  44. size={'small'}
  45. onChange={(e)=>{
  46. this.changeEvidence(e.target.value,index,'patentName')
  47. }}/>
  48. }
  49. },
  50. {
  51. title: '受理时间',
  52. dataIndex: 'acceptTimes',
  53. key: 'acceptTimes',
  54. render: (text, record,index) => {
  55. return !record.isChange ? text : <DatePicker
  56. value={
  57. text ? moment(text) : null
  58. }
  59. size={'small'}
  60. style={{
  61. marginTop: '4px',
  62. width: '100px'
  63. }}
  64. showTime
  65. format="YYYY-MM-DD"
  66. onChange={(data, dataString) => {
  67. this.changeEvidence(dataString,index,'acceptTimes')
  68. }}
  69. />
  70. }
  71. },
  72. {
  73. title: '下证时间',
  74. dataIndex: 'licenceTimes',
  75. key: 'licenceTimes',
  76. render: (text, record,index) => {
  77. return !record.isChange ? text : <DatePicker
  78. value={
  79. text ? moment(text) : null
  80. }
  81. size={'small'}
  82. style={{
  83. marginTop: '4px',
  84. width: '100px'
  85. }}
  86. showTime
  87. format="YYYY-MM-DD"
  88. onChange={(data, dataString) => {
  89. this.changeEvidence(dataString,index,'licenceTimes')
  90. }}
  91. />
  92. }
  93. },
  94. {
  95. title: '状态',
  96. dataIndex: 'status',
  97. key: 'status',
  98. render: (text, record,index) => {
  99. return !record.isChange ? text === 0 ? '待审核' : text === 1 ? '通过' : '驳回' : <Select style={{width:'80px'}} value={text} size={'small'} onChange={(v)=>{
  100. this.changeEvidence(v,index,'status')
  101. }}>
  102. <Option value={0}>待审核</Option>
  103. <Option value={1}>通过</Option>
  104. <option value={2}>驳回</option>
  105. </Select>
  106. }
  107. },
  108. {
  109. title: '操作',
  110. dataIndex: 'h',
  111. key: 'h',
  112. render: (text, record,index) => {
  113. return (
  114. !props.readOnly ? <span>
  115. <Button
  116. size={'small'}
  117. style={{
  118. marginRight:'10px',
  119. color: '#ffffff',
  120. background: '#f00',
  121. border: 'none',
  122. }}
  123. loading={this.state.loading}
  124. onClick={()=>{
  125. let _this = this;
  126. if(record.isChange){
  127. this.state.dataSource.splice(index,1)
  128. this.setState({
  129. dataSource: this.state.dataSource
  130. })
  131. }else{
  132. confirm({
  133. title: '提醒',
  134. content: '确定要删除吗?',
  135. onOk() {
  136. _this.delectTaskProgress(record.id)
  137. }
  138. })
  139. }
  140. }}
  141. >
  142. 删除
  143. </Button>
  144. {record.id && !record.isChange && <Button size={'small'} type='primary' onClick={()=>{
  145. this.state.dataSource[index]['isChange'] = true
  146. this.setState({
  147. dataSource: this.state.dataSource
  148. })
  149. }}>修改</Button>}
  150. {record.isChange &&<Button
  151. size={'small'}
  152. loading={this.state.loading}
  153. style={{
  154. marginLeft:'10px',
  155. color: '#ffffff',
  156. background: '#4ad028',
  157. border: 'none',
  158. }} onClick={()=>{
  159. if(record.id){
  160. this.changeTaskProgress(record);
  161. }else{
  162. this.createTaskProgress(record);
  163. }
  164. }}>保存</Button> }
  165. </span> : null
  166. )
  167. }
  168. }
  169. ],
  170. dataSource: [],
  171. visible: false,
  172. columnsA: [
  173. {
  174. title: '时间',
  175. dataIndex: 'createTime',
  176. key: 'createTime',
  177. },
  178. {
  179. title: '操作类型',
  180. dataIndex: 'status',
  181. key: 'status',
  182. render: (text, record) => {
  183. return text === 0 ? '新增' : text === 1 ? '删除' : '修改'
  184. }
  185. },
  186. {
  187. title: '专利号',
  188. dataIndex: 'patentName',
  189. key: 'patentName',
  190. }
  191. ],
  192. dataSourceA: [],
  193. progressLogLoading: false,
  194. acceptCount: props.acceptCount || 0,
  195. certificatesCount: props.certificatesCount || 0,
  196. rejectCount: props.rejectCount || 0,
  197. };
  198. this.changeEvidence = this.changeEvidence.bind(this);
  199. this.createTaskProgress = this.createTaskProgress.bind(this);
  200. this.selectTaskProgressLog = this.selectTaskProgressLog.bind(this);
  201. this.delectTaskProgress = this.delectTaskProgress.bind(this);
  202. this.changeTaskProgress = this.changeTaskProgress.bind(this);
  203. this.loaduserss = this.loaduserss.bind(this);
  204. }
  205. changeEvidence(value,index,key){
  206. this.state.dataSource[index][key] = value;
  207. this.setState({
  208. dataSource: this.state.dataSource
  209. })
  210. }
  211. //新增申报进度
  212. createTaskProgress(record) {
  213. if(!record.patentNo){
  214. message.warning('请填写专利号');
  215. return;
  216. }
  217. if(!record.patentName){
  218. message.warning('请填写专利名称');
  219. return;
  220. }
  221. if(typeof record.status !== 'number'){
  222. message.warning('请选择状态');
  223. return;
  224. }
  225. this.setState({
  226. loading: true,
  227. })
  228. let _this = this;
  229. let data = Object.assign({},record);
  230. delete data.isChange;
  231. delete data.key;
  232. data.taskId = this.props.taskId;
  233. data.alreadyNumber = 1;
  234. data.type = this.props.bpType === 1 ? 1 : this.props.bpType === 6 ? 2 : '';//0软著 1专利 2商标
  235. $.ajax({
  236. method: 'post',
  237. dataType: 'json',
  238. crossDomain: false,
  239. url: globalConfig.context + '/api/admin/orderProject/createTaskProgress',
  240. data: data,
  241. success: function (data) {
  242. if (data.error.length) {
  243. if (data.error && data.error.length) {
  244. message.warning(data.error[0].message)
  245. }
  246. }else{
  247. message.success('添加成功');
  248. delete record.isChange;
  249. delete record.key;
  250. _this.props.refresh && _this.props.refresh();
  251. _this.loaduserss();
  252. }
  253. }.bind(this),
  254. }).always(
  255. function () {
  256. this.setState({
  257. loading: false,
  258. })
  259. }.bind(this)
  260. )
  261. }
  262. //申报进度日志
  263. selectTaskProgressLog() {
  264. this.setState({
  265. loading: true,
  266. })
  267. $.ajax({
  268. method: 'get',
  269. dataType: 'json',
  270. crossDomain: false,
  271. url: globalConfig.context + '/api/admin/orderProject/selectTaskProgressLog',
  272. data: {
  273. tid: this.props.taskId,
  274. },
  275. success: function (data) {
  276. let theArr = []
  277. if (data.error.length || data.data.list === '') {
  278. if (data.error && data.error.length) {
  279. message.warning(data.error[0].message)
  280. }
  281. } else {
  282. for (let i = 0; i < data.data.length; i++) {
  283. let thisdata = data.data[i];
  284. thisdata.key = i;
  285. theArr.push(thisdata)
  286. }
  287. }
  288. this.setState({
  289. dataSourceA: theArr,
  290. })
  291. }.bind(this),
  292. }).always(
  293. function () {
  294. this.setState({
  295. loading: false,
  296. })
  297. }.bind(this)
  298. )
  299. }
  300. //修改申报进度
  301. changeTaskProgress(record) {
  302. if(!record.patentNo){
  303. message.warning('请填写专利号');
  304. return;
  305. }
  306. if(!record.patentName){
  307. message.warning('请填写专利名称');
  308. return;
  309. }
  310. if(typeof record.status !== 'number'){
  311. message.warning('请选择状态');
  312. return;
  313. }
  314. this.setState({
  315. loading: true,
  316. })
  317. let _this = this;
  318. let data = Object.assign({},record);
  319. delete data.isChange;
  320. delete data.key;
  321. data.taskId = this.props.taskId;
  322. data.alreadyNumber = 1;
  323. data.type = this.props.bpType === 1 ? 1 : this.props.bpType === 6 ? 2 : '';//0软著 1专利 2商标
  324. for(let i in data){
  325. if(typeof data[i] === 'object'){
  326. delete data[i]
  327. }
  328. }
  329. $.ajax({
  330. method: 'post',
  331. dataType: 'json',
  332. crossDomain: false,
  333. url: globalConfig.context + '/api/admin/orderProject/updateTaskProgress',
  334. data: data,
  335. success: function (data) {
  336. if (data.error.length) {
  337. if (data.error && data.error.length) {
  338. message.warning(data.error[0].message)
  339. }
  340. }else{
  341. message.success('修改成功');
  342. delete record.isChange;
  343. delete record.key;
  344. _this.props.refresh && _this.props.refresh();
  345. _this.loaduserss();
  346. }
  347. }.bind(this),
  348. }).always(
  349. function () {
  350. this.setState({
  351. loading: false,
  352. })
  353. }.bind(this)
  354. )
  355. }
  356. // 删除申报进度
  357. delectTaskProgress(id) {
  358. this.setState({
  359. loading: true,
  360. })
  361. let _this = this;
  362. $.ajax({
  363. method: 'post',
  364. dataType: 'json',
  365. crossDomain: false,
  366. url: globalConfig.context + '/api/admin/orderProject/delectTaskProgress',
  367. data: {
  368. id
  369. },
  370. success: function (data) {
  371. if (data.error.length) {
  372. if (data.error && data.error.length) {
  373. message.warning(data.error[0].message)
  374. }
  375. }else{
  376. message.success('删除成功');
  377. _this.loaduserss();
  378. _this.props.refresh && this.props.refresh();
  379. }
  380. }.bind(this),
  381. }).always(
  382. function () {
  383. this.setState({
  384. loading: false,
  385. })
  386. }.bind(this)
  387. )
  388. }
  389. //查看下证信息
  390. loaduserss() {
  391. this.setState({
  392. progressLogLoading: true,
  393. })
  394. $.ajax({
  395. method: 'get',
  396. dataType: 'json',
  397. crossDomain: false,
  398. url: globalConfig.context + '/api/admin/orderProject/selectTaskProgress',
  399. data: {
  400. tid: this.props.taskId,
  401. },
  402. success: function (data) {
  403. let thisData = []
  404. if (!thisData) {
  405. if (data.error && data.error.length) {
  406. message.warning(data.error[0].message)
  407. }
  408. } else {
  409. this.setState({
  410. dataSource: data.data,
  411. })
  412. }
  413. }.bind(this),
  414. }).always(
  415. function () {
  416. this.setState({
  417. progressLogLoading: false,
  418. })
  419. }.bind(this)
  420. )
  421. }
  422. componentDidMount() {
  423. this.loaduserss();
  424. if(this.props.bpType === 1){
  425. this.state.columns.splice(-2,0,{
  426. title: '授权时间',
  427. dataIndex: 'authorizeTimes',
  428. key: 'authorizeTimes',
  429. render: (text, record,index) => {
  430. return !record.isChange ? text : <DatePicker
  431. size={'small'}
  432. style={{
  433. marginTop: '4px',
  434. width: '100px'
  435. }}
  436. value={
  437. text ? moment(text) : null
  438. }
  439. showTime
  440. format="YYYY-MM-DD"
  441. onChange={(data, dataString) => {
  442. this.changeEvidence(dataString,index,'authorizeTimes')
  443. }}
  444. />
  445. }
  446. });
  447. this.setState({
  448. columns:this.state.columns
  449. })
  450. }
  451. }
  452. render() {
  453. return (
  454. <div>
  455. <div style={{
  456. display:'flex',
  457. alignItems:'center',
  458. paddingLeft: '3%',
  459. paddingRight: '10%',
  460. color: '#000',
  461. fontWeight: 400,
  462. }}>
  463. <div style={{paddingRight:'10px'}}>派单项目数:{this.props.commodityQuantity}</div>
  464. <div style={{paddingRight:'10px'}}>
  465. 受理数:
  466. {this.props.readOnly ?
  467. this.props.acceptCount:
  468. <Input type='number' defaultValue={this.props.acceptCount || 0} value={this.state.acceptCount} style={{width:'70px'}} onChange={(e)=>{
  469. this.setState({
  470. acceptCount:e.target.value
  471. })
  472. this.props.onChange('acceptCount',e.target.value);
  473. }}/>
  474. }
  475. </div>
  476. <div style={{paddingRight:'10px'}}>
  477. 下证数(即授权数):
  478. {this.props.readOnly ?
  479. this.props.certificatesCount:
  480. <Input type='number' defaultValue={this.props.certificatesCount || 0} value={this.state.certificatesCount || (this.props.certificatesCount || 0)} style={{width:'70px'}} onChange={(e)=>{
  481. this.setState({
  482. certificatesCount:e.target.value
  483. })
  484. this.props.onChange('certificatesCount',e.target.value);
  485. }}/>
  486. }
  487. </div>
  488. <div>
  489. 驳回数:
  490. {this.props.readOnly ?
  491. this.props.rejectCount:
  492. <Input type='number' defaultValue={this.props.rejectCount || 0} value={this.state.rejectCount || (this.props.rejectCount || 0)} style={{width:'70px'}} onChange={(e)=>{
  493. this.setState({
  494. rejectCount:e.target.value
  495. })
  496. this.props.onChange('rejectCount',e.target.value);
  497. }}/>
  498. }
  499. </div>
  500. <div style={{display:'flex',alignItems:'center',marginLeft:'auto'}}>
  501. {!this.props.readOnly ? <Button
  502. type="primary"
  503. style={{ marginRight: '15px' }}
  504. onClick={()=>{
  505. let arr = this.state.dataSource.filter((v)=>v.isChange)
  506. if(arr.length > 0){
  507. message.warning('已存在未保存项,请先保存!')
  508. return;
  509. }
  510. this.state.dataSource.push({
  511. key: this.state.dataSource.length+1,
  512. isChange: true,
  513. })
  514. this.setState({
  515. dataSource: this.state.dataSource
  516. })
  517. }}
  518. >
  519. {/* bpType: 0 正常 1专利 2软著 3审计 4双软 5高新 6商标*/}
  520. {this.props.bpType === 1 ? '增加专利信息' : this.props.bpType === 6 ? '增加商标信息' : ''}
  521. </Button> : null}
  522. <Button
  523. type="primary"
  524. onClick={()=>{
  525. this.selectTaskProgressLog();
  526. this.setState({
  527. visible: true
  528. })
  529. }}
  530. >
  531. 操作日志
  532. </Button>
  533. </div>
  534. </div>
  535. <div style={{
  536. paddingTop:'10px'
  537. }}>
  538. <Spin spinning={this.state.progressLogLoading}>
  539. <Table
  540. columns={this.state.columns}
  541. scroll={{ x: 'max-content', y: 0 }}
  542. dataSource={this.state.dataSource}
  543. pagination={false}
  544. bordered
  545. size={'small'}
  546. />
  547. </Spin>
  548. </div>
  549. {this.state.visible ? <Modal
  550. maskClosable={false}
  551. width="800px"
  552. visible={this.state.visible}
  553. onCancel={()=>{
  554. this.setState({
  555. visible: false
  556. })
  557. }}
  558. title="操作日志"
  559. footer=""
  560. className="admin-desc-content"
  561. >
  562. <div className="patent-table patent-table-center">
  563. <Spin spinning={this.state.loading}>
  564. <Table
  565. columns={this.state.columnsA}
  566. dataSource={this.state.dataSourceA}
  567. pagination={false}
  568. bordered
  569. size="small"
  570. />
  571. </Spin>
  572. </div>
  573. </Modal> : null}
  574. </div>
  575. )
  576. }
  577. }
  578. export default PatentSchedule;