copyright.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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 + "/api/admin/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. width:'25%'
  189. }, {
  190. title: '软著名称',
  191. dataIndex: 'copyrightName',
  192. key: 'copyrightName',
  193. }, {
  194. title: '加急天数',
  195. dataIndex: 'inUrgent',
  196. key: 'inUrgent',
  197. render: (text) => {
  198. switch (text) {
  199. case 0:
  200. return '不加急(45个工作日)';
  201. case 3:
  202. return '3个工作日';
  203. case 5:
  204. return '5个工作日';
  205. case 10:
  206. return '6-10个工作日';
  207. case 15:
  208. return '11-15个工作日';
  209. case 20:
  210. return '16-20个工作日';
  211. case 25:
  212. return '21-25个工作日';
  213. case 30:
  214. return '26-30个工作日';
  215. }
  216. }
  217. }, {
  218. title: '咨询师',
  219. dataIndex: 'principal',
  220. key: 'principal',
  221. }, {
  222. title: '派单日',
  223. dataIndex: 'createTimeFormattedDate',
  224. key: 'createTimeFormattedDate',
  225. }, {
  226. title: '受理日',
  227. dataIndex: 'acceptTimeFormattedDate',
  228. key: 'acceptTimeFormattedDate',
  229. }, {
  230. title: '(预计)下证时间',
  231. dataIndex: 'expectTime',
  232. key: 'expectTime',
  233. render: (text) => {
  234. if (text[0]) {
  235. if (text[1]) {
  236. return getTime(getInUrgentTime(moment(text[0]), text[1]))
  237. } else {
  238. return getTime(getInUrgentTime(moment(text[0]), 45))
  239. }
  240. };
  241. return;
  242. }
  243. }, {
  244. title: '备注',
  245. dataIndex: 'comment',
  246. key: 'comment',
  247. }
  248. ],
  249. dataSource: []
  250. };
  251. },
  252. componentWillMount() {
  253. let _me = this;
  254. provinceArr.map(function (item) {
  255. _me.state.provinceOption.push(
  256. <Select.Option value={item} key={item}>{item}</Select.Option>
  257. )
  258. });
  259. copyrightStateList.map(function (item) {
  260. _me.state.stateOption.push(
  261. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  262. )
  263. });
  264. this.loadData();
  265. this.getAuthorList();
  266. this.getCompanyList();
  267. },
  268. tableRowClick(record, index) {
  269. this.state.RowData = record;
  270. this.setState({
  271. showDesc: true
  272. });
  273. },
  274. delectRow() {
  275. let deletedIds = [];
  276. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  277. let rowItem = this.state.selectedRows[idx];
  278. if (rowItem.id) {
  279. deletedIds.push(rowItem.id)
  280. }
  281. }
  282. this.setState({
  283. selectedRowKeys: [],
  284. loading: deletedIds.length > 0
  285. });
  286. $.ajax({
  287. method: "POST",
  288. dataType: "json",
  289. crossDomain: false,
  290. url: globalConfig.context + "/api/admin/copyright/delete",
  291. data: {
  292. id: deletedIds
  293. }
  294. }).done(function (data) {
  295. if (!data.error.length) {
  296. message.success('保存成功!');
  297. this.setState({
  298. loading: false,
  299. });
  300. } else {
  301. message.warning(data.error[0].message);
  302. };
  303. this.loadData();
  304. }.bind(this));
  305. },
  306. closeDesc(e, s) {
  307. this.state.showDesc = e;
  308. if (s) {
  309. this.loadData();
  310. };
  311. },
  312. addClick() {
  313. this.setState({
  314. showAdd: true
  315. });
  316. },
  317. closeAdd(e, s) {
  318. this.state.showAdd = e;
  319. if (s) {
  320. this.loadData();
  321. };
  322. },
  323. searchSwitch() {
  324. this.setState({
  325. searchMore: !this.state.searchMore
  326. });
  327. },
  328. search() {
  329. this.loadData();
  330. },
  331. reset() {
  332. this.state.province = undefined;
  333. this.state.unitName = undefined;
  334. this.state.copyrightName = undefined;
  335. thiss.state.status = undefined;
  336. this.state.createTime = [];
  337. this.state.acceptTime = [];
  338. this.state.authTime = [];
  339. this.loadData();
  340. },
  341. render() {
  342. const rowSelection = {
  343. selectedRowKeys: this.state.selectedRowKeys,
  344. onChange: (selectedRowKeys, selectedRows) => {
  345. this.setState({
  346. selectedRows: selectedRows,
  347. selectedRowKeys: selectedRowKeys
  348. });
  349. }
  350. };
  351. const hasSelected = this.state.selectedRowKeys.length > 0;
  352. const { MonthPicker, RangePicker } = DatePicker;
  353. return (
  354. <div className="foster-box">
  355. <div className="foster-content">
  356. <div className="content-title">
  357. <span>软著申请管理</span>
  358. <PatentAdd
  359. companyOption={this.state.companyOption}
  360. authorOption={this.state.authorOption}
  361. onClick={this.addClick}
  362. closeAdd={this.closeAdd} />
  363. </div>
  364. <div className="foster-query">
  365. <Select placeholder="选择省份"
  366. style={{ width: 100 }}
  367. value={this.state.province}
  368. showSearch
  369. filterOption={companySearch}
  370. onChange={(e) => { this.setState({ province: e }) }}>
  371. {this.state.provinceOption}
  372. </Select>
  373. <Select placeholder="选择公司"
  374. style={{ width: 200 }}
  375. value={this.state.unitName}
  376. showSearch
  377. filterOption={companySearch}
  378. onChange={(e) => { this.setState({ unitName: e }) }}>
  379. {this.state.companyOption}
  380. </Select>
  381. <Input style={{ width: 160 }}
  382. placeholder="请输入软著名称"
  383. value={this.state.copyrightName}
  384. onChange={(e) => { this.setState({ copyrightName: e.target.value }); }} />
  385. <Select style={{ width: 120 }}
  386. value={this.state.status}
  387. onChange={(e) => { this.setState({ status: e }) }}
  388. placeholder="选择一个状态">{this.state.stateOption}</Select>
  389. <span>更多搜索 <Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  390. <Button type="primary" onClick={this.search}>搜索</Button>
  391. <Button onClick={this.reset}>重置</Button>
  392. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  393. disabled={!hasSelected}
  394. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  395. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  396. <span>派单时间:</span>
  397. <RangePicker style={{ width: '240px' }}
  398. allowClear={false}
  399. value={[moment(this.state.createTime[0]), moment(this.state.createTime[1])]}
  400. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  401. <span>受理时间:</span>
  402. <RangePicker style={{ width: '240px' }}
  403. allowClear={false}
  404. value={[moment(this.state.acceptTime[0]), moment(this.state.acceptTime[1])]}
  405. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  406. <span>下证时间:</span>
  407. <RangePicker style={{ width: '240px' }}
  408. allowClear={false}
  409. value={[moment(this.state.authTime[0]), moment(this.state.authTime[1])]}
  410. onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />
  411. </div>
  412. </div>
  413. <div className="foster-table">
  414. <Spin spinning={this.state.loading}>
  415. <Table columns={this.state.columns}
  416. rowSelection={rowSelection}
  417. dataSource={this.state.dataSource}
  418. pagination={this.state.pagination}
  419. onRowClick={this.tableRowClick} />
  420. </Spin>
  421. </div>
  422. <PatentChange
  423. data={this.state.RowData}
  424. authorOption={this.state.authorOption}
  425. showDesc={this.state.showDesc}
  426. closeDesc={this.closeDesc} />
  427. </div >
  428. </div>
  429. );
  430. }
  431. });
  432. export default copyright;