copyright.jsx 26 KB

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