copyright.jsx 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader, Switch } from 'antd';
  3. import { provinceArr } 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. locationProvince: this.state.province,
  26. unitName: 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. status: thisdata.status,
  53. comment: thisdata.comment,
  54. workIssue: thisdata.workIssue,
  55. outsource: thisdata.outsource,
  56. inUrgent: thisdata.inUrgent,
  57. expectTime: [moment(thisdata.acceptTime), thisdata.inUrgent],
  58. authorizedDate: thisdata.authorizedDate,
  59. fisrtContact: thisdata.fisrtContact,
  60. secondContact: thisdata.secondContact,
  61. thirdContact: thisdata.thirdContact,
  62. authorizedDateFormattedDate: thisdata.authorizedDateFormattedDate,
  63. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  64. acceptTimeFormattedDate: thisdata.acceptTimeFormattedDate
  65. });
  66. };
  67. this.state.pagination.defaultCurrent = data.data.pageNo;
  68. this.state.pagination.total = data.data.totalCount;
  69. this.setState({
  70. dataSource: this.state.data,
  71. pagination: this.state.pagination
  72. });
  73. }.bind(this),
  74. }).always(function () {
  75. this.setState({
  76. loading: false
  77. });
  78. }.bind(this));
  79. },
  80. getAuthorList() {
  81. this.setState({
  82. loading: true
  83. });
  84. $.ajax({
  85. method: "get",
  86. dataType: "json",
  87. crossDomain: false,
  88. url: globalConfig.context + "/techservice/patent/getAdmin",
  89. success: function (data) {
  90. if (data.error.length || !data.data) {
  91. return;
  92. };
  93. let _me = this;
  94. for (var item in data.data) {
  95. _me.state.authorOption.push(
  96. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  97. )
  98. };
  99. }.bind(this),
  100. }).always(function () {
  101. this.setState({
  102. loading: false
  103. });
  104. }.bind(this));
  105. },
  106. getCompanyList() {
  107. this.setState({
  108. loading: true
  109. });
  110. $.ajax({
  111. method: "get",
  112. dataType: "json",
  113. crossDomain: false,
  114. url: globalConfig.context + "/techservice/patent/getUnitNames",
  115. success: function (data) {
  116. if (data.error.length || !data.data) {
  117. return;
  118. };
  119. let _me = this;
  120. for (var item in data.data) {
  121. _me.state.companyOption.push(
  122. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  123. )
  124. };
  125. }.bind(this),
  126. }).always(function () {
  127. this.setState({
  128. loading: false
  129. });
  130. }.bind(this));
  131. },
  132. getInitialState() {
  133. return {
  134. visible: false,
  135. provinceOption: [],
  136. companyOption: [],
  137. authorOption: [],
  138. data: [],
  139. selectedRowKeys: [],
  140. selectedRows: [],
  141. loading: false,
  142. showAdd: false,
  143. showDesc: false,
  144. searchMore: true,
  145. createTime: [],
  146. acceptTime: [],
  147. authTime: [],
  148. pagination: {
  149. defaultCurrent: 1,
  150. defaultPageSize: 10,
  151. showQuickJumper: true,
  152. pageSize: 10,
  153. onChange: function (page) {
  154. this.loadData(page);
  155. }.bind(this),
  156. showTotal: function (total) {
  157. return '共' + total + '条数据';
  158. }
  159. },
  160. columns: [
  161. {
  162. title: '编号',
  163. dataIndex: 'serialNumber',
  164. key: 'serialNumber',
  165. }, {
  166. title: '省份',
  167. dataIndex: 'province',
  168. key: 'province',
  169. }, {
  170. title: '外包公司',
  171. dataIndex: 'outsource',
  172. key: 'outsource',
  173. }, {
  174. title: '公司名称',
  175. dataIndex: 'unitName',
  176. key: 'unitName',
  177. }, {
  178. title: '认证状态',
  179. dataIndex: 'status',
  180. key: 'status',
  181. render: (text) => { return getCopyrightState(text) }
  182. }, {
  183. title: '派单信息',
  184. dataIndex: 'workIssue',
  185. key: 'workIssue',
  186. }, {
  187. title: '软著名称',
  188. dataIndex: 'copyrightName',
  189. key: 'copyrightName',
  190. }, {
  191. title: '加急天数',
  192. dataIndex: 'inUrgent',
  193. key: 'inUrgent',
  194. }, {
  195. title: '咨询师',
  196. dataIndex: 'principal',
  197. key: 'principal',
  198. }, {
  199. title: '派单日',
  200. dataIndex: 'createTimeFormattedDate',
  201. key: 'createTimeFormattedDate',
  202. }, {
  203. title: '受理日',
  204. dataIndex: 'acceptTimeFormattedDate',
  205. key: 'acceptTimeFormattedDate',
  206. }, {
  207. title: '(预计)下证时间',
  208. dataIndex: 'expectTime',
  209. key: 'expectTime',
  210. render: (text) => { return getTime(getInUrgentTime(text[0], text[1])) }
  211. }, {
  212. title: '备注',
  213. dataIndex: 'comment',
  214. key: 'comment',
  215. }
  216. ],
  217. dataSource: []
  218. };
  219. },
  220. componentWillMount() {
  221. let _me = this;
  222. provinceArr.map(function (item) {
  223. _me.state.provinceOption.push(
  224. <Select.Option value={item} key={item}>{item}</Select.Option>
  225. )
  226. });
  227. //console.log(this.state.pagination.total);
  228. this.loadData();
  229. this.getAuthorList();
  230. this.getCompanyList();
  231. },
  232. tableRowClick(record, index) {
  233. this.state.RowData = record;
  234. this.setState({
  235. showDesc: true
  236. });
  237. },
  238. delectRow() {
  239. let deletedIds = [];
  240. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  241. let rowItem = this.state.selectedRows[idx];
  242. if (rowItem.id) {
  243. deletedIds.push(rowItem.id)
  244. }
  245. }
  246. this.setState({
  247. selectedRowKeys: [],
  248. loading: deletedIds.length > 0
  249. });
  250. $.ajax({
  251. method: "POST",
  252. dataType: "json",
  253. crossDomain: false,
  254. url: globalConfig.context + "/api/admin/copyright/delete",
  255. data: {
  256. id: deletedIds
  257. }
  258. }).done(function (data) {
  259. if (!data.error.length) {
  260. message.success('保存成功!');
  261. this.setState({
  262. loading: false,
  263. });
  264. } else {
  265. message.warning(data.error[0].message);
  266. };
  267. this.loadData();
  268. }.bind(this));
  269. },
  270. closeDesc(e, s) {
  271. this.state.showDesc = e;
  272. if (s) {
  273. this.loadData();
  274. };
  275. },
  276. addClick() {
  277. this.setState({
  278. showAdd: true
  279. });
  280. },
  281. closeAdd(e, s) {
  282. this.state.showAdd = e;
  283. if (s) {
  284. this.loadData();
  285. };
  286. },
  287. searchSwitch() {
  288. this.setState({
  289. searchMore: !this.state.searchMore
  290. });
  291. },
  292. search() {
  293. this.loadData();
  294. },
  295. reset() {
  296. this.state.province = undefined;
  297. this.state.unitName = undefined;
  298. this.state.createTime = [];
  299. this.state.acceptTime = [];
  300. this.state.authTime = [];
  301. this.loadData();
  302. },
  303. render() {
  304. const rowSelection = {
  305. selectedRowKeys: this.state.selectedRowKeys,
  306. onChange: (selectedRowKeys, selectedRows) => {
  307. this.setState({
  308. selectedRows: selectedRows,
  309. selectedRowKeys: selectedRowKeys
  310. });
  311. }
  312. };
  313. const hasSelected = this.state.selectedRowKeys.length > 0;
  314. const { MonthPicker, RangePicker } = DatePicker;
  315. return (
  316. <div className="foster-box">
  317. <div className="foster-content">
  318. <div className="content-title">
  319. <span>软著申请管理</span>
  320. <PatentAdd
  321. companyOption={this.state.companyOption}
  322. authorOption={this.state.authorOption}
  323. onClick={this.addClick}
  324. closeAdd={this.closeAdd} />
  325. </div>
  326. <div className="foster-query">
  327. <Select placeholder="选择省份"
  328. style={{ width: 200 }}
  329. value={this.state.province}
  330. showSearch
  331. filterOption={companySearch}
  332. onChange={(e) => { this.setState({ province: e }) }}>
  333. {this.state.provinceOption}
  334. </Select>
  335. <Select placeholder="选择公司"
  336. style={{ width: 200 }}
  337. value={this.state.unitName}
  338. showSearch
  339. filterOption={companySearch}
  340. onChange={(e) => { this.setState({ unitName: e }) }}>
  341. {this.state.companyOption}
  342. </Select>
  343. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  344. <Button type="primary" onClick={this.search}>搜索</Button>
  345. <Button onClick={this.reset}>重置</Button>
  346. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  347. disabled={!hasSelected}
  348. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  349. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  350. <span>派单时间:</span>
  351. <RangePicker style={{ width: '240px' }}
  352. allowClear={false}
  353. value={[moment(this.state.createTime[0]), moment(this.state.createTime[1])]}
  354. onChange={(date, dateString) => { this.setState({ createTime: dateString }) }} />
  355. <span>受理时间:</span>
  356. <RangePicker style={{ width: '240px' }}
  357. allowClear={false}
  358. value={[moment(this.state.acceptTime[0]), moment(this.state.acceptTime[1])]}
  359. onChange={(date, dateString) => { this.setState({ acceptTime: dateString }) }} />
  360. <span>下证时间:</span>
  361. <RangePicker style={{ width: '240px' }}
  362. allowClear={false}
  363. value={[moment(this.state.authTime[0]), moment(this.state.authTime[1])]}
  364. onChange={(date, dateString) => { this.setState({ authTime: dateString }) }} />
  365. </div>
  366. </div>
  367. <div className="foster-table">
  368. <Spin spinning={this.state.loading}>
  369. <Table columns={this.state.columns}
  370. rowSelection={rowSelection}
  371. dataSource={this.state.dataSource}
  372. pagination={this.state.pagination}
  373. onRowClick={this.tableRowClick} />
  374. </Spin>
  375. </div>
  376. <PatentChange
  377. data={this.state.RowData}
  378. authorOption={this.state.authorOption}
  379. showDesc={this.state.showDesc}
  380. closeDesc={this.closeDesc} />
  381. </div >
  382. </div>
  383. );
  384. }
  385. });
  386. export default copyright;