copyright.jsx 12 KB

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