copyright.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader, Switch } from 'antd';
  3. import { provinceArr, copyrightStateList } from '../../../dataDic.js';
  4. import { getTime, companySearch, getCopyrightState, getInUrgentTime } 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. copyrightName: this.state.copyrightName,
  28. status: this.state.status,
  29. createTime: this.state.createTime,
  30. acceptTime: this.state.acceptTime,
  31. authTime: this.state.authTime
  32. },
  33. success: function (data) {
  34. if (data.error.length || !data.data || !data.data.list) {
  35. message.warning(data.error[0].message);
  36. return;
  37. };
  38. for (let i = 0; i < data.data.list.length; i++) {
  39. let thisdata = data.data.list[i];
  40. this.state.data.push({
  41. key: i,
  42. id: thisdata.id,
  43. uid: thisdata.uid,
  44. province: thisdata.province,
  45. unitName: thisdata.unitName,
  46. serialNumber: thisdata.serialNumber,
  47. createTime: thisdata.createTime,
  48. acceptTime: thisdata.acceptTime,
  49. principal: thisdata.principal,
  50. contact: thisdata.contact,
  51. copyrightName: thisdata.copyrightName,
  52. copyrightNumber: thisdata.copyrightNumber,
  53. status: thisdata.status,
  54. comment: thisdata.comment,
  55. workIssue: thisdata.workIssue,
  56. outsource: thisdata.outsource,
  57. inUrgent: thisdata.inUrgent,
  58. expectTime: [thisdata.acceptTime, thisdata.inUrgent],
  59. authorizedDate: thisdata.authorizedDate,
  60. fisrtContact: thisdata.fisrtContact,
  61. secondContact: thisdata.secondContact,
  62. thirdContact: thisdata.thirdContact,
  63. authorizedDateFormattedDate: thisdata.authorizedDateFormattedDate,
  64. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  65. acceptTimeFormattedDate: thisdata.acceptTimeFormattedDate
  66. });
  67. };
  68. this.state.pagination.defaultCurrent = data.data.pageNo;
  69. this.state.pagination.total = data.data.totalCount;
  70. this.setState({
  71. dataSource: this.state.data,
  72. pagination: this.state.pagination
  73. });
  74. }.bind(this),
  75. }).always(function () {
  76. this.setState({
  77. loading: false
  78. });
  79. }.bind(this));
  80. },
  81. getAuthorList() {
  82. this.setState({
  83. loading: true
  84. });
  85. $.ajax({
  86. method: "get",
  87. dataType: "json",
  88. crossDomain: false,
  89. url: globalConfig.context + "/techservice/patent/getAdmin",
  90. success: function (data) {
  91. if (data.error.length || !data.data) {
  92. return;
  93. };
  94. let _me = this;
  95. for (var item in data.data) {
  96. _me.state.authorOption.push(
  97. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  98. )
  99. };
  100. }.bind(this),
  101. }).always(function () {
  102. this.setState({
  103. loading: false
  104. });
  105. }.bind(this));
  106. },
  107. getCompanyList() {
  108. this.setState({
  109. loading: true
  110. });
  111. $.ajax({
  112. method: "get",
  113. dataType: "json",
  114. crossDomain: false,
  115. url: globalConfig.context + "/techservice/patent/getUnitNames",
  116. success: function (data) {
  117. if (data.error.length || !data.data) {
  118. return;
  119. };
  120. let _me = this;
  121. for (var item in data.data) {
  122. _me.state.companyOption.push(
  123. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  124. )
  125. };
  126. }.bind(this),
  127. }).always(function () {
  128. this.setState({
  129. loading: false
  130. });
  131. }.bind(this));
  132. },
  133. getInitialState() {
  134. return {
  135. visible: false,
  136. provinceOption: [],
  137. stateOption: [],
  138. companyOption: [],
  139. authorOption: [],
  140. data: [],
  141. selectedRowKeys: [],
  142. selectedRows: [],
  143. loading: false,
  144. showAdd: false,
  145. showDesc: false,
  146. searchMore: true,
  147. createTime: [],
  148. acceptTime: [],
  149. authTime: [],
  150. pagination: {
  151. defaultCurrent: 1,
  152. defaultPageSize: 10,
  153. showQuickJumper: true,
  154. pageSize: 10,
  155. onChange: function (page) {
  156. this.loadData(page);
  157. }.bind(this),
  158. showTotal: function (total) {
  159. return '共' + total + '条数据';
  160. }
  161. },
  162. columns: [
  163. {
  164. title: '编号',
  165. dataIndex: 'serialNumber',
  166. key: 'serialNumber',
  167. }, {
  168. title: '省份',
  169. dataIndex: 'province',
  170. key: 'province',
  171. }, {
  172. title: '外包公司',
  173. dataIndex: 'outsource',
  174. key: 'outsource',
  175. }, {
  176. title: '公司名称',
  177. dataIndex: 'unitName',
  178. key: 'unitName',
  179. }, {
  180. title: '认证状态',
  181. dataIndex: 'status',
  182. key: 'status',
  183. render: (text) => { return getCopyrightState(text) }
  184. }, {
  185. title: '派单信息',
  186. dataIndex: 'workIssue',
  187. key: 'workIssue',
  188. }, {
  189. title: '软著名称',
  190. dataIndex: 'copyrightName',
  191. key: 'copyrightName',
  192. }, {
  193. title: '加急天数',
  194. dataIndex: 'inUrgent',
  195. key: 'inUrgent',
  196. render: (text) => {
  197. switch (text) {
  198. case 0:
  199. return '不加急';
  200. case 3:
  201. return '3天';
  202. case 5:
  203. return '5天';
  204. case 10:
  205. return '6-10天';
  206. case 15:
  207. return '11-15天';
  208. case 20:
  209. return '16-20天';
  210. case 25:
  211. return '21-25天';
  212. case 30:
  213. return '26-30天';
  214. }
  215. }
  216. }, {
  217. title: '咨询师',
  218. dataIndex: 'principal',
  219. key: 'principal',
  220. }, {
  221. title: '派单日',
  222. dataIndex: 'createTimeFormattedDate',
  223. key: 'createTimeFormattedDate',
  224. }, {
  225. title: '受理日',
  226. dataIndex: 'acceptTimeFormattedDate',
  227. key: 'acceptTimeFormattedDate',
  228. }, {
  229. title: '(预计)下证时间',
  230. dataIndex: 'expectTime',
  231. key: 'expectTime',
  232. render: (text) => {
  233. if (text[0]) {
  234. if (text[1]) {
  235. return getTime(getInUrgentTime(moment(text[0]), text[1]))
  236. } else {
  237. return getTime(getInUrgentTime(moment(text[0]), 45))
  238. }
  239. };
  240. return;
  241. }
  242. }, {
  243. title: '备注',
  244. dataIndex: 'comment',
  245. key: 'comment',
  246. }
  247. ],
  248. dataSource: []
  249. };
  250. },
  251. componentWillMount() {
  252. let _me = this;
  253. provinceArr.map(function (item) {
  254. _me.state.provinceOption.push(
  255. <Select.Option value={item} key={item}>{item}</Select.Option>
  256. )
  257. });
  258. copyrightStateList.map(function (item) {
  259. _me.state.stateOption.push(
  260. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  261. )
  262. });
  263. this.loadData();
  264. this.getAuthorList();
  265. this.getCompanyList();
  266. },
  267. tableRowClick(record, index) {
  268. this.state.RowData = record;
  269. this.setState({
  270. showDesc: true
  271. });
  272. },
  273. delectRow() {
  274. let deletedIds = [];
  275. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  276. let rowItem = this.state.selectedRows[idx];
  277. if (rowItem.id) {
  278. deletedIds.push(rowItem.id)
  279. }
  280. }
  281. this.setState({
  282. selectedRowKeys: [],
  283. loading: deletedIds.length > 0
  284. });
  285. $.ajax({
  286. method: "POST",
  287. dataType: "json",
  288. crossDomain: false,
  289. url: globalConfig.context + "/api/admin/copyright/delete",
  290. data: {
  291. id: deletedIds
  292. }
  293. }).done(function (data) {
  294. if (!data.error.length) {
  295. message.success('保存成功!');
  296. this.setState({
  297. loading: false,
  298. });
  299. } else {
  300. message.warning(data.error[0].message);
  301. };
  302. this.loadData();
  303. }.bind(this));
  304. },
  305. closeDesc(e, s) {
  306. this.state.showDesc = e;
  307. if (s) {
  308. this.loadData();
  309. };
  310. },
  311. addClick() {
  312. this.setState({
  313. showAdd: true
  314. });
  315. },
  316. closeAdd(e, s) {
  317. this.state.showAdd = e;
  318. if (s) {
  319. this.loadData();
  320. };
  321. },
  322. searchSwitch() {
  323. this.setState({
  324. searchMore: !this.state.searchMore
  325. });
  326. },
  327. search() {
  328. this.loadData();
  329. },
  330. reset() {
  331. this.state.province = undefined;
  332. this.state.unitName = undefined;
  333. this.state.createTime = [];
  334. this.state.acceptTime = [];
  335. this.state.authTime = [];
  336. this.loadData();
  337. },
  338. render() {
  339. const rowSelection = {
  340. selectedRowKeys: this.state.selectedRowKeys,
  341. onChange: (selectedRowKeys, selectedRows) => {
  342. this.setState({
  343. selectedRows: selectedRows,
  344. selectedRowKeys: selectedRowKeys
  345. });
  346. }
  347. };
  348. const hasSelected = this.state.selectedRowKeys.length > 0;
  349. const { MonthPicker, RangePicker } = DatePicker;
  350. return (
  351. <div className="foster-box">
  352. <div className="foster-content">
  353. <div className="content-title">
  354. <span>软著申请管理</span>
  355. <PatentAdd
  356. companyOption={this.state.companyOption}
  357. authorOption={this.state.authorOption}
  358. onClick={this.addClick}
  359. closeAdd={this.closeAdd} />
  360. </div>
  361. <div className="foster-query">
  362. <Select placeholder="选择省份"
  363. style={{ width: 200 }}
  364. value={this.state.province}
  365. showSearch
  366. filterOption={companySearch}
  367. onChange={(e) => { this.setState({ province: e }) }}>
  368. {this.state.provinceOption}
  369. </Select>
  370. <Select placeholder="选择公司"
  371. style={{ width: 200 }}
  372. value={this.state.unitName}
  373. showSearch
  374. filterOption={companySearch}
  375. onChange={(e) => { this.setState({ unitName: e }) }}>
  376. {this.state.companyOption}
  377. </Select>
  378. <Input style={{ width: '160px' }}
  379. placeholder="请输入软著名称"
  380. value={this.state.copyrightName}
  381. onChange={(e) => { this.setState({ copyrightName: e.target.value }); }} />
  382. <Select style={{ width: '160px' }}
  383. value={this.state.status}
  384. onChange={(e) => { this.setState({ status: e }) }}
  385. placeholder="选择一个状态">{this.state.stateOption}</Select>
  386. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  387. <Button type="primary" onClick={this.search}>搜索</Button>
  388. <Button onClick={this.reset}>重置</Button>
  389. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  390. disabled={!hasSelected}
  391. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  392. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  393. <span>派单时间:</span>
  394. <RangePicker style={{ width: '240px' }}
  395. allowClear={false}
  396. value={[moment(this.state.createTime[0]), moment(this.state.createTime[1])]}
  397. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  398. <span>受理时间:</span>
  399. <RangePicker style={{ width: '240px' }}
  400. allowClear={false}
  401. value={[moment(this.state.acceptTime[0]), moment(this.state.acceptTime[1])]}
  402. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  403. <span>下证时间:</span>
  404. <RangePicker style={{ width: '240px' }}
  405. allowClear={false}
  406. value={[moment(this.state.authTime[0]), moment(this.state.authTime[1])]}
  407. onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />
  408. </div>
  409. </div>
  410. <div className="foster-table">
  411. <Spin spinning={this.state.loading}>
  412. <Table columns={this.state.columns}
  413. rowSelection={rowSelection}
  414. dataSource={this.state.dataSource}
  415. pagination={this.state.pagination}
  416. onRowClick={this.tableRowClick} />
  417. </Spin>
  418. </div>
  419. <PatentChange
  420. data={this.state.RowData}
  421. authorOption={this.state.authorOption}
  422. showDesc={this.state.showDesc}
  423. closeDesc={this.closeDesc} />
  424. </div >
  425. </div>
  426. );
  427. }
  428. });
  429. export default copyright;