techDemandDesc.jsx 73 KB

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