techDemandDesc.jsx 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676
  1. import React from 'react';
  2. import { AutoComplete, Switch, Tabs, Table, Icon, Tooltip, Modal, Popover, message, Spin, Upload, Input, InputNumber, Select, DatePicker, Button, Radio, Form, Cascader, Tag } from 'antd';
  3. import moment from 'moment';
  4. import './techDemand.less';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
  8. import { getTechField } from '../../DicTechFieldList.js';
  9. import { beforeUploadFile, getTechAuditStatus, splitUrl, companySearch, getDemandType, getAchievementCategory,beforeUpload, getBase64 } from '../../tools.js';
  10. import throttle from '../../throttle.js';
  11. const KeyWordTagGroup = React.createClass({
  12. getInitialState() {
  13. return {
  14. tags: [],
  15. inputVisible: false,
  16. inputValue: ''
  17. };
  18. },
  19. handleClose(removedTag) {
  20. const tags = this.state.tags.filter(tag => tag !== removedTag);
  21. this.props.tagsArr(tags);
  22. this.setState({ tags });
  23. },
  24. showInput() {
  25. this.setState({ inputVisible: true }, () => this.input.focus());
  26. },
  27. handleInputChange(e) {
  28. this.setState({ inputValue: e.target.value });
  29. },
  30. handleInputConfirm() {
  31. const state = this.state;
  32. const inputValue = state.inputValue;
  33. let tags = state.tags;
  34. if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
  35. tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
  36. }
  37. this.props.tagsArr(tags);
  38. this.setState({
  39. tags,
  40. inputVisible: false,
  41. inputValue: '',
  42. });
  43. },
  44. componentWillMount() {
  45. this.state.tags = this.props.keyWordArr;
  46. },
  47. componentWillReceiveProps(nextProps) {
  48. if (this.props.keyWordArr != nextProps.keyWordArr) {
  49. this.state.tags = nextProps.keyWordArr;
  50. };
  51. },
  52. render() {
  53. const { tags, inputVisible, inputValue } = this.state;
  54. return (
  55. <div className="keyWord-tips">
  56. {tags.map((tag, index) => {
  57. const isLongTag = tag.length > 10;
  58. const tagElem = (
  59. <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
  60. {isLongTag ? `${tag.slice(0, 10)}...` : tag}
  61. </Tag>
  62. );
  63. return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
  64. })}
  65. {inputVisible && (
  66. <Input
  67. ref={input => this.input = input}
  68. type="text"
  69. style={{ width: 78 }}
  70. value={inputValue}
  71. onChange={this.handleInputChange}
  72. onBlur={this.handleInputConfirm}
  73. onPressEnter={this.handleInputConfirm}
  74. />
  75. )}
  76. {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
  77. </div>
  78. );
  79. }
  80. });
  81. const PicturesWall = React.createClass({
  82. getInitialState() {
  83. return {
  84. previewVisible: false,
  85. previewImage: '',
  86. fileList: [],
  87. }
  88. },
  89. handleCancel() {
  90. this.setState({ previewVisible: false })
  91. },
  92. handlePreview(file) {
  93. this.setState({
  94. previewImage: file.url || file.thumbUrl,
  95. previewVisible: true,
  96. });
  97. },
  98. handleChange(info) {
  99. let fileList = info.fileList;
  100. this.setState({ fileList });
  101. this.props.fileList(fileList);
  102. },
  103. componentWillReceiveProps(nextProps) {
  104. this.state.fileList = nextProps.pictureUrl;
  105. },
  106. render() {
  107. const { previewVisible, previewImage, fileList } = this.state;
  108. const uploadButton = (
  109. <div>
  110. <Icon type="plus" />
  111. <div className="ant-upload-text">点击上传</div>
  112. </div>
  113. );
  114. return (
  115. <div className="clearfix">
  116. <Upload
  117. action={globalConfig.context + "/api/admin/demand/uploadPicture"}
  118. data={{ 'sign': this.props.pictureSign, 'uid': this.props.uid}}
  119. listType="picture-card"
  120. fileList={fileList}
  121. onPreview={this.handlePreview}
  122. onChange={this.handleChange} >
  123. {fileList.length >= 5 ? null : uploadButton}
  124. </Upload>
  125. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  126. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  127. </Modal>
  128. </div>
  129. );
  130. }
  131. });
  132. const DemandDetailShow = Form.create()(React.createClass({
  133. getInitialState() {
  134. return {
  135. visible: false,
  136. loading: false,
  137. contactsObj: {},
  138. salesmanObj: {},
  139. data: {},
  140. tags: [],
  141. pictureUrl: [],
  142. coverImg: []
  143. };
  144. },
  145. loadData(id, detailApiUrl,dataCategory) {
  146. console.log(dataCategory);
  147. this.setState({
  148. loading: true
  149. });
  150. $.ajax({
  151. method: "get",
  152. dataType: "json",
  153. crossDomain: false,
  154. url: globalConfig.context + detailApiUrl,
  155. data: {
  156. id: id,
  157. dataCategory:dataCategory?dataCategory:this.props.data.dataCategory
  158. },
  159. success: function (data) {
  160. let thisData = data.data;
  161. if (!thisData) {
  162. if (data.error && data.error.length) {
  163. message.warning(data.error[0].message);
  164. };
  165. thisData = {};
  166. };
  167. this.setState({
  168. data: thisData,
  169. switchValue: Boolean(!thisData.employerId),
  170. radios: thisData.hot == '1' ? true : false,
  171. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  172. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  173. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : []
  174. });
  175. }.bind(this),
  176. }).always(function () {
  177. this.setState({
  178. loading: false
  179. });
  180. }.bind(this));
  181. },
  182. getContactsList(theUid) {
  183. $.ajax({
  184. method: "get",
  185. dataType: "json",
  186. crossDomain: false,
  187. url: globalConfig.context + "/api/admin/getContacts",
  188. data: {
  189. uid: theUid
  190. },
  191. success: function (data) {
  192. let theOption = [];
  193. if (!data.data) {
  194. if (data.error && data.error.length) {
  195. message.warning(data.error[0].message);
  196. };
  197. } else {
  198. this.setState({
  199. contactsObj: data.data
  200. });
  201. };
  202. }.bind(this),
  203. });
  204. },
  205. offShelf() {
  206. this.setState({
  207. loading: true
  208. });
  209. $.ajax({
  210. method: "post",
  211. dataType: "json",
  212. crossDomain: false,
  213. url: globalConfig.context + "/api/admin/demand/offShelf",
  214. data: { "id": this.props.data.id }
  215. }).done(function (data) {
  216. if (!data.error.length) {
  217. message.success('撤销成功!');
  218. this.props.handleOk();
  219. } else {
  220. message.warning(data.error[0].message);
  221. };
  222. this.setState({
  223. loading: false,
  224. releaseSubmitVisible: false
  225. });
  226. }.bind(this));
  227. },
  228. modifyBroker() {
  229. this.props.form.validateFields((err, values) => {
  230. if (!err) {
  231. this.setState({
  232. loading: true
  233. });
  234. $.ajax({
  235. method: "POST",
  236. dataType: "json",
  237. crossDomain: false,
  238. url: globalConfig.context + '/api/admin/audit/modifyDemandTechBroker',
  239. data: {
  240. id: this.props.data.id,
  241. techBrokerId: values.modifyTechBrokerId
  242. }
  243. }).done(function (data) {
  244. this.state.auditStatus = 0;
  245. this.setState({
  246. loading: false
  247. });
  248. if (data.error && data.error.length) {
  249. message.warning(data.error[0].message);
  250. } else {
  251. message.success('保存成功!');
  252. this.props.handleOk();
  253. };
  254. }.bind(this));
  255. }
  256. });
  257. },
  258. formSubmit() {
  259. this.props.form.validateFields((err, values) => {
  260. if (values.auditStatus == 3 && !values.techBrokerId) {
  261. message.warning('必须选择一个技术经纪人!');
  262. return
  263. };
  264. if (!err) {
  265. this.setState({
  266. loading: true
  267. });
  268. $.ajax({
  269. method: "POST",
  270. dataType: "json",
  271. crossDomain: false,
  272. url: globalConfig.context + '/api/admin/audit/demand',
  273. data: {
  274. id: this.props.data.id,
  275. techBroderId: values.techBrokerId,
  276. auditStatus: values.auditStatus
  277. }
  278. }).done(function (data) {
  279. this.state.auditStatus = 0;
  280. if (!data.error.length) {
  281. message.success('保存成功!');
  282. this.setState({ formSubmitVisible: false });
  283. this.props.handleOk();
  284. } else {
  285. message.warning(data.error[0].message);
  286. this.setState({
  287. loading: false,
  288. });
  289. }
  290. }.bind(this));
  291. }
  292. });
  293. },
  294. handleSubmit(e) {
  295. e.preventDefault();
  296. this.props.form.validateFields((err, values) => {
  297. if (values.auditStatus == 4) {
  298. this.setState({
  299. formSubmitVisible: true
  300. });
  301. } else {
  302. this.formSubmit();
  303. };
  304. });
  305. },
  306. buildMatchList() {
  307. this.setState({
  308. buttonLoading: true
  309. });
  310. $.ajax({
  311. method: "POST",
  312. dataType: "json",
  313. crossDomain: false,
  314. url: globalConfig.context + '/api/admin/demand/matchAchievement',
  315. data: {
  316. id: this.props.data.id,
  317. }
  318. }).done(function (data) {
  319. this.setState({
  320. buttonLoading: false
  321. });
  322. if (!data.error.length) {
  323. message.success('匹配完成!匹配到' + data.data + '条记录');
  324. } else {
  325. message.warning(data.error[0].message);
  326. };
  327. }.bind(this));
  328. },
  329. componentWillMount() {
  330. this.loadData(this.props.data.id, this.props.detailApiUrl);
  331. if (this.props.data.employerId && this.props.data.dataCategory) {
  332. this.getContactsList(this.props.data.employerId);
  333. };
  334. },
  335. componentWillReceiveProps(nextProps) {
  336. if (!this.props.visible && nextProps.visible) {
  337. this.loadData(nextProps.data.id, nextProps.detailApiUrl,nextProps.data.dataCategory);
  338. if (nextProps.data.employerId && nextProps.data.dataCategory) {
  339. this.getContactsList(nextProps.data.employerId);
  340. };
  341. this.props.form.resetFields();
  342. };
  343. },
  344. render() {
  345. const theData = this.state.data || {};
  346. const { getFieldDecorator } = this.props.form;
  347. const FormItem = Form.Item
  348. const formItemLayout = {
  349. labelCol: { span: 6 },
  350. wrapperCol: { span: 12 },
  351. };
  352. return (
  353. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  354. <Spin spinning={this.state.loading}>
  355. <div className="clearfix">
  356. <FormItem className="half-item"
  357. {...formItemLayout}
  358. label="编号" >
  359. <span>{theData.serialNumber}</span>
  360. </FormItem>
  361. <FormItem className="half-item"
  362. {...formItemLayout}
  363. label="需求名称" >
  364. <span>{theData.name}</span>
  365. </FormItem>
  366. </div>
  367. <div>
  368. <FormItem className="half-item"
  369. {...formItemLayout}
  370. label="精品需求" >
  371. {(() => {
  372. switch (theData.boutique) {
  373. case "0":
  374. return <span>否</span>;
  375. case "1":
  376. return <span>是</span>;
  377. }
  378. })()}
  379. </FormItem>
  380. <FormItem className="half-item"
  381. {...formItemLayout}
  382. label="首页展示" >
  383. {(() => {
  384. switch (theData.hot) {
  385. case "0":
  386. return <span>否</span>;
  387. case "1":
  388. return <span>是</span>;
  389. }
  390. })()}
  391. </FormItem>
  392. </div>
  393. {this.state.radios==true ? <div>
  394. <FormItem
  395. labelCol={{ span: 3 }}
  396. wrapperCol={{ span: 18 }}
  397. label="首页展示图片:" >
  398. <div className="clearfix">
  399. <Upload className="demandDetailShow-upload"
  400. listType="picture-card"
  401. fileList={this.state.coverImg}
  402. onPreview={(file) => {
  403. this.setState({
  404. previewImage: file.url || file.thumbUrl,
  405. previewVisible: true,
  406. });
  407. }} >
  408. </Upload>
  409. <Modal maskClosable={false} footer={null}
  410. visible={this.state.previewVisible}
  411. onCancel={() => { this.setState({ previewVisible: false }) }}>
  412. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  413. </Modal>
  414. </div>
  415. </FormItem>
  416. </div> :<div></div>}
  417. {this.state.switchValue ? <div>
  418. <FormItem className="half-item"
  419. {...formItemLayout}
  420. label="雇主名称" >
  421. <span>{theData.employerName}</span>
  422. </FormItem>
  423. <FormItem className="half-item"
  424. {...formItemLayout}
  425. label="联系电话" >
  426. <span>{theData.employerContactsMobile}</span>
  427. </FormItem>
  428. <FormItem className="half-item"
  429. {...formItemLayout}
  430. label="电子邮箱" >
  431. <span>{theData.employerContactsMailbox}</span>
  432. </FormItem>
  433. <FormItem className="half-item"
  434. {...formItemLayout}
  435. label="通讯地址" >
  436. <span>{theData.employerAddress}</span>
  437. </FormItem>
  438. </div> : <div className="clearfix">
  439. <FormItem className="half-item"
  440. {...formItemLayout}
  441. label="雇主名称" >
  442. <span>{theData.username}</span>
  443. </FormItem>
  444. {this.props.data.dataCategory ? <FormItem className="half-item"
  445. {...formItemLayout}
  446. label="联系人" >
  447. <span>{this.state.contactsObj[theData.contacts]}</span>
  448. </FormItem> : <FormItem className="half-item"
  449. {...formItemLayout}
  450. label="联系人" >
  451. <span>{theData.contactsName}</span>
  452. </FormItem>}
  453. </div>}
  454. <div className="clearfix">
  455. <FormItem className="half-item"
  456. {...formItemLayout}
  457. label="负责人" >
  458. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  459. </FormItem>
  460. </div>
  461. <div className="clearfix">
  462. <FormItem className="half-item"
  463. {...formItemLayout}
  464. label="是否发布" >
  465. {(() => {
  466. switch (theData.releaseStatus) {
  467. case "0":
  468. return <span>未发布</span>;
  469. case "1":
  470. return <div>
  471. <span>已发布</span>
  472. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  473. <Modal maskClosable={false} title="确认"
  474. visible={this.state.releaseSubmitVisible}
  475. width='300px'
  476. footer={null}
  477. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  478. <span>确认要撤销发布吗?</span>
  479. <Button className="modal-submit" type="primary" onClick={this.offShelf} >确认</Button>
  480. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  481. </Modal>
  482. </div>;
  483. }
  484. })()}
  485. </FormItem>
  486. <FormItem className="half-item"
  487. {...formItemLayout}
  488. label="发布时间" >
  489. <span>{theData.releaseDateFormattedDate}</span>
  490. </FormItem>
  491. </div>
  492. <FormItem className="half-item"
  493. {...formItemLayout}
  494. label="加急天数" >
  495. <span>{theData.urgentDays}</span>
  496. </FormItem>
  497. <FormItem className="half-item"
  498. {...formItemLayout}
  499. label="加急报酬" >
  500. <span>{theData.urgentMoney}</span>
  501. </FormItem>
  502. <div className="clearfix">
  503. <FormItem className="half-item"
  504. {...formItemLayout}
  505. label="需求状态" >
  506. {(() => {
  507. switch (theData.status) {
  508. case "0":
  509. return <span>未解决</span>;
  510. case "1":
  511. return <span>已解决</span>;
  512. }
  513. })()}
  514. </FormItem>
  515. <FormItem className="half-item"
  516. {...formItemLayout}
  517. label="审核状态" >
  518. {(() => {
  519. switch (theData.auditStatus) {
  520. case 0:
  521. return <span>未提交审核(草稿)</span>;
  522. case 1:
  523. return <span>提交审核</span>;
  524. case 2:
  525. return <span>审核中</span>;
  526. case 3:
  527. return <span>审核通过</span>;
  528. case 4:
  529. return <span>审核未通过</span>;
  530. }
  531. })()}
  532. </FormItem>
  533. </div>
  534. <div className="clearfix">
  535. <FormItem className="half-item"
  536. {...formItemLayout}
  537. label="信息来源" >
  538. {(() => {
  539. switch (theData.infoSources) {
  540. case "0":
  541. return <span>平台采集</span>;
  542. case "1":
  543. return <span>客户发布</span>;
  544. case "2":
  545. return <span>批量导入</span>;
  546. case "3":
  547. return <span>三方对接</span>;
  548. }
  549. })()}
  550. </FormItem>
  551. </div>
  552. <FormItem
  553. labelCol={{ span: 3 }}
  554. wrapperCol={{ span: 20 }}
  555. label="关键词" >
  556. {this.state.tags.map((tag) => {
  557. return <Tooltip key={tag} title={tag}>
  558. <Tag key={tag}>{tag}</Tag>
  559. </Tooltip>;
  560. })}
  561. </FormItem>
  562. <FormItem
  563. labelCol={{ span: 3 }}
  564. wrapperCol={{ span: 18 }}
  565. label="行业类别" >
  566. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  567. </FormItem>
  568. <div className="clearfix">
  569. <FormItem className="half-item"
  570. {...formItemLayout}
  571. label="需求类型" >
  572. <span>{getDemandType(theData.demandType)}</span>
  573. </FormItem>
  574. </div>
  575. <FormItem
  576. labelCol={{ span: 3 }}
  577. wrapperCol={{ span: 18 }}
  578. label="问题说明" >
  579. <span>{theData.problemDes}</span>
  580. </FormItem>
  581. <FormItem
  582. labelCol={{ span: 3 }}
  583. wrapperCol={{ span: 18 }}
  584. label="备注" >
  585. <span>{theData.remark}</span>
  586. </FormItem>
  587. <FormItem
  588. labelCol={{ span: 3 }}
  589. wrapperCol={{ span: 18 }}
  590. label="技术指标要求" >
  591. <span>{theData.technicalRequirements}</span>
  592. </FormItem>
  593. <FormItem
  594. labelCol={{ span: 3 }}
  595. wrapperCol={{ span: 18 }}
  596. label="需求文件(图片)" >
  597. <div className="clearfix">
  598. <Upload className="demandDetailShow-upload"
  599. listType="picture-card"
  600. fileList={this.state.pictureUrl}
  601. onPreview={(file) => {
  602. this.setState({
  603. previewImage: file.url || file.thumbUrl,
  604. previewVisible: true,
  605. });
  606. }} >
  607. </Upload>
  608. <Modal maskClosable={false} footer={null}
  609. visible={this.state.previewVisible}
  610. onCancel={() => { this.setState({ previewVisible: false }) }}>
  611. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  612. </Modal>
  613. </div>
  614. </FormItem>
  615. <FormItem
  616. labelCol={{ span: 3 }}
  617. wrapperCol={{ span: 6 }}
  618. label="需求文件(文本)" >
  619. <div>{theData.textFileUrl ?
  620. <span className="download-file">
  621. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  622. </span>
  623. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  624. </FormItem>
  625. <FormItem
  626. labelCol={{ span: 3 }}
  627. wrapperCol={{ span: 18 }}
  628. label="需求文件(视频地址)" >
  629. <span>{theData.videoUrl}</span>
  630. </FormItem>
  631. <div className="clearfix">
  632. <FormItem className="half-item"
  633. {...formItemLayout}
  634. label="固定周期" >
  635. <span>{theData.fixedCycle}</span>
  636. </FormItem>
  637. <FormItem className="half-item"
  638. {...formItemLayout}
  639. label="固定人数" >
  640. <span>{theData.peopleNumber || 0} 人</span>
  641. </FormItem>
  642. </div>
  643. <FormItem
  644. labelCol={{ span: 3 }}
  645. wrapperCol={{ span: 18 }}
  646. label="固定方案" >
  647. <span>{theData.fixedScheme}</span>
  648. </FormItem>
  649. <div className="clearfix">
  650. <FormItem className="half-item"
  651. {...formItemLayout}
  652. label="预算费用" >
  653. <span>{theData.budgetCost || 0} 万元</span>
  654. </FormItem>
  655. <FormItem className="half-item"
  656. {...formItemLayout}
  657. label="费用托管" >
  658. {(() => {
  659. switch (theData.costEscrow) {
  660. case 0:
  661. return <span>否</span>;
  662. case 1:
  663. return <span>是</span>;
  664. }
  665. })()}
  666. </FormItem>
  667. <FormItem className="half-item"
  668. {...formItemLayout}
  669. label="有效期限" >
  670. <span>{theData.validityPeriodFormattedDate}</span>
  671. </FormItem>
  672. </div>
  673. {window.showAuditStatus && theData.auditStatus == 2 ? <div className="clearfix">
  674. <FormItem className="half-item"
  675. {...formItemLayout}
  676. label="审核状态" >
  677. {getFieldDecorator('auditStatus')(
  678. <Radio.Group>
  679. <Radio value={3}>审核通过</Radio>
  680. <Radio value={4}>审核未通过</Radio>
  681. </Radio.Group>
  682. )}
  683. </FormItem>
  684. <FormItem className="half-item"
  685. {...formItemLayout}
  686. label="技术经纪人" >
  687. {getFieldDecorator('techBrokerId', {
  688. initialValue: theData.techBrokerId
  689. })(
  690. <Select style={{ width: 260 }}
  691. placeholder="请选择技术经纪人"
  692. notFoundContent="未获取到经纪人列表"
  693. showSearch
  694. filterOption={companySearch}>
  695. {this.props.techBrodersOption}
  696. </Select>
  697. )}
  698. </FormItem>
  699. </div> : <div></div>}
  700. {window.showAuditStatus && theData.auditStatus == 3 ? <div className="clearfix">
  701. <FormItem className="half-item"
  702. {...formItemLayout}
  703. label="指派新经纪人" >
  704. {getFieldDecorator('modifyTechBrokerId', {
  705. initialValue: theData.techBrokerId
  706. })(
  707. <Select style={{ width: 260 ,"display":"none"}}
  708. placeholder="请选择要指派的新经纪人"
  709. notFoundContent="未获取到经纪人列表"
  710. showSearch
  711. filterOption={companySearch}>
  712. {this.props.techBrodersOption}
  713. </Select>
  714. )}
  715. </FormItem>
  716. </div> : <div></div>}
  717. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  718. {theData.auditStatus == 2 ? <Button className="set-submit" type="primary" htmlType="submit">提交审核</Button> : <span></span>}
  719. {theData.auditStatus == 3 ? <Button className="set-submit" type="primary" onClick={() => { this.modifyBroker(); }} style={{"display":"none"}}>保存</Button> : <span></span>}
  720. {theData.auditStatus == 2 ? <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>: <span></span>}
  721. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList} style={{"display":"none"}}>生成匹配列表</Button> : <span></span>}
  722. </FormItem>
  723. <Modal maskClosable={false} title="确认"
  724. visible={this.state.formSubmitVisible}
  725. width='360px'
  726. footer={null}
  727. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  728. <span>确认该需求审核未通过?</span>
  729. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  730. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  731. </Modal>
  732. </Spin>
  733. </Form >
  734. )
  735. }
  736. }));
  737. const DemandDetailForm = Form.create()(React.createClass({
  738. getInitialState() {
  739. return {
  740. visible: false,
  741. loading: false,
  742. auditStatus: 0,
  743. switchValue: false,
  744. radios: false,
  745. textFileList: [],
  746. videoFileList: [],
  747. contactsOption: [],
  748. data: {},
  749. tags: [],
  750. pictureUrl: [],
  751. coverImg:[],
  752. dataSource: []
  753. };
  754. },
  755. getContactsList(theUid) {
  756. $.ajax({
  757. method: "get",
  758. dataType: "json",
  759. crossDomain: false,
  760. url: globalConfig.context + "/api/admin/getContacts",
  761. data: {
  762. uid: theUid
  763. },
  764. success: function (data) {
  765. let theOption = [];
  766. if (!data.data) {
  767. if (data.error && data.error.length) {
  768. message.warning(data.error[0].message);
  769. return;
  770. };
  771. };
  772. for (let item in data.data) {
  773. let theData = data.data[item];
  774. theOption.push(
  775. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  776. );
  777. };
  778. this.setState({
  779. contactsOption: theOption
  780. });
  781. }.bind(this),
  782. });
  783. },
  784. loadData(id, detailApiUrl,dataCategory) {
  785. console.log(this.props.data);
  786. this.setState({
  787. loading: true
  788. });
  789. $.ajax({
  790. method: "get",
  791. dataType: "json",
  792. crossDomain: false,
  793. url: globalConfig.context + detailApiUrl,
  794. data: {
  795. id: id,
  796. dataCategory:dataCategory?dataCategory:this.props.data.dataCategory
  797. },
  798. success: function (data) {
  799. let thisData = data.data;
  800. if (!thisData) {
  801. if (data.error && data.error.length) {
  802. message.warning(data.error[0].message);
  803. };
  804. thisData = {};
  805. };
  806. if (thisData.employerId) {
  807. this.getContactsList(thisData.employerId)
  808. };
  809. this.setState({
  810. data: thisData,
  811. dataCategory:(thisData.dataCategory>-1)?thisData.dataCategory.toString():'',
  812. switchValue: Boolean(!thisData.employerId),
  813. radios: thisData.hot == '1' ? true : false,
  814. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  815. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  816. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : []
  817. });
  818. }.bind(this),
  819. }).always(function () {
  820. this.setState({
  821. loading: false
  822. });
  823. }.bind(this));
  824. },
  825. getTagsArr(e) {
  826. this.setState({ tags: e });
  827. },
  828. getPictureUrl(e) {
  829. this.setState({ pictureUrl: e });
  830. },
  831. getcoverImg(e) {
  832. this.setState({ coverImg: e });
  833. },
  834. handleSubmit(e) {
  835. e.preventDefault();
  836. if(!this.state.dataCategory){
  837. message.warning('请选择需求类别');
  838. return false;
  839. }
  840. this.props.form.validateFields((err, values) => {
  841. //keyword长度判断
  842. if ((this.state.tags ? this.state.tags.length : this.props.tags.length) < 3) {
  843. message.warning('关键词数量不能小于3个!');
  844. return;
  845. };
  846. //url转化
  847. let thePictureUrl = [];
  848. if (this.state.pictureUrl.length) {
  849. let picArr = [];
  850. this.state.pictureUrl.map(function (item) {
  851. if ( item.response && item.response.data && item.response.data.length ){
  852. picArr.push(item.response.data);
  853. }
  854. });
  855. thePictureUrl = picArr.join(",");
  856. };
  857. let thecoverImg = [];
  858. if (this.state.coverImg.length) {
  859. let picArr = [];
  860. this.state.coverImg.map(function (item) {
  861. if ( item.response && item.response.data && item.response.data.length ){
  862. picArr.push(item.response.data);
  863. }
  864. });
  865. thecoverImg = picArr.join(",");
  866. };
  867. if (!err) {
  868. this.setState({
  869. loading: true
  870. });
  871. $.ajax({
  872. method: "POST",
  873. dataType: "json",
  874. crossDomain: false,
  875. url: this.props.data.id ? globalConfig.context + '/api/admin/demand/update' : globalConfig.context + '/api/admin/demand/apply',
  876. data: {
  877. id: this.props.data.id,
  878. dataCategory: this.state.dataCategory,//this.props.detailApiUrl.indexOf('org') >= 0 ? 1 : 0
  879. serialNumber: this.props.data.serialNumber,
  880. name: values.name,
  881. keyword: this.state.tags ? this.state.tags.join(",") : this.props.tags.join(","),
  882. keywords: this.state.tags ? this.state.tags : this.props.tags,
  883. infoSources: 0,
  884. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  885. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  886. demandType: values.demandType,
  887. problemDes: values.problemDes,
  888. remark: values.remark,
  889. technicalRequirements: values.technicalRequirements,
  890. pictureUrl: thePictureUrl,
  891. coverImg: thecoverImg,
  892. textFileUrl: this.state.textFileUrl,
  893. videoUrl: values.videoUrl,
  894. fixedBudget: values.fixedBudget,
  895. fixedCycle: values.fixedCycle,
  896. peopleNumber: values.peopleNumber,
  897. fixedScheme: values.fixedScheme,
  898. costEscrow: values.costEscrow,
  899. budgetCost: values.budgetCost,
  900. //
  901. switchSign: this.state.switchValue ? 1 : 0,
  902. //
  903. employerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.employerId] : this.props.data.employerId) : null,
  904. contacts: !this.state.switchValue ? values.contacts : null,
  905. //自定义
  906. employerName: this.state.switchValue ? values.employerName : null,
  907. urgentDays: this.state.switchValue ? values.urgentDays : null,
  908. urgentMoney: this.state.switchValue ? values.urgentMoney : null,
  909. employerAddress: this.state.switchValue ? values.employerAddress : null,
  910. employerContactsMobile: this.state.switchValue ? values.employerContactsMobile : null,
  911. employerContactsMailbox: this.state.switchValue ? values.employerContactsMailbox : null,
  912. //
  913. releaseStatus: values.releaseStatus,
  914. principalId: values.principalId,
  915. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  916. //
  917. status: this.state.status,
  918. auditStatus: this.state.auditStatus,
  919. boutique: values.boutique,
  920. hot: values.hot,
  921. }
  922. }).done(function (data) {
  923. this.state.auditStatus = 0;
  924. if (!data.error.length) {
  925. message.success('保存成功!');
  926. this.props.handleOk();
  927. this.componentWillMount();
  928. } else {
  929. message.warning(data.error[0].message);
  930. };
  931. this.setState({
  932. loading: false
  933. });
  934. }.bind(this));
  935. }
  936. });
  937. },
  938. handleSearch(e) {
  939. if (this.props.detailApiUrl.indexOf('org') != -1) {
  940. $.ajax({
  941. method: "get",
  942. dataType: "json",
  943. crossDomain: false,
  944. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  945. data: { name: e },
  946. success: function (data) {
  947. let theArr = [];
  948. let theObj = {};
  949. if (!data.data) {
  950. if (data.error && data.error.length) {
  951. message.warning(data.error[0].message);
  952. };
  953. } else if (!$.isEmptyObject(data.data)) {
  954. data.data.map(function (item) {
  955. theArr.push(item.unitName);
  956. theObj[item.unitName] = item.uid;
  957. });
  958. };
  959. this.setState({
  960. dataSource: theArr,
  961. dataSourceObj: theObj
  962. });
  963. }.bind(this),
  964. });
  965. } else {
  966. $.ajax({
  967. method: "get",
  968. dataType: "json",
  969. crossDomain: false,
  970. url: globalConfig.context + "/api/admin/achievement/userOwner",
  971. data: { name: e },
  972. success: function (data) {
  973. let theArr = [];
  974. let theObj = {};
  975. if (!data.data) {
  976. if (data.error && data.error.length) {
  977. message.warning(data.error[0].message);
  978. };
  979. } else if (!$.isEmptyObject(data.data)) {
  980. for (let item in data.data) {
  981. theArr.push(data.data[item]);
  982. theObj[data.data[item]] = item;
  983. };
  984. };
  985. this.setState({
  986. dataSource: theArr,
  987. dataSourceObj: theObj
  988. });
  989. }.bind(this),
  990. });
  991. };
  992. },
  993. componentWillMount() {
  994. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  995. if (this.props.data && this.props.data.id) {
  996. this.loadData(this.props.data.id, this.props.detailApiUrl);
  997. };
  998. },
  999. componentWillReceiveProps(nextProps) {
  1000. if (!this.props.visible && nextProps.visible) {
  1001. if (nextProps.data && nextProps.data.id) {
  1002. this.loadData(nextProps.data.id, nextProps.detailApiUrl,nextProps.data.dataCategory);
  1003. };
  1004. this.state.contactsOption = [];
  1005. this.state.data = {};
  1006. this.state.tags = [];
  1007. this.state.switchValue = false;
  1008. this.state.radios = false;
  1009. this.state.pictureUrl = [];
  1010. this.state.coverImg = [];
  1011. this.state.textFileList = [];
  1012. this.state.videoFileList = [];
  1013. this.state.textFileUrl = undefined;
  1014. this.props.form.resetFields();
  1015. this.state.dataCategory = undefined;
  1016. };
  1017. },
  1018. render() {
  1019. const theData = this.state.data || {};
  1020. const { getFieldDecorator } = this.props.form;
  1021. const FormItem = Form.Item
  1022. const formItemLayout = {
  1023. labelCol: { span: 6 },
  1024. wrapperCol: { span: 12 },
  1025. };
  1026. return (
  1027. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  1028. <Spin spinning={this.state.loading}>
  1029. <div className="clearfix">
  1030. <FormItem className="half-item"
  1031. {...formItemLayout}
  1032. label="编号" >
  1033. <span>{theData.serialNumber}</span>
  1034. </FormItem>
  1035. <FormItem className="half-item"
  1036. {...formItemLayout}
  1037. label="需求名称" >
  1038. {getFieldDecorator('name', {
  1039. rules: [{ required: true, message: '此项为必填项!' }],
  1040. initialValue: theData.name
  1041. })(
  1042. <Input />
  1043. )}
  1044. </FormItem>
  1045. </div>
  1046. <div>
  1047. <FormItem className="half-item"
  1048. {...formItemLayout}
  1049. label="精品需求" >
  1050. {getFieldDecorator('boutique', {
  1051. initialValue: theData.boutique
  1052. })(
  1053. <Radio.Group>
  1054. <Radio value="0">否</Radio>
  1055. <Radio value="1">是</Radio>
  1056. </Radio.Group>
  1057. )}
  1058. </FormItem>
  1059. <FormItem className="half-item"
  1060. {...formItemLayout}
  1061. label="首页展示:" >
  1062. {getFieldDecorator('hot', {
  1063. initialValue: theData.hot
  1064. })(
  1065. <Radio.Group onChange={(e) => { this.setState({ radios: e.target.value }); }}>
  1066. <Radio value="0" name='radios'>否</Radio>
  1067. <Radio value="1" name='radios'>是</Radio>
  1068. </Radio.Group>
  1069. )}
  1070. </FormItem>
  1071. </div>
  1072. {this.state.radios==true ? <div>
  1073. <FormItem
  1074. labelCol={{ span: 3 }}
  1075. wrapperCol={{ span: 18 }}
  1076. label="首页展示图片:" >
  1077. <PicturesWall
  1078. pictureSign='demand_cover_picture'
  1079. uid={theData.employerId}
  1080. fileList={this.getcoverImg}
  1081. pictureUrl={this.state.coverImg}
  1082. visible={this.props.visible}
  1083. />
  1084. <span>尺寸为:320x160(像素)</span>
  1085. </FormItem>
  1086. </div> :<div></div>}
  1087. <FormItem style={{ marginBottom: '10px' }} labelCol={{ span: 3 }}
  1088. label="自定义雇主" >
  1089. <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
  1090. </FormItem>
  1091. {this.state.switchValue ? <div className="clearfix" >
  1092. <FormItem className="half-item"
  1093. {...formItemLayout}
  1094. label="雇主名称" >
  1095. {getFieldDecorator('employerName', {
  1096. initialValue: theData.employerName
  1097. })(
  1098. <Input />
  1099. )}
  1100. </FormItem>
  1101. <FormItem className="half-item"
  1102. {...formItemLayout}
  1103. label="联系电话" >
  1104. {getFieldDecorator('employerContactsMobile', {
  1105. initialValue: theData.employerContactsMobile
  1106. })(
  1107. <Input />
  1108. )}
  1109. </FormItem>
  1110. <FormItem className="half-item"
  1111. {...formItemLayout}
  1112. label="电子邮箱" >
  1113. {getFieldDecorator('employerContactsMailbox', {
  1114. initialValue: theData.employerContactsMailbox
  1115. })(
  1116. <Input />
  1117. )}
  1118. </FormItem>
  1119. <FormItem className="half-item"
  1120. {...formItemLayout}
  1121. label="通讯地址" >
  1122. {getFieldDecorator('employerAddress', {
  1123. initialValue: theData.employerAddress
  1124. })(
  1125. <Input />
  1126. )}
  1127. </FormItem>
  1128. </div> : <div className="clearfix">
  1129. <FormItem className="half-item"
  1130. {...formItemLayout}
  1131. label="雇主名称" >
  1132. {getFieldDecorator('employerId', {
  1133. initialValue: theData.username || ''
  1134. })(
  1135. <AutoComplete
  1136. dataSource={this.state.dataSource}
  1137. style={{ width: 200 }}
  1138. onSearch={this.state.therottleSearch}
  1139. placeholder="雇主名称"
  1140. onSelect={(e) => {
  1141. this.getContactsList(this.state.dataSourceObj[e]);
  1142. }} />
  1143. )}
  1144. </FormItem>
  1145. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  1146. {...formItemLayout}
  1147. label="联系人" >
  1148. {getFieldDecorator('contacts', {
  1149. initialValue: theData.contacts
  1150. })(
  1151. <Select style={{ width: 260 }}
  1152. placeholder="请选择联系人"
  1153. notFoundContent="未获取到联系人列表"
  1154. showSearch
  1155. filterOption={companySearch}>
  1156. {this.state.contactsOption}
  1157. </Select>
  1158. )}
  1159. </FormItem> : <div></div>}
  1160. </div>}
  1161. <div className="clearfix">
  1162. {theData.techBrokerId ? <FormItem className="half-item"
  1163. {...formItemLayout}
  1164. label="负责人" >
  1165. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  1166. </FormItem> : <div></div>}
  1167. </div>
  1168. {theData.releaseStatus ? <div className="clearfix">
  1169. <FormItem className="half-item"
  1170. {...formItemLayout}
  1171. label="是否发布" >
  1172. {(() => {
  1173. switch (theData.releaseStatus) {
  1174. case "0":
  1175. return <span>未发布</span>;
  1176. case "1":
  1177. return <span>已发布</span>;
  1178. }
  1179. })()}
  1180. </FormItem>
  1181. <FormItem className="half-item"
  1182. {...formItemLayout}
  1183. label="发布时间" >
  1184. <span>{theData.releaseDateFormattedDate}</span>
  1185. </FormItem>
  1186. </div> : <div></div>}
  1187. <div className="clearfix">
  1188. {theData.releaseStatus == "1" ? <FormItem className="half-item"
  1189. {...formItemLayout}
  1190. label="需求状态" >
  1191. {getFieldDecorator('status', {
  1192. initialValue: theData.status
  1193. })(
  1194. <Radio.Group>
  1195. <Radio value="0">未解决</Radio>
  1196. <Radio value="1">已解决</Radio>
  1197. </Radio.Group>
  1198. )}
  1199. </FormItem> : <div></div>}
  1200. <FormItem className="half-item"
  1201. {...formItemLayout}
  1202. label="审核状态" >
  1203. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  1204. </FormItem>
  1205. </div>
  1206. <FormItem
  1207. labelCol={{ span: 3 }}
  1208. wrapperCol={{ span: 20 }}
  1209. label="关键词" >
  1210. <KeyWordTagGroup
  1211. keyWordArr={this.state.tags}
  1212. tagsArr={this.getTagsArr}
  1213. visible={this.props.visible} />
  1214. </FormItem>
  1215. <FormItem
  1216. labelCol={{ span: 3 }}
  1217. wrapperCol={{ span: 20 }}
  1218. label="需求类别" >
  1219. <Select placeholder="选择需求类别" style={{ width: 120 }}
  1220. value={this.state.dataCategory}
  1221. onChange={(e) => { this.setState({ dataCategory: e }) }}>
  1222. <Select.Option value="0" >个人</Select.Option>
  1223. <Select.Option value="1" >组织</Select.Option>
  1224. </Select>
  1225. </FormItem>
  1226. <FormItem
  1227. labelCol={{ span: 3 }}
  1228. wrapperCol={{ span: 18 }}
  1229. label="行业类别" >
  1230. {getFieldDecorator('industryCategory', {
  1231. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  1232. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  1233. })(
  1234. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  1235. )}
  1236. </FormItem>
  1237. <FormItem className="half-item"
  1238. {...formItemLayout}
  1239. label="加急天数" >
  1240. {getFieldDecorator('urgentDays', {
  1241. initialValue: theData.urgentDays
  1242. })(
  1243. <Input style={{width:'95%'}}/>
  1244. )}
  1245. <span>天</span>
  1246. </FormItem>
  1247. <FormItem className="half-item"
  1248. {...formItemLayout}
  1249. label="加急报酬" >
  1250. {getFieldDecorator('urgentMoney', {
  1251. initialValue: theData.urgentMoney
  1252. })(
  1253. <Input style={{width:'95%'}}/>
  1254. )}
  1255. <span>万</span>
  1256. </FormItem>
  1257. <div className="clearfix">
  1258. <FormItem className="half-item"
  1259. {...formItemLayout}
  1260. label="需求类型" >
  1261. {getFieldDecorator('demandType', {
  1262. rules: [{ required: true, message: '此项为必填项!' }],
  1263. initialValue: theData.demandType
  1264. })(
  1265. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  1266. {this.props.demandTypeOption}
  1267. </Select>
  1268. )}
  1269. </FormItem>
  1270. </div>
  1271. <FormItem
  1272. labelCol={{ span: 3 }}
  1273. wrapperCol={{ span: 18 }}
  1274. label="问题说明" >
  1275. {getFieldDecorator('problemDes', {
  1276. rules: [{ required: true, message: '此项为必填项!' }],
  1277. initialValue: theData.problemDes
  1278. })(
  1279. <Input type="textarea" rows={4} />
  1280. )}
  1281. </FormItem>
  1282. <FormItem
  1283. labelCol={{ span: 3 }}
  1284. wrapperCol={{ span: 18 }}
  1285. label="备注" >
  1286. {getFieldDecorator('remark', {
  1287. initialValue: theData.remark
  1288. })(
  1289. <Input type="textarea" rows={4} />
  1290. )}
  1291. </FormItem>
  1292. <FormItem
  1293. labelCol={{ span: 3 }}
  1294. wrapperCol={{ span: 18 }}
  1295. label="技术指标要求" >
  1296. {getFieldDecorator('technicalRequirements', {
  1297. initialValue: theData.technicalRequirements
  1298. })(
  1299. <Input type="textarea" rows={2} />
  1300. )}
  1301. </FormItem>
  1302. <FormItem
  1303. labelCol={{ span: 3 }}
  1304. wrapperCol={{ span: 18 }}
  1305. label="需求文件(图片)" >
  1306. <PicturesWall
  1307. pictureSign="demand_picture"
  1308. uid={theData.employerId}
  1309. fileList={this.getPictureUrl}
  1310. pictureUrl={this.state.pictureUrl}
  1311. visible={this.props.visible} />
  1312. </FormItem>
  1313. <FormItem
  1314. labelCol={{ span: 3 }}
  1315. wrapperCol={{ span: 6 }}
  1316. label="需求文件(文本)" >
  1317. <Upload
  1318. name="ratepay"
  1319. action={globalConfig.context + "/api/admin/demand/uploadTextFile"}
  1320. data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
  1321. beforeUpload={beforeUploadFile}
  1322. fileList={this.state.textFileList}
  1323. onChange={(info) => {
  1324. if (info.file.status !== 'uploading') {
  1325. console.log(info.file, info.fileList);
  1326. }
  1327. if (info.file.status === 'done') {
  1328. if (!info.file.response.error.length) {
  1329. message.success(`${info.file.name} 文件上传成功!`);
  1330. } else {
  1331. message.warning(info.file.response.error[0].message);
  1332. return;
  1333. };
  1334. this.state.textFileUrl = info.file.response.data;
  1335. } else if (info.file.status === 'error') {
  1336. message.error(`${info.file.name} 文件上传失败。`);
  1337. };
  1338. this.setState({ textFileList: info.fileList.slice(-1) });
  1339. }} >
  1340. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  1341. </Upload>
  1342. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  1343. <span className="download-file">
  1344. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  1345. </span>
  1346. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1347. </FormItem>
  1348. <FormItem
  1349. labelCol={{ span: 3 }}
  1350. wrapperCol={{ span: 18 }}
  1351. label="需求文件(视频地址)" >
  1352. {getFieldDecorator('videoUrl', {
  1353. initialValue: theData.videoUrl
  1354. })(
  1355. <Input />
  1356. )}
  1357. </FormItem>
  1358. <div className="clearfix">
  1359. <FormItem className="half-item"
  1360. {...formItemLayout}
  1361. label="固定周期" >
  1362. {getFieldDecorator('fixedCycle', {
  1363. initialValue: theData.fixedCycle
  1364. })(
  1365. <Input />
  1366. )}
  1367. </FormItem>
  1368. <FormItem className="half-item"
  1369. {...formItemLayout}
  1370. label="固定人数" >
  1371. {getFieldDecorator('peopleNumber', {
  1372. initialValue: theData.peopleNumber || 0
  1373. })(
  1374. <InputNumber />
  1375. )}
  1376. <span style={{ marginLeft: '20px' }}>人</span>
  1377. </FormItem>
  1378. </div>
  1379. <FormItem
  1380. labelCol={{ span: 3 }}
  1381. wrapperCol={{ span: 18 }}
  1382. label="固定方案" >
  1383. {getFieldDecorator('fixedScheme', {
  1384. initialValue: theData.fixedScheme
  1385. })(
  1386. <Input type="textarea" rows={2} />
  1387. )}
  1388. </FormItem>
  1389. <div className="clearfix">
  1390. <FormItem className="half-item"
  1391. {...formItemLayout}
  1392. label="预算费用" >
  1393. {getFieldDecorator('budgetCost', {
  1394. initialValue: theData.budgetCost || 0
  1395. })(
  1396. <InputNumber min={0} max={999999} step={0.01} />
  1397. )}
  1398. <span style={{ marginLeft: '20px' }}>万元</span>
  1399. </FormItem>
  1400. <FormItem className="half-item"
  1401. {...formItemLayout}
  1402. label="费用托管" >
  1403. {getFieldDecorator('costEscrow', {
  1404. initialValue: theData.costEscrow
  1405. })(
  1406. <Radio.Group>
  1407. <Radio value={0}>否</Radio>
  1408. <Radio value={1}>是</Radio>
  1409. </Radio.Group>
  1410. )}
  1411. </FormItem>
  1412. <FormItem className="half-item"
  1413. {...formItemLayout}
  1414. label="有效期限" >
  1415. {getFieldDecorator('validityPeriod', {
  1416. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  1417. })(
  1418. <DatePicker />
  1419. )}
  1420. </FormItem>
  1421. </div>
  1422. <div className="clearfix" style={{ display: 'none' }}>
  1423. <FormItem className="half-item"
  1424. {...formItemLayout}
  1425. label="雇主地址" >
  1426. <span>{theData.employerAddress}</span>
  1427. </FormItem>
  1428. <FormItem className="half-item"
  1429. {...formItemLayout}
  1430. label="雇主联系人名称" >
  1431. <span>{theData.employerContacts}</span>
  1432. </FormItem>
  1433. <FormItem className="half-item"
  1434. {...formItemLayout}
  1435. label="雇主联系人电话" >
  1436. <span>{theData.employerContactsMobile}</span>
  1437. </FormItem>
  1438. <FormItem className="half-item"
  1439. {...formItemLayout}
  1440. label="雇主联系人邮箱" >
  1441. <span>{theData.employerContactsMailbox}</span>
  1442. </FormItem>
  1443. </div>
  1444. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  1445. {(theData.auditStatus != 2)? <Button className="set-submit" type="primary" htmlType="submit">保存草稿</Button>: <span></span>}
  1446. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">提交审核</Button>
  1447. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1448. </FormItem>
  1449. </Spin>
  1450. </Form >
  1451. )
  1452. }
  1453. }));
  1454. const DemandDetail = React.createClass({
  1455. getInitialState() {
  1456. return {
  1457. visible: false,
  1458. techBrodersObj: {},
  1459. tabsKey: "1",
  1460. columns: [
  1461. {
  1462. title: '编号',
  1463. dataIndex: 'serialNumber',
  1464. key: 'serialNumber',
  1465. }, {
  1466. title: '名称',
  1467. dataIndex: 'name',
  1468. key: 'name',
  1469. }, {
  1470. title: '关键字',
  1471. dataIndex: 'keyword',
  1472. key: 'keyword',
  1473. }, {
  1474. title: '类型',
  1475. dataIndex: 'category',
  1476. key: 'category',
  1477. render: text => { return getAchievementCategory(text); }
  1478. }, {
  1479. title: '所有人名称',
  1480. dataIndex: 'theName',
  1481. key: 'theName',
  1482. }, {
  1483. title: '所有人类型',
  1484. dataIndex: 'ownerType',
  1485. key: 'ownerType',
  1486. render: text => {
  1487. switch (text) {
  1488. case "0":
  1489. return <span>个人</span>;
  1490. case "1":
  1491. return <span>组织</span>
  1492. }
  1493. }
  1494. }, {
  1495. title: '发布时间',
  1496. dataIndex: 'releaseDateFormattedDate',
  1497. key: 'releaseDateFormattedDate',
  1498. }
  1499. ],
  1500. dataSource: [],
  1501. };
  1502. },
  1503. getTechBrodersList() {
  1504. this.setState({
  1505. loading: true
  1506. });
  1507. $.ajax({
  1508. method: "get",
  1509. dataType: "json",
  1510. crossDomain: false,
  1511. url: globalConfig.context + "/api/admin/audit/techBroders",
  1512. success: function (data) {
  1513. if (!data.data) {
  1514. if (data.error && data.error.length) {
  1515. message.warning(data.error[0].message);
  1516. }
  1517. return;
  1518. };
  1519. let _me = this, theArr = [];
  1520. for (var item in data.data) {
  1521. theArr.push(
  1522. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1523. )
  1524. };
  1525. this.setState({
  1526. techBrodersOption: theArr,
  1527. techBrodersObj: data.data
  1528. });
  1529. }.bind(this),
  1530. }).always(function () {
  1531. this.setState({
  1532. loading: false
  1533. });
  1534. }.bind(this));
  1535. },
  1536. getTableList() {
  1537. this.setState({
  1538. loading: true
  1539. });
  1540. $.ajax({
  1541. method: "get",
  1542. dataType: "json",
  1543. crossDomain: false,
  1544. url: globalConfig.context + "/api/admin/demand/achievementDemand",
  1545. data: { id: this.props.data.id },
  1546. success: function (data) {
  1547. let theArr = [];
  1548. if (!data.data) {
  1549. if (data.error && data.error.length) {
  1550. message.warning(data.error[0].message);
  1551. };
  1552. } else if (data.data.length) {
  1553. for (let i = 0; i < data.data.length; i++) {
  1554. let thisdata = data.data[i];
  1555. theArr.push({
  1556. key: i,
  1557. id: thisdata.id,
  1558. serialNumber: thisdata.serialNumber,
  1559. dataCategory: thisdata.dataCategory,
  1560. name: thisdata.name,
  1561. keyword: thisdata.keyword,
  1562. category: thisdata.category,
  1563. ownerType: thisdata.ownerType,
  1564. theName: thisdata.username || thisdata.unitName,
  1565. releaseDate: thisdata.releaseDate,
  1566. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1567. });
  1568. };
  1569. };
  1570. this.setState({
  1571. dataSource: theArr,
  1572. });
  1573. }.bind(this),
  1574. }).always(function () {
  1575. this.setState({
  1576. loading: false
  1577. });
  1578. }.bind(this));
  1579. },
  1580. tableRowClick(record, index) {
  1581. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1582. },
  1583. handleCancel(e) {
  1584. this.setState({
  1585. visible: false,
  1586. });
  1587. this.props.closeDesc(false);
  1588. },
  1589. handleOk(e) {
  1590. this.setState({
  1591. visible: false,
  1592. });
  1593. this.props.closeDesc(false, true);
  1594. },
  1595. componentWillMount() {
  1596. this.getTechBrodersList();
  1597. },
  1598. componentWillReceiveProps(nextProps) {
  1599. if (!this.state.visible && nextProps.showDesc) {
  1600. this.state.tabsKey = "1";
  1601. };
  1602. this.state.visible = nextProps.showDesc;
  1603. },
  1604. render() {
  1605. if (this.props.data) {
  1606. return (
  1607. <div className="patent-desc">
  1608. <Modal maskClosable={false} visible={this.state.visible}
  1609. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1610. width='1000px'
  1611. footer=''
  1612. className="admin-desc-content">
  1613. <Spin spinning={this.state.loading}>
  1614. <Tabs activeKey={this.state.tabsKey}
  1615. onChange={(e) => {
  1616. this.setState({ tabsKey: e });
  1617. if (e == "2") {
  1618. this.getTableList();
  1619. };
  1620. }} >
  1621. <Tabs.TabPane tab="需求详情" key="1">
  1622. {(() => {
  1623. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4"&& this.props.data.auditStatus != "2") {
  1624. return <DemandDetailShow
  1625. data={this.props.data}
  1626. detailApiUrl={this.props.detailApiUrl}
  1627. techBrodersOption={this.state.techBrodersOption}
  1628. techBrodersObj={this.state.techBrodersObj}
  1629. demandTypeOption={this.props.demandTypeOption}
  1630. closeDesc={this.handleCancel}
  1631. visible={this.state.visible}
  1632. handleOk={this.handleOk} />
  1633. } else {
  1634. return <DemandDetailForm
  1635. data={this.props.data}
  1636. detailApiUrl={this.props.detailApiUrl}
  1637. companyOption={this.props.companyOption}
  1638. userOption={this.props.userOption}
  1639. techBrodersObj={this.state.techBrodersObj}
  1640. demandTypeOption={this.props.demandTypeOption}
  1641. closeDesc={this.handleCancel}
  1642. visible={this.state.visible}
  1643. handleOk={this.handleOk} />
  1644. }
  1645. })()}
  1646. </Tabs.TabPane>
  1647. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  1648. <Table columns={this.state.columns}
  1649. dataSource={this.state.dataSource}
  1650. pagination={false}
  1651. onRowClick={this.tableRowClick} />
  1652. </Tabs.TabPane>
  1653. </Tabs>
  1654. </Spin>
  1655. </Modal>
  1656. </div>
  1657. );
  1658. } else {
  1659. return <div></div>
  1660. }
  1661. },
  1662. });
  1663. export default DemandDetail;