techDemandDesc.jsx 73 KB

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