techDemandAudit.jsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. import React from 'react';
  2. import { Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload } from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import moment from 'moment';
  6. import '../techDemand.less';
  7. import TechDemandDesc from './demandAuditDesc.jsx';
  8. import { demandTypeList } from '../../../dataDic.js';
  9. import { companySearch, getDemandType, getSearchUrl, beforeUploadFile ,getboutique,gethot} from '../../../tools.js';
  10. const TechDemandPublish = React.createClass({
  11. loadData(pageNo, apiUrl) {
  12. this.state.data = [];
  13. if(this.state.serialNumber&&isNaN(this.state.serialNumber)){
  14. message.warning('请输入正确的编号格式');
  15. return false;
  16. }
  17. this.setState({
  18. loading: true,
  19. ispage:pageNo,
  20. });
  21. $.ajax({
  22. method: "get",
  23. dataType: "json",
  24. crossDomain: false,
  25. url: globalConfig.context +'/api/admin/demand/orgList',
  26. data: {
  27. pageNo: pageNo || 1,
  28. pageSize: this.state.pagination.pageSize,
  29. serialNumber: this.state.serialNumber,
  30. name: this.state.name,
  31. auditStatus:2,
  32. keyword: this.state.keyword,
  33. infoSources: this.state.infoSources ? Number(this.state.infoSources) : undefined,
  34. demandType: this.state.demandType ? Number(this.state.demandType) : undefined,
  35. //username: this.state.username,
  36. status: this.state.status ? Number(this.state.status) : undefined,
  37. releaseStatus: this.state.releaseStatus ? Number(this.state.releaseStatus) : undefined,
  38. validityPeriodStartDate: this.state.validityPeriodDate[0],
  39. validityPeriodEndDate: this.state.validityPeriodDate[1],
  40. releaseDateStartDate: this.state.releaseDate[0],
  41. releaseDateEndDate: this.state.releaseDate[1],
  42. createDateStartDate: this.state.releaseDateS[0],
  43. createDateEndDate: this.state.releaseDateS[1],
  44. boutique:this.state.boutique,
  45. hot:this.state.hot,
  46. dataCategory:this.state.dataCategory,
  47. employerName: this.state.searchType == 1 ? this.state.searchName : undefined,
  48. username: this.state.searchType == 0 && this.props['data-listApiUrl'].indexOf('org') == -1 ? this.state.searchName : undefined,
  49. unitName: this.state.searchType == 0 && this.props['data-listApiUrl'].indexOf('user') == -1 ? this.state.searchName : undefined,
  50. },
  51. success: function (data) {
  52. let theArr = [];
  53. if (!data.data || !data.data.list) {
  54. if (data.error && data.error.length) {
  55. message.warning(data.error[0].message);
  56. };
  57. } else {
  58. for (let i = 0; i < data.data.list.length; i++) {
  59. let thisdata = data.data.list[i];
  60. theArr.push({
  61. key: i,
  62. id: thisdata.id,
  63. serialNumber: thisdata.serialNumber,
  64. dataCategory: thisdata.dataCategory,
  65. name: thisdata.name,
  66. keyword: thisdata.keyword,
  67. infoSources: thisdata.infoSources,
  68. username: thisdata.username,
  69. theName: thisdata.username || thisdata.employerName,
  70. demandType: thisdata.demandType,
  71. validityPeriod: thisdata.validityPeriod,
  72. employerName: thisdata.employerName,
  73. employerId: thisdata.employerId,
  74. province: thisdata.province,
  75. status: thisdata.status,
  76. releaseStatus: thisdata.releaseStatus,
  77. releaseDate: thisdata.releaseDate,
  78. principalId: thisdata.principalId,
  79. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate,
  80. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  81. auditStatus: thisdata.auditStatus,
  82. boutique: thisdata.boutique,
  83. urgentMoney:thisdata.urgentMoney,
  84. urgentDays:thisdata.urgentDays,
  85. hot: thisdata.hot,
  86. techBrokerId:thisdata.techBrokerId,
  87. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  88. techBrokerIdd:thisdata.techBrokerIdd,
  89. });
  90. };
  91. this.state.pagination.current = data.data.pageNo;
  92. this.state.pagination.total = data.data.totalCount;
  93. };
  94. this.setState({
  95. dataSource: theArr,
  96. pagination: this.state.pagination
  97. });
  98. }.bind(this),
  99. }).always(function () {
  100. this.setState({
  101. loading: false
  102. });
  103. }.bind(this));
  104. },
  105. getInitialState() {
  106. return {
  107. searchMore: true,
  108. searchType: 0,
  109. validityPeriodDate: [],
  110. releaseDate: [],
  111. releaseDateS: [],
  112. selectedRowKeys: [],
  113. selectedRows: [],
  114. loading: false,
  115. pagination: {
  116. defaultCurrent: 1,
  117. defaultPageSize: 10,
  118. showQuickJumper: true,
  119. pageSize: 10,
  120. onChange: function (page) {
  121. this.loadData(page);
  122. }.bind(this),
  123. showTotal: function (total) {
  124. return '共' + total + '条数据';
  125. }
  126. },
  127. columns: [
  128. {
  129. title: '编号',
  130. dataIndex: 'serialNumber',
  131. key: 'serialNumber',
  132. }, {
  133. title: '需求名称',
  134. dataIndex: 'name',
  135. key: 'name',
  136. },
  137. {
  138. title: '录入人',
  139. dataIndex: 'techBrokerId',
  140. key: 'techBrokerId',
  141. },
  142. {
  143. title: '是否精品',
  144. dataIndex: 'boutique',
  145. key: 'boutique',
  146. render: text => { return getboutique(text) }
  147. },
  148. {
  149. title: '关键字',
  150. dataIndex: 'keyword',
  151. key: 'keyword',
  152. }, {
  153. title: '需求类型',
  154. dataIndex: 'demandType',
  155. key: 'demandType',
  156. render: text => { return getDemandType(text); }
  157. }, {
  158. title: '信息来源',
  159. dataIndex: 'infoSources',
  160. key: 'infoSources',
  161. render: text => {
  162. switch (text) {
  163. case "0":
  164. return <span>平台采集</span>;
  165. case "1":
  166. return <span>客户发布</span>;
  167. case "2":
  168. return <span>批量导入</span>
  169. case "3":
  170. return <span>三方对接</span>
  171. }
  172. }
  173. }, {
  174. title: '加急天数',
  175. dataIndex: 'urgentDays',
  176. key: 'urgentDays',
  177. }, {
  178. title: '加急报酬(万)',
  179. dataIndex: 'urgentMoney',
  180. key: 'urgentMoney',
  181. }, {
  182. title: '审核状态',
  183. dataIndex: 'auditStatus',
  184. key: 'auditStatus',
  185. render: text => {
  186. switch (text) {
  187. case 0:
  188. return <span>未提交审核(草稿)</span>;
  189. case 1:
  190. return <span>提交审核</span>;
  191. case 2:
  192. return <span>审核中</span>;
  193. case 3:
  194. return <span>审核通过</span>;
  195. case 4:
  196. return <span>审核未通过</span>;
  197. }
  198. }
  199. }, {
  200. title: '需求状态',
  201. dataIndex: 'status',
  202. key: 'status',
  203. render: text => {
  204. switch (text) {
  205. case "0":
  206. return <span>进行中</span>;
  207. case "1":
  208. return <span>未解决</span>;
  209. case "2":
  210. return <span>已解决</span>;
  211. }
  212. }
  213. }, {
  214. title: '有效期限',
  215. dataIndex: 'validityPeriodFormattedDate',
  216. key: 'validityPeriodFormattedDate',
  217. },{
  218. title: '录入时间',
  219. dataIndex: 'createTimeFormattedDate',
  220. key: 'createTimeFormattedDate',
  221. }
  222. ],
  223. dataSource: [],
  224. searchTime: []
  225. };
  226. },
  227. getCompanyList() {
  228. this.setState({
  229. loading: true
  230. });
  231. $.ajax({
  232. method: "get",
  233. dataType: "json",
  234. crossDomain: false,
  235. url: globalConfig.context + "/api/admin/demand/unitNames",
  236. success: function (data) {
  237. let theArr = [];
  238. if (!data.data) {
  239. if (data.error && data.error.length) {
  240. message.warning(data.error[0].message);
  241. };
  242. } else {
  243. data.data.map(function (item) {
  244. theArr.push(
  245. <Select.Option value={item.uid} key={item.uid}>{item.unitName}</Select.Option>
  246. )
  247. });
  248. };
  249. this.setState({
  250. companyOption: theArr
  251. });
  252. }.bind(this),
  253. }).always(function () {
  254. this.setState({
  255. loading: false
  256. });
  257. }.bind(this));
  258. },
  259. getUserList() {
  260. this.setState({
  261. loading: true
  262. });
  263. $.ajax({
  264. method: "get",
  265. dataType: "json",
  266. crossDomain: false,
  267. url: globalConfig.context + "/api/admin/demand/userNames",
  268. success: function (data) {
  269. let theArr = [];
  270. if (!data.data) {
  271. if (data.error && data.error.length) {
  272. message.warning(data.error[0].message);
  273. };
  274. } else {
  275. data.data.map(function (item) {
  276. theArr.push(
  277. <Select.Option value={item.uid} key={item.uid}>{item.username}</Select.Option>
  278. )
  279. });
  280. };
  281. this.setState({
  282. userOption: theArr
  283. });
  284. }.bind(this),
  285. }).always(function () {
  286. this.setState({
  287. loading: false
  288. });
  289. }.bind(this));
  290. },
  291. //审核不通过
  292. examineCancel(){
  293. let nub=4;
  294. this.examine(nub)
  295. },
  296. //审核通过
  297. examineOK(){
  298. let nub=3;
  299. this.examine(nub)
  300. },
  301. examine(nub) {
  302. let deletedIds = [];
  303. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  304. let rowItem = this.state.selectedRows[idx];
  305. if (rowItem.id) {
  306. deletedIds.push(rowItem.id,rowItem.techBrokerIdd)
  307. };
  308. };
  309. this.setState({
  310. selectedRowKeys: [],
  311. loading: deletedIds.length > 0
  312. });
  313. $.ajax({
  314. method: "POST",
  315. dataType: "json",
  316. crossDomain: false,
  317. url: globalConfig.context + '/api/admin/audit/demand',
  318. data: {
  319. id: deletedIds[0],
  320. auditStatus:nub,
  321. techBroderId:deletedIds[1],
  322. releaseStatus:0
  323. }
  324. }).done(function (data) {
  325. if (!data.error.length) {
  326. message.success('操作成功');
  327. this.setState({
  328. loading: false,
  329. });
  330. } else {
  331. message.warning(data.error[0].message);
  332. };
  333. this.loadData(this.state.ispage);
  334. }.bind(this));
  335. },
  336. componentWillMount() {
  337. let theArr = [];
  338. demandTypeList.map(function (item) {
  339. theArr.push(
  340. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  341. )
  342. });
  343. this.state.demandTypeOption = theArr;
  344. if (window.location.search) {
  345. let theObj = getSearchUrl(window.location.search);
  346. if (theObj.rid) {
  347. theObj.id = theObj.rid;
  348. theObj.employerId = theObj.uid;
  349. if (theObj.rid != 'null') {
  350. this.tableRowClick(theObj);
  351. };
  352. };
  353. };
  354. this.loadData();
  355. this.getCompanyList();
  356. this.getUserList();
  357. },
  358. componentWillReceiveProps(nextProps) {
  359. if (this.props['data-listApiUrl'] != nextProps['data-listApiUrl']) {
  360. this.state.selectedRowKeys = [];
  361. this.state.selectedRows = [];
  362. this.state.serialNumber = undefined;
  363. this.state.name = undefined;
  364. this.state.keyword = undefined;
  365. this.state.infoSources = undefined;
  366. this.state.demandType = undefined;
  367. this.state.searchName = undefined;
  368. this.state.searchType = 0;
  369. this.state.status = undefined;
  370. this.state.releaseStatus = undefined;
  371. this.state.auditStatus = undefined;
  372. this.state.validityPeriodDate = [];
  373. this.state.releaseDate = [];
  374. this.state.releaseDateS = [];
  375. this.loadData(null, nextProps['data-listApiUrl']);
  376. };
  377. },
  378. tableRowClick(record, index) {
  379. this.state.RowData = record;
  380. if(index!=undefined){
  381. this.setState({
  382. showDesc: true
  383. });
  384. }
  385. },
  386. // delectRow() {
  387. // let deletedIds = [];
  388. // for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  389. // let rowItem = this.state.selectedRows[idx];
  390. // if (rowItem.id) {
  391. // deletedIds.push(rowItem.id)
  392. // };
  393. // };
  394. // this.setState({
  395. // selectedRowKeys: [],
  396. // loading: deletedIds.length > 0
  397. // });
  398. // $.ajax({
  399. // method: "POST",
  400. // dataType: "json",
  401. // crossDomain: false,
  402. // url: globalConfig.context + "/api/admin/demand/delete",
  403. // data: {
  404. // ids: deletedIds
  405. // }
  406. // }).done(function (data) {
  407. // if (!data.error.length) {
  408. // message.success('删除成功!');
  409. // this.setState({
  410. // loading: false,
  411. // });
  412. // } else {
  413. // message.warning(data.error[0].message);
  414. // };
  415. // this.loadData();
  416. // }.bind(this));
  417. // },
  418. addClick() {
  419. this.state.RowData = {};
  420. this.setState({
  421. showDesc: true
  422. });
  423. },
  424. closeDesc(e, s) {
  425. this.state.showDesc = e;
  426. if (s) {
  427. this.loadData(this.state.ispage);
  428. };
  429. },
  430. search() {
  431. this.loadData();
  432. },
  433. reset() {
  434. this.state.serialNumber = undefined;
  435. this.state.name = undefined;
  436. this.state.keyword = undefined;
  437. this.state.infoSources = undefined;
  438. this.state.demandType = undefined;
  439. this.state.searchName = undefined;
  440. this.state.searchType = 0;
  441. this.state.boutique = '';
  442. this.state.hot='' ;
  443. this.state.status = undefined;
  444. this.state.releaseStatus = undefined;
  445. this.state.auditStatus = undefined;
  446. this.state.dataCategory = undefined;
  447. this.state.validityPeriodDate = [];
  448. this.state.releaseDate = [];
  449. this.state.releaseDateS = [];
  450. this.loadData();
  451. },
  452. searchSwitch() {
  453. this.setState({
  454. searchMore: !this.state.searchMore
  455. });
  456. },
  457. render() {
  458. const rowSelection = {
  459. selectedRowKeys: this.state.selectedRowKeys,
  460. onChange: (selectedRowKeys, selectedRows) => {
  461. this.setState({
  462. selectedRows: selectedRows.slice(-1),
  463. selectedRowKeys: selectedRowKeys.slice(-1)
  464. });
  465. }
  466. };
  467. const hasSelected = this.state.selectedRowKeys.length > 0;
  468. const { RangePicker } = DatePicker;
  469. return (
  470. <div className="user-content" >
  471. <div className="content-title">
  472. <span>科技需求审核管理</span>
  473. <div className="patent-addNew clearfix">
  474. <Upload
  475. action={globalConfig.context + "/api/admin/demand/uploadTemplate"}
  476. data={{ 'sign': 'demand_template' }}
  477. beforeUpload={beforeUploadFile}
  478. showUploadList={false}
  479. onChange={(info) => {
  480. if (info.file.status !== 'uploading') {
  481. console.log(info.file, info.fileList);
  482. }
  483. if (info.file.status === 'done') {
  484. if (!info.file.response.error.length) {
  485. message.success(`${info.file.name} 文件上传成功!`);
  486. } else {
  487. message.warning(info.file.response.error[0].message);
  488. return;
  489. };
  490. } else if (info.file.status === 'error') {
  491. message.error(`${info.file.name} 文件上传失败。`);
  492. };
  493. }} >
  494. <Button style={{"display":"none"}}>上传批量导入模板</Button>
  495. </Upload>
  496. <Button onClick={() => { window.open(globalConfig.context + '/api/admin/demand/downloadTemplate?sign=demand_template') }} style={{"display":"none"}}>下载批量导入模板</Button>
  497. <Button type="primary" className="addButton" onClick={this.addClick} style={{"display":"none"}}>新增需求<Icon type="plus" /></Button>
  498. </div>
  499. </div>
  500. <div className="user-search">
  501. <Input placeholder="需求编号"
  502. value={this.state.serialNumber}
  503. onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
  504. <Input placeholder="需求名称"
  505. value={this.state.name}
  506. onChange={(e) => { this.setState({ name: e.target.value }); }} />
  507. <Input placeholder="关键字"
  508. value={this.state.keyword}
  509. onChange={(e) => { this.setState({ keyword: e.target.value }); }} />
  510. <Radio.Group value={this.state.searchType} onChange={(e) => {
  511. this.setState({ searchType: e.target.value })
  512. }}>
  513. <Radio value={0}>认证用户</Radio>
  514. <Radio value={1}>非认证用户</Radio>
  515. </Radio.Group>
  516. <Button type="primary" onClick={this.search}>搜索</Button>
  517. <Button onClick={this.reset}>重置</Button>
  518. <Button type='primary' onClick={this.examineOK} disabled={!hasSelected} style={{"display":"none"}}>审核通过</Button>
  519. <Button type='primary' onClick={this.examineCancel} disabled={!hasSelected} style={{"display":"none"}}>审核不通过</Button>
  520. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  521. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  522. <Radio.Group value={this.state.boutique} onChange={(e) => {
  523. this.setState({ boutique: e.target.value })
  524. }}>
  525. <Radio value={1}>精品</Radio>
  526. <Radio value={0}>非精品</Radio>
  527. </Radio.Group>
  528. <Select placeholder="选择信息来源" style={{ width: 120 }}
  529. value={this.state.infoSources}
  530. onChange={(e) => { this.setState({ infoSources: e }) }}>
  531. <Select.Option value="0" >平台采集</Select.Option>
  532. <Select.Option value="1" >客户发布</Select.Option>
  533. <Select.Option value="2" >批量导入</Select.Option>
  534. <Select.Option value="3" >三方对接</Select.Option>
  535. </Select>
  536. <Select placeholder="选择需求类型"
  537. style={{ width: 120 }}
  538. value={this.state.demandType}
  539. onChange={(e) => { this.setState({ demandType: e }) }}>
  540. {this.state.demandTypeOption}
  541. </Select>
  542. <Select placeholder="选择需求状态" style={{ width: 120 }}
  543. value={this.state.status}
  544. onChange={(e) => { this.setState({ status: e }) }}>
  545. <Select.Option value="0" >进行中</Select.Option>
  546. <Select.Option value="1" >未解决</Select.Option>
  547. <Select.Option value="2" >已解决</Select.Option>
  548. </Select>
  549. <Select placeholder="选择审核状态" style={{ width: 160 }}
  550. value={this.state.auditStatus}
  551. onChange={(e) => { this.setState({ auditStatus: e }) }}>
  552. <Select.Option value="0" >未提交审核(草稿)</Select.Option>
  553. <Select.Option value="1" >提交审核</Select.Option>
  554. <Select.Option value="2" >审核中</Select.Option>
  555. <Select.Option value="3" >审核通过</Select.Option>
  556. <Select.Option value="4" >审核未通过</Select.Option>
  557. </Select>
  558. <Select placeholder="选择需求类别" style={{ width: 120 }}
  559. value={this.state.dataCategory}
  560. onChange={(e) => { this.setState({ dataCategory: e }) }}>
  561. <Select.Option value="0" >个人</Select.Option>
  562. <Select.Option value="1" >组织</Select.Option>
  563. </Select>
  564. <div style={{ marginTop: '10px' }}>
  565. <span style={{ marginLeft: '10px' }}>有效期限 : </span>
  566. <RangePicker
  567. value={[this.state.validityPeriodDate[0] ? moment(this.state.validityPeriodDate[0]) : null,
  568. this.state.validityPeriodDate[1] ? moment(this.state.validityPeriodDate[1]) : null]}
  569. onChange={(data, dataString) => { this.setState({ validityPeriodDate: dataString }); }} />
  570. <span style={{ marginLeft: '10px' }}>发布时间 : </span>
  571. <RangePicker
  572. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  573. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  574. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  575. <span style={{ marginLeft: '10px' }}>录入时间 : </span>
  576. <RangePicker
  577. value={[this.state.releaseDateS[0] ? moment(this.state.releaseDateS[0]) : null,
  578. this.state.releaseDateS[1] ? moment(this.state.releaseDateS[1]) : null]}
  579. onChange={(data, dataString) => { this.setState({ releaseDateS: dataString }); }} />
  580. </div>
  581. </div>
  582. </div>
  583. <div className="patent-table">
  584. <Spin spinning={this.state.loading}>
  585. <Table columns={this.state.columns}
  586. dataSource={this.state.dataSource}
  587. rowSelection={rowSelection}
  588. pagination={this.state.pagination}
  589. onRowClick={this.tableRowClick} />
  590. </Spin>
  591. </div>
  592. <TechDemandDesc
  593. data={this.state.RowData}
  594. detailApiUrl={this.props['data-detailApiUrl']}
  595. companyOption={this.state.companyOption}
  596. userOption={this.state.userOption}
  597. demandTypeOption={this.state.demandTypeOption}
  598. showDesc={this.state.showDesc}
  599. closeDesc={this.closeDesc} />
  600. </div >
  601. );
  602. }
  603. });
  604. export default TechDemandPublish;