copyright.jsx 26 KB

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