copyright.jsx 26 KB

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