techDemandDesc.jsx 74 KB

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