techDemandQueryDesc.jsx 71 KB

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