copyright.jsx 23 KB

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