copyright.jsx 23 KB

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