releaseDemand.jsx 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
  1. import React from 'react';
  2. import ReactDom from 'react-dom';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import './content.less';
  6. import {
  7. Form,
  8. Radio,
  9. Icon,
  10. Button,
  11. Input,
  12. Select,
  13. Spin,
  14. Table,
  15. Switch,
  16. message,
  17. DatePicker,
  18. Modal,
  19. Upload,
  20. Popconfirm,
  21. AutoComplete,
  22. Tabs
  23. } from 'antd';
  24. import {patternOrganization,conditionOrganization,client,stick} from '../../dataDic.js';
  25. import {getPattern,getAchievementCategory,getboutique,getClient,getStick} from '../../tools.js';
  26. import {ChooseList} from "../order/orderNew/chooseList";
  27. const TabPane = Tabs.TabPane;
  28. const Organization=Form.create()(React.createClass({
  29. loadData(pageNo) {
  30. this.state.data = [];
  31. this.setState({
  32. loading: true,
  33. ispage:pageNo,
  34. });
  35. let nameText=this.state.SuperArr;
  36. let superText=(this.state.superId)?nameText[parseInt(this.state.superId)].id:undefined;
  37. let nameTexts=this.state.SuperArrs;
  38. let superTexts=(this.state.publishPage)?nameTexts[parseInt(this.state.publishPage)].id:undefined;
  39. $.ajax({
  40. method: "get",
  41. dataType: "json",
  42. crossDomain: false,
  43. url: globalConfig.context + '/api/admin/demand/listPublish',
  44. data: {
  45. pageNo: pageNo || 1,
  46. pageSize: this.state.pagination.pageSize,
  47. name: this.state.name, //需求名称
  48. employerName: this.state.employerName, //需求雇主名称
  49. publishPlatform:superText,//发布子平台
  50. publishClient:this.state.publishClient,//发布客户端
  51. publishPage:superTexts,//发布页面
  52. ifTop:this.state.ifTop,//是否置顶
  53. },
  54. success: function (data) {
  55. let theArr = [];
  56. if (!data.data || !data.data.list) {
  57. if (data.error && data.error.length) {
  58. message.warning(data.error[0].message);
  59. };
  60. } else {
  61. for (let i = 0; i < data.data.list.length; i++) {
  62. let thisdata = data.data.list[i];
  63. theArr.push({
  64. key: i,
  65. id: thisdata.id,//发布需求ID
  66. achievementId:thisdata.demandId,//成果ID
  67. publishPlatform:thisdata.publishPlatform,//发布子平台ID
  68. platformName:thisdata.platformName,//发布子平台ID
  69. publishClient:thisdata.publishClient.toString(),//发布客户端
  70. publishPage:thisdata.publishPage,//发布页面
  71. publishPageName:thisdata.publishPageName,//发布页面
  72. ifTop:thisdata.ifTop.toString(),//是否置顶
  73. topNumber:thisdata.topNumber,//置顶编号
  74. showNumber:thisdata.showNumber,//显示编号
  75. publisher:thisdata.publisher,//发布人ID
  76. publishTime:thisdata.publishTime,//发布时间
  77. serialNumber:thisdata.serialNumber,//成果编号
  78. name:thisdata.name,//成果名称
  79. userName:thisdata.userName,//成果所有人
  80. publisherName:thisdata.publisherName,//发布人名称
  81. publishTimeFormattedDate:thisdata.publishTimeFormattedDate,//发布时间
  82. });
  83. };
  84. this.state.pagination.current = data.data.pageNo;
  85. this.state.pagination.total = data.data.totalCount;
  86. };
  87. this.setState({
  88. dataSource: theArr,
  89. pagination: this.state.pagination
  90. });
  91. }.bind(this),
  92. }).always(function () {
  93. this.setState({
  94. loading: false
  95. });
  96. }.bind(this));
  97. },
  98. loadDatas(pageNo, apiUrl) {
  99. this.state.data = [];
  100. if(this.state.serialNumber&&isNaN(this.state.serialNumber)){
  101. message.warning('请输入正确的编号格式');
  102. return false;
  103. }
  104. this.setState({
  105. loading: true,
  106. ispage:pageNo,
  107. });
  108. $.ajax({
  109. method: "get",
  110. dataType: "json",
  111. crossDomain: false,
  112. url: globalConfig.context + '/api/admin/demand/orgList',
  113. data: {
  114. pageNo: pageNo || 1,
  115. pageSize: this.state.pagination.pageSize,
  116. serialNumber: this.state.serialNumber, //编号
  117. name: this.state.name,
  118. auditStatus:3,//名称
  119. keyword: this.state.keyword, // 关键词
  120. category: this.state.category, //类型(0--专利, 2--软著, 3--项目, 4--版权, 5--工业设计, 6--配方, 7--非标)
  121. releaseDateStartDate: this.state.releaseDate[0],
  122. releaseDateEndDate: this.state.releaseDate[1],
  123. releaseStatus: this.state.releaseStatus ? Number(this.state.releaseStatus) : undefined, //是否发布(0--未发布,1--已发布)
  124. boutique:this.state.boutique,
  125. hot:this.state.hot,
  126. createDateStartDate: this.state.releaseDateS[0],
  127. createDateEndDate: this.state.releaseDateS[1],
  128. ownerType:this.state.ownerType,
  129. },
  130. success: function (data) {
  131. let theArr = [];
  132. if (!data.data || !data.data.list) {
  133. if (data.error && data.error.length) {
  134. message.warning(data.error[0].message);
  135. };
  136. } else {
  137. for (let i = 0; i < data.data.list.length; i++) {
  138. let thisdata = data.data.list[i];
  139. theArr.push({
  140. key: thisdata.id,
  141. id: thisdata.id,
  142. serialNumber: thisdata.serialNumber,
  143. dataCategory: thisdata.dataCategory,
  144. name: thisdata.name,
  145. keyword: thisdata.keyword,
  146. theName: thisdata.username || thisdata.ownerName,
  147. category: thisdata.category,
  148. ownerName: thisdata.username ? thisdata.username : thisdata.ownerName,
  149. ownerType: thisdata.ownerType,
  150. ownerMobile: thisdata.ownerMobile,
  151. status: thisdata.status,
  152. releaseDate: thisdata.releaseDate,
  153. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  154. auditStatus: thisdata.auditStatus,
  155. boutique: thisdata.boutique,
  156. hot: thisdata.hot,
  157. releaseStatus: thisdata.releaseStatus,
  158. techBrokerId:thisdata.techBrokerId,
  159. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  160. remark:thisdata.remark,
  161. ispage:pageNo,
  162. });
  163. };
  164. this.state.paginations.current = data.data.pageNo;
  165. this.state.paginations.total = data.data.totalCount;
  166. };
  167. this.setState({
  168. dataSourcesli: theArr,
  169. paginations: this.state.paginations
  170. });
  171. }.bind(this),
  172. }).always(function () {
  173. this.setState({
  174. loading: false,
  175. visible: true
  176. });
  177. }.bind(this));
  178. },
  179. getInitialState() {
  180. return {
  181. searchMore: true,
  182. selectedRowKeys: [],
  183. selectedRowKeysli:[],
  184. selectedRows: [],
  185. releaseDate: [],
  186. releaseDateS: [],
  187. loading: false,
  188. pagination: {
  189. defaultCurrent: 1,
  190. defaultPageSize: 10,
  191. showQuickJumper: true,
  192. pageSize: 10,
  193. onChange: function (page) {
  194. this.loadData(page);
  195. }.bind(this),
  196. showTotal: function (total) {
  197. return '共' + total + '条数据';
  198. }
  199. },
  200. paginations: {
  201. defaultCurrent: 1,
  202. defaultPageSize: 10,
  203. showQuickJumper: true,
  204. pageSize: 10,
  205. onChange: function (page) {
  206. this.loadDatas(page);
  207. }.bind(this),
  208. showTotal: function (total) {
  209. return '共' + total + '条数据';
  210. }
  211. },
  212. columns: [
  213. {
  214. title: '需求编号',
  215. dataIndex: 'serialNumber',
  216. key: 'serialNumber',
  217. }, {
  218. title: '需求名称',
  219. dataIndex: 'name',
  220. key: 'name',
  221. }, {
  222. title: '客户名称',
  223. dataIndex: 'userName',
  224. key: 'userName',
  225. }, {
  226. title: '发布子平台',
  227. dataIndex: 'platformName',
  228. key: 'platformName',
  229. },{
  230. title: '发布客户端',
  231. dataIndex: 'publishClient',
  232. key: 'publishClient',
  233. render: text => { return getClient(text) }
  234. }, {
  235. title: '发布页面',
  236. dataIndex: 'publishPageName',
  237. key: 'publishPageName',
  238. },{
  239. title: '是否置顶',
  240. dataIndex: 'ifTop',
  241. key: 'ifTop',
  242. render: text => { return getStick(text) }
  243. }, {
  244. title: '展示序号',
  245. dataIndex: 'showNumber',
  246. key: 'showNumber',
  247. }, {
  248. title: '置顶序号',
  249. dataIndex: 'topNumber',
  250. key: 'topNumber',
  251. }, {
  252. title: '发布人',
  253. dataIndex: 'publisherName',
  254. key: 'publisherName',
  255. }, {
  256. title: '发布时间',
  257. dataIndex: 'publishTimeFormattedDate',
  258. key: 'publishTimeFormattedDate',
  259. }, {
  260. title: '操作',
  261. dataIndex: 'ee',
  262. key: 'ee',
  263. render: (text, record, index) => {
  264. return <div>
  265. <Popconfirm title={'请确认撤销发布成果【'+record.name+'】'} onConfirm={(e)=>{this.examine(record)}} okText="确认" cancelText="取消">
  266. <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">撤销发布</Button>
  267. </Popconfirm>
  268. </div>
  269. }
  270. }
  271. ],
  272. dataSource: [],
  273. searchTime: [,],
  274. column: [
  275. {
  276. title: '编号',
  277. dataIndex: 'serialNumber',
  278. key: 'serialNumber',
  279. }, {
  280. title: '名称',
  281. dataIndex: 'name',
  282. key: 'name',
  283. }, {
  284. title: '关键字',
  285. dataIndex: 'keyword',
  286. key: 'keyword',
  287. }, {
  288. title: '类型',
  289. dataIndex: 'category',
  290. key: 'category',
  291. render: text => { return getAchievementCategory(text); }
  292. }, {
  293. title: '录入人',
  294. dataIndex: 'techBrokerId',
  295. key: 'techBrokerId',
  296. },
  297. {
  298. title: '是否精品',
  299. dataIndex: 'boutique',
  300. key: 'boutique',
  301. render: text => { return getboutique(text) }
  302. },
  303. {
  304. title: '发布时间',
  305. dataIndex: 'releaseDateFormattedDate',
  306. key: 'releaseDateFormattedDate',
  307. },{
  308. title: '录入时间',
  309. dataIndex: 'createTimeFormattedDate',
  310. key: 'createTimeFormattedDate',
  311. }
  312. ],
  313. dataSourcesli: [],
  314. searchTime: [,]
  315. };
  316. },
  317. componentWillMount() {
  318. this.selectSuperIds();
  319. },
  320. examine(record) {
  321. this.setState({
  322. selectedRowKeys: [],
  323. });
  324. $.ajax({
  325. method: "get",
  326. dataType: "json",
  327. crossDomain: false,
  328. url: globalConfig.context + '/api/admin/demand/deletePublish',
  329. data: {
  330. id:record.id,
  331. }
  332. }).done(function (data) {
  333. if (!data.error.length) {
  334. message.success('操作成功');
  335. this.setState({
  336. loading: false,
  337. });
  338. } else {
  339. message.warning(data.error[0].message);
  340. };
  341. this.loadData(this.state.ispage);
  342. }.bind(this));
  343. },
  344. //获取发布子平台
  345. selectSuperId() {
  346. this.state.data = []
  347. $.ajax({
  348. method: "get",
  349. dataType: "json",
  350. crossDomain: false,
  351. url: globalConfig.context + "/api/admin/achievement/getBranchInformation",
  352. data:{
  353. },
  354. success: function (data) {
  355. let theArr = [];
  356. let thedata=data.data;
  357. if (!thedata) {
  358. if (data.error && data.error.length) {
  359. message.warning(data.error[0].message);
  360. };
  361. thedata = {};
  362. };
  363. var contactIds=[];
  364. for(var i=0;i<data.data.length;i++){
  365. let theData = data.data[i];
  366. theArr.push(
  367. <Select.Option value={i.toString()} key={theData.platformName}>{theData.platformName}</Select.Option>
  368. );
  369. };
  370. this.setState({
  371. SuperArr:thedata,
  372. contactsOption: theArr,
  373. orderStatusOptions:data.data,
  374. });
  375. }.bind(this),
  376. }).always(function () {
  377. this.loadData();
  378. this.setState({
  379. loading: false
  380. });
  381. }.bind(this));
  382. },
  383. //获取发布页面
  384. selectSuperIds() {
  385. this.state.data = []
  386. $.ajax({
  387. method: "get",
  388. dataType: "json",
  389. crossDomain: false,
  390. url: globalConfig.context + "/api/admin/demand/getPublishPage",
  391. data:{
  392. },
  393. success: function (data) {
  394. let theArr = [];
  395. let thedata=data.data;
  396. if (!thedata) {
  397. if (data.error && data.error.length) {
  398. message.warning(data.error[0].message);
  399. };
  400. thedata = {};
  401. };
  402. var contactIds=[];
  403. for(var i=0;i<data.data.length;i++){
  404. let theData = data.data[i];
  405. theArr.push(
  406. <Select.Option value={i.toString()} key={theData.name}>{theData.name}</Select.Option>
  407. );
  408. };
  409. this.setState({
  410. SuperArrs:thedata,
  411. contactsOptions: theArr,
  412. orderStatusOptions:data.data,
  413. });
  414. }.bind(this),
  415. }).always(function () {
  416. this.selectSuperId();
  417. this.setState({
  418. loading: false
  419. });
  420. }.bind(this));
  421. },
  422. //编辑部门,保存
  423. edithandleSubmit(e){
  424. e.preventDefault();
  425. if(!this.state.editifTop){
  426. message.warning('请确认是否置顶');
  427. return false;
  428. }
  429. let topNumbers=(this.state.edittopNumber==9999999)?undefined:this.state.edittopNumber;
  430. topNumbers=topNumbers?topNumbers:undefined;
  431. if(this.state.editifTop==0){
  432. if(!topNumbers){
  433. message.warning('请输入置顶序号');
  434. return false;
  435. }
  436. let b=this.state.edittopNumber.toString().split('');
  437. for(var i=0;i<b.length;i++){
  438. if(parseInt(b[i]).toString()=='NaN'){
  439. message.warning('置顶序号请输入数字');
  440. return false;
  441. };
  442. }
  443. }else{
  444. if(topNumbers){
  445. message.warning('请清空置顶序号');
  446. return false;
  447. }
  448. if(!this.state.editshowNumber){
  449. message.warning('请输入展示序号');
  450. return false;
  451. }
  452. let b=this.state.editshowNumber.toString().split('');
  453. for(var i=0;i<b.length;i++){
  454. if(parseInt(b[i]).toString()=='NaN'){
  455. message.warning('展示序号请输入数字');
  456. return false;
  457. };
  458. }
  459. }
  460. //上级组织字典
  461. let nameText=this.state.SuperArr;
  462. let nameTexts=this.state.SuperArrs;
  463. let superText=(parseInt(this.state.editpublishPlatform).toString()=='NaN')?undefined:nameText[parseInt(this.state.editpublishPlatform)].id;
  464. let superTexts=(parseInt(this.state.editpublishPage).toString()=='NaN')?undefined:nameTexts[parseInt(this.state.editpublishPage)].id;
  465. $.ajax({
  466. method: "get",
  467. dataType: "json",
  468. crossDomain: false,
  469. url:globalConfig.context + '/api/admin/demand/updatePublish',
  470. data:{
  471. id:this.state.editid,//成果发布ID
  472. demandId:this.state.editachievementId, //成果ID
  473. publishPlatform:superText,//发布平台
  474. publishClient:this.state.editpublishClient,//发布客户端
  475. publishPage:superTexts,//发布页面
  476. ifTop:this.state.editifTop,//是否置顶
  477. topNumber:topNumbers,//置顶序号
  478. showNumber:this.state.editshowNumber,//展示序号
  479. }
  480. }).done(function (data) {
  481. this.setState({
  482. loading: false
  483. });
  484. if (!data.error.length) {
  485. message.success('保存成功!');
  486. this.edithandleCancel();
  487. this.selectSuperId();
  488. } else {
  489. message.warning(data.error[0].message);
  490. }
  491. }.bind(this));
  492. },
  493. //整行点击
  494. tableRowClick(record, index) {
  495. this.selectSuperIds();
  496. this.state.RowData = record;
  497. this.setState({
  498. editvisible: true,
  499. selectedRowKeys:[],
  500. editid:record.id,
  501. editachievementId:record.achievementId,
  502. editpublishPlatform:record.platformName,
  503. editpublishClient:record.publishClient,
  504. editpublishPage:record.publishPageName,
  505. editifTop:record.ifTop,
  506. edittopNumber:record.topNumber,
  507. editshowNumber:record.showNumber,
  508. editserialNumber:record.serialNumber,
  509. editname:record.name,
  510. edituserName:record.userName,
  511. })
  512. },
  513. //新增一个部门,保存
  514. addhandleSubmit(e){
  515. e.preventDefault();
  516. if(!this.state.publishPlatform){
  517. message.warning('请选择发布子平台');
  518. return false;
  519. }
  520. if(!this.state.publishClient){
  521. message.warning('请选择发布客户端');
  522. return false;
  523. }
  524. if(!this.state.publishPage){
  525. message.warning('请选择发布页面');
  526. return false;
  527. }
  528. if(!this.state.ifTop){
  529. message.warning('请确认是否置顶');
  530. return false;
  531. }
  532. if(this.state.ifTop==0){
  533. if(!this.state.topNumber){
  534. message.warning('请输入置顶序号');
  535. return false;
  536. }
  537. let b=this.state.topNumber.split('');
  538. for(var i=0;i<b.length;i++){
  539. if(parseInt(b[i]).toString()=='NaN'){
  540. message.warning('置顶序号请输入数字');
  541. return false;
  542. };
  543. }
  544. }else{
  545. if(this.state.topNumber){
  546. message.warning('请清空置顶序号');
  547. return false;
  548. }
  549. if(!this.state.showNumber){
  550. message.warning('请输入展示序号');
  551. return false;
  552. }
  553. let b=this.state.showNumber.split('');
  554. for(var i=0;i<b.length;i++){
  555. if(parseInt(b[i]).toString()=='NaN'){
  556. message.warning('展示序号请输入数字');
  557. return false;
  558. };
  559. }
  560. }
  561. this.props.form.validateFields((err, values) => {
  562. if (!err) {
  563. this.setState({
  564. loading: true
  565. });
  566. //上级组织字典
  567. let nameText=this.state.SuperArr;
  568. let superText=nameText[parseInt(this.state.publishPlatform)].id;
  569. let nameTexts=this.state.SuperArrs;
  570. let superTexts=nameTexts[parseInt(this.state.publishPage)].id;
  571. $.ajax({
  572. method: "post",
  573. dataType: "json",
  574. crossDomain: false,
  575. url:globalConfig.context + '/api/admin/demand/addDemandPublish',
  576. data:{
  577. demandId:this.state.selectedRowKeysli?this.state.selectedRowKeysli.join(","):undefined,//成果ID
  578. publishPlatform:superText,//发布平台
  579. publishClient:this.state.publishClient,//发布客户端
  580. publishPage:superTexts, //发布页面
  581. ifTop:this.state.ifTop,//是否置顶
  582. topNumber:this.state.topNumber,//置顶序号
  583. showNumber:this.state.showNumber,//展示序号
  584. }
  585. }).done(function (data) {
  586. this.setState({
  587. loading: false
  588. });
  589. if (!data.error.length) {
  590. message.success('保存成功!');
  591. this.handleCancel();
  592. this.reset();
  593. } else {
  594. message.warning(data.error[0].message);
  595. }
  596. }.bind(this));
  597. }
  598. });
  599. },
  600. //主管初始加载(自动补全)
  601. supervisor(e){
  602. $.ajax({
  603. method: "post",
  604. dataType: "json",
  605. crossDomain: false,
  606. url: globalConfig.context + "/api/admin/organization/selectName",
  607. data:{
  608. name:e
  609. },
  610. success: function (data) {
  611. let thedata=data.data;
  612. if (!thedata) {
  613. if (data.error && data.error.length) {
  614. message.warning(data.error[0].message);
  615. };
  616. thedata = {};
  617. };
  618. this.setState({
  619. customerArr:thedata,
  620. });
  621. }.bind(this),
  622. }).always(function () {
  623. this.setState({
  624. loading: false
  625. });
  626. }.bind(this));
  627. },
  628. //上级主管输入框失去焦点是判断客户是否存在
  629. selectAuto(value,options){
  630. this.setState({
  631. managerIdOrganization:value
  632. })
  633. },
  634. //失去焦点时
  635. blurChange(e){
  636. // let theType='';
  637. // let contactLists=this.state.customerArr||[];
  638. // if (e) {
  639. // contactLists.map(function (item) {
  640. // if (item.name == e.toString()) {
  641. // theType = item.id;
  642. // }
  643. // });
  644. // }
  645. this.setState({
  646. theTypes:e
  647. })
  648. },
  649. //值改变时请求客户名称
  650. httpChange(e){
  651. if(e.length>=2){
  652. this.supervisor(e);
  653. }
  654. this.setState({
  655. managerIdOrganization:e
  656. })
  657. },
  658. addClick() {
  659. this.state.name = undefined;//成果名称清零
  660. this.state.publishPlatform = undefined;//发布子平台清零
  661. this.state.publishClient = undefined;//发布客户端清零
  662. this.state.publishPage = undefined;//发布页面清零
  663. this.state.ifTop = undefined;//是否置顶清零
  664. this.state.topNumber = undefined;//置顶序号清零
  665. this.state.showNumber = undefined;//展示序号清零
  666. this.state.selectedRowKeysli=undefined;//选定的成果ID清零
  667. this.state.RowData = {};
  668. this.selectSuperId();
  669. this.loadDatas();
  670. },
  671. editClick() {
  672. this.state.RowData = {};
  673. this.setState({
  674. editvisible: true
  675. });
  676. },
  677. handleCancel() {
  678. this.setState({ visible: false })
  679. },
  680. edithandleCancel() {
  681. this.setState({ editvisible: false })
  682. },
  683. search() {
  684. this.loadData();
  685. },
  686. searchs() {
  687. this.loadDatas();
  688. },
  689. //把搜索的部分置零
  690. reset() {
  691. this.state.name = undefined;//成果名称清零
  692. this.state.superId = undefined;//发布子平台清零
  693. this.state.employerName= undefined;//需求雇主清零
  694. this.state.publishClient = undefined;//发布客户端清零
  695. this.state.publishPage = undefined;//发布页面清零
  696. this.state.ifTop = undefined;//是否置顶清零
  697. this.selectSuperId();
  698. },
  699. resets() {
  700. this.state.serialNumber = undefined;
  701. this.state.name = undefined;
  702. this.state.keyword = undefined;
  703. this.state.infoSources = undefined;
  704. this.state.demandType = undefined;
  705. this.state.searchName = undefined;
  706. this.state.searchType = 0;
  707. this.state.boutique = '';
  708. this.state.hot='' ;
  709. this.state.status = undefined;
  710. this.state.releaseStatus = undefined;
  711. this.state.auditStatus = undefined;
  712. this.state.dataCategory = undefined;
  713. this.state.validityPeriodDate = [];
  714. this.state.releaseDate = [];
  715. this.state.releaseDateS = [];
  716. this.loadDatas();
  717. },
  718. searchSwitch() {
  719. this.setState({
  720. searchMore: !this.state.searchMore
  721. });
  722. },
  723. changeList(arr) {
  724. const newArr = [];
  725. this.state.columns.forEach(item => {
  726. arr.forEach(val => {
  727. if (val === item.title) {
  728. newArr.push(item);
  729. }
  730. });
  731. });
  732. this.setState({
  733. changeList: newArr
  734. });
  735. },
  736. render() {
  737. const FormItem = Form.Item
  738. const rowSelection = {
  739. selectedRowKeys: this.state.selectedRowKeys,
  740. onChange: (selectedRowKeys, selectedRows) => {
  741. this.setState({
  742. selectedRows: selectedRows.slice(-1),
  743. selectedRowKeys: selectedRowKeys.slice(-1)
  744. });
  745. },
  746. onSelect: (recordt, selected, selectedRows) => {
  747. this.setState({
  748. recordt:recordt.id
  749. })
  750. },
  751. };
  752. const rowSelections = {
  753. selectedRowKeysli: this.state.selectedRowKeysli,
  754. onChange: (selectedRowKeysli, selectedRows) => {
  755. this.setState({
  756. selectedRows: selectedRows,
  757. selectedRowKeysli: selectedRowKeysli
  758. });
  759. },
  760. onSelect: (recordt, selected, selectedRows) => {
  761. this.setState({
  762. recordt:recordt.id
  763. })
  764. },
  765. };
  766. const formItemLayout = {
  767. labelCol: { span: 8 },
  768. wrapperCol: { span: 14 },
  769. };
  770. const { getFieldDecorator } = this.props.form;
  771. const hasSelected = this.state.selectedRowKeys.length > 0;
  772. const { RangePicker } = DatePicker;
  773. const dataSources=this.state.customerArr || [];
  774. const options = dataSources.map((group,index) =>
  775. <Option key={index} value={group.name}>{group.name}</Option>
  776. )
  777. return (
  778. <div className="user-content" >
  779. <div className="content-title">
  780. <Tabs defaultActiveKey="1" className="test">
  781. <TabPane tab="搜索" key="1">
  782. <div className="user-search">
  783. <Input placeholder="需求名称" style={{width:'150px',marginRight:'10px',marginBottom:'10px'}}
  784. value={this.state.name}
  785. onChange={(e) => { this.setState({ name: e.target.value }); }} />
  786. <Input placeholder="需求雇主名称"
  787. value={this.state.employerName}
  788. onChange={(e) => { this.setState({ employerName: e.target.value }); }} />
  789. <Select placeholder="发布子平台"
  790. style={{ width:'200px',marginRight:'10px' }}
  791. value={this.state.superId}
  792. onChange={(e) => { this.setState({ superId: e }) }} notFoundContent="未获取到上级组织列表">
  793. {this.state.contactsOption}
  794. </Select>
  795. <Select placeholder="发布客户端"
  796. style={{width:'150px',marginRight:'20px'}}
  797. value={this.state.publishClient}
  798. onChange={(e) => { this.setState({ publishClient: e }) }}>
  799. <Select.Option value="0" >网站</Select.Option>
  800. <Select.Option value="1" >APP</Select.Option>
  801. </Select>
  802. <Button type="primary" onClick={this.search} style={{marginRight:'10px'}}>搜索</Button>
  803. <Button onClick={this.reset} style={{marginRight:'10px'}}>重置</Button>
  804. <span style={{marginRight:'20px'}}>更多搜索 <Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  805. <div style={this.state.searchMore ? { display: 'none' } : {display: 'inline-block'}}>
  806. <Select placeholder="发布页面"
  807. style={{ width:'200px',marginRight:'10px' }}
  808. value={this.state.publishPage}
  809. onChange={(e) => { this.setState({ publishPage: e }) }} notFoundContent="未获取到发布页面">
  810. {this.state.contactsOptions}
  811. </Select>
  812. <Select placeholder="是否置顶"
  813. style={{width:'150px',marginRight:'50px'}}
  814. value={this.state.ifTop}
  815. onChange={(e) => { this.setState({ ifTop: e }) }}>
  816. <Select.Option value="0" >置顶</Select.Option>
  817. <Select.Option value="1" >不置顶</Select.Option>
  818. </Select>
  819. </div>
  820. <Button type="primary" className="addButton" onClick={this.addClick} style={{marginBottom:'10px'}}>发布需求<Icon type="plus" /></Button>
  821. </div>
  822. </TabPane>
  823. <TabPane tab="更改表格显示数据" key="2">
  824. <div style={{ marginLeft: 10 }}>
  825. <ChooseList
  826. columns={this.state.columns}
  827. changeFn={this.changeList}
  828. changeList={this.state.changeList}
  829. top={55}
  830. margin={11}
  831. />
  832. </div>
  833. </TabPane>
  834. </Tabs>
  835. <div className="patent-table">
  836. <Spin spinning={this.state.loading}>
  837. <Table columns={
  838. this.state.changeList
  839. ? this.state.changeList
  840. : this.state.columns
  841. }
  842. dataSource={this.state.dataSource}
  843. rowSelection={rowSelection}
  844. pagination={this.state.pagination}
  845. style={{
  846. cursor: 'pointer',
  847. }}
  848. onRowClick={this.tableRowClick} />
  849. </Spin>
  850. </div>
  851. <div className="patent-desc">
  852. <Modal maskClosable={false} visible={this.state.visible}
  853. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  854. width='1200px'
  855. title='发布需求'
  856. footer=''
  857. className="admin-desc-content">
  858. <Form horizontal onSubmit={this.addhandleSubmit} id="add-form">
  859. <Spin spinning={this.state.loading}>
  860. <div className="clearfix">
  861. <FormItem className="half-item"
  862. labelCol={{ span: 7 }}
  863. wrapperCol={{ span: 12 }}
  864. label="发布子平台"
  865. >
  866. <Select placeholder="请选择子平台" value={this.state.publishPlatform} onChange={(e)=>{this.setState({publishPlatform:e})}}
  867. notFoundContent="未获取到子平台">
  868. {this.state.contactsOption}
  869. </Select>
  870. </FormItem>
  871. <FormItem className="half-item"
  872. labelCol={{ span: 7 }}
  873. wrapperCol={{ span: 12 }}
  874. label="发布客户端"
  875. >
  876. <Select placeholder="选择客户端" value={this.state.publishClient}
  877. onChange={(e)=>{this.setState({publishClient:e})}}>
  878. {
  879. client.map(function (item) {
  880. return <Select.Option key={item.value} >{item.key}</Select.Option>
  881. })
  882. }
  883. </Select>
  884. </FormItem>
  885. </div>
  886. <div className="clearfix">
  887. <FormItem className="half-item"
  888. labelCol={{ span: 7 }}
  889. wrapperCol={{ span: 12 }}
  890. label="发布页面位置"
  891. >
  892. <Select placeholder="请选择页面位置" value={this.state.publishPage} onChange={(e)=>{this.setState({publishPage:e})}}
  893. notFoundContent="未获取到页面位置">
  894. {this.state.contactsOptions}
  895. </Select>
  896. </FormItem>
  897. <FormItem className="half-item"
  898. labelCol={{ span: 7 }}
  899. wrapperCol={{ span: 12 }}
  900. label="是否置顶"
  901. >
  902. <Select placeholder="选择是否置顶" value={this.state.ifTop}
  903. onChange={(e)=>{this.setState({ifTop:e})}}>
  904. {
  905. stick.map(function (item) {
  906. return <Select.Option key={item.value} >{item.key}</Select.Option>
  907. })
  908. }
  909. </Select>
  910. </FormItem>
  911. </div>
  912. <div className="clearfix">
  913. <FormItem className="half-item"
  914. labelCol={{ span: 7 }}
  915. wrapperCol={{ span: 12 }}
  916. label="置顶序号" >
  917. <Input placeholder="请输入置顶序号" value={this.state.topNumber}
  918. onChange={(e)=>{this.setState({topNumber:e.target.value})}}/>
  919. </FormItem>
  920. <FormItem className="half-item"
  921. labelCol={{ span: 7 }}
  922. wrapperCol={{ span: 12}}
  923. label="展示序号" >
  924. <Input placeholder="请输入展示序号" value={this.state.showNumber}
  925. onChange={(e)=>{this.setState({showNumber:e.target.value})}}/>
  926. </FormItem>
  927. </div>
  928. <div className="user-search">
  929. <Input placeholder="需求编号" style={{"width":"150px","display":"inlineBlock","marginRight":"10px",'marginBottom':"5px"}}
  930. value={this.state.serialNumber}
  931. onChange={(e) => { this.setState({ serialNumber: e.target.value }); }} />
  932. <Input placeholder="需求名称" style={{"width":"150px","display":"inlineBlock","marginRight":"10px",'marginBottom':"5px"}}
  933. value={this.state.name}
  934. onChange={(e) => { this.setState({ name: e.target.value }); }} />
  935. <Input placeholder="关键字" style={{"width":"150px","display":"inlineBlock","marginRight":"10px",'marginBottom':"5px"}}
  936. value={this.state.keyword}
  937. onChange={(e) => { this.setState({ keyword: e.target.value }); }} />
  938. <span style={{"marginRight":"5px"}}>是否精品 :</span>
  939. <Radio.Group value={this.state.boutique} onChange={(e) => {
  940. this.setState({ boutique: e.target.value })
  941. }}>
  942. <Radio value={1}>精品</Radio>
  943. <Radio value={0}>非精品</Radio>
  944. </Radio.Group>
  945. <span style={{ marginLeft: '5px' }}>发布时间 : </span>
  946. <RangePicker style={{"marginRight":"150px"}}
  947. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  948. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  949. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  950. <span style={{ marginLeft: '10px' }}>录入时间 : </span>
  951. <RangePicker style={{"display":"inlineBlock",'marginRight':'10px'}}
  952. value={[this.state.releaseDateS[0] ? moment(this.state.releaseDateS[0]) : null,
  953. this.state.releaseDateS[1] ? moment(this.state.releaseDateS[1]) : null]}
  954. onChange={(data, dataString) => { this.setState({ releaseDateS: dataString }); }} />
  955. <Button type="primary" onClick={this.searchs} style={{"display":"inlineBlock",'marginRight':'10px'}}>搜索</Button>
  956. <Button onClick={this.resets} style={{"display":"inlineBlock",'marginRight':'10px'}}>重置</Button>
  957. </div>
  958. <div className="patent-table">
  959. <Spin spinning={this.state.loading}>
  960. <Table columns={this.state.column}
  961. dataSource={this.state.dataSourcesli}
  962. rowSelection={rowSelections}
  963. pagination={this.state.paginations}
  964. />
  965. </Spin>
  966. </div>
  967. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  968. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  969. <Button className="set-submit" type="ghost" onClick={this.handleCancel} style={{marginLeft:'100px'}}>取消</Button>
  970. </FormItem>
  971. </Spin>
  972. </Form >
  973. </Modal>
  974. </div>
  975. <div className="patent-desc">
  976. <Modal maskClosable={false} visible={this.state.editvisible}
  977. onOk={this.checkPatentProcess} onCancel={this.edithandleCancel}
  978. width='1200px'
  979. title='编辑发布'
  980. footer=''
  981. className="admin-desc-content">
  982. <Form horizontal onSubmit={this.edithandleSubmit} id="edit-form">
  983. <Spin spinning={this.state.loading}>
  984. <div className="clearfix">
  985. <FormItem className="half-item"
  986. labelCol={{ span: 6 }}
  987. wrapperCol={{ span: 12 }}
  988. label="发布子平台"
  989. >
  990. <Select placeholder="请选择子平台" value={this.state.editpublishPlatform} onChange={(e)=>{this.setState({editpublishPlatform:e})}}
  991. notFoundContent="未获取到子平台">
  992. {this.state.contactsOption}
  993. </Select>
  994. </FormItem>
  995. <FormItem className="half-item"
  996. labelCol={{ span: 6 }}
  997. wrapperCol={{ span: 12 }}
  998. label="发布客户端"
  999. >
  1000. <Select placeholder="选择客户端" value={this.state.editpublishClient}
  1001. onChange={(e)=>{this.setState({editpublishClient:e})}}>
  1002. {
  1003. client.map(function (item) {
  1004. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1005. })
  1006. }
  1007. </Select>
  1008. </FormItem>
  1009. </div>
  1010. <div className="clearfix">
  1011. <FormItem className="half-item"
  1012. labelCol={{ span: 6 }}
  1013. wrapperCol={{ span: 12 }}
  1014. label="发布页面位置"
  1015. >
  1016. <Select placeholder="请选择页面位置" value={this.state.editpublishPage} onChange={(e)=>{this.setState({editpublishPage:e})}}
  1017. notFoundContent="未获取到页面位置">
  1018. {this.state.contactsOptions}
  1019. </Select>
  1020. </FormItem>
  1021. <FormItem className="half-item"
  1022. labelCol={{ span: 6 }}
  1023. wrapperCol={{ span: 12 }}
  1024. label="是否置顶"
  1025. >
  1026. <Select placeholder="选择是否置顶" value={this.state.editifTop}
  1027. onChange={(e)=>{this.setState({editifTop:e})}}>
  1028. {
  1029. stick.map(function (item) {
  1030. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1031. })
  1032. }
  1033. </Select>
  1034. </FormItem>
  1035. </div>
  1036. <div className="clearfix">
  1037. <FormItem className="half-item"
  1038. labelCol={{ span: 6 }}
  1039. wrapperCol={{ span: 12 }}
  1040. label="置顶序号" >
  1041. <Input placeholder="请输入置顶序号" value={this.state.edittopNumber}
  1042. onChange={(e)=>{this.setState({edittopNumber:e.target.value})}}/>
  1043. </FormItem>
  1044. <FormItem className="half-item"
  1045. labelCol={{ span: 6 }}
  1046. wrapperCol={{ span: 12}}
  1047. label="展示序号" >
  1048. <Input placeholder="请输入展示序号" value={this.state.editshowNumber}
  1049. onChange={(e)=>{this.setState({editshowNumber:e.target.value})}}/>
  1050. </FormItem>
  1051. </div>
  1052. <div className="clearfix">
  1053. <FormItem className="half-item"
  1054. labelCol={{ span: 6 }}
  1055. wrapperCol={{ span: 12 }}
  1056. label="需求编号"
  1057. >
  1058. <span>{this.state.editserialNumber}</span>
  1059. </FormItem>
  1060. <FormItem className="half-item"
  1061. labelCol={{ span: 6 }}
  1062. wrapperCol={{ span: 12 }}
  1063. label="客户名称"
  1064. >
  1065. <span>{this.state.edituserName}</span>
  1066. </FormItem>
  1067. </div>
  1068. <div className="clearfix">
  1069. <FormItem
  1070. labelCol={{ span: 3 }}
  1071. wrapperCol={{ span: 18 }}
  1072. label="需求名称"
  1073. >
  1074. <span>{this.state.editname}</span>
  1075. </FormItem>
  1076. </div>
  1077. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  1078. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1079. <Button className="set-submit" type="ghost" onClick={this.edithandleCancel} style={{marginLeft:'100px'}}>取消</Button>
  1080. </FormItem>
  1081. </Spin>
  1082. </Form >
  1083. </Modal>
  1084. </div>
  1085. </div>
  1086. </div>
  1087. );
  1088. }
  1089. }));
  1090. export default Organization;