copyright.jsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. this.setState({
  306. showDesc: true
  307. });
  308. },
  309. delectRow() {
  310. let deletedIds = [];
  311. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  312. let rowItem = this.state.selectedRows[idx];
  313. if (rowItem.id) {
  314. deletedIds.push(rowItem.id)
  315. }
  316. }
  317. this.setState({
  318. selectedRowKeys: [],
  319. loading: deletedIds.length > 0
  320. });
  321. $.ajax({
  322. method: "POST",
  323. dataType: "json",
  324. crossDomain: false,
  325. url: globalConfig.context + "/api/admin/copyright/delete",
  326. data: {
  327. id: deletedIds
  328. }
  329. }).done(function (data) {
  330. if (!data.error.length) {
  331. message.success('删除成功!');
  332. this.setState({
  333. loading: false,
  334. });
  335. } else {
  336. message.warning(data.error[0].message);
  337. };
  338. this.loadData();
  339. }.bind(this));
  340. },
  341. closeDesc(e, s) {
  342. this.state.showDesc = e;
  343. if (s) {
  344. this.loadData();
  345. };
  346. },
  347. addClick() {
  348. this.setState({
  349. showAdd: true
  350. });
  351. },
  352. closeAdd(e, s) {
  353. this.state.showAdd = e;
  354. if (s) {
  355. this.loadData();
  356. };
  357. },
  358. searchSwitch() {
  359. this.setState({
  360. searchMore: !this.state.searchMore
  361. });
  362. },
  363. search() {
  364. this.loadData();
  365. },
  366. reset() {
  367. this.state.province = undefined;
  368. this.state.unitName = undefined;
  369. this.state.copyrightName = undefined;
  370. this.state.searchStatus = undefined;
  371. this.state.contractId = undefined;
  372. this.state.createTime = [];
  373. this.state.acceptTime = [];
  374. this.state.authTime = [];
  375. this.loadData();
  376. },
  377. circulation() {
  378. let deletedIds = [];
  379. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  380. let rowItem = this.state.selectedRows[idx];
  381. if (rowItem.id) {
  382. deletedIds.push(rowItem.id)
  383. }
  384. }
  385. this.setState({
  386. selectedRowKeys: [],
  387. loading: deletedIds.length > 0
  388. });
  389. $.ajax({
  390. method: "POST",
  391. dataType: "json",
  392. crossDomain: false,
  393. url: globalConfig.context + "/api/admin/copyright/circulation",
  394. data: {
  395. ids: deletedIds,
  396. principal: this.state.principal,
  397. status: this.state.status,
  398. comment: this.state.comment,
  399. recordTimeFormattedDate: this.state.recordTime
  400. }
  401. }).done(function (data) {
  402. if (!data.error.length) {
  403. message.success('保存成功!');
  404. this.setState({
  405. loading: false,
  406. visible: false
  407. });
  408. } else {
  409. message.warning(data.error[0].message);
  410. };
  411. this.loadData();
  412. }.bind(this));
  413. },
  414. showModal() {
  415. this.setState({
  416. visible: true,
  417. principal: undefined,
  418. status: undefined,
  419. comment: undefined,
  420. recordTime: undefined
  421. });
  422. },
  423. handleCancel() {
  424. this.setState({ visible: false });
  425. },
  426. render() {
  427. const columns = [
  428. {
  429. title: '编号',
  430. dataIndex: 'serialNumber',
  431. key: 'serialNumber',
  432. }, {
  433. title: '省份',
  434. dataIndex: 'province',
  435. key: 'province',
  436. render: text => { return getProvince(text); }
  437. }, {
  438. title: '合同编号',
  439. dataIndex: 'contractNumber',
  440. key: 'contractNumber',
  441. }, {
  442. title: '公司名称',
  443. dataIndex: 'unitName',
  444. key: 'unitName',
  445. }, {
  446. title: '认证状态',
  447. dataIndex: 'status',
  448. key: 'status',
  449. render: (text) => { return getCopyrightState(text) }
  450. }, {
  451. title: '软著名称',
  452. dataIndex: 'copyrightName',
  453. key: 'copyrightName',
  454. }, {
  455. title: '加急天数',
  456. dataIndex: 'inUrgent',
  457. key: 'inUrgent',
  458. render: (text) => {
  459. switch (text) {
  460. case 0:
  461. return '不加急(45个工作日)';
  462. case 3:
  463. return '3个工作日';
  464. case 5:
  465. return '5个工作日';
  466. case 10:
  467. return '6-10个工作日';
  468. case 15:
  469. return '11-15个工作日';
  470. case 20:
  471. return '16-20个工作日';
  472. case 25:
  473. return '21-25个工作日';
  474. case 30:
  475. return '26-30个工作日';
  476. case 35:
  477. return '31-35个工作日';
  478. }
  479. }
  480. }, {
  481. title: '负责人',
  482. dataIndex: 'principal',
  483. key: 'principal',
  484. }, {
  485. title: '派单日',
  486. dataIndex: 'createTimeFormattedDate',
  487. key: 'createTimeFormattedDate',
  488. }, {
  489. title: '受理日',
  490. dataIndex: 'acceptTimeFormattedDate',
  491. key: 'acceptTimeFormattedDate',
  492. }, {
  493. title: '(预计)下证时间',
  494. dataIndex: 'expectTime',
  495. key: 'expectTime',
  496. render: (text) => {
  497. if (text[0]) {
  498. if (text[1]) {
  499. return getTime(getInUrgentTime(moment(text[0]), text[1], this.state.vacations))
  500. } else {
  501. return getTime(getInUrgentTime(moment(text[0]), 45, this.state.vacations))
  502. }
  503. };
  504. return;
  505. }
  506. }, {
  507. title: '创建人',
  508. dataIndex: 'founder',
  509. key: 'founder'
  510. }, {
  511. title: '技术员',
  512. dataIndex: 'techPrincipal',
  513. key: 'techPrincipal',
  514. }
  515. ];
  516. const rowSelection = {
  517. selectedRowKeys: this.state.selectedRowKeys,
  518. onChange: (selectedRowKeys, selectedRows) => {
  519. this.setState({
  520. selectedRows: selectedRows,
  521. selectedRowKeys: selectedRowKeys
  522. });
  523. }
  524. };
  525. const hasSelected = this.state.selectedRowKeys.length > 0;
  526. const { MonthPicker, RangePicker } = DatePicker;
  527. return (
  528. <div className="foster-box">
  529. <div className="foster-content">
  530. <div className="content-title">
  531. <span>软著申请管理</span>
  532. </div>
  533. <div className="foster-query">
  534. <Cascader placeholder="选择省份"
  535. style={{ width: 100, marginTop: "-4px" }}
  536. value={this.state.province}
  537. options={provinceSelect()}
  538. showSearch
  539. filterOption={companySearch}
  540. onChange={(e) => { this.setState({ province: e }) }} />
  541. <Select placeholder="选择公司"
  542. style={{ width: 200 }}
  543. value={this.state.unitName}
  544. showSearch
  545. filterOption={companySearch}
  546. onChange={(e) => { this.setState({ unitName: e }) }}>
  547. {this.state.companyOption}
  548. </Select>
  549. <Input style={{ width: 160 }}
  550. placeholder="请输入软著名称"
  551. value={this.state.copyrightName}
  552. onChange={(e) => { this.setState({ copyrightName: e.target.value }); }} />
  553. <Select placeholder="选择合同编号"
  554. style={{ width: 120 }}
  555. value={this.state.contractId}
  556. showSearch
  557. filterOption={companySearch}
  558. onChange={(e) => { this.setState({ contractId: e }) }}>
  559. {this.state.contractListOption}
  560. </Select>
  561. <Select style={{ width: 120 }}
  562. value={this.state.searchStatus}
  563. onChange={(e) => { this.setState({ searchStatus: e }) }}
  564. placeholder="选择一个状态">{this.state.stateOption}</Select>
  565. <span>更多搜索 <Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  566. <Button type="primary" onClick={this.search}>搜索</Button>
  567. <Button onClick={this.reset}>重置</Button>
  568. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  569. disabled={!hasSelected}
  570. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  571. <Button disabled={!hasSelected} style={{ marginTop: '10px' }}
  572. type="ghost" onClick={this.showModal}>软著批量流转<Icon type="retweet" /></Button>
  573. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  574. <span>派单时间:</span>
  575. <RangePicker style={{ width: '240px' }}
  576. allowClear={false}
  577. value={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  578. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  579. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  580. <span>受理时间:</span>
  581. <RangePicker style={{ width: '240px' }}
  582. allowClear={false}
  583. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  584. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  585. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  586. </div>
  587. </div>
  588. <div className="foster-table">
  589. <Spin spinning={this.state.loading}>
  590. <Table columns={columns}
  591. rowSelection={rowSelection}
  592. dataSource={this.state.dataSource}
  593. pagination={this.state.pagination}
  594. onRowClick={this.tableRowClick} />
  595. </Spin>
  596. </div>
  597. <PatentChange
  598. data={this.state.RowData}
  599. authorOption={this.state.authorOption}
  600. statusOption={this.state.statusOption}
  601. showDesc={this.state.showDesc}
  602. closeDesc={this.closeDesc} />
  603. <Modal maskClosable={false} title="软著批量流转" visible={this.state.visible}
  604. onCancel={this.handleCancel}
  605. width='800px'
  606. footer={[
  607. <Button key="submit" type="primary" size="large" onClick={this.circulation}>保存</Button>,
  608. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  609. ]} className="patent-desc-content">
  610. <div className="clearfix">
  611. <div className="widthThird">
  612. <span>状态流转:</span>
  613. <Select placeholder='请选择状态'
  614. value={this.state.status}
  615. style={{ width: 150 }}
  616. onChange={(e) => { this.setState({ status: e }); }}>
  617. {this.state.statusOption}
  618. </Select>
  619. </div>
  620. <p className="widthThird">
  621. <span>处理时间:</span>
  622. <DatePicker
  623. value={this.state.recordTime ? moment(this.state.recordTime) : undefined}
  624. format="YYYY-MM-DD HH:mm:ss"
  625. onChange={(data, dataString) => { this.setState({ recordTime: dataString }); }} />
  626. </p>
  627. <div className="widthThird">
  628. <span>负责人:</span>
  629. <Select placeholder='请填写负责人'
  630. value={this.state.principal}
  631. style={{ width: 150 }}
  632. onChange={(e) => { this.setState({ principal: e }); }}>
  633. {this.state.authorOption}
  634. </Select>
  635. </div>
  636. </div>
  637. <div>
  638. <span>备注:</span>
  639. <Input value={this.state.comment} placeholder='请填写备注' style={{ width: 400 }} onChange={(e) => { this.setState({ comment: e.target.value }); }} />
  640. </div>
  641. </Modal>
  642. </div >
  643. </div>
  644. );
  645. }
  646. });
  647. export default copyright;
  648. // <PatentAdd
  649. // companyOption={this.state.companyOption}
  650. // salesmanOption={this.state.salesmanOption}
  651. // onClick={this.addClick}
  652. // closeAdd={this.closeAdd} />