DemandExamine.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. import React from 'react';
  2. import { Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal } 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 './demandDesc.jsx';
  8. import { demandTypeList } from '@/dataDic.js';
  9. import { IndustryObject, getIndustryCategory } from '@/DicIndustryList.js';
  10. import { getDemandType,getReleaseStateList } from '@/tools.js';
  11. const DemandList = 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/demand/list",
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. employerName: this.state.employerNameSearch,//客户名称
  26. name: this.state.nameSearch,
  27. demandType: this.state.demandTypeSearch ? Number(this.state.demandTypeSearch) : undefined,
  28. status: this.state.statusSearch ? Number(this.state.statusSearch) : undefined,
  29. startDate: this.state.releaseDate[0],
  30. endDate: this.state.releaseDate[1],
  31. auditStatus: this.state.auditStatusSearch
  32. },
  33. success: function (data) {
  34. let theArr = [];
  35. if (!data.data || !data.data.list) {
  36. if (data.error && data.error.length) {
  37. message.warning(data.error[0].message);
  38. };
  39. } else {
  40. for (let i = 0; i < data.data.list.length; i++) {
  41. let thisdata = data.data.list[i];
  42. theArr.push({
  43. key: i,
  44. id: thisdata.id,
  45. serialNumber: thisdata.serialNumber,
  46. status: thisdata.status,
  47. name: thisdata.name,
  48. demandType: thisdata.demandType,
  49. createDate: thisdata.createDate,
  50. auditStatus: thisdata.auditStatus,
  51. isHot: thisdata.isHot,
  52. isUrgent: thisdata.isUrgent,
  53. });
  54. };
  55. }
  56. this.state.pagination.current = data.data.pageNo;
  57. this.state.pagination.total = data.data.totalCount;
  58. this.setState({
  59. dataSource: theArr,
  60. pagination: this.state.pagination
  61. });
  62. }.bind(this),
  63. }).always(function () {
  64. this.setState({
  65. loading: false
  66. });
  67. }.bind(this));
  68. },
  69. getInitialState() {
  70. return {
  71. searchMore: true,
  72. validityPeriodDate: [],
  73. releaseDate: [],
  74. selectedRowKeys: [],
  75. selectedRows: [],
  76. loading: false,
  77. pagination: {
  78. defaultCurrent: 1,
  79. defaultPageSize: 10,
  80. showQuickJumper: true,
  81. pageSize: 10,
  82. onChange: function (page) {
  83. this.loadData(page);
  84. }.bind(this),
  85. showTotal: function (total) {
  86. return '共' + total + '条数据';
  87. }
  88. },
  89. columns: [
  90. {
  91. title: '编号',
  92. dataIndex: 'serialNumber',
  93. key: 'serialNumber',
  94. }, {
  95. title: '需求名称',
  96. dataIndex: 'name',
  97. key: 'name',
  98. }, {
  99. title: '需求类型',
  100. dataIndex: 'demandType',
  101. key: 'demandType',
  102. render: (text) => { return getDemandType(text); }
  103. },
  104. {
  105. title: '是否热门',
  106. dataIndex: 'isHot',
  107. key: 'isHot',
  108. render: text => { return text?'热门':'非热门'; }
  109. },
  110. {
  111. title: '是否加急',
  112. dataIndex: 'isUrgent',
  113. key: 'isUrgent',
  114. render: text => { return text?'加急':'未加急' }
  115. },
  116. {
  117. title: '客户名称',
  118. dataIndex: 'employerName',
  119. key: 'employerName'
  120. },
  121. {
  122. title: '发布状态',
  123. dataIndex: 'auditStatus',
  124. key: 'auditStatus',
  125. render: text => { return getReleaseStateList(text) }
  126. },
  127. {
  128. title: '审核',
  129. dataIndex: 'caozuo',
  130. key: 'caozuo',
  131. render:(text,recard) => {
  132. return <div className="btnRight">
  133. <Button type="primary" onClick={(e)=>{e.stopPropagation;this.tableRowClick(recard)}}>审核</Button>
  134. </div>
  135. }
  136. }
  137. ],
  138. dataSource: [],
  139. searchTime: [,]
  140. };
  141. },
  142. componentWillMount() {
  143. let theArr = [];
  144. demandTypeList.map(function (item) {
  145. theArr.push(
  146. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  147. )
  148. });
  149. this.state.demandTypeOption = theArr;
  150. this.loadData();
  151. },
  152. tableRowClick(record, index) {
  153. this.state.RowData = record;
  154. this.setState({
  155. showDesc: true,
  156. examineState:true
  157. });
  158. },
  159. delectRow(recard) {
  160. this.setState({
  161. loading:true
  162. })
  163. $.ajax({
  164. method: "POST",
  165. dataType: "json",
  166. crossDomain: false,
  167. url: globalConfig.context + "/api/user/demand/delete",
  168. data: {
  169. ids: recard.id
  170. }
  171. }).done(function (data) {
  172. if (!data.error.length) {
  173. message.success('删除成功!');
  174. this.setState({
  175. loading: false,
  176. });
  177. } else {
  178. message.warning(data.error[0].message);
  179. };
  180. this.loadData();
  181. }.bind(this));
  182. },
  183. closeDesc(e, s) {
  184. this.state.showDesc = e;
  185. if (s) {
  186. this.loadData();
  187. };
  188. },
  189. search() {
  190. this.loadData();
  191. },
  192. reset() {
  193. this.state.nameSearch = '';
  194. this.state.demandTypeSearch = undefined;
  195. this.state.auditStatus = undefined;
  196. this.state.statusSearch = undefined;
  197. this.state.employerNameSearch='';
  198. this.state.releaseDate = [];
  199. this.loadData();
  200. },
  201. searchSwitch() {
  202. this.setState({
  203. searchMore: !this.state.searchMore
  204. });
  205. },
  206. render() {
  207. const rowSelection = {
  208. selectedRowKeys: this.state.selectedRowKeys,
  209. onChange: (selectedRowKeys, selectedRows) => {
  210. this.setState({
  211. selectedRows: selectedRows.slice(-1),
  212. selectedRowKeys: selectedRowKeys.slice(-1)
  213. });
  214. }
  215. };
  216. const hasSelected = this.state.selectedRowKeys.length > 0;
  217. const { RangePicker } = DatePicker;
  218. this.state.dataSource=[
  219. {key:1,serialNumber:1,id:1,releaseStatus:'0'},
  220. {key:2,serialNumber:2,id:24,releaseStatus:'1'},
  221. {key:3,serialNumber:3,id:23,releaseStatus:'2'},
  222. {key:4,serialNumber:4,id:22,releaseStatus:'3'},
  223. {key:5,serialNumber:5,id:21,releaseStatus:'4'},
  224. ]
  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.demandTypeSearch}
  237. onChange={(e) => { this.setState({ demandTypeSearch: e }) }}>
  238. {this.state.demandTypeOption}
  239. </Select>
  240. <Select placeholder="发布状态" style={{ width: 120 }}
  241. value={this.state.auditStatus}
  242. onChange={(e) => { this.setState({ auditStatus: e }) }}>
  243. <Select.Option value="0" >草稿</Select.Option>
  244. <Select.Option value="1" >发布审核</Select.Option>
  245. <Select.Option value="2" >已发布</Select.Option>
  246. <Select.Option value="3" >发布失败</Select.Option>
  247. <Select.Option value="4" >已撤销</Select.Option>
  248. </Select>
  249. <Select placeholder="需求状态" style={{ width: 160 }}
  250. value={this.state.statusSearch}
  251. onChange={(e) => { this.setState({ statusSearch: e }) }}>
  252. <Select.Option value="0" >进行中</Select.Option>
  253. <Select.Option value="1" >未解决</Select.Option>
  254. <Select.Option value="2" >已解决</Select.Option>
  255. </Select>
  256. <Button type="primary" onClick={this.search}>搜索</Button>
  257. <Button onClick={this.reset}>重置</Button>
  258. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  259. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  260. <Input style={{width:140,marginRight:10}} value={this.state.employerNameSearch} onChange={(e)=>{this.setState({employerNameSearch:e.target.value})}} placeholder="客户名称"/>
  261. <span>发布时间 :</span>
  262. <RangePicker
  263. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  264. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  265. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  266. </div>
  267. </div>
  268. <div className="patent-table">
  269. <Spin spinning={this.state.loading}>
  270. <Table columns={this.state.columns}
  271. dataSource={this.state.dataSource}
  272. rowSelection={rowSelection}
  273. pagination={this.state.pagination}
  274. />
  275. </Spin>
  276. </div>
  277. <TechDemandDesc
  278. data={this.state.RowData}
  279. demandTypeOption={this.state.demandTypeOption}
  280. examineState={this.state.examineState}
  281. showDesc={this.state.showDesc}
  282. closeDesc={this.closeDesc} />
  283. </div >
  284. );
  285. }
  286. });
  287. export default DemandList;