techDemandDesc.jsx 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  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. if ( item.response && item.response.data && item.response.data.length ){
  523. picArr.push(item.response.data);
  524. }
  525. });
  526. thePictureUrl = picArr.join(",");
  527. };
  528. if (!err) {
  529. this.setState({
  530. loading: true
  531. });
  532. $.ajax({
  533. method: "POST",
  534. dataType: "json",
  535. crossDomain: false,
  536. url: this.props.data.id ? globalConfig.context + '/api/user/demand/update' : globalConfig.context + '/api/user/demand/apply',
  537. data: {
  538. id: this.props.data.id,
  539. dataCategory: Number(window.userData.type),
  540. serialNumber: this.props.data.serialNumber,
  541. name: values.name,
  542. keyword: this.state.tags ? this.state.tags.join(",") : [],
  543. keywords: this.state.tags,
  544. infoSources: 1,
  545. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  546. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  547. demandType: values.demandType,
  548. problemDes: values.problemDes,
  549. technicalRequirements: values.technicalRequirements,
  550. pictureUrl: thePictureUrl,
  551. textFileUrl: this.state.textFileUrl,
  552. videoUrl: values.videoUrl,
  553. fixedBudget: values.fixedBudget,
  554. fixedCycle: values.fixedCycle,
  555. peopleNumber: values.peopleNumber,
  556. fixedScheme: values.fixedScheme,
  557. costEscrow: values.costEscrow,
  558. budgetCost: values.budgetCost,
  559. employerId: values.employerId || this.state.data.employerId,
  560. releaseStatus: values.releaseStatus,
  561. principalId: values.principalId,
  562. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  563. //
  564. contacts: values.contacts,
  565. status: this.state.status,
  566. auditStatus: this.state.auditStatus
  567. }
  568. }).done(function (data) {
  569. this.state.auditStatus = 0;
  570. this.setState({
  571. loading: false
  572. });
  573. if (!data.error.length) {
  574. message.success('保存成功!');
  575. this.setState({
  576. visible: false
  577. });
  578. this.props.handleOk();
  579. } else {
  580. message.warning(data.error[0].message);
  581. }
  582. }.bind(this));
  583. }
  584. });
  585. },
  586. componentWillMount() {
  587. if (this.props.data.id) {
  588. this.loadData(this.props.data.id);
  589. } else {
  590. this.state.data = {};
  591. };
  592. },
  593. componentWillReceiveProps(nextProps) {
  594. if (!this.props.visible && nextProps.visible) {
  595. this.state.textFileList = [];
  596. this.state.videoFileList = [];
  597. if (nextProps.data.id) {
  598. this.loadData(nextProps.data.id);
  599. } else {
  600. this.state.data = {};
  601. this.state.tags = [];
  602. this.state.pictureUrl = [];
  603. };
  604. this.props.form.resetFields();
  605. };
  606. },
  607. render() {
  608. const theData = this.state.data || {};
  609. const { getFieldDecorator } = this.props.form;
  610. const FormItem = Form.Item
  611. const formItemLayout = {
  612. labelCol: { span: 6 },
  613. wrapperCol: { span: 12 },
  614. };
  615. return (
  616. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  617. <Spin spinning={this.state.loading}>
  618. <div className="clearfix">
  619. <FormItem className="half-item"
  620. {...formItemLayout}
  621. label="编号" >
  622. <span>{theData.serialNumber}</span>
  623. </FormItem>
  624. <FormItem className="half-item"
  625. {...formItemLayout}
  626. label="需求名称" >
  627. {getFieldDecorator('name', {
  628. rules: [{ required: true, message: '此项为必填项!' }],
  629. initialValue: theData.name
  630. })(
  631. <Input />
  632. )}
  633. </FormItem>
  634. {theData.username ? <FormItem className="half-item"
  635. {...formItemLayout}
  636. label="雇主名称" >
  637. <span>{theData.username}</span>
  638. </FormItem> : <div></div>}
  639. {window.userData.type == "1" ? <FormItem className="half-item"
  640. {...formItemLayout}
  641. label="联系人" >
  642. {getFieldDecorator('contacts', {
  643. initialValue: theData.contacts
  644. })(
  645. <Select style={{ width: 260 }}
  646. placeholder="请选择联系人"
  647. notFoundContent="未获取到联系人列表"
  648. showSearch
  649. filterOption={companySearch}>
  650. {this.props.contactsOption}
  651. </Select>
  652. )}
  653. </FormItem> : <div></div>}
  654. {window.userData.type == "0" ? <FormItem className="half-item"
  655. {...formItemLayout}
  656. label="联系方式" >
  657. <span>{theData.mobile}</span>
  658. </FormItem> : <div></div>}
  659. </div>
  660. {theData.releaseStatus ? <div className="clearfix">
  661. <FormItem className="half-item"
  662. {...formItemLayout}
  663. label="是否发布" >
  664. {(() => {
  665. switch (theData.releaseStatus) {
  666. case "0":
  667. return <span>未发布</span>;
  668. case "1":
  669. return <span>已发布</span>;
  670. }
  671. })()}
  672. </FormItem>
  673. <FormItem className="half-item"
  674. {...formItemLayout}
  675. label="发布时间" >
  676. <span>{theData.releaseDateFormattedDate}</span>
  677. </FormItem>
  678. </div> : <div></div>}
  679. <div className="clearfix">
  680. {theData.releaseStatus == "1" ? <FormItem className="half-item"
  681. {...formItemLayout}
  682. label="需求状态" >
  683. {getFieldDecorator('status', {
  684. initialValue: theData.status
  685. })(
  686. <Radio.Group>
  687. <Radio value="0">未解决</Radio>
  688. <Radio value="1">已解决</Radio>
  689. </Radio.Group>
  690. )}
  691. </FormItem> : <div></div>}
  692. <FormItem className="half-item"
  693. {...formItemLayout}
  694. label="审核状态" >
  695. {(() => {
  696. switch (theData.auditStatus) {
  697. case "0":
  698. return <span>未提交审核(草稿)</span>;
  699. case "1":
  700. return <span>提交审核</span>;
  701. case "2":
  702. return <span>审核中</span>;
  703. case "3":
  704. return <span>审核通过</span>;
  705. case "4":
  706. return <span>审核未通过</span>;
  707. }
  708. })()}
  709. </FormItem>
  710. </div>
  711. <FormItem
  712. labelCol={{ span: 3 }}
  713. wrapperCol={{ span: 20 }}
  714. label="关键词" >
  715. <KeyWordTagGroup
  716. keyWordArr={this.state.tags}
  717. tagsArr={this.getTagsArr}
  718. visible={this.props.visible} />
  719. </FormItem>
  720. <FormItem
  721. labelCol={{ span: 3 }}
  722. wrapperCol={{ span: 18 }}
  723. label="行业类别" >
  724. {getFieldDecorator('industryCategory', {
  725. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  726. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  727. })(
  728. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  729. )}
  730. </FormItem>
  731. <div className="clearfix">
  732. <FormItem className="half-item"
  733. {...formItemLayout}
  734. label="需求类型" >
  735. {getFieldDecorator('demandType', {
  736. rules: [{ required: true, message: '此项为必填项!' }],
  737. initialValue: theData.demandType
  738. })(
  739. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  740. {this.props.demandTypeOption}
  741. </Select>
  742. )}
  743. </FormItem>
  744. </div>
  745. <FormItem
  746. labelCol={{ span: 3 }}
  747. wrapperCol={{ span: 18 }}
  748. label="问题说明" >
  749. {getFieldDecorator('problemDes', {
  750. rules: [{ required: true, message: '此项为必填项!' }],
  751. initialValue: theData.problemDes
  752. })(
  753. <Input type="textarea" rows={4} />
  754. )}
  755. </FormItem>
  756. <FormItem
  757. labelCol={{ span: 3 }}
  758. wrapperCol={{ span: 18 }}
  759. label="技术指标要求" >
  760. {getFieldDecorator('technicalRequirements', {
  761. initialValue: theData.technicalRequirements
  762. })(
  763. <Input type="textarea" rows={2} />
  764. )}
  765. </FormItem>
  766. <FormItem
  767. labelCol={{ span: 3 }}
  768. wrapperCol={{ span: 18 }}
  769. label="需求文件(图片)" >
  770. <PicturesWall
  771. uid={theData.employerId}
  772. fileList={this.getPictureUrl}
  773. pictureUrl={this.state.pictureUrl}
  774. visible={this.props.visible} />
  775. </FormItem>
  776. <FormItem
  777. labelCol={{ span: 3 }}
  778. wrapperCol={{ span: 6 }}
  779. label="需求文件(文本)" >
  780. <Upload
  781. name="ratepay"
  782. action={globalConfig.context + "/api/user/demand/uploadTextFile"}
  783. data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
  784. beforeUpload={beforeUploadFile}
  785. fileList={this.state.textFileList}
  786. onChange={(info) => {
  787. if (info.file.status !== 'uploading') {
  788. console.log(info.file, info.fileList);
  789. }
  790. if (info.file.status === 'done') {
  791. if (!info.file.response.error.length) {
  792. message.success(`${info.file.name} 文件上传成功!`);
  793. } else {
  794. message.warning(info.file.response.error[0].message);
  795. return;
  796. };
  797. this.state.textFileUrl = info.file.response.data;
  798. } else if (info.file.status === 'error') {
  799. message.error(`${info.file.name} 文件上传失败。`);
  800. };
  801. this.setState({ textFileList: info.fileList.slice(-1) });
  802. }} >
  803. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  804. </Upload>
  805. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  806. <span className="download-file">
  807. <a onClick={() => { window.open(globalConfig.context + '/api/user/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  808. </span>
  809. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  810. </FormItem>
  811. <FormItem
  812. labelCol={{ span: 3 }}
  813. wrapperCol={{ span: 18 }}
  814. label="需求文件(视频地址)" >
  815. {getFieldDecorator('videoUrl', {
  816. initialValue: theData.videoUrl
  817. })(
  818. <Input />
  819. )}
  820. </FormItem>
  821. <div className="clearfix">
  822. <FormItem className="half-item"
  823. {...formItemLayout}
  824. label="固定周期" >
  825. {getFieldDecorator('fixedCycle', {
  826. initialValue: theData.fixedCycle
  827. })(
  828. <Input />
  829. )}
  830. </FormItem>
  831. <FormItem className="half-item"
  832. {...formItemLayout}
  833. label="固定人数" >
  834. {getFieldDecorator('peopleNumber', {
  835. initialValue: theData.peopleNumber
  836. })(
  837. <InputNumber min={0} max={999999} step={1} />
  838. )}
  839. <span style={{ marginLeft: '20px' }}>人</span>
  840. </FormItem>
  841. </div>
  842. <FormItem
  843. labelCol={{ span: 3 }}
  844. wrapperCol={{ span: 18 }}
  845. label="固定方案" >
  846. {getFieldDecorator('fixedScheme', {
  847. initialValue: theData.fixedScheme
  848. })(
  849. <Input type="textarea" rows={2} />
  850. )}
  851. </FormItem>
  852. <div className="clearfix">
  853. <FormItem className="half-item"
  854. {...formItemLayout}
  855. label="预算费用" >
  856. {getFieldDecorator('budgetCost', {
  857. initialValue: theData.budgetCost
  858. })(
  859. <InputNumber min={0} max={999999} step={0.01} />
  860. )}
  861. <span style={{ marginLeft: '20px' }}>万元</span>
  862. </FormItem>
  863. <FormItem className="half-item"
  864. {...formItemLayout}
  865. label="费用托管" >
  866. {getFieldDecorator('costEscrow', {
  867. initialValue: theData.costEscrow
  868. })(
  869. <Radio.Group>
  870. <Radio value={0}>否</Radio>
  871. <Radio value={1}>是</Radio>
  872. </Radio.Group>
  873. )}
  874. </FormItem>
  875. <FormItem className="half-item"
  876. {...formItemLayout}
  877. label="有效期限" >
  878. {getFieldDecorator('validityPeriod', {
  879. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  880. })(
  881. <DatePicker />
  882. )}
  883. </FormItem>
  884. </div>
  885. <div className="clearfix" style={{ display: 'none' }}>
  886. <FormItem className="half-item"
  887. {...formItemLayout}
  888. label="雇主地址" >
  889. <span>{theData.employerAddress}</span>
  890. </FormItem>
  891. <FormItem className="half-item"
  892. {...formItemLayout}
  893. label="雇主联系人名称" >
  894. <span>{theData.employerContacts}</span>
  895. </FormItem>
  896. <FormItem className="half-item"
  897. {...formItemLayout}
  898. label="雇主联系人电话" >
  899. <span>{theData.employerContactsMobile}</span>
  900. </FormItem>
  901. <FormItem className="half-item"
  902. {...formItemLayout}
  903. label="雇主联系人邮箱" >
  904. <span>{theData.employerContactsMailbox}</span>
  905. </FormItem>
  906. </div>
  907. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  908. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  909. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  910. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  911. </FormItem>
  912. </Spin>
  913. </Form >
  914. )
  915. }
  916. }));
  917. const DemandDetail = React.createClass({
  918. getInitialState() {
  919. return {
  920. visible: false,
  921. contactsObj: {},
  922. tabsKey: "1",
  923. columns: [
  924. {
  925. title: '编号',
  926. dataIndex: 'serialNumber',
  927. key: 'serialNumber',
  928. }, {
  929. title: '数据类型',
  930. dataIndex: 'dataCategory',
  931. key: 'dataCategory',
  932. render: text => {
  933. switch (text) {
  934. case "0":
  935. return <span>成果</span>;
  936. case "1":
  937. return <span>技术</span>;
  938. case "2":
  939. return <span>项目</span>;
  940. }
  941. }
  942. }, {
  943. title: '名称',
  944. dataIndex: 'name',
  945. key: 'name',
  946. }, {
  947. title: '关键字',
  948. dataIndex: 'keyword',
  949. key: 'keyword',
  950. }, {
  951. title: '类型',
  952. dataIndex: 'category',
  953. key: 'category',
  954. render: text => { return getAchievementCategory(text); }
  955. }, {
  956. title: '所有人名称',
  957. dataIndex: 'theName',
  958. key: 'theName',
  959. }, {
  960. title: '所有人类型',
  961. dataIndex: 'ownerType',
  962. key: 'ownerType',
  963. render: text => {
  964. switch (text) {
  965. case "0":
  966. return <span>个人</span>;
  967. case "1":
  968. return <span>组织</span>
  969. }
  970. }
  971. }, {
  972. title: '发布时间',
  973. dataIndex: 'releaseDateFormattedDate',
  974. key: 'releaseDateFormattedDate',
  975. }
  976. ],
  977. dataSource: [],
  978. };
  979. },
  980. getContactsList() {
  981. $.ajax({
  982. method: "get",
  983. dataType: "json",
  984. crossDomain: false,
  985. url: globalConfig.context + "/api/user/cognizance/getContacts",
  986. success: function (data) {
  987. let theOption = [];
  988. if (!data.data) {
  989. if (data.error && data.error.length) {
  990. message.warning(data.error[0].message);
  991. };
  992. } else {
  993. for (let item in data.data) {
  994. let theData = data.data[item];
  995. theOption.push(
  996. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  997. );
  998. };
  999. };
  1000. this.setState({
  1001. contactsOption: theOption,
  1002. contactsObj: data.data || {}
  1003. });
  1004. }.bind(this),
  1005. });
  1006. },
  1007. getTableList() {
  1008. this.setState({
  1009. loading: true
  1010. });
  1011. $.ajax({
  1012. method: "get",
  1013. dataType: "json",
  1014. crossDomain: false,
  1015. url: globalConfig.context + "/api/user/demand/achievementDemand",
  1016. data: { id: this.props.data.id },
  1017. success: function (data) {
  1018. let theArr = [];
  1019. if (!data.data) {
  1020. if (data.error && data.error.length) {
  1021. message.warning(data.error[0].message);
  1022. };
  1023. } else if (data.data.length) {
  1024. for (let i = 0; i < data.data.length; i++) {
  1025. let thisdata = data.data[i];
  1026. theArr.push({
  1027. key: i,
  1028. id: thisdata.id,
  1029. serialNumber: thisdata.serialNumber,
  1030. dataCategory: thisdata.dataCategory,
  1031. name: thisdata.name,
  1032. keyword: thisdata.keyword,
  1033. category: thisdata.category,
  1034. ownerType: thisdata.ownerType,
  1035. theName: thisdata.username || thisdata.unitName,
  1036. releaseDate: thisdata.releaseDate,
  1037. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1038. });
  1039. };
  1040. };
  1041. this.setState({
  1042. dataSource: theArr,
  1043. });
  1044. }.bind(this),
  1045. }).always(function () {
  1046. this.setState({
  1047. loading: false
  1048. });
  1049. }.bind(this));
  1050. },
  1051. tableRowClick(record, index) {
  1052. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1053. },
  1054. showModal() {
  1055. this.setState({
  1056. visible: true,
  1057. });
  1058. },
  1059. handleCancel(e) {
  1060. this.setState({
  1061. visible: false,
  1062. });
  1063. this.props.closeDesc(false);
  1064. },
  1065. handleOk(e) {
  1066. this.setState({
  1067. visible: false,
  1068. });
  1069. this.props.closeDesc(false, true);
  1070. },
  1071. componentWillMount() {
  1072. this.getContactsList();
  1073. },
  1074. componentWillReceiveProps(nextProps) {
  1075. if (nextProps.showDesc) {
  1076. this.state.tabsKey = "1";
  1077. this.state.tabBool = true;
  1078. };
  1079. this.state.visible = nextProps.showDesc;
  1080. },
  1081. render() {
  1082. if (this.props.data) {
  1083. return (
  1084. <div className="patent-desc">
  1085. <Modal maskClosable={false} visible={this.state.visible}
  1086. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1087. width='1000px'
  1088. footer=''
  1089. className="admin-desc-content">
  1090. <Tabs activeKey={this.state.tabsKey}
  1091. onChange={(e) => {
  1092. this.setState({ tabsKey: e });
  1093. if (e == "2" && this.state.tabBool) {
  1094. this.getTableList();
  1095. this.state.tabBool = false;
  1096. };
  1097. }} >
  1098. <Tabs.TabPane tab="需求详情" key="1">
  1099. {(() => {
  1100. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1101. return <DemandDetailShow
  1102. data={this.props.data}
  1103. demandTypeOption={this.props.demandTypeOption}
  1104. contactsObj={this.state.contactsObj}
  1105. closeDesc={this.handleCancel}
  1106. visible={this.state.visible}
  1107. handleOk={this.handleOk} />
  1108. } else {
  1109. return <DemandDetailForm
  1110. data={this.props.data}
  1111. contactsOption={this.state.contactsOption}
  1112. demandTypeOption={this.props.demandTypeOption}
  1113. closeDesc={this.handleCancel}
  1114. visible={this.state.visible}
  1115. handleOk={this.handleOk} />
  1116. }
  1117. })()}
  1118. </Tabs.TabPane>
  1119. <Tabs.TabPane tab="匹配列表" key="2">
  1120. <Table columns={this.state.columns}
  1121. dataSource={this.state.dataSource}
  1122. pagination={false}
  1123. onRowClick={this.tableRowClick} />
  1124. </Tabs.TabPane>
  1125. </Tabs>
  1126. </Modal>
  1127. </div>
  1128. );
  1129. } else {
  1130. return <div></div>
  1131. }
  1132. },
  1133. });
  1134. export default DemandDetail;