copyright.jsx 25 KB

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