achievementExamine.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. import React from 'react';
  2. import { Button, Input, Select, Spin, Table, Switch, message, DatePicker} from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import moment from 'moment';
  5. import './techAchievement.less';
  6. import TechDemandDesc from './achievementDesc.jsx';
  7. import {achievementCategoryList,achievementType } from '@/dataDic.js';
  8. import {getReleaseStateList,getAchievementCategory,getAchievementType } from '@/tools.js';
  9. const DemandList = React.createClass({
  10. loadData(pageNo) {
  11. this.state.data = [];
  12. this.setState({
  13. page:pageNo,
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "get",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + "/api/admin/achievement/list",
  21. data: {
  22. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. ownerName: this.state.employerNameSearch,//客户名称
  25. name: this.state.nameSearch,
  26. dataCategory: this.state.dataCategorySearch ? Number(this.state.dataCategorySearch) : undefined,
  27. category: this.state.categorySearch ? Number(this.state.categorySearch) : undefined,
  28. startDate: this.state.releaseDate[0],
  29. endDate: this.state.releaseDate[1],
  30. auditStatus: 1
  31. },
  32. success: function (data) {
  33. let theArr = [];
  34. if (!data.data || !data.data.list) {
  35. if (data.error && data.error.length) {
  36. message.warning(data.error[0].message);
  37. };
  38. } else {
  39. for (let i = 0; i < data.data.list.length; i++) {
  40. let thisdata = data.data.list[i];
  41. theArr.push({
  42. key: i,
  43. id: thisdata.id,
  44. serialNumber: thisdata.serialNumber,
  45. name: thisdata.name,
  46. fieldA:thisdata.fieldA,
  47. fieldB:thisdata.fieldB,
  48. category: thisdata.category,
  49. dataCategory: thisdata.dataCategory,
  50. auditStatus: thisdata.auditStatus,
  51. ownerName:thisdata.ownerName,
  52. releaseDate:thisdata.releaseDate?(new Date(thisdata.releaseDate)).toLocaleString():''
  53. });
  54. };
  55. }
  56. this.state.pagination.current = data.data.pageNo;
  57. this.state.pagination.total = data.data.totalCount;
  58. if(data.data&&data.data.list&&!data.data.list.length){
  59. this.state.pagination.current=0
  60. this.state.pagination.total=0
  61. }
  62. this.setState({
  63. dataSource: theArr,
  64. pagination: this.state.pagination
  65. });
  66. }.bind(this),
  67. }).always(function () {
  68. this.setState({
  69. loading: false
  70. });
  71. }.bind(this));
  72. },
  73. getInitialState() {
  74. return {
  75. searchMore: true,
  76. validityPeriodDate: [],
  77. releaseDate: [],
  78. selectedRowKeys: [],
  79. selectedRows: [],
  80. loading: false,
  81. pagination: {
  82. defaultCurrent: 1,
  83. defaultPageSize: 10,
  84. showQuickJumper: true,
  85. pageSize: 10,
  86. onChange: function (page) {
  87. this.loadData(page);
  88. }.bind(this),
  89. showTotal: function (total) {
  90. return '共' + total + '条数据';
  91. }
  92. },
  93. columns: [
  94. {
  95. title: '编号',
  96. dataIndex: 'serialNumber',
  97. key: 'serialNumber',
  98. }, {
  99. title: '成果名称',
  100. dataIndex: 'name',
  101. key: 'name',
  102. }, {
  103. title: '成果类型',
  104. dataIndex: 'dataCategory',
  105. key: 'dataCategory',
  106. render: (text) => { return getAchievementType(text); }
  107. },
  108. {
  109. title: '知识产权类型',
  110. dataIndex: 'category',
  111. key: 'category',
  112. render: (text) => { return getAchievementCategory(text); }
  113. },
  114. {
  115. title: '客户名称',
  116. dataIndex: 'ownerName',
  117. key: 'ownerName'
  118. },
  119. {
  120. title: '发布状态',
  121. dataIndex: 'auditStatus',
  122. key: 'auditStatus',
  123. render: text => { return getReleaseStateList(text) }
  124. },
  125. {
  126. title: '审核',
  127. dataIndex: 'caozuo',
  128. key: 'caozuo',
  129. render:(text,recard) => {
  130. return <div className="btnRight">
  131. <Button type="primary" onClick={(e)=>{e.stopPropagation();this.tableRowClick(recard)}}>审核</Button>
  132. </div>
  133. }
  134. }
  135. ],
  136. dataSource: [],
  137. searchTime: [,]
  138. };
  139. },
  140. componentWillMount() {
  141. let theArr = [];
  142. achievementType.map(function (item) {
  143. theArr.push(
  144. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  145. )
  146. });
  147. this.state.demandTypeOption = theArr;
  148. this.loadData();
  149. },
  150. tableRowClick(record, index) {
  151. this.state.RowData = record;
  152. this.setState({
  153. showDesc: true,
  154. examineState:true
  155. });
  156. },
  157. delectRow(recard) {
  158. this.setState({
  159. loading:true
  160. })
  161. $.ajax({
  162. method: "POST",
  163. dataType: "json",
  164. crossDomain: false,
  165. url: globalConfig.context + "/api/user/demand/delete",
  166. data: {
  167. ids: recard.id
  168. }
  169. }).done(function (data) {
  170. if (!data.error.length) {
  171. message.success('删除成功!');
  172. this.setState({
  173. loading: false,
  174. });
  175. } else {
  176. message.warning(data.error[0].message);
  177. };
  178. this.loadData();
  179. }.bind(this));
  180. },
  181. closeDesc(e, s) {
  182. this.state.showDesc = e;
  183. if (s) {
  184. this.loadData(this.state.page);
  185. };
  186. },
  187. search() {
  188. this.loadData();
  189. },
  190. reset() {
  191. this.state.nameSearch = '';
  192. this.state.dataCategorySearch = undefined;
  193. this.state.categorySearch = undefined;
  194. this.state.employerNameSearch='';
  195. this.state.releaseDate = [];
  196. this.loadData();
  197. },
  198. searchSwitch() {
  199. this.setState({
  200. searchMore: !this.state.searchMore
  201. });
  202. },
  203. render() {
  204. const rowSelection = {
  205. selectedRowKeys: this.state.selectedRowKeys,
  206. onChange: (selectedRowKeys, selectedRows) => {
  207. this.setState({
  208. selectedRows: selectedRows.slice(-1),
  209. selectedRowKeys: selectedRowKeys.slice(-1)
  210. });
  211. }
  212. };
  213. const hasSelected = this.state.selectedRowKeys.length > 0;
  214. const { RangePicker } = DatePicker;
  215. return (
  216. <div className="user-content" >
  217. <div className="content-title">
  218. <span>成果发布审核</span>
  219. </div>
  220. <div className="user-search">
  221. <Input placeholder="成果名称"
  222. value={this.state.nameSearch}
  223. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  224. <Select placeholder="选择成果类型"
  225. style={{ width: 120 }}
  226. value={this.state.dataCategorySearch}
  227. onChange={(e) => { this.setState({ dataCategorySearch: e }) }}>
  228. {this.state.demandTypeOption}
  229. </Select>
  230. <Select placeholder="知识产权类型" style={{ width: 120 }}
  231. value={this.state.categorySearch}
  232. onChange={(e) => { this.setState({ categorySearch: e }) }}>
  233. {
  234. achievementCategoryList.map(function (item) {
  235. return <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  236. })
  237. }
  238. </Select>
  239. <Button type="primary" onClick={this.search}>搜索</Button>
  240. <Button onClick={this.reset}>重置</Button>
  241. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  242. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  243. <Input style={{width:140,marginRight:10}} value={this.state.employerNameSearch} onChange={(e)=>{this.setState({employerNameSearch:e.target.value})}} placeholder="客户名称"/>
  244. <span>发布时间 :</span>
  245. <RangePicker
  246. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  247. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  248. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  249. </div>
  250. </div>
  251. <div className="patent-table">
  252. <Spin spinning={this.state.loading}>
  253. <Table columns={this.state.columns}
  254. dataSource={this.state.dataSource}
  255. rowSelection={rowSelection}
  256. pagination={this.state.pagination}
  257. />
  258. </Spin>
  259. </div>
  260. <TechDemandDesc
  261. data={this.state.RowData}
  262. demandTypeOption={this.state.demandTypeOption}
  263. examineState={this.state.examineState}
  264. showDesc={this.state.showDesc}
  265. closeDesc={this.closeDesc} />
  266. </div >
  267. );
  268. }
  269. });
  270. export default DemandList;