techAchievementAudit.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. import React from 'react';
  2. import {Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload, Tabs} from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import moment from 'moment';
  6. import '../techAchievement.less';
  7. import TechAchievementDesc from './auditDesc.jsx';
  8. import { achievementCategoryList, techAuditStatusList } from '../../../dataDic.js';
  9. import { beforeUploadFile, companySearch, getAchievementCategory, getSearchUrl, getTechAuditStatus ,getboutique,gethot} from '../../../tools.js';
  10. import {ChooseList} from "../../order/orderNew/chooseList";
  11. const TabPane = Tabs.TabPane;
  12. const AchievementList = React.createClass({
  13. loadData(pageNo, apiUrl) {
  14. this.state.data = [];
  15. if(this.state.serialNumber&&isNaN(this.state.serialNumber)){
  16. message.warning('请输入正确的编号格式');
  17. return false;
  18. }
  19. this.setState({
  20. loading: true,
  21. ispage:pageNo,
  22. });
  23. $.ajax({
  24. method: "get",
  25. dataType: "json",
  26. crossDomain: false,
  27. url: globalConfig.context + '/api/admin/achievement/orgList',
  28. data: {
  29. pageNo: pageNo || 1,
  30. pageSize: this.state.pagination.pageSize,
  31. auditStatus:2,
  32. serialNumber: this.state.serialNumber, //编号
  33. name: this.state.name, //名称
  34. ownerName:this.state.ownerName, //成果所有人
  35. // ownerName: this.state.searchType == 1 ? this.state.searchName : undefined,
  36. // username: this.state.searchType == 0 && this.props['data-listApiUrl'].indexOf('org') == -1 ? this.state.searchName : undefined,
  37. // unitName: this.state.searchType == 0 && this.props['data-listApiUrl'].indexOf('user') == -1 ? this.state.searchName : undefined,
  38. keyword: this.state.keyword, // 关键词
  39. category: this.state.category, //类型(0--专利, 2--软著, 3--项目, 4--版权, 5--工业设计, 6--配方, 7--非标)
  40. releaseDateStartDate: this.state.releaseDate[0],
  41. releaseDateEndDate: this.state.releaseDate[1],
  42. releaseStatus: this.state.releaseStatus ? Number(this.state.releaseStatus) : undefined, //是否发布(0--未发布,1--已发布)
  43. boutique:this.state.boutique,
  44. hot:this.state.hot,
  45. createDateStartDate: this.state.releaseDateS[0],
  46. createDateEndDate: this.state.releaseDateS[1],
  47. ownerType:this.state.ownerType,
  48. },
  49. success: function (data) {
  50. let theArr = [];
  51. if (!data.data || !data.data.list) {
  52. if (data.error && data.error.length) {
  53. message.warning(data.error[0].message);
  54. };
  55. } else {
  56. for (let i = 0; i < data.data.list.length; i++) {
  57. let thisdata = data.data.list[i];
  58. theArr.push({
  59. key: i,
  60. id: thisdata.id,
  61. serialNumber: thisdata.serialNumber,
  62. dataCategory: thisdata.dataCategory,
  63. name: thisdata.name,
  64. keyword: thisdata.keyword,
  65. theName: thisdata.username || thisdata.ownerName,
  66. category: thisdata.category,
  67. ownerName: thisdata.username ? thisdata.username : thisdata.ownerName,
  68. ownerType: thisdata.ownerType,
  69. ownerMobile: thisdata.ownerMobile,
  70. status: thisdata.status,
  71. releaseDate: thisdata.releaseDate,
  72. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  73. auditStatus: thisdata.auditStatus,
  74. boutique: thisdata.boutique,
  75. hot: thisdata.hot,
  76. techBrokerId:thisdata.techBrokerId,
  77. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  78. remark:thisdata.remark,
  79. techBrokerIdd:thisdata.techBrokerIdd
  80. });
  81. };
  82. this.state.pagination.current = data.data.pageNo;
  83. this.state.pagination.total = data.data.totalCount;
  84. };
  85. this.setState({
  86. dataSource: theArr,
  87. pagination: this.state.pagination
  88. });
  89. }.bind(this),
  90. }).always(function () {
  91. this.setState({
  92. loading: false
  93. });
  94. }.bind(this));
  95. },
  96. getInitialState() {
  97. return {
  98. searchMore: true,
  99. searchType: 0,
  100. validityPeriodDate: [],
  101. releaseDate: [],
  102. releaseDateS: [],
  103. selectedRowKeys: [],
  104. selectedRows: [],
  105. loading: false,
  106. pagination: {
  107. defaultCurrent: 1,
  108. defaultPageSize: 10,
  109. showQuickJumper: true,
  110. pageSize: 10,
  111. onChange: function (page) {
  112. this.loadData(page);
  113. }.bind(this),
  114. showTotal: function (total) {
  115. return '共' + total + '条数据';
  116. }
  117. },
  118. columns: [
  119. {
  120. title: '编号',
  121. dataIndex: 'serialNumber',
  122. key: 'serialNumber',
  123. }, {
  124. title: '名称',
  125. dataIndex: 'name',
  126. key: 'name',
  127. }, {
  128. title: '关键字',
  129. dataIndex: 'keyword',
  130. key: 'keyword',
  131. }, {
  132. title: '类型',
  133. dataIndex: 'category',
  134. key: 'category',
  135. render: text => { return getAchievementCategory(text); }
  136. }, {
  137. title: '录入人',
  138. dataIndex: 'techBrokerId',
  139. key: 'techBrokerId',
  140. },{
  141. title: '审核状态',
  142. dataIndex: 'auditStatus',
  143. key: 'auditStatus',
  144. render: text => { return getTechAuditStatus(text) }
  145. },
  146. {
  147. title: '是否精品',
  148. dataIndex: 'boutique',
  149. key: 'boutique',
  150. render: text => { return getboutique(text) }
  151. },
  152. { title: '录入时间',
  153. dataIndex: 'createTimeFormattedDate',
  154. key: 'createTimeFormattedDate',
  155. },
  156. ],
  157. dataSource: [],
  158. searchTime: [,]
  159. };
  160. },
  161. componentWillMount() {
  162. let theArr = [];
  163. achievementCategoryList.map(function (item) {
  164. theArr.push(
  165. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  166. )
  167. });
  168. let auditArr = [];
  169. techAuditStatusList.map(function (item) {
  170. auditArr.push(
  171. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  172. )
  173. });
  174. this.state.achievementCategoryOption = theArr;
  175. this.state.auditStatusOption = auditArr;
  176. //管理中心跳转
  177. let data=localStorage.getItem('newData');
  178. if(data!='{}'&&data){
  179. var newData = JSON.parse(data);
  180. this.tableRowClick(newData);
  181. };
  182. this.loadData();
  183. },
  184. componentWillReceiveProps(nextProps) {
  185. if (this.props['data-listApiUrl'] != nextProps['data-listApiUrl']) {
  186. this.state.selectedRowKeys = [];
  187. this.state.selectedRows = [];
  188. this.state.serialNumber = undefined;
  189. this.state.name = undefined;
  190. this.state.keyword = undefined;
  191. this.state.category = undefined;
  192. this.state.ownerType = undefined;
  193. this.state.releaseStatus = undefined;
  194. this.state.auditStatus = undefined;
  195. this.state.searchName = undefined;
  196. this.state.searchType = 0;
  197. this.state.releaseDate = [];
  198. this.state.releaseDateS = [];
  199. this.loadData(null, nextProps['data-listApiUrl']);
  200. };
  201. },
  202. tableRowClick(record, index) {
  203. this.setState({
  204. RowData:record,
  205. showDesc: true
  206. });
  207. localStorage.setItem('newData','{}');
  208. },
  209. // delectRow() {
  210. // let deletedIds = [];
  211. // for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  212. // let rowItem = this.state.selectedRows[idx];
  213. // if (rowItem.id) {
  214. // deletedIds.push(rowItem.id)
  215. // };
  216. // };
  217. // this.setState({
  218. // selectedRowKeys: [],
  219. // loading: deletedIds.length > 0
  220. // });
  221. // $.ajax({
  222. // method: "POST",
  223. // dataType: "json",
  224. // crossDomain: false,
  225. // url: globalConfig.context + "/api/admin/achievement/delete",
  226. // data: {
  227. // ids: deletedIds
  228. // }
  229. // }).done(function (data) {
  230. // if (!data.error.length) {
  231. // message.success('删除成功!');
  232. // this.setState({
  233. // loading: false,
  234. // });
  235. // } else {
  236. // message.warning(data.error[0].message);
  237. // };
  238. // this.loadData();
  239. // }.bind(this));
  240. // },
  241. //审核不通过
  242. examineCancel(){
  243. let nub=4;
  244. this.examine(nub)
  245. },
  246. examineOK(){
  247. let nub=3;
  248. this.examine(nub)
  249. },
  250. examine(nub) {
  251. let deletedIds = [];
  252. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  253. let rowItem = this.state.selectedRows[idx];
  254. if (rowItem.id) {
  255. deletedIds.push(rowItem.id,rowItem.techBrokerIdd)
  256. };
  257. };
  258. this.setState({
  259. selectedRowKeys: [],
  260. loading: deletedIds.length > 0
  261. });
  262. $.ajax({
  263. method: "POST",
  264. dataType: "json",
  265. crossDomain: false,
  266. url: globalConfig.context + '/api/admin/audit/achievement',
  267. data: {
  268. id: deletedIds[0],
  269. auditStatus:nub,
  270. techBroderId:deletedIds[1],
  271. releaseStatus:0
  272. }
  273. }).done(function (data) {
  274. if (!data.error.length) {
  275. message.success('操作成功');
  276. this.setState({
  277. loading: false,
  278. });
  279. } else {
  280. message.warning(data.error[0].message);
  281. };
  282. this.loadData();
  283. }.bind(this));
  284. },
  285. addClick() {
  286. this.state.RowData = {};
  287. this.setState({
  288. showDesc: true
  289. });
  290. },
  291. closeDesc(e, s) {
  292. this.state.showDesc = e;
  293. if (s) {
  294. this.loadData(this.state.ispage);
  295. };
  296. },
  297. search() {
  298. this.loadData();
  299. },
  300. reset() {
  301. this.state.serialNumber = undefined;
  302. this.state.name = undefined;
  303. this.state.ownerName= undefined;
  304. this.state.keyword = undefined;
  305. this.state.category = undefined;
  306. this.state.ownerType = undefined;
  307. this.state.releaseStatus = undefined;
  308. this.state.auditStatus = undefined;
  309. this.state.searchName = undefined;
  310. this.state.releaseDate = [];
  311. this.state.releaseDateS = [];
  312. this.state.boutique = '';
  313. this.state.hot='' ;
  314. this.loadData();
  315. },
  316. searchSwitch() {
  317. this.setState({
  318. searchMore: !this.state.searchMore
  319. });
  320. },
  321. changeList(arr) {
  322. const newArr = [];
  323. this.state.columns.forEach(item => {
  324. arr.forEach(val => {
  325. if (val === item.title) {
  326. newArr.push(item);
  327. }
  328. });
  329. });
  330. this.setState({
  331. changeList: newArr
  332. });
  333. },
  334. render() {
  335. const rowSelection = {
  336. selectedRowKeys: this.state.selectedRowKeys,
  337. onChange: (selectedRowKeys, selectedRows) => {
  338. this.setState({
  339. selectedRows: selectedRows.slice(-1),
  340. selectedRowKeys: selectedRowKeys.slice(-1)
  341. });
  342. }
  343. };
  344. const hasSelected = this.state.selectedRowKeys.length > 0;
  345. const { RangePicker } = DatePicker;
  346. return (
  347. <div className="user-content" >
  348. <div className="content-title">
  349. <span>成果审核管理</span>
  350. <div className="patent-addNew clearfix">
  351. <Upload
  352. action={globalConfig.context + "/api/admin/achievement/uploadTemplate"}
  353. data={{ 'sign': 'achievement_template' }}
  354. beforeUpload={beforeUploadFile}
  355. showUploadList={false}
  356. onChange={(info) => {
  357. if (info.file.status !== 'uploading') {
  358. }
  359. if (info.file.status === 'done') {
  360. if (!info.file.response.error.length) {
  361. message.success(`${info.file.name} 文件上传成功!`);
  362. } else {
  363. message.warning(info.file.response.error[0].message);
  364. return;
  365. };
  366. } else if (info.file.status === 'error') {
  367. message.error(`${info.file.name} 文件上传失败。`);
  368. };
  369. }} >
  370. <Button style={{"display":"none"}}>上传批量导入模板</Button>
  371. </Upload>
  372. <Button onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/downloadTemplate?sign=achievement_template') }} style={{"display":"none"}}>下载批量导入模板</Button>
  373. <Button type="primary" className="addButton" onClick={this.addClick} style={{"display":"none"}}>发布成果<Icon type="plus" /></Button>
  374. </div>
  375. </div>
  376. <Tabs
  377. defaultActiveKey="1"
  378. onChange={this.callback}
  379. className="test"
  380. >
  381. <TabPane tab="搜索" key="1">
  382. <div className="user-search">
  383. <Input placeholder="编号"
  384. value={this.state.serialNumber}
  385. onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
  386. <Input placeholder="名称"
  387. value={this.state.name}
  388. onChange={(e) => { this.setState({ name: e.target.value }); }} />
  389. <Input placeholder="关键字"
  390. value={this.state.keyword}
  391. onChange={(e) => { this.setState({ keyword: e.target.value }); }} />
  392. <Input placeholder="成果所有人"
  393. value={this.state.ownerName}
  394. onChange={(e) => { this.setState({ ownerName: e.target.value }); }} />
  395. <Radio.Group value={this.state.searchType} onChange={(e) => {
  396. this.setState({ searchType: e.target.value })
  397. }}>
  398. <Radio value={0}>认证用户</Radio>
  399. <Radio value={1}>非认证用户</Radio>
  400. </Radio.Group>
  401. <Button type="primary" onClick={this.search}>搜索</Button>
  402. <Button onClick={this.reset}>重置</Button>
  403. <Button type='primary' onClick={this.examineOK} disabled={!hasSelected} style={{"display":"none"}}>审核通过</Button>
  404. <Button type='primary' onClick={this.examineCancel} disabled={!hasSelected} style={{"display":"none"}}>审核不通过</Button>
  405. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  406. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  407. <Radio.Group value={this.state.boutique} onChange={(e) => {
  408. this.setState({ boutique: e.target.value })
  409. }}>
  410. <Radio value={1}>精品</Radio>
  411. <Radio value={0}>非精品</Radio>
  412. </Radio.Group>
  413. <Select placeholder="选择类型" style={{ width: 160 }}
  414. value={this.state.category}
  415. onChange={(e) => { this.setState({ category: e }) }}>
  416. {this.state.achievementCategoryOption}
  417. </Select>
  418. <Select placeholder="选择所有人类型" style={{ width: 120 }}
  419. value={this.state.ownerType}
  420. onChange={(e) => { this.setState({ ownerType: e }) }}>
  421. <Select.Option value="0" >个人</Select.Option>
  422. <Select.Option value="1" >组织</Select.Option>
  423. </Select>
  424. <div style={{marginTop:'10px'}}>
  425. <span>发布时间 :</span>
  426. <RangePicker
  427. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  428. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  429. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  430. <span style={{marginLeft:'5px'}}>录入时间 :</span>
  431. <RangePicker
  432. value={[this.state.releaseDateS[0] ? moment(this.state.releaseDateS[0]) : null,
  433. this.state.releaseDateS[1] ? moment(this.state.releaseDateS[1]) : null]}
  434. onChange={(data, dataString) => { this.setState({ releaseDateS: dataString }); }} />
  435. </div>
  436. </div>
  437. </div>
  438. </TabPane>
  439. <TabPane tab="更改表格显示数据" key="2">
  440. <div style={{ marginLeft: 10 }}>
  441. <ChooseList
  442. columns={this.state.columns}
  443. changeFn={this.changeList}
  444. changeList={this.state.changeList}
  445. top={55}
  446. margin={11}
  447. />
  448. </div>
  449. </TabPane>
  450. </Tabs>
  451. <div className="patent-table">
  452. <Spin spinning={this.state.loading}>
  453. <Table size="middle" columns={
  454. this.state.changeList
  455. ? this.state.changeList
  456. : this.state.columns
  457. }
  458. style={{
  459. cursor: 'pointer',
  460. }}
  461. dataSource={this.state.dataSource}
  462. rowSelection={rowSelection}
  463. pagination={this.state.pagination}
  464. onRowClick={this.tableRowClick} />
  465. </Spin>
  466. </div>
  467. <TechAchievementDesc
  468. data={this.state.RowData}
  469. detailApiUrl={this.props['data-detailApiUrl']}
  470. achievementCategoryOption={this.state.achievementCategoryOption}
  471. showDesc={this.state.showDesc}
  472. closeDesc={this.closeDesc} />
  473. </div >
  474. );
  475. }
  476. });
  477. export default AchievementList;