copyright.jsx 25 KB

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