techDemandDesc.jsx 76 KB

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