copyright.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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: 'workIssue',
  116. key: 'workIssue',
  117. }, {
  118. title: '软著名称',
  119. dataIndex: 'copyrightName',
  120. key: 'copyrightName',
  121. }, {
  122. title: '加急天数',
  123. dataIndex: 'inUrgent',
  124. key: 'inUrgent',
  125. render: (text) => {
  126. switch (text) {
  127. case 0:
  128. return '不加急(45个工作日)';
  129. case 3:
  130. return '3个工作日';
  131. case 5:
  132. return '5个工作日';
  133. case 10:
  134. return '6-10个工作日';
  135. case 15:
  136. return '11-15个工作日';
  137. case 20:
  138. return '16-20个工作日';
  139. case 25:
  140. return '21-25个工作日';
  141. case 30:
  142. return '26-30个工作日';
  143. }
  144. }
  145. }, {
  146. title: '咨询师',
  147. dataIndex: 'principal',
  148. key: 'principal',
  149. }, {
  150. title: '派单日',
  151. dataIndex: 'createTimeFormattedDate',
  152. key: 'createTimeFormattedDate',
  153. }, {
  154. title: '受理日',
  155. dataIndex: 'acceptTimeFormattedDate',
  156. key: 'acceptTimeFormattedDate',
  157. }, {
  158. title: '(预计)下证时间',
  159. dataIndex: 'expectTime',
  160. key: 'expectTime',
  161. render: (text) => {
  162. if (text[0]) {
  163. if (text[1]) {
  164. return getTime(getInUrgentTime(moment(text[0]), text[1]))
  165. } else {
  166. return getTime(getInUrgentTime(moment(text[0]), 45))
  167. }
  168. };
  169. return;
  170. }
  171. }, {
  172. title: '备注',
  173. dataIndex: 'comment',
  174. key: 'comment',
  175. }
  176. ],
  177. dataSource: []
  178. };
  179. },
  180. componentWillMount() {
  181. let _me = this;
  182. copyrightStateList.map(function (item) {
  183. _me.state.stateOption.push(
  184. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  185. )
  186. });
  187. this.loadData();
  188. },
  189. tableRowClick(record, index) {
  190. this.state.RowData = record;
  191. this.setState({
  192. showDesc: true
  193. });
  194. },
  195. closeDesc(e, s) {
  196. this.state.showDesc = e;
  197. if (s) {
  198. this.loadData();
  199. };
  200. },
  201. addClick() {
  202. this.setState({
  203. showAdd: true
  204. });
  205. },
  206. closeAdd(e, s) {
  207. this.state.showAdd = e;
  208. if (s) {
  209. this.loadData();
  210. };
  211. },
  212. searchSwitch() {
  213. this.setState({
  214. searchMore: !this.state.searchMore
  215. });
  216. },
  217. search() {
  218. this.loadData();
  219. },
  220. reset() {
  221. this.state.copyrightName = undefined;
  222. this.state.status = undefined;
  223. this.state.createTime = [];
  224. this.state.acceptTime = [];
  225. this.state.authTime = [];
  226. this.loadData();
  227. },
  228. render() {
  229. const { MonthPicker, RangePicker } = DatePicker;
  230. return (
  231. <div className="foster-box">
  232. <div className="foster-content">
  233. <div className="content-title">
  234. <span>软著申请管理</span>
  235. <PatentAdd
  236. onClick={this.addClick}
  237. closeAdd={this.closeAdd} />
  238. </div>
  239. <div className="foster-query">
  240. <Input style={{ width: '160px' }}
  241. placeholder="请输入软著名称"
  242. value={this.state.copyrightName}
  243. onChange={(e) => { this.setState({ copyrightName: e.target.value }); }} />
  244. <Select style={{ width: '160px' }}
  245. value={this.state.status}
  246. onChange={(e) => { this.setState({ status: e }) }}
  247. placeholder="选择一个状态">{this.state.stateOption}</Select>
  248. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  249. <Button type="primary" onClick={this.search}>搜索</Button>
  250. <Button onClick={this.reset}>重置</Button>
  251. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  252. <span>派单时间:</span>
  253. <RangePicker style={{ width: '240px' }}
  254. allowClear={false}
  255. value={[moment(this.state.createTime[0]), moment(this.state.createTime[1])]}
  256. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  257. <span>受理时间:</span>
  258. <RangePicker style={{ width: '240px' }}
  259. allowClear={false}
  260. value={[moment(this.state.acceptTime[0]), moment(this.state.acceptTime[1])]}
  261. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  262. <span>下证时间:</span>
  263. <RangePicker style={{ width: '240px' }}
  264. allowClear={false}
  265. value={[moment(this.state.authTime[0]), moment(this.state.authTime[1])]}
  266. onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />
  267. </div>
  268. </div>
  269. <div className="foster-table">
  270. <Spin spinning={this.state.loading}>
  271. <Table columns={this.state.columns}
  272. dataSource={this.state.dataSource}
  273. pagination={this.state.pagination}
  274. onRowClick={this.tableRowClick} />
  275. </Spin>
  276. </div>
  277. <PatentChange
  278. data={this.state.RowData}
  279. showDesc={this.state.showDesc}
  280. closeDesc={this.closeDesc} />
  281. </div >
  282. </div>
  283. );
  284. }
  285. });
  286. export default copyright;