techDemandDesc.jsx 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138
  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 || 0} 人</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 || 0} 万元</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. case "2":
  937. return <span>项目</span>;
  938. }
  939. }
  940. }, {
  941. title: '名称',
  942. dataIndex: 'name',
  943. key: 'name',
  944. }, {
  945. title: '关键字',
  946. dataIndex: 'keyword',
  947. key: 'keyword',
  948. }, {
  949. title: '类型',
  950. dataIndex: 'category',
  951. key: 'category',
  952. render: text => { return getAchievementCategory(text); }
  953. }, {
  954. title: '所有人名称',
  955. dataIndex: 'theName',
  956. key: 'theName',
  957. }, {
  958. title: '所有人类型',
  959. dataIndex: 'ownerType',
  960. key: 'ownerType',
  961. render: text => {
  962. switch (text) {
  963. case "0":
  964. return <span>个人</span>;
  965. case "1":
  966. return <span>组织</span>
  967. }
  968. }
  969. }, {
  970. title: '发布时间',
  971. dataIndex: 'releaseDateFormattedDate',
  972. key: 'releaseDateFormattedDate',
  973. }
  974. ],
  975. dataSource: [],
  976. };
  977. },
  978. getContactsList() {
  979. $.ajax({
  980. method: "get",
  981. dataType: "json",
  982. crossDomain: false,
  983. url: globalConfig.context + "/api/user/cognizance/getContacts",
  984. success: function (data) {
  985. let theOption = [];
  986. if (!data.data) {
  987. if (data.error && data.error.length) {
  988. message.warning(data.error[0].message);
  989. };
  990. } else {
  991. for (let item in data.data) {
  992. let theData = data.data[item];
  993. theOption.push(
  994. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  995. );
  996. };
  997. };
  998. this.setState({
  999. contactsOption: theOption,
  1000. contactsObj: data.data || {}
  1001. });
  1002. }.bind(this),
  1003. });
  1004. },
  1005. getTableList() {
  1006. this.setState({
  1007. loading: true
  1008. });
  1009. $.ajax({
  1010. method: "get",
  1011. dataType: "json",
  1012. crossDomain: false,
  1013. url: globalConfig.context + "/api/user/demand/achievementDemand",
  1014. data: { id: this.props.data.id },
  1015. success: function (data) {
  1016. let theArr = [];
  1017. if (!data.data) {
  1018. if (data.error && data.error.length) {
  1019. message.warning(data.error[0].message);
  1020. };
  1021. } else if (data.data.length) {
  1022. for (let i = 0; i < data.data.length; i++) {
  1023. let thisdata = data.data[i];
  1024. theArr.push({
  1025. key: i,
  1026. id: thisdata.id,
  1027. serialNumber: thisdata.serialNumber,
  1028. dataCategory: thisdata.dataCategory,
  1029. name: thisdata.name,
  1030. keyword: thisdata.keyword,
  1031. category: thisdata.category,
  1032. ownerType: thisdata.ownerType,
  1033. theName: thisdata.username || thisdata.unitName,
  1034. releaseDate: thisdata.releaseDate,
  1035. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1036. });
  1037. };
  1038. };
  1039. this.setState({
  1040. dataSource: theArr,
  1041. });
  1042. }.bind(this),
  1043. }).always(function () {
  1044. this.setState({
  1045. loading: false
  1046. });
  1047. }.bind(this));
  1048. },
  1049. tableRowClick(record, index) {
  1050. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1051. },
  1052. showModal() {
  1053. this.setState({
  1054. visible: true,
  1055. });
  1056. },
  1057. handleCancel(e) {
  1058. this.setState({
  1059. visible: false,
  1060. });
  1061. this.props.closeDesc(false);
  1062. },
  1063. handleOk(e) {
  1064. this.setState({
  1065. visible: false,
  1066. });
  1067. this.props.closeDesc(false, true);
  1068. },
  1069. componentWillMount() {
  1070. this.getContactsList();
  1071. },
  1072. componentWillReceiveProps(nextProps) {
  1073. if (nextProps.showDesc) {
  1074. this.state.tabsKey = "1";
  1075. this.state.tabBool = true;
  1076. };
  1077. this.state.visible = nextProps.showDesc;
  1078. },
  1079. render() {
  1080. if (this.props.data) {
  1081. return (
  1082. <div className="patent-desc">
  1083. <Modal maskClosable={false} visible={this.state.visible}
  1084. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1085. width='1000px'
  1086. footer=''
  1087. className="admin-desc-content">
  1088. <Tabs activeKey={this.state.tabsKey}
  1089. onChange={(e) => {
  1090. this.setState({ tabsKey: e });
  1091. if (e == "2" && this.state.tabBool) {
  1092. this.getTableList();
  1093. this.state.tabBool = false;
  1094. };
  1095. }} >
  1096. <Tabs.TabPane tab="需求详情" key="1">
  1097. {(() => {
  1098. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1099. return <DemandDetailShow
  1100. data={this.props.data}
  1101. demandTypeOption={this.props.demandTypeOption}
  1102. contactsObj={this.state.contactsObj}
  1103. closeDesc={this.handleCancel}
  1104. visible={this.state.visible}
  1105. handleOk={this.handleOk} />
  1106. } else {
  1107. return <DemandDetailForm
  1108. data={this.props.data}
  1109. contactsOption={this.state.contactsOption}
  1110. demandTypeOption={this.props.demandTypeOption}
  1111. closeDesc={this.handleCancel}
  1112. visible={this.state.visible}
  1113. handleOk={this.handleOk} />
  1114. }
  1115. })()}
  1116. </Tabs.TabPane>
  1117. <Tabs.TabPane tab="匹配列表" key="2">
  1118. <Table columns={this.state.columns}
  1119. dataSource={this.state.dataSource}
  1120. pagination={false}
  1121. onRowClick={this.tableRowClick} />
  1122. </Tabs.TabPane>
  1123. </Tabs>
  1124. </Modal>
  1125. </div>
  1126. );
  1127. } else {
  1128. return <div></div>
  1129. }
  1130. },
  1131. });
  1132. export default DemandDetail;