techDemandDesc.jsx 50 KB

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