copyright.jsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader, Switch, Modal } from 'antd';
  3. import { provinceArr, copyrightStateList } from '../../../dataDic.js';
  4. import { getTime, companySearch, getCopyrightState, getInUrgentTime, getSearchUrl } from '../../../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import PatentAdd from './comPatentAdd.jsx';
  8. import PatentChange from './comPatentChange.jsx';
  9. import moment from 'moment';
  10. import './copyright.less';
  11. const copyright = React.createClass({
  12. loadData(pageNo) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "get",
  19. dataType: "json",
  20. crossDomain: false,
  21. url: globalConfig.context + "/api/admin/copyright/list",
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. province: this.state.province,
  26. uid: this.state.unitName,
  27. contractId: this.state.contractId,
  28. copyrightName: this.state.copyrightName,
  29. status: this.state.searchStatus,
  30. createTime: this.state.createTime,
  31. acceptTime: this.state.acceptTime,
  32. authTime: this.state.authTime
  33. },
  34. success: function (data) {
  35. if (data.error.length || !data.data || !data.data.list) {
  36. message.warning(data.error[0].message);
  37. return;
  38. };
  39. for (let i = 0; i < data.data.list.length; i++) {
  40. let thisdata = data.data.list[i];
  41. this.state.data.push({
  42. key: i,
  43. id: thisdata.id,
  44. uid: thisdata.uid,
  45. province: thisdata.province,
  46. unitName: thisdata.unitName,
  47. serialNumber: thisdata.serialNumber,
  48. contractNumber: thisdata.contractNumber,
  49. createTime: thisdata.createTime,
  50. acceptTime: thisdata.acceptTime,
  51. principal: thisdata.principal,
  52. contact: thisdata.contact,
  53. copyrightName: thisdata.copyrightName,
  54. copyrightNumber: thisdata.copyrightNumber,
  55. status: thisdata.status,
  56. comment: thisdata.comment,
  57. workIssue: thisdata.workIssue,
  58. outsource: thisdata.outsource,
  59. inUrgent: thisdata.inUrgent,
  60. expectTime: [thisdata.acceptTime, thisdata.inUrgent],
  61. authorizedDate: thisdata.authorizedDate,
  62. fisrtContact: thisdata.fisrtContact,
  63. secondContact: thisdata.secondContact,
  64. thirdContact: thisdata.thirdContact,
  65. authorizedDateFormattedDate: thisdata.authorizedDateFormattedDate,
  66. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  67. acceptTimeFormattedDate: thisdata.acceptTimeFormattedDate,
  68. founder: thisdata.founder,
  69. techPrincipal: thisdata.techPrincipal
  70. });
  71. };
  72. this.state.pagination.defaultCurrent = data.data.pageNo;
  73. this.state.pagination.total = data.data.totalCount;
  74. this.setState({
  75. dataSource: this.state.data,
  76. pagination: this.state.pagination
  77. });
  78. }.bind(this),
  79. }).always(function () {
  80. this.setState({
  81. loading: false
  82. });
  83. }.bind(this));
  84. },
  85. getAuthorList() {
  86. this.setState({
  87. loading: true
  88. });
  89. $.ajax({
  90. method: "get",
  91. dataType: "json",
  92. crossDomain: false,
  93. url: globalConfig.context + "/api/admin/copyright/getPrincipal",
  94. success: function (data) {
  95. if (!data.data) {
  96. if (data.error && data.error.length) {
  97. message.warning(data.error[0].message);
  98. }
  99. return;
  100. };
  101. let _me = this;
  102. for (var item in data.data) {
  103. _me.state.authorOption.push(
  104. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  105. )
  106. };
  107. }.bind(this),
  108. }).always(function () {
  109. this.setState({
  110. loading: false
  111. });
  112. }.bind(this));
  113. },
  114. getSalesmanList() {
  115. this.setState({
  116. loading: true
  117. });
  118. $.ajax({
  119. method: "get",
  120. dataType: "json",
  121. crossDomain: false,
  122. url: globalConfig.context + "/api/admin/salesman",
  123. success: function (data) {
  124. if (!data.data) {
  125. if (data.error && data.error.length) {
  126. message.warning(data.error[0].message);
  127. }
  128. return;
  129. };
  130. let _me = this, theArr = [];
  131. for (var item in data.data) {
  132. theArr.push(
  133. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  134. )
  135. };
  136. this.setState({
  137. salesmanOption: theArr
  138. });
  139. }.bind(this),
  140. }).always(function () {
  141. this.setState({
  142. loading: false
  143. });
  144. }.bind(this));
  145. },
  146. getCompanyList() {
  147. this.setState({
  148. loading: true
  149. });
  150. $.ajax({
  151. method: "get",
  152. dataType: "json",
  153. crossDomain: false,
  154. url: globalConfig.context + "/api/admin/getUnitNames",
  155. success: function (data) {
  156. if (!data.data) {
  157. if (data.error && data.error.length) {
  158. message.warning(data.error[0].message);
  159. };
  160. return;
  161. };
  162. let _me = this;
  163. for (var item in data.data) {
  164. _me.state.companyOption.push(
  165. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  166. )
  167. };
  168. }.bind(this),
  169. }).always(function () {
  170. this.setState({
  171. loading: false
  172. });
  173. }.bind(this));
  174. },
  175. getStateList() {
  176. this.setState({
  177. loading: true
  178. });
  179. $.ajax({
  180. method: "get",
  181. dataType: "json",
  182. crossDomain: false,
  183. url: globalConfig.context + "/api/admin/copyright/status",
  184. success: function (data) {
  185. let _me = this;
  186. if (!data.data) {
  187. if (data.error && data.error.length) {
  188. message.warning(data.error[0].message);
  189. return;
  190. };
  191. };
  192. _me.state.statusOption = [];
  193. for (var item in data.data) {
  194. _me.state.statusOption.push(
  195. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  196. )
  197. };
  198. }.bind(this),
  199. }).always(function () {
  200. this.setState({
  201. loading: false
  202. });
  203. }.bind(this));
  204. },
  205. getInitialState() {
  206. return {
  207. visible: false,
  208. provinceOption: [],
  209. stateOption: [],
  210. companyOption: [],
  211. authorOption: [],
  212. consultantOption: [],
  213. data: [],
  214. selectedRowKeys: [],
  215. selectedRows: [],
  216. loading: false,
  217. showAdd: false,
  218. showDesc: false,
  219. searchMore: true,
  220. createTime: [],
  221. acceptTime: [],
  222. authTime: [],
  223. pagination: {
  224. defaultCurrent: 1,
  225. defaultPageSize: 10,
  226. showQuickJumper: true,
  227. pageSize: 10,
  228. onChange: function (page) {
  229. this.loadData(page);
  230. }.bind(this),
  231. showTotal: function (total) {
  232. return '共' + total + '条数据';
  233. }
  234. },
  235. columns: [
  236. {
  237. title: '编号',
  238. dataIndex: 'serialNumber',
  239. key: 'serialNumber',
  240. }, {
  241. title: '省份',
  242. dataIndex: 'province',
  243. key: 'province',
  244. }, {
  245. title: '合同编号',
  246. dataIndex: 'contractNumber',
  247. key: 'contractNumber',
  248. }, {
  249. title: '公司名称',
  250. dataIndex: 'unitName',
  251. key: 'unitName',
  252. }, {
  253. title: '认证状态',
  254. dataIndex: 'status',
  255. key: 'status',
  256. render: (text) => { return getCopyrightState(text) }
  257. }, {
  258. title: '软著名称',
  259. dataIndex: 'copyrightName',
  260. key: 'copyrightName',
  261. }, {
  262. title: '加急天数',
  263. dataIndex: 'inUrgent',
  264. key: 'inUrgent',
  265. render: (text) => {
  266. switch (text) {
  267. case 0:
  268. return '不加急(45个工作日)';
  269. case 3:
  270. return '3个工作日';
  271. case 5:
  272. return '5个工作日';
  273. case 10:
  274. return '6-10个工作日';
  275. case 15:
  276. return '11-15个工作日';
  277. case 20:
  278. return '16-20个工作日';
  279. case 25:
  280. return '21-25个工作日';
  281. case 30:
  282. return '26-30个工作日';
  283. case 35:
  284. return '31-35个工作日';
  285. }
  286. }
  287. }, {
  288. title: '负责人',
  289. dataIndex: 'principal',
  290. key: 'principal',
  291. }, {
  292. title: '派单日',
  293. dataIndex: 'createTimeFormattedDate',
  294. key: 'createTimeFormattedDate',
  295. }, {
  296. title: '受理日',
  297. dataIndex: 'acceptTimeFormattedDate',
  298. key: 'acceptTimeFormattedDate',
  299. }, {
  300. title: '(预计)下证时间',
  301. dataIndex: 'expectTime',
  302. key: 'expectTime',
  303. render: (text) => {
  304. if (text[0]) {
  305. if (text[1]) {
  306. return getTime(getInUrgentTime(moment(text[0]), text[1]))
  307. } else {
  308. return getTime(getInUrgentTime(moment(text[0]), 45))
  309. }
  310. };
  311. return;
  312. }
  313. }, {
  314. title: '创建人',
  315. dataIndex: 'founder',
  316. key: 'founder'
  317. }, {
  318. title: '技术员',
  319. dataIndex: 'techPrincipal',
  320. key: 'techPrincipal',
  321. }
  322. ],
  323. dataSource: []
  324. };
  325. },
  326. getContractList() {
  327. this.setState({
  328. loading: true
  329. });
  330. $.ajax({
  331. method: "get",
  332. dataType: "json",
  333. crossDomain: false,
  334. url: globalConfig.context + "/api/admin/contract/serialNumber",
  335. success: function (data) {
  336. if (!data.data) {
  337. if (data.error && data.error.length) {
  338. message.warning(data.error[0].message);
  339. };
  340. return;
  341. };
  342. let theArr = [];
  343. for (let i = 0; i < data.data.length; i++) {
  344. let item = data.data[i];
  345. theArr.push(
  346. <Select.Option value={item.contractId} key={item.contractId}>{item.serialNumber}</Select.Option>
  347. );
  348. };
  349. this.setState({
  350. contractListOption: theArr
  351. });
  352. }.bind(this),
  353. }).always(function () {
  354. this.setState({
  355. loading: false
  356. });
  357. }.bind(this));
  358. },
  359. componentWillMount() {
  360. let _me = this;
  361. provinceArr.map(function (item) {
  362. _me.state.provinceOption.push(
  363. <Select.Option value={item} key={item}>{item}</Select.Option>
  364. )
  365. });
  366. copyrightStateList.map(function (item) {
  367. _me.state.stateOption.push(
  368. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  369. )
  370. });
  371. this.getAuthorList();
  372. this.getSalesmanList();
  373. this.getCompanyList();
  374. this.getStateList();
  375. this.getContractList();
  376. if (window.location.search) {
  377. let theObj = getSearchUrl(window.location.search);
  378. if (theObj.rid) {
  379. theObj.id = theObj.rid;
  380. if (theObj.rid != 'null' && theObj.uid != 'null') {
  381. this.tableRowClick(theObj);
  382. };
  383. } else {
  384. if (theObj.uid) {
  385. this.state.unitName = theObj.uid;
  386. } else if (theObj.contractId) {
  387. this.state.contractId = theObj.contractId;
  388. };
  389. };
  390. };
  391. this.loadData();
  392. },
  393. tableRowClick(record, index) {
  394. this.state.RowData = record;
  395. this.setState({
  396. showDesc: true
  397. });
  398. },
  399. delectRow() {
  400. let deletedIds = [];
  401. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  402. let rowItem = this.state.selectedRows[idx];
  403. if (rowItem.id) {
  404. deletedIds.push(rowItem.id)
  405. }
  406. }
  407. this.setState({
  408. selectedRowKeys: [],
  409. loading: deletedIds.length > 0
  410. });
  411. $.ajax({
  412. method: "POST",
  413. dataType: "json",
  414. crossDomain: false,
  415. url: globalConfig.context + "/api/admin/copyright/delete",
  416. data: {
  417. id: deletedIds
  418. }
  419. }).done(function (data) {
  420. if (!data.error.length) {
  421. message.success('删除成功!');
  422. this.setState({
  423. loading: false,
  424. });
  425. } else {
  426. message.warning(data.error[0].message);
  427. };
  428. this.loadData();
  429. }.bind(this));
  430. },
  431. closeDesc(e, s) {
  432. this.state.showDesc = e;
  433. if (s) {
  434. this.loadData();
  435. };
  436. },
  437. addClick() {
  438. this.setState({
  439. showAdd: true
  440. });
  441. },
  442. closeAdd(e, s) {
  443. this.state.showAdd = e;
  444. if (s) {
  445. this.loadData();
  446. };
  447. },
  448. searchSwitch() {
  449. this.setState({
  450. searchMore: !this.state.searchMore
  451. });
  452. },
  453. search() {
  454. this.loadData();
  455. },
  456. reset() {
  457. this.state.province = undefined;
  458. this.state.unitName = undefined;
  459. this.state.copyrightName = undefined;
  460. this.state.searchStatus = undefined;
  461. this.state.contractId = undefined;
  462. this.state.createTime = [];
  463. this.state.acceptTime = [];
  464. this.state.authTime = [];
  465. this.loadData();
  466. },
  467. circulation() {
  468. let deletedIds = [];
  469. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  470. let rowItem = this.state.selectedRows[idx];
  471. if (rowItem.id) {
  472. deletedIds.push(rowItem.id)
  473. }
  474. }
  475. this.setState({
  476. selectedRowKeys: [],
  477. loading: deletedIds.length > 0
  478. });
  479. $.ajax({
  480. method: "POST",
  481. dataType: "json",
  482. crossDomain: false,
  483. url: globalConfig.context + "/api/admin/copyright/circulation",
  484. data: {
  485. ids: deletedIds,
  486. principal: this.state.principal,
  487. status: this.state.status,
  488. comment: this.state.comment,
  489. recordTimeFormattedDate: this.state.recordTime
  490. }
  491. }).done(function (data) {
  492. if (!data.error.length) {
  493. message.success('保存成功!');
  494. this.setState({
  495. loading: false,
  496. visible: false
  497. });
  498. } else {
  499. message.warning(data.error[0].message);
  500. };
  501. this.loadData();
  502. }.bind(this));
  503. },
  504. showModal() {
  505. this.setState({
  506. visible: true,
  507. principal: undefined,
  508. status: undefined,
  509. comment: undefined,
  510. recordTime: undefined
  511. });
  512. },
  513. handleCancel() {
  514. this.setState({ visible: false });
  515. },
  516. render() {
  517. const rowSelection = {
  518. selectedRowKeys: this.state.selectedRowKeys,
  519. onChange: (selectedRowKeys, selectedRows) => {
  520. this.setState({
  521. selectedRows: selectedRows,
  522. selectedRowKeys: selectedRowKeys
  523. });
  524. }
  525. };
  526. const hasSelected = this.state.selectedRowKeys.length > 0;
  527. const { MonthPicker, RangePicker } = DatePicker;
  528. return (
  529. <div className="foster-box">
  530. <div className="foster-content">
  531. <div className="content-title">
  532. <span>软著申请管理</span>
  533. </div>
  534. <div className="foster-query">
  535. <Select placeholder="选择省份"
  536. style={{ width: 100 }}
  537. value={this.state.province}
  538. showSearch
  539. filterOption={companySearch}
  540. onChange={(e) => { this.setState({ province: e }) }}>
  541. {this.state.provinceOption}
  542. </Select>
  543. <Select placeholder="选择公司"
  544. style={{ width: 200 }}
  545. value={this.state.unitName}
  546. showSearch
  547. filterOption={companySearch}
  548. onChange={(e) => { this.setState({ unitName: e }) }}>
  549. {this.state.companyOption}
  550. </Select>
  551. <Input style={{ width: 160 }}
  552. placeholder="请输入软著名称"
  553. value={this.state.copyrightName}
  554. onChange={(e) => { this.setState({ copyrightName: e.target.value }); }} />
  555. <Select placeholder="选择合同编号"
  556. style={{ width: 120 }}
  557. value={this.state.contractId}
  558. showSearch
  559. filterOption={companySearch}
  560. onChange={(e) => { this.setState({ contractId: e }) }}>
  561. {this.state.contractListOption}
  562. </Select>
  563. <Select style={{ width: 120 }}
  564. value={this.state.searchStatus}
  565. onChange={(e) => { this.setState({ searchStatus: e }) }}
  566. placeholder="选择一个状态">{this.state.stateOption}</Select>
  567. <span>更多搜索 <Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  568. <Button type="primary" onClick={this.search}>搜索</Button>
  569. <Button onClick={this.reset}>重置</Button>
  570. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  571. disabled={!hasSelected}
  572. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  573. <Button disabled={!hasSelected} style={{ marginTop: '10px' }}
  574. type="ghost" onClick={this.showModal}>软著批量流转<Icon type="retweet" /></Button>
  575. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  576. <span>派单时间:</span>
  577. <RangePicker style={{ width: '240px' }}
  578. allowClear={false}
  579. value={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  580. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  581. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  582. <span>受理时间:</span>
  583. <RangePicker style={{ width: '240px' }}
  584. allowClear={false}
  585. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  586. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  587. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  588. <span>下证时间:</span>
  589. <RangePicker style={{ width: '240px' }}
  590. allowClear={false}
  591. value={[this.state.authTime[0] ? moment(this.state.authTime[0]) : null,
  592. this.state.authTime[1] ? moment(this.state.authTime[1]) : null]}
  593. onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />
  594. </div>
  595. </div>
  596. <div className="foster-table">
  597. <Spin spinning={this.state.loading}>
  598. <Table columns={this.state.columns}
  599. rowSelection={rowSelection}
  600. dataSource={this.state.dataSource}
  601. pagination={this.state.pagination}
  602. onRowClick={this.tableRowClick} />
  603. </Spin>
  604. </div>
  605. <PatentChange
  606. data={this.state.RowData}
  607. authorOption={this.state.authorOption}
  608. statusOption={this.state.statusOption}
  609. showDesc={this.state.showDesc}
  610. closeDesc={this.closeDesc} />
  611. <Modal maskClosable={false} title="软著批量流转" visible={this.state.visible}
  612. onCancel={this.handleCancel}
  613. width='800px'
  614. footer={[
  615. <Button key="submit" type="primary" size="large" onClick={this.circulation}>保存</Button>,
  616. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  617. ]} className="patent-desc-content">
  618. <div className="clearfix">
  619. <div className="widthThird">
  620. <span>状态流转:</span>
  621. <Select placeholder='请选择状态'
  622. value={this.state.status}
  623. style={{ width: 150 }}
  624. onChange={(e) => { this.setState({ status: e }); }}>
  625. {this.state.statusOption}
  626. </Select>
  627. </div>
  628. <p className="widthThird">
  629. <span>处理时间:</span>
  630. <DatePicker
  631. value={this.state.recordTime ? moment(this.state.recordTime) : undefined}
  632. format="YYYY-MM-DD HH:mm:ss"
  633. onChange={(data, dataString) => { this.setState({ recordTime: dataString }); }} />
  634. </p>
  635. <div className="widthThird">
  636. <span>负责人:</span>
  637. <Select placeholder='请填写负责人'
  638. value={this.state.principal}
  639. style={{ width: 150 }}
  640. onChange={(e) => { this.setState({ principal: e }); }}>
  641. {this.state.authorOption}
  642. </Select>
  643. </div>
  644. </div>
  645. <div>
  646. <span>备注:</span>
  647. <Input value={this.state.comment} placeholder='请填写备注' style={{ width: 400 }} onChange={(e) => { this.setState({ comment: e.target.value }); }} />
  648. </div>
  649. </Modal>
  650. </div >
  651. </div>
  652. );
  653. }
  654. });
  655. export default copyright;
  656. // <PatentAdd
  657. // companyOption={this.state.companyOption}
  658. // salesmanOption={this.state.salesmanOption}
  659. // onClick={this.addClick}
  660. // closeAdd={this.closeAdd} />