techDemandDesc.jsx 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136
  1. import React from 'react';
  2. import { Icon, Tabs, Table, 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 { getTechField } from '../../DicTechFieldList.js';
  8. import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
  9. import { beforeUploadFile, splitUrl, companySearch, getDemandType, getAchievementCategory } from '../../tools.js';
  10. const KeyWordTagGroup = React.createClass({
  11. getInitialState() {
  12. return {
  13. tags: [],
  14. inputVisible: false,
  15. inputValue: ''
  16. };
  17. },
  18. handleClose(removedTag) {
  19. const tags = this.state.tags.filter(tag => tag !== removedTag);
  20. this.props.tagsArr(tags);
  21. this.setState({ tags });
  22. },
  23. showInput() {
  24. this.setState({ inputVisible: true }, () => this.input.focus());
  25. },
  26. handleInputChange(e) {
  27. this.setState({ inputValue: e.target.value });
  28. },
  29. handleInputConfirm() {
  30. const state = this.state;
  31. const inputValue = state.inputValue;
  32. let tags = state.tags;
  33. if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
  34. tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
  35. }
  36. this.props.tagsArr(tags);
  37. this.setState({
  38. tags,
  39. inputVisible: false,
  40. inputValue: '',
  41. });
  42. },
  43. componentWillMount() {
  44. this.state.tags = this.props.keyWordArr;
  45. },
  46. componentWillReceiveProps(nextProps) {
  47. if (this.props.keyWordArr != nextProps.keyWordArr) {
  48. this.state.tags = nextProps.keyWordArr;
  49. };
  50. },
  51. render() {
  52. const { tags, inputVisible, inputValue } = this.state;
  53. return (
  54. <div className="keyWord-tips">
  55. {tags.map((tag, index) => {
  56. const isLongTag = tag.length > 10;
  57. const tagElem = (
  58. <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
  59. {isLongTag ? `${tag.slice(0, 10)}...` : tag}
  60. </Tag>
  61. );
  62. return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
  63. })}
  64. {inputVisible && (
  65. <Input
  66. ref={input => this.input = input}
  67. type="text"
  68. style={{ width: 78 }}
  69. value={inputValue}
  70. onChange={this.handleInputChange}
  71. onBlur={this.handleInputConfirm}
  72. onPressEnter={this.handleInputConfirm}
  73. />
  74. )}
  75. {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
  76. </div>
  77. );
  78. }
  79. });
  80. const PicturesWall = React.createClass({
  81. getInitialState() {
  82. return {
  83. previewVisible: false,
  84. previewImage: '',
  85. fileList: [],
  86. }
  87. },
  88. handleCancel() {
  89. this.setState({ previewVisible: false })
  90. },
  91. handlePreview(file) {
  92. this.setState({
  93. previewImage: file.url || file.thumbUrl,
  94. previewVisible: true,
  95. });
  96. },
  97. handleChange(info) {
  98. let fileList = info.fileList;
  99. this.setState({ fileList });
  100. this.props.fileList(fileList);
  101. },
  102. componentWillReceiveProps(nextProps) {
  103. this.state.fileList = nextProps.pictureUrl;
  104. },
  105. render() {
  106. const { previewVisible, previewImage, fileList } = this.state;
  107. const uploadButton = (
  108. <div>
  109. <Icon type="plus" />
  110. <div className="ant-upload-text">点击上传</div>
  111. </div>
  112. );
  113. return (
  114. <div className="clearfix">
  115. <Upload
  116. action={globalConfig.context + "/api/user/demand/uploadPicture"}
  117. data={{ 'sign': 'demand_picture', 'uid': this.props.uid }}
  118. listType="picture-card"
  119. fileList={fileList}
  120. onPreview={this.handlePreview}
  121. onChange={this.handleChange} >
  122. {fileList.length >= 5 ? null : uploadButton}
  123. </Upload>
  124. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  125. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  126. </Modal>
  127. </div>
  128. );
  129. }
  130. });
  131. const DemandDetailShow = Form.create()(React.createClass({
  132. getInitialState() {
  133. return {
  134. visible: false,
  135. loading: false,
  136. contactsObj: {},
  137. salesmanObj: {},
  138. pictureUrl: [],
  139. tags: []
  140. };
  141. },
  142. loadData(id) {
  143. this.setState({
  144. loading: true
  145. });
  146. $.ajax({
  147. method: "get",
  148. dataType: "json",
  149. crossDomain: false,
  150. url: globalConfig.context + (window.userData.type == '1' ? '/api/user/demand/orgDemandDetail' : '/api/user/demand/userDemandDetail'),
  151. data: {
  152. id: id
  153. },
  154. success: function (data) {
  155. let thisData = data.data;
  156. if (!thisData) {
  157. if (data.error && data.error.length) {
  158. message.warning(data.error[0].message);
  159. };
  160. thisData = {};
  161. };
  162. this.setState({
  163. data: thisData,
  164. tags: thisData.keyword ? thisData.keyword.split(",") : [],
  165. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  166. });
  167. }.bind(this),
  168. }).always(function () {
  169. this.setState({
  170. loading: false
  171. });
  172. }.bind(this));
  173. },
  174. offShelf() {
  175. this.setState({
  176. loading: true
  177. });
  178. $.ajax({
  179. method: "post",
  180. dataType: "json",
  181. crossDomain: false,
  182. url: globalConfig.context + "/api/user/demand/offShelf",
  183. data: { "id": this.props.data.id }
  184. }).done(function (data) {
  185. this.setState({
  186. loading: false
  187. });
  188. if (!data.error.length) {
  189. message.success('撤销成功!');
  190. this.setState({
  191. visible: false,
  192. releaseSubmitVisible: false
  193. });
  194. this.props.handleOk();
  195. } else {
  196. message.warning(data.error[0].message);
  197. }
  198. }.bind(this));
  199. },
  200. componentWillMount() {
  201. if (this.props.data.id) {
  202. this.loadData(this.props.data.id);
  203. } else {
  204. this.state.data = {};
  205. };
  206. },
  207. componentWillReceiveProps(nextProps) {
  208. if (!this.props.visible && nextProps.visible) {
  209. if (nextProps.data.id) {
  210. this.loadData(nextProps.data.id);
  211. } else {
  212. this.state.data = {};
  213. };
  214. this.props.form.resetFields();
  215. };
  216. },
  217. render() {
  218. const theData = this.state.data || {};
  219. const { getFieldDecorator } = this.props.form;
  220. const FormItem = Form.Item
  221. const formItemLayout = {
  222. labelCol: { span: 6 },
  223. wrapperCol: { span: 12 },
  224. };
  225. return (
  226. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  227. <Spin spinning={this.state.loading}>
  228. <div className="clearfix">
  229. <FormItem className="half-item"
  230. {...formItemLayout}
  231. label="编号" >
  232. <span>{theData.serialNumber}</span>
  233. </FormItem>
  234. <FormItem className="half-item"
  235. {...formItemLayout}
  236. label="需求名称" >
  237. <span>{theData.name}</span>
  238. </FormItem>
  239. <FormItem className="half-item"
  240. {...formItemLayout}
  241. label="雇主名称" >
  242. <span>{theData.username}</span>
  243. </FormItem>
  244. {window.userData.type == '1' ? <FormItem className="half-item"
  245. {...formItemLayout}
  246. label="联系人" >
  247. <span>{this.props.contactsObj[theData.contacts]}</span>
  248. </FormItem> : <div></div>}
  249. {window.userData.type == '0' ? <FormItem className="half-item"
  250. {...formItemLayout}
  251. label="联系方式" >
  252. <span>{theData.mobile}</span>
  253. </FormItem> : <div></div>}
  254. </div>
  255. <div className="clearfix">
  256. <FormItem className="half-item"
  257. {...formItemLayout}
  258. label="是否发布" >
  259. {(() => {
  260. switch (theData.releaseStatus) {
  261. case "0":
  262. return <span>未发布</span>;
  263. case "1":
  264. return <div>
  265. <span>已发布</span>
  266. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  267. <Modal maskClosable={false} title="确认"
  268. visible={this.state.releaseSubmitVisible}
  269. width='300px'
  270. footer={null}
  271. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  272. <span>确认要撤销发布吗?</span>
  273. <Button className="modal-submit" type="primary" onClick={this.offShelf} >确认</Button>
  274. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  275. </Modal>
  276. </div>;
  277. }
  278. })()}
  279. </FormItem>
  280. <FormItem className="half-item"
  281. {...formItemLayout}
  282. label="发布时间" >
  283. <span>{theData.releaseDateFormattedDate}</span>
  284. </FormItem>
  285. </div>
  286. <div className="clearfix">
  287. <FormItem className="half-item"
  288. {...formItemLayout}
  289. label="需求状态" >
  290. {(() => {
  291. switch (theData.status) {
  292. case "0":
  293. return <span>未解决</span>;
  294. case "1":
  295. return <span>已解决</span>;
  296. }
  297. })()}
  298. </FormItem>
  299. <FormItem className="half-item"
  300. {...formItemLayout}
  301. label="审核状态" >
  302. {(() => {
  303. switch (theData.auditStatus) {
  304. case "0":
  305. return <span>未提交审核(草稿)</span>;
  306. case "1":
  307. return <span>提交审核</span>;
  308. case "2":
  309. return <span>审核中</span>;
  310. case "3":
  311. return <span>审核通过</span>;
  312. case "4":
  313. return <span>审核未通过</span>;
  314. }
  315. })()}
  316. </FormItem>
  317. </div>
  318. <div className="clearfix">
  319. <FormItem className="half-item"
  320. {...formItemLayout}
  321. label="信息来源" >
  322. {(() => {
  323. switch (theData.infoSources) {
  324. case "0":
  325. return <span>平台采集</span>;
  326. case "1":
  327. return <span>客户发布</span>;
  328. case "2":
  329. return <span>批量导入</span>;
  330. case "3":
  331. return <span>三方对接</span>;
  332. }
  333. })()}
  334. </FormItem>
  335. </div>
  336. <FormItem
  337. labelCol={{ span: 3 }}
  338. wrapperCol={{ span: 20 }}
  339. label="关键词" >
  340. {this.state.tags.map((tag) => {
  341. return <Tooltip key={tag} title={tag}>
  342. <Tag key={tag}>{tag}</Tag>
  343. </Tooltip>;
  344. })}
  345. </FormItem>
  346. <FormItem
  347. labelCol={{ span: 3 }}
  348. wrapperCol={{ span: 18 }}
  349. label="行业类别" >
  350. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  351. </FormItem>
  352. <div className="clearfix">
  353. <FormItem className="half-item"
  354. {...formItemLayout}
  355. label="需求类型" >
  356. <span>{getDemandType(theData.demandType)}</span>
  357. </FormItem>
  358. </div>
  359. <FormItem
  360. labelCol={{ span: 3 }}
  361. wrapperCol={{ span: 18 }}
  362. label="问题说明" >
  363. <span>{theData.problemDes}</span>
  364. </FormItem>
  365. <FormItem
  366. labelCol={{ span: 3 }}
  367. wrapperCol={{ span: 18 }}
  368. label="技术指标要求" >
  369. <span>{theData.technicalRequirements}</span>
  370. </FormItem>
  371. <FormItem
  372. labelCol={{ span: 3 }}
  373. wrapperCol={{ span: 18 }}
  374. label="需求文件(图片)" >
  375. <div className="clearfix">
  376. <Upload className="demandDetailShow-upload"
  377. listType="picture-card"
  378. fileList={this.state.pictureUrl}
  379. onPreview={(file) => {
  380. this.setState({
  381. previewImage: file.url || file.thumbUrl,
  382. previewVisible: true,
  383. });
  384. }} >
  385. </Upload>
  386. <Modal maskClosable={false} footer={null}
  387. visible={this.state.previewVisible}
  388. onCancel={() => { this.setState({ previewVisible: false }) }}>
  389. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  390. </Modal>
  391. </div>
  392. </FormItem>
  393. <FormItem
  394. labelCol={{ span: 3 }}
  395. wrapperCol={{ span: 6 }}
  396. label="需求文件(文本)" >
  397. <div>{theData.textFileUrl ?
  398. <span className="download-file">
  399. <a onClick={() => { window.open(globalConfig.context + '/api/user/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  400. </span>
  401. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  402. </FormItem>
  403. <FormItem
  404. labelCol={{ span: 3 }}
  405. wrapperCol={{ span: 18 }}
  406. label="需求文件(视频地址)" >
  407. <span>{theData.videoUrl}</span>
  408. </FormItem>
  409. <div className="clearfix">
  410. <FormItem className="half-item"
  411. {...formItemLayout}
  412. label="固定周期" >
  413. <span>{theData.fixedCycle}</span>
  414. </FormItem>
  415. <FormItem className="half-item"
  416. {...formItemLayout}
  417. label="固定人数" >
  418. <span>{theData.peopleNumber} 人</span>
  419. </FormItem>
  420. </div>
  421. <FormItem
  422. labelCol={{ span: 3 }}
  423. wrapperCol={{ span: 18 }}
  424. label="固定方案" >
  425. <span>{theData.fixedScheme}</span>
  426. </FormItem>
  427. <div className="clearfix">
  428. <FormItem className="half-item"
  429. {...formItemLayout}
  430. label="预算费用" >
  431. <span>{theData.budgetCost} 万元</span>
  432. </FormItem>
  433. <FormItem className="half-item"
  434. {...formItemLayout}
  435. label="费用托管" >
  436. {(() => {
  437. switch (theData.costEscrow) {
  438. case 0:
  439. return <span>否</span>;
  440. case 1:
  441. return <span>是</span>;
  442. }
  443. })()}
  444. </FormItem>
  445. <FormItem className="half-item"
  446. {...formItemLayout}
  447. label="有效期限" >
  448. <span>{theData.validityPeriodFormattedDate}</span>
  449. </FormItem>
  450. </div>
  451. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  452. <Button className="set-submit" type="primary" onClick={this.props.closeDesc}>取消</Button>
  453. </FormItem>
  454. </Spin>
  455. </Form >
  456. )
  457. }
  458. }));
  459. const DemandDetailForm = Form.create()(React.createClass({
  460. getInitialState() {
  461. return {
  462. visible: false,
  463. loading: false,
  464. auditStatus: 0,
  465. textFileList: [],
  466. videoFileList: [],
  467. pictureUrl: [],
  468. tags: []
  469. };
  470. },
  471. loadData(id) {
  472. this.setState({
  473. loading: true
  474. });
  475. $.ajax({
  476. method: "get",
  477. dataType: "json",
  478. crossDomain: false,
  479. url: globalConfig.context + (window.userData.type == '1' ? '/api/user/demand/orgDemandDetail' : '/api/user/demand/userDemandDetail'),
  480. data: {
  481. id: id
  482. },
  483. success: function (data) {
  484. let thisData = data.data;
  485. if (!thisData) {
  486. if (data.error && data.error.length) {
  487. message.warning(data.error[0].message);
  488. };
  489. thisData = {};
  490. };
  491. this.setState({
  492. data: thisData,
  493. tags: thisData.keyword ? thisData.keyword.split(",") : [],
  494. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  495. });
  496. }.bind(this),
  497. }).always(function () {
  498. this.setState({
  499. loading: false
  500. });
  501. }.bind(this));
  502. },
  503. getTagsArr(e) {
  504. this.setState({ tags: e });
  505. },
  506. getPictureUrl(e) {
  507. this.setState({ pictureUrl: e });
  508. },
  509. handleSubmit(e) {
  510. e.preventDefault();
  511. this.props.form.validateFields((err, values) => {
  512. //keyword长度判断
  513. if (this.state.tags.length < 3) {
  514. message.warning('关键词数量不能小于3个!');
  515. return;
  516. };
  517. //url转化
  518. let thePictureUrl = [];
  519. if (this.state.pictureUrl.length) {
  520. let picArr = [];
  521. this.state.pictureUrl.map(function (item) {
  522. picArr.push(item.response.data);
  523. });
  524. thePictureUrl = picArr.join(",");
  525. };
  526. if (!err) {
  527. this.setState({
  528. loading: true
  529. });
  530. $.ajax({
  531. method: "POST",
  532. dataType: "json",
  533. crossDomain: false,
  534. url: this.props.data.id ? globalConfig.context + '/api/user/demand/update' : globalConfig.context + '/api/user/demand/apply',
  535. data: {
  536. id: this.props.data.id,
  537. dataCategory: Number(window.userData.type),
  538. serialNumber: this.props.data.serialNumber,
  539. name: values.name,
  540. keyword: this.state.tags ? this.state.tags.join(",") : [],
  541. keywords: this.state.tags,
  542. infoSources: 1,
  543. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  544. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  545. demandType: values.demandType,
  546. problemDes: values.problemDes,
  547. technicalRequirements: values.technicalRequirements,
  548. pictureUrl: thePictureUrl,
  549. textFileUrl: this.state.textFileUrl,
  550. videoUrl: values.videoUrl,
  551. fixedBudget: values.fixedBudget,
  552. fixedCycle: values.fixedCycle,
  553. peopleNumber: values.peopleNumber,
  554. fixedScheme: values.fixedScheme,
  555. costEscrow: values.costEscrow,
  556. budgetCost: values.budgetCost,
  557. employerId: values.employerId || this.state.data.employerId,
  558. releaseStatus: values.releaseStatus,
  559. principalId: values.principalId,
  560. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  561. //
  562. contacts: values.contacts,
  563. status: this.state.status,
  564. auditStatus: this.state.auditStatus
  565. }
  566. }).done(function (data) {
  567. this.state.auditStatus = 0;
  568. this.setState({
  569. loading: false
  570. });
  571. if (!data.error.length) {
  572. message.success('保存成功!');
  573. this.setState({
  574. visible: false
  575. });
  576. this.props.handleOk();
  577. } else {
  578. message.warning(data.error[0].message);
  579. }
  580. }.bind(this));
  581. }
  582. });
  583. },
  584. componentWillMount() {
  585. if (this.props.data.id) {
  586. this.loadData(this.props.data.id);
  587. } else {
  588. this.state.data = {};
  589. };
  590. },
  591. componentWillReceiveProps(nextProps) {
  592. if (!this.props.visible && nextProps.visible) {
  593. this.state.textFileList = [];
  594. this.state.videoFileList = [];
  595. if (nextProps.data.id) {
  596. this.loadData(nextProps.data.id);
  597. } else {
  598. this.state.data = {};
  599. this.state.tags = [];
  600. this.state.pictureUrl = [];
  601. };
  602. this.props.form.resetFields();
  603. };
  604. },
  605. render() {
  606. const theData = this.state.data || {};
  607. const { getFieldDecorator } = this.props.form;
  608. const FormItem = Form.Item
  609. const formItemLayout = {
  610. labelCol: { span: 6 },
  611. wrapperCol: { span: 12 },
  612. };
  613. return (
  614. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  615. <Spin spinning={this.state.loading}>
  616. <div className="clearfix">
  617. <FormItem className="half-item"
  618. {...formItemLayout}
  619. label="编号" >
  620. <span>{theData.serialNumber}</span>
  621. </FormItem>
  622. <FormItem className="half-item"
  623. {...formItemLayout}
  624. label="需求名称" >
  625. {getFieldDecorator('name', {
  626. rules: [{ required: true, message: '此项为必填项!' }],
  627. initialValue: theData.name
  628. })(
  629. <Input />
  630. )}
  631. </FormItem>
  632. {theData.username ? <FormItem className="half-item"
  633. {...formItemLayout}
  634. label="雇主名称" >
  635. <span>{theData.username}</span>
  636. </FormItem> : <div></div>}
  637. {window.userData.type == "1" ? <FormItem className="half-item"
  638. {...formItemLayout}
  639. label="联系人" >
  640. {getFieldDecorator('contacts', {
  641. initialValue: theData.contacts
  642. })(
  643. <Select style={{ width: 260 }}
  644. placeholder="请选择联系人"
  645. notFoundContent="未获取到联系人列表"
  646. showSearch
  647. filterOption={companySearch}>
  648. {this.props.contactsOption}
  649. </Select>
  650. )}
  651. </FormItem> : <div></div>}
  652. {window.userData.type == "0" ? <FormItem className="half-item"
  653. {...formItemLayout}
  654. label="联系方式" >
  655. <span>{theData.mobile}</span>
  656. </FormItem> : <div></div>}
  657. </div>
  658. {theData.releaseStatus ? <div className="clearfix">
  659. <FormItem className="half-item"
  660. {...formItemLayout}
  661. label="是否发布" >
  662. {(() => {
  663. switch (theData.releaseStatus) {
  664. case "0":
  665. return <span>未发布</span>;
  666. case "1":
  667. return <span>已发布</span>;
  668. }
  669. })()}
  670. </FormItem>
  671. <FormItem className="half-item"
  672. {...formItemLayout}
  673. label="发布时间" >
  674. <span>{theData.releaseDateFormattedDate}</span>
  675. </FormItem>
  676. </div> : <div></div>}
  677. <div className="clearfix">
  678. {theData.releaseStatus == "1" ? <FormItem className="half-item"
  679. {...formItemLayout}
  680. label="需求状态" >
  681. {getFieldDecorator('status', {
  682. initialValue: theData.status
  683. })(
  684. <Radio.Group>
  685. <Radio value="0">未解决</Radio>
  686. <Radio value="1">已解决</Radio>
  687. </Radio.Group>
  688. )}
  689. </FormItem> : <div></div>}
  690. <FormItem className="half-item"
  691. {...formItemLayout}
  692. label="审核状态" >
  693. {(() => {
  694. switch (theData.auditStatus) {
  695. case "0":
  696. return <span>未提交审核(草稿)</span>;
  697. case "1":
  698. return <span>提交审核</span>;
  699. case "2":
  700. return <span>审核中</span>;
  701. case "3":
  702. return <span>审核通过</span>;
  703. case "4":
  704. return <span>审核未通过</span>;
  705. }
  706. })()}
  707. </FormItem>
  708. </div>
  709. <FormItem
  710. labelCol={{ span: 3 }}
  711. wrapperCol={{ span: 20 }}
  712. label="关键词" >
  713. <KeyWordTagGroup
  714. keyWordArr={this.state.tags}
  715. tagsArr={this.getTagsArr}
  716. visible={this.props.visible} />
  717. </FormItem>
  718. <FormItem
  719. labelCol={{ span: 3 }}
  720. wrapperCol={{ span: 18 }}
  721. label="行业类别" >
  722. {getFieldDecorator('industryCategory', {
  723. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  724. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  725. })(
  726. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  727. )}
  728. </FormItem>
  729. <div className="clearfix">
  730. <FormItem className="half-item"
  731. {...formItemLayout}
  732. label="需求类型" >
  733. {getFieldDecorator('demandType', {
  734. rules: [{ required: true, message: '此项为必填项!' }],
  735. initialValue: theData.demandType
  736. })(
  737. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  738. {this.props.demandTypeOption}
  739. </Select>
  740. )}
  741. </FormItem>
  742. </div>
  743. <FormItem
  744. labelCol={{ span: 3 }}
  745. wrapperCol={{ span: 18 }}
  746. label="问题说明" >
  747. {getFieldDecorator('problemDes', {
  748. rules: [{ required: true, message: '此项为必填项!' }],
  749. initialValue: theData.problemDes
  750. })(
  751. <Input type="textarea" rows={4} />
  752. )}
  753. </FormItem>
  754. <FormItem
  755. labelCol={{ span: 3 }}
  756. wrapperCol={{ span: 18 }}
  757. label="技术指标要求" >
  758. {getFieldDecorator('technicalRequirements', {
  759. initialValue: theData.technicalRequirements
  760. })(
  761. <Input type="textarea" rows={2} />
  762. )}
  763. </FormItem>
  764. <FormItem
  765. labelCol={{ span: 3 }}
  766. wrapperCol={{ span: 18 }}
  767. label="需求文件(图片)" >
  768. <PicturesWall
  769. uid={theData.employerId}
  770. fileList={this.getPictureUrl}
  771. pictureUrl={this.state.pictureUrl}
  772. visible={this.props.visible} />
  773. </FormItem>
  774. <FormItem
  775. labelCol={{ span: 3 }}
  776. wrapperCol={{ span: 6 }}
  777. label="需求文件(文本)" >
  778. <Upload
  779. name="ratepay"
  780. action={globalConfig.context + "/api/user/demand/uploadTextFile"}
  781. data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
  782. beforeUpload={beforeUploadFile}
  783. fileList={this.state.textFileList}
  784. onChange={(info) => {
  785. if (info.file.status !== 'uploading') {
  786. console.log(info.file, info.fileList);
  787. }
  788. if (info.file.status === 'done') {
  789. if (!info.file.response.error.length) {
  790. message.success(`${info.file.name} 文件上传成功!`);
  791. } else {
  792. message.warning(info.file.response.error[0].message);
  793. return;
  794. };
  795. this.state.textFileUrl = info.file.response.data;
  796. } else if (info.file.status === 'error') {
  797. message.error(`${info.file.name} 文件上传失败。`);
  798. };
  799. this.setState({ textFileList: info.fileList.slice(-1) });
  800. }} >
  801. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  802. </Upload>
  803. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  804. <span className="download-file">
  805. <a onClick={() => { window.open(globalConfig.context + '/api/user/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  806. </span>
  807. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  808. </FormItem>
  809. <FormItem
  810. labelCol={{ span: 3 }}
  811. wrapperCol={{ span: 18 }}
  812. label="需求文件(视频地址)" >
  813. {getFieldDecorator('videoUrl', {
  814. initialValue: theData.videoUrl
  815. })(
  816. <Input />
  817. )}
  818. </FormItem>
  819. <div className="clearfix">
  820. <FormItem className="half-item"
  821. {...formItemLayout}
  822. label="固定周期" >
  823. {getFieldDecorator('fixedCycle', {
  824. initialValue: theData.fixedCycle
  825. })(
  826. <Input />
  827. )}
  828. </FormItem>
  829. <FormItem className="half-item"
  830. {...formItemLayout}
  831. label="固定人数" >
  832. {getFieldDecorator('peopleNumber', {
  833. initialValue: theData.peopleNumber
  834. })(
  835. <InputNumber min={0} max={999999} step={1} />
  836. )}
  837. <span style={{ marginLeft: '20px' }}>人</span>
  838. </FormItem>
  839. </div>
  840. <FormItem
  841. labelCol={{ span: 3 }}
  842. wrapperCol={{ span: 18 }}
  843. label="固定方案" >
  844. {getFieldDecorator('fixedScheme', {
  845. initialValue: theData.fixedScheme
  846. })(
  847. <Input type="textarea" rows={2} />
  848. )}
  849. </FormItem>
  850. <div className="clearfix">
  851. <FormItem className="half-item"
  852. {...formItemLayout}
  853. label="预算费用" >
  854. {getFieldDecorator('budgetCost', {
  855. initialValue: theData.budgetCost
  856. })(
  857. <InputNumber min={0} max={999999} step={0.01} />
  858. )}
  859. <span style={{ marginLeft: '20px' }}>万元</span>
  860. </FormItem>
  861. <FormItem className="half-item"
  862. {...formItemLayout}
  863. label="费用托管" >
  864. {getFieldDecorator('costEscrow', {
  865. initialValue: theData.costEscrow
  866. })(
  867. <Radio.Group>
  868. <Radio value={0}>否</Radio>
  869. <Radio value={1}>是</Radio>
  870. </Radio.Group>
  871. )}
  872. </FormItem>
  873. <FormItem className="half-item"
  874. {...formItemLayout}
  875. label="有效期限" >
  876. {getFieldDecorator('validityPeriod', {
  877. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  878. })(
  879. <DatePicker />
  880. )}
  881. </FormItem>
  882. </div>
  883. <div className="clearfix" style={{ display: 'none' }}>
  884. <FormItem className="half-item"
  885. {...formItemLayout}
  886. label="雇主地址" >
  887. <span>{theData.employerAddress}</span>
  888. </FormItem>
  889. <FormItem className="half-item"
  890. {...formItemLayout}
  891. label="雇主联系人名称" >
  892. <span>{theData.employerContacts}</span>
  893. </FormItem>
  894. <FormItem className="half-item"
  895. {...formItemLayout}
  896. label="雇主联系人电话" >
  897. <span>{theData.employerContactsMobile}</span>
  898. </FormItem>
  899. <FormItem className="half-item"
  900. {...formItemLayout}
  901. label="雇主联系人邮箱" >
  902. <span>{theData.employerContactsMailbox}</span>
  903. </FormItem>
  904. </div>
  905. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  906. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  907. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  908. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  909. </FormItem>
  910. </Spin>
  911. </Form >
  912. )
  913. }
  914. }));
  915. const DemandDetail = React.createClass({
  916. getInitialState() {
  917. return {
  918. visible: false,
  919. contactsObj: {},
  920. tabsKey: "1",
  921. columns: [
  922. {
  923. title: '编号',
  924. dataIndex: 'serialNumber',
  925. key: 'serialNumber',
  926. }, {
  927. title: '数据类型',
  928. dataIndex: 'dataCategory',
  929. key: 'dataCategory',
  930. render: text => {
  931. switch (text) {
  932. case "0":
  933. return <span>个人需求</span>;
  934. case "1":
  935. return <span>团体需求</span>;
  936. }
  937. }
  938. }, {
  939. title: '名称',
  940. dataIndex: 'name',
  941. key: 'name',
  942. }, {
  943. title: '关键字',
  944. dataIndex: 'keyword',
  945. key: 'keyword',
  946. }, {
  947. title: '类型',
  948. dataIndex: 'category',
  949. key: 'category',
  950. render: text => { return getAchievementCategory(text); }
  951. }, {
  952. title: '所有人名称',
  953. dataIndex: 'theName',
  954. key: 'theName',
  955. }, {
  956. title: '所有人类型',
  957. dataIndex: 'ownerType',
  958. key: 'ownerType',
  959. render: text => {
  960. switch (text) {
  961. case "0":
  962. return <span>个人</span>;
  963. case "1":
  964. return <span>组织</span>
  965. }
  966. }
  967. }, {
  968. title: '发布时间',
  969. dataIndex: 'releaseDateFormattedDate',
  970. key: 'releaseDateFormattedDate',
  971. }
  972. ],
  973. dataSource: [],
  974. };
  975. },
  976. getContactsList() {
  977. $.ajax({
  978. method: "get",
  979. dataType: "json",
  980. crossDomain: false,
  981. url: globalConfig.context + "/api/user/cognizance/getContacts",
  982. success: function (data) {
  983. let theOption = [];
  984. if (!data.data) {
  985. if (data.error && data.error.length) {
  986. message.warning(data.error[0].message);
  987. };
  988. } else {
  989. for (let item in data.data) {
  990. let theData = data.data[item];
  991. theOption.push(
  992. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  993. );
  994. };
  995. };
  996. this.setState({
  997. contactsOption: theOption,
  998. contactsObj: data.data || {}
  999. });
  1000. }.bind(this),
  1001. });
  1002. },
  1003. getTableList() {
  1004. this.setState({
  1005. loading: true
  1006. });
  1007. $.ajax({
  1008. method: "get",
  1009. dataType: "json",
  1010. crossDomain: false,
  1011. url: globalConfig.context + "/api/user/demand/achievementDemand",
  1012. data: { id: this.props.data.id },
  1013. success: function (data) {
  1014. let theArr = [];
  1015. if (!data.data) {
  1016. if (data.error && data.error.length) {
  1017. message.warning(data.error[0].message);
  1018. };
  1019. } else if (data.data.length) {
  1020. for (let i = 0; i < data.data.length; i++) {
  1021. let thisdata = data.data[i];
  1022. theArr.push({
  1023. key: i,
  1024. id: thisdata.id,
  1025. serialNumber: thisdata.serialNumber,
  1026. dataCategory: thisdata.dataCategory,
  1027. name: thisdata.name,
  1028. keyword: thisdata.keyword,
  1029. category: thisdata.category,
  1030. ownerType: thisdata.ownerType,
  1031. theName: thisdata.username || thisdata.unitName,
  1032. releaseDate: thisdata.releaseDate,
  1033. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1034. });
  1035. };
  1036. };
  1037. this.setState({
  1038. dataSource: theArr,
  1039. });
  1040. }.bind(this),
  1041. }).always(function () {
  1042. this.setState({
  1043. loading: false
  1044. });
  1045. }.bind(this));
  1046. },
  1047. tableRowClick(record, index) {
  1048. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1049. },
  1050. showModal() {
  1051. this.setState({
  1052. visible: true,
  1053. });
  1054. },
  1055. handleCancel(e) {
  1056. this.setState({
  1057. visible: false,
  1058. });
  1059. this.props.closeDesc(false);
  1060. },
  1061. handleOk(e) {
  1062. this.setState({
  1063. visible: false,
  1064. });
  1065. this.props.closeDesc(false, true);
  1066. },
  1067. componentWillMount() {
  1068. this.getContactsList();
  1069. },
  1070. componentWillReceiveProps(nextProps) {
  1071. if (nextProps.showDesc) {
  1072. this.state.tabsKey = "1";
  1073. this.state.tabBool = true;
  1074. };
  1075. this.state.visible = nextProps.showDesc;
  1076. },
  1077. render() {
  1078. if (this.props.data) {
  1079. return (
  1080. <div className="patent-desc">
  1081. <Modal maskClosable={false} visible={this.state.visible}
  1082. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1083. width='1000px'
  1084. footer=''
  1085. className="admin-desc-content">
  1086. <Tabs activeKey={this.state.tabsKey}
  1087. onChange={(e) => {
  1088. this.setState({ tabsKey: e });
  1089. if (e == "2" && this.state.tabBool) {
  1090. this.getTableList();
  1091. this.state.tabBool = false;
  1092. };
  1093. }} >
  1094. <Tabs.TabPane tab="需求详情" key="1">
  1095. {(() => {
  1096. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1097. return <DemandDetailShow
  1098. data={this.props.data}
  1099. demandTypeOption={this.props.demandTypeOption}
  1100. contactsObj={this.state.contactsObj}
  1101. closeDesc={this.handleCancel}
  1102. visible={this.state.visible}
  1103. handleOk={this.handleOk} />
  1104. } else {
  1105. return <DemandDetailForm
  1106. data={this.props.data}
  1107. contactsOption={this.state.contactsOption}
  1108. demandTypeOption={this.props.demandTypeOption}
  1109. closeDesc={this.handleCancel}
  1110. visible={this.state.visible}
  1111. handleOk={this.handleOk} />
  1112. }
  1113. })()}
  1114. </Tabs.TabPane>
  1115. <Tabs.TabPane tab="匹配列表" key="2">
  1116. <Table columns={this.state.columns}
  1117. dataSource={this.state.dataSource}
  1118. pagination={false}
  1119. onRowClick={this.tableRowClick} />
  1120. </Tabs.TabPane>
  1121. </Tabs>
  1122. </Modal>
  1123. </div>
  1124. );
  1125. } else {
  1126. return <div></div>
  1127. }
  1128. },
  1129. });
  1130. export default DemandDetail;