copyright.jsx 26 KB

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