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, getVacations } 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. },
  30. success: function (data) {
  31. this.state.data = [];
  32. if (!data.data || !data.data.list) {
  33. message.warning(data.error[0].message);
  34. } else {
  35. for (let i = 0; i < data.data.list.length; i++) {
  36. let thisdata = data.data.list[i];
  37. this.state.data.push({
  38. key: i,
  39. id: thisdata.id,
  40. uid: thisdata.uid,
  41. province: thisdata.province,
  42. unitName: thisdata.unitName,
  43. serialNumber: thisdata.serialNumber,
  44. createTime: thisdata.createTime,
  45. acceptTime: thisdata.acceptTime,
  46. principal: thisdata.principal,
  47. contact: thisdata.contact,
  48. copyrightName: thisdata.copyrightName,
  49. copyrightNumber: thisdata.copyrightNumber,
  50. status: thisdata.status == '9' ? '8' : thisdata.status,
  51. comment: thisdata.comment,
  52. workIssue: thisdata.workIssue,
  53. outsource: thisdata.outsource,
  54. inUrgent: thisdata.inUrgent,
  55. authorizedDate: thisdata.authorizedDate,
  56. fisrtContact: thisdata.fisrtContact,
  57. secondContact: thisdata.secondContact,
  58. thirdContact: thisdata.thirdContact,
  59. authorizedDateFormattedDate: thisdata.authorizedDateFormattedDate,
  60. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  61. acceptTimeFormattedDate: thisdata.acceptTimeFormattedDate,
  62. expectTime: [thisdata.acceptTime, thisdata.inUrgent]
  63. });
  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. vacations: [],
  104. columns: [
  105. {
  106. title: '编号',
  107. dataIndex: 'serialNumber',
  108. key: 'serialNumber',
  109. }, {
  110. title: '认证状态',
  111. dataIndex: 'status',
  112. key: 'status',
  113. render: (text) => { return getCopyrightState(text) }
  114. }, {
  115. title: '软著名称',
  116. dataIndex: 'copyrightName',
  117. key: 'copyrightName',
  118. }, {
  119. title: '加急天数',
  120. dataIndex: 'inUrgent',
  121. key: 'inUrgent',
  122. render: (text) => {
  123. switch (text) {
  124. case 0:
  125. return '不加急(45个工作日)';
  126. case 3:
  127. return '3个工作日';
  128. case 5:
  129. return '5个工作日';
  130. case 10:
  131. return '6-10个工作日';
  132. case 15:
  133. return '11-15个工作日';
  134. case 20:
  135. return '16-20个工作日';
  136. case 25:
  137. return '21-25个工作日';
  138. case 30:
  139. return '26-30个工作日';
  140. case 35:
  141. return '31-35个工作日';
  142. }
  143. }
  144. }, {
  145. title: '负责人',
  146. dataIndex: 'principal',
  147. key: 'principal',
  148. }, {
  149. title: '派单日',
  150. dataIndex: 'createTimeFormattedDate',
  151. key: 'createTimeFormattedDate',
  152. }, {
  153. title: '受理日',
  154. dataIndex: 'acceptTimeFormattedDate',
  155. key: 'acceptTimeFormattedDate',
  156. }, {
  157. title: '下证时间',
  158. dataIndex: 'expectTime',
  159. key: 'expectTime',
  160. render: (text, record) => {
  161. if (record.authorizedDate) {
  162. return record.authorizedDateFormattedDate
  163. } else {
  164. if (text[0]) {
  165. if (text[1]) {
  166. return getTime(getInUrgentTime(moment(text[0]), text[1], this.state.vacations))
  167. } else {
  168. return getTime(getInUrgentTime(moment(text[0]), 45, this.state.vacations))
  169. }
  170. };
  171. }
  172. }
  173. }, {
  174. title: '备注',
  175. dataIndex: 'comment',
  176. key: 'comment',
  177. }
  178. ],
  179. dataSource: []
  180. };
  181. },
  182. componentWillMount() {
  183. let _me = this;
  184. copyrightStateList.map(function (item) {
  185. _me.state.stateOption.push(
  186. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  187. )
  188. });
  189. getVacations((data) => { this.setState({ vacations: data }); });
  190. this.loadData();
  191. },
  192. tableRowClick(record, index) {
  193. this.state.RowData = record;
  194. this.setState({
  195. showDesc: true
  196. });
  197. },
  198. closeDesc(e, s) {
  199. this.state.showDesc = e;
  200. if (s) {
  201. this.loadData();
  202. };
  203. },
  204. addClick() {
  205. this.setState({
  206. showAdd: true
  207. });
  208. },
  209. closeAdd(e, s) {
  210. this.state.showAdd = e;
  211. if (s) {
  212. this.loadData();
  213. };
  214. },
  215. searchSwitch() {
  216. this.setState({
  217. searchMore: !this.state.searchMore
  218. });
  219. },
  220. search() {
  221. this.loadData();
  222. },
  223. reset() {
  224. this.state.copyrightName = undefined;
  225. this.state.status = undefined;
  226. this.state.createTime = [];
  227. this.state.acceptTime = [];
  228. this.state.authTime = [];
  229. this.loadData();
  230. },
  231. render() {
  232. const { MonthPicker, RangePicker } = DatePicker;
  233. return (
  234. <div className="foster-box">
  235. <div className="foster-content">
  236. <div className="content-title">
  237. <span>软著申请管理</span>
  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={[this.state.createTime[0] ? moment(this.state.createTime[0]) : null,
  256. this.state.createTime[1] ? moment(this.state.createTime[1]) : null]}
  257. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  258. <span>受理时间:</span>
  259. <RangePicker style={{ width: '240px' }}
  260. allowClear={false}
  261. value={[this.state.acceptTime[0] ? moment(this.state.acceptTime[0]) : null,
  262. this.state.acceptTime[1] ? moment(this.state.acceptTime[1]) : null]}
  263. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  264. </div>
  265. </div>
  266. <div className="foster-table">
  267. <Spin spinning={this.state.loading}>
  268. <Table columns={this.state.columns}
  269. dataSource={this.state.dataSource}
  270. pagination={this.state.pagination}
  271. onRowClick={this.tableRowClick} />
  272. </Spin>
  273. </div>
  274. <PatentChange
  275. data={this.state.RowData}
  276. showDesc={this.state.showDesc}
  277. closeDesc={this.closeDesc} />
  278. </div >
  279. </div>
  280. );
  281. }
  282. });
  283. export default copyright;
  284. // <PatentAdd
  285. // onClick={this.addClick}
  286. // closeAdd={this.closeAdd} />