copyright.jsx 26 KB

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