techDemandDesc.jsx 45 KB

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