copyright.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader, Switch } from 'antd';
  3. import { 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/user/copyright/list",
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. copyrightName: this.state.copyrightName,
  26. status: this.state.status,
  27. createTime: this.state.createTime,
  28. acceptTime: this.state.acceptTime,
  29. authTime: this.state.authTime
  30. },
  31. success: function (data) {
  32. if (data.error.length || !data.data || !data.data.list) {
  33. message.warning(data.error[0].message);
  34. return;
  35. };
  36. for (let i = 0; i < data.data.list.length; i++) {
  37. let thisdata = data.data.list[i];
  38. this.state.data.push({
  39. key: i,
  40. id: thisdata.id,
  41. uid: thisdata.uid,
  42. province: thisdata.province,
  43. unitName: thisdata.unitName,
  44. serialNumber: thisdata.serialNumber,
  45. createTime: thisdata.createTime,
  46. acceptTime: thisdata.acceptTime,
  47. principal: thisdata.principal,
  48. contact: thisdata.contact,
  49. copyrightName: thisdata.copyrightName,
  50. copyrightNumber: thisdata.copyrightNumber,
  51. status: thisdata.status,
  52. comment: thisdata.comment,
  53. workIssue: thisdata.workIssue,
  54. outsource: thisdata.outsource,
  55. inUrgent: thisdata.inUrgent,
  56. authorizedDate: thisdata.authorizedDate,
  57. fisrtContact: thisdata.fisrtContact,
  58. secondContact: thisdata.secondContact,
  59. thirdContact: thisdata.thirdContact,
  60. authorizedDateFormattedDate: thisdata.authorizedDateFormattedDate,
  61. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  62. acceptTimeFormattedDate: thisdata.acceptTimeFormattedDate,
  63. expectTime: [thisdata.acceptTime, thisdata.inUrgent]
  64. });
  65. };
  66. this.state.pagination.defaultCurrent = data.data.pageNo;
  67. this.state.pagination.total = data.data.totalCount;
  68. this.setState({
  69. dataSource: this.state.data,
  70. pagination: this.state.pagination
  71. });
  72. }.bind(this),
  73. }).always(function () {
  74. this.setState({
  75. loading: false
  76. });
  77. }.bind(this));
  78. },
  79. getInitialState() {
  80. return {
  81. visible: false,
  82. stateOption: [],
  83. data: [],
  84. loading: false,
  85. showAdd: false,
  86. showDesc: false,
  87. searchMore: true,
  88. createTime: [],
  89. acceptTime: [],
  90. authTime: [],
  91. pagination: {
  92. defaultCurrent: 1,
  93. defaultPageSize: 10,
  94. showQuickJumper: true,
  95. pageSize: 10,
  96. onChange: function (page) {
  97. this.loadData(page);
  98. }.bind(this),
  99. showTotal: function (total) {
  100. return '共' + total + '条数据';
  101. }
  102. },
  103. columns: [
  104. {
  105. title: '编号',
  106. dataIndex: 'serialNumber',
  107. key: 'serialNumber',
  108. }, {
  109. title: '认证状态',
  110. dataIndex: 'status',
  111. key: 'status',
  112. render: (text) => { return getCopyrightState(text) }
  113. }, {
  114. title: '软著名称',
  115. dataIndex: 'copyrightName',
  116. key: 'copyrightName',
  117. }, {
  118. title: '加急天数',
  119. dataIndex: 'inUrgent',
  120. key: 'inUrgent',
  121. render: (text) => {
  122. switch (text) {
  123. case 0:
  124. return '不加急(45个工作日)';
  125. case 3:
  126. return '3个工作日';
  127. case 5:
  128. return '5个工作日';
  129. case 10:
  130. return '6-10个工作日';
  131. case 15:
  132. return '11-15个工作日';
  133. case 20:
  134. return '16-20个工作日';
  135. case 25:
  136. return '21-25个工作日';
  137. case 30:
  138. return '26-30个工作日';
  139. case 35:
  140. return '31-35个工作日';
  141. }
  142. }
  143. }, {
  144. title: '负责人',
  145. dataIndex: 'principal',
  146. key: 'principal',
  147. }, {
  148. title: '派单日',
  149. dataIndex: 'createTimeFormattedDate',
  150. key: 'createTimeFormattedDate',
  151. }, {
  152. title: '受理日',
  153. dataIndex: 'acceptTimeFormattedDate',
  154. key: 'acceptTimeFormattedDate',
  155. }, {
  156. title: '(预计)下证时间',
  157. dataIndex: 'expectTime',
  158. key: 'expectTime',
  159. render: (text) => {
  160. if (text[0]) {
  161. if (text[1]) {
  162. return getTime(getInUrgentTime(moment(text[0]), text[1]))
  163. } else {
  164. return getTime(getInUrgentTime(moment(text[0]), 45))
  165. }
  166. };
  167. return;
  168. }
  169. }, {
  170. title: '备注',
  171. dataIndex: 'comment',
  172. key: 'comment',
  173. }
  174. ],
  175. dataSource: []
  176. };
  177. },
  178. componentWillMount() {
  179. let _me = this;
  180. copyrightStateList.map(function (item) {
  181. _me.state.stateOption.push(
  182. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  183. )
  184. });
  185. this.loadData();
  186. },
  187. tableRowClick(record, index) {
  188. this.state.RowData = record;
  189. this.setState({
  190. showDesc: true
  191. });
  192. },
  193. closeDesc(e, s) {
  194. this.state.showDesc = e;
  195. if (s) {
  196. this.loadData();
  197. };
  198. },
  199. addClick() {
  200. this.setState({
  201. showAdd: true
  202. });
  203. },
  204. closeAdd(e, s) {
  205. this.state.showAdd = e;
  206. if (s) {
  207. this.loadData();
  208. };
  209. },
  210. searchSwitch() {
  211. this.setState({
  212. searchMore: !this.state.searchMore
  213. });
  214. },
  215. search() {
  216. this.loadData();
  217. },
  218. reset() {
  219. this.state.copyrightName = undefined;
  220. this.state.status = undefined;
  221. this.state.createTime = [];
  222. this.state.acceptTime = [];
  223. this.state.authTime = [];
  224. this.loadData();
  225. },
  226. render() {
  227. const { MonthPicker, RangePicker } = DatePicker;
  228. return (
  229. <div className="foster-box">
  230. <div className="foster-content">
  231. <div className="content-title">
  232. <span>软著申请管理</span>
  233. <PatentAdd
  234. onClick={this.addClick}
  235. closeAdd={this.closeAdd} />
  236. </div>
  237. <div className="foster-query">
  238. <Input style={{ width: '160px' }}
  239. placeholder="请输入软著名称"
  240. value={this.state.copyrightName}
  241. onChange={(e) => { this.setState({ copyrightName: e.target.value }); }} />
  242. <Select style={{ width: '160px' }}
  243. value={this.state.status}
  244. onChange={(e) => { this.setState({ status: e }) }}
  245. placeholder="选择一个状态">{this.state.stateOption}</Select>
  246. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  247. <Button type="primary" onClick={this.search}>搜索</Button>
  248. <Button onClick={this.reset}>重置</Button>
  249. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  250. <span>派单时间:</span>
  251. <RangePicker style={{ width: '240px' }}
  252. allowClear={false}
  253. value={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  254. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  255. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  256. <span>受理时间:</span>
  257. <RangePicker style={{ width: '240px' }}
  258. allowClear={false}
  259. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  260. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  261. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  262. <span>下证时间:</span>
  263. <RangePicker style={{ width: '240px' }}
  264. allowClear={false}
  265. value={[this.state.authTime[0] ? moment(this.state.authTime[0]) : null,
  266. this.state.authTime[1] ? moment(this.state.authTime[1]) : null]}
  267. onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />
  268. </div>
  269. </div>
  270. <div className="foster-table">
  271. <Spin spinning={this.state.loading}>
  272. <Table columns={this.state.columns}
  273. dataSource={this.state.dataSource}
  274. pagination={this.state.pagination}
  275. onRowClick={this.tableRowClick} />
  276. </Spin>
  277. </div>
  278. <PatentChange
  279. data={this.state.RowData}
  280. showDesc={this.state.showDesc}
  281. closeDesc={this.closeDesc} />
  282. </div >
  283. </div>
  284. );
  285. }
  286. });
  287. export default copyright;