achievementExamine.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. render:text=>{
  103. return text&&text.length>16?text.substr(0,16)+'...':text
  104. }
  105. }, {
  106. title: '成果类型',
  107. dataIndex: 'dataCategory',
  108. key: 'dataCategory',
  109. render: (text) => { return getAchievementType(text); }
  110. },
  111. {
  112. title: '知识产权类型',
  113. dataIndex: 'category',
  114. key: 'category',
  115. render: (text) => { return getAchievementCategory(text); }
  116. },
  117. {
  118. title: '客户名称',
  119. dataIndex: 'ownerName',
  120. key: 'ownerName',
  121. render:text=>{
  122. return text&&text.length>16?text.substr(0,16)+'...':text
  123. }
  124. },
  125. {
  126. title: '发布状态',
  127. dataIndex: 'auditStatus',
  128. key: 'auditStatus',
  129. render: text => { return getReleaseStateList(text) }
  130. },
  131. {
  132. title: '审核',
  133. dataIndex: 'caozuo',
  134. key: 'caozuo',
  135. render:(text,recard) => {
  136. return <div className="btnRight">
  137. <Button type="primary" onClick={(e)=>{e.stopPropagation();this.tableRowClick(recard)}}>审核</Button>
  138. </div>
  139. }
  140. }
  141. ],
  142. dataSource: [],
  143. searchTime: [,]
  144. };
  145. },
  146. componentWillMount() {
  147. let theArr = [];
  148. achievementType.map(function (item) {
  149. theArr.push(
  150. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  151. )
  152. });
  153. this.state.demandTypeOption = theArr;
  154. this.loadData();
  155. },
  156. tableRowClick(record, index) {
  157. this.state.RowData = record;
  158. this.setState({
  159. showDesc: true,
  160. examineState:true
  161. });
  162. },
  163. delectRow(recard) {
  164. this.setState({
  165. loading:true
  166. })
  167. $.ajax({
  168. method: "POST",
  169. dataType: "json",
  170. crossDomain: false,
  171. url: globalConfig.context + "/api/user/demand/delete",
  172. data: {
  173. ids: recard.id
  174. }
  175. }).done(function (data) {
  176. if (!data.error.length) {
  177. message.success('删除成功!');
  178. this.setState({
  179. loading: false,
  180. });
  181. } else {
  182. message.warning(data.error[0].message);
  183. };
  184. this.loadData(this.state.page);
  185. }.bind(this));
  186. },
  187. closeDesc(e, s) {
  188. this.state.showDesc = e;
  189. if (s) {
  190. if(this.state.pagination.total%10==1){
  191. this.loadData((this.state.page)-1);
  192. }else{
  193. this.loadData(this.state.page);
  194. }
  195. };
  196. },
  197. search() {
  198. this.loadData();
  199. },
  200. reset() {
  201. this.state.nameSearch = '';
  202. this.state.dataCategorySearch = undefined;
  203. this.state.categorySearch = undefined;
  204. this.state.employerNameSearch='';
  205. this.state.releaseDate = [];
  206. this.loadData();
  207. },
  208. searchSwitch() {
  209. this.setState({
  210. searchMore: !this.state.searchMore
  211. });
  212. },
  213. render() {
  214. const rowSelection = {
  215. selectedRowKeys: this.state.selectedRowKeys,
  216. onChange: (selectedRowKeys, selectedRows) => {
  217. this.setState({
  218. selectedRows: selectedRows.slice(-1),
  219. selectedRowKeys: selectedRowKeys.slice(-1)
  220. });
  221. }
  222. };
  223. const hasSelected = this.state.selectedRowKeys.length > 0;
  224. const { RangePicker } = DatePicker;
  225. return (
  226. <div className="user-content" >
  227. <div className="content-title">
  228. <span>成果发布审核</span>
  229. </div>
  230. <div className="user-search">
  231. <Input placeholder="成果名称"
  232. value={this.state.nameSearch}
  233. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  234. <Select placeholder="选择成果类型"
  235. style={{ width: 120 }}
  236. value={this.state.dataCategorySearch}
  237. onChange={(e) => { this.setState({ dataCategorySearch: e }) }}>
  238. {this.state.demandTypeOption}
  239. </Select>
  240. <Select placeholder="知识产权类型" style={{ width: 120 }}
  241. value={this.state.categorySearch}
  242. onChange={(e) => { this.setState({ categorySearch: e }) }}>
  243. {
  244. achievementCategoryList.map(function (item) {
  245. return <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  246. })
  247. }
  248. </Select>
  249. <Button type="primary" onClick={this.search}>搜索</Button>
  250. <Button onClick={this.reset}>重置</Button>
  251. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  252. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  253. <Input style={{width:140,marginRight:10}} value={this.state.employerNameSearch} onChange={(e)=>{this.setState({employerNameSearch:e.target.value})}} placeholder="客户名称"/>
  254. {/* <span>发布时间 :</span>
  255. <RangePicker
  256. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  257. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  258. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} /> */}
  259. </div>
  260. </div>
  261. <div className="patent-table">
  262. <Spin spinning={this.state.loading}>
  263. <Table columns={this.state.columns}
  264. dataSource={this.state.dataSource}
  265. rowSelection={rowSelection}
  266. pagination={this.state.pagination}
  267. />
  268. </Spin>
  269. </div>
  270. <TechDemandDesc
  271. data={this.state.RowData}
  272. demandTypeOption={this.state.demandTypeOption}
  273. examineState={this.state.examineState}
  274. showDesc={this.state.showDesc}
  275. closeDesc={this.closeDesc} />
  276. </div >
  277. );
  278. }
  279. });
  280. export default DemandList;