techDemandDesc.jsx 71 KB

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