copyright.jsx 24 KB

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