techDemandDesc.jsx 50 KB

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