techDemandDesc.jsx 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. import React from 'react';
  2. import { Icon, Tooltip, Modal, 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 } from '../../DicIndustryList.js';
  8. import { beforeUploadFile, splitUrl, companySearch } 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/admin/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 DemandDetailForm = Form.create()(React.createClass({
  131. getInitialState() {
  132. return {
  133. visible: false,
  134. loading: false,
  135. textFileList: [],
  136. videoFileList: [],
  137. pictureUrl: [],
  138. tags: []
  139. };
  140. },
  141. loadData(id, detailApiUrl) {
  142. this.setState({
  143. loading: true
  144. });
  145. $.ajax({
  146. method: "get",
  147. dataType: "json",
  148. crossDomain: false,
  149. url: globalConfig.context + detailApiUrl,
  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. let d = new Date()
  162. if (thisData && thisData.dateOfBirthMonth && thisData.dateOfBirthYear) {
  163. d.setMonth(thisData.dateOfBirthMonth - 1);
  164. d.setYear(parseInt(thisData.dateOfBirthYear));
  165. };
  166. this.setState({
  167. data: thisData,
  168. tags: thisData.keyword ? thisData.keyword.split(",") : [],
  169. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  170. });
  171. }.bind(this),
  172. }).always(function () {
  173. this.setState({
  174. loading: false
  175. });
  176. }.bind(this));
  177. },
  178. getSalesmanList() {
  179. this.setState({
  180. loading: true
  181. });
  182. $.ajax({
  183. method: "get",
  184. dataType: "json",
  185. crossDomain: false,
  186. url: globalConfig.context + "/api/admin/salesman",
  187. success: function (data) {
  188. if (!data.data) {
  189. if (data.error && data.error.length) {
  190. message.warning(data.error[0].message);
  191. }
  192. return;
  193. };
  194. let _me = this, theArr = [];
  195. for (var item in data.data) {
  196. theArr.push(
  197. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  198. )
  199. };
  200. this.setState({
  201. salesmanOption: theArr
  202. });
  203. }.bind(this),
  204. }).always(function () {
  205. this.setState({
  206. loading: false
  207. });
  208. }.bind(this));
  209. },
  210. getContactsList(theUid) {
  211. $.ajax({
  212. method: "get",
  213. dataType: "json",
  214. crossDomain: false,
  215. url: globalConfig.context + "/api/admin/getContacts",
  216. data: {
  217. uid: theUid
  218. },
  219. success: function (data) {
  220. let theOption = [];
  221. if (!data.data) {
  222. if (data.error && data.error.length) {
  223. message.warning(data.error[0].message);
  224. return;
  225. };
  226. };
  227. for (let item in data.data) {
  228. let theData = data.data[item];
  229. theOption.push(
  230. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  231. );
  232. };
  233. this.setState({
  234. contactsOption: theOption
  235. });
  236. }.bind(this),
  237. });
  238. },
  239. getTagsArr(e) {
  240. this.setState({ tags: e });
  241. },
  242. getPictureUrl(e) {
  243. this.setState({ pictureUrl: e });
  244. },
  245. handleSubmit(e) {
  246. e.preventDefault();
  247. this.props.form.validateFields((err, values) => {
  248. //keyword长度判断
  249. if (this.state.tags.length < 3) {
  250. message.warning('关键词数量不能小于3个!');
  251. };
  252. //url转化
  253. let thePictureUrl = [];
  254. if (this.state.pictureUrl.length) {
  255. let picArr = [];
  256. this.state.pictureUrl.map(function (item) {
  257. picArr.push(item.response.data);
  258. });
  259. thePictureUrl = picArr.join(",");
  260. };
  261. if (!err) {
  262. this.setState({
  263. loading: true
  264. });
  265. $.ajax({
  266. method: "POST",
  267. dataType: "json",
  268. crossDomain: false,
  269. url: this.props.data.id ? globalConfig.context + '/api/admin/demand/update' : globalConfig.context + '/api/admin/demand/apply',
  270. data: {
  271. id: this.props.data.id,
  272. dataCategory: this.props.detailApiUrl.indexOf('org') >= 0 ? 1 : 0,
  273. serialNumber: this.props.data.serialNumber,
  274. name: values.name,
  275. keyword: this.state.tags ? this.state.tags.join(",") : [],
  276. infoSources: values.infoSources,
  277. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  278. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  279. demandType: values.demandType,
  280. problemDes: values.problemDes,
  281. technicalRequirements: values.technicalRequirements,
  282. pictureUrl: thePictureUrl,
  283. textFileUrl: this.state.textFileUrl,
  284. videoUrl: values.videoUrl,
  285. fixedBudget: values.fixedBudget,
  286. fixedCycle: values.fixedCycle,
  287. peopleNumber: values.peopleNumber,
  288. fixedScheme: values.fixedScheme,
  289. costEscrow: values.costEscrow,
  290. budgetCost: values.budgetCost,
  291. employerId: values.employerId || this.state.data.employerId,
  292. releaseStatus: values.releaseStatus,
  293. principalId: values.principalId,
  294. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  295. //
  296. contacts: values.contacts,
  297. status: this.state.status
  298. }
  299. }).done(function (data) {
  300. if (!data.error.length) {
  301. message.success('保存成功!');
  302. this.setState({
  303. visible: false
  304. });
  305. this.props.handleOk();
  306. } else {
  307. message.warning(data.error[0].message);
  308. }
  309. }.bind(this));
  310. }
  311. });
  312. },
  313. componentWillMount() {
  314. this.getSalesmanList();
  315. if (this.props.data.id) {
  316. this.loadData(this.props.data.id, this.props.detailApiUrl);
  317. if (this.props.data.employerId && this.props.detailApiUrl.indexOf('org') >= 0) {
  318. this.getContactsList(this.props.data.employerId)
  319. };
  320. } else {
  321. this.state.data = {};
  322. };
  323. },
  324. componentWillReceiveProps(nextProps) {
  325. if (!this.props.visible && nextProps.visible) {
  326. this.state.textFileList = [];
  327. this.state.videoFileList = [];
  328. if (nextProps.data.id) {
  329. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  330. if (nextProps.data.employerId && nextProps.detailApiUrl.indexOf('org') >= 0) {
  331. this.getContactsList(nextProps.data.employerId)
  332. };
  333. } else {
  334. this.state.data = {};
  335. this.state.tags = [];
  336. this.state.pictureUrl = [];
  337. };
  338. this.props.form.resetFields();
  339. };
  340. },
  341. render() {
  342. const theData = this.state.data || {};
  343. const { getFieldDecorator } = this.props.form;
  344. const FormItem = Form.Item
  345. const formItemLayout = {
  346. labelCol: { span: 6 },
  347. wrapperCol: { span: 12 },
  348. };
  349. return (
  350. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  351. <div className="clearfix">
  352. <FormItem className="half-item"
  353. {...formItemLayout}
  354. label="编号" >
  355. <span>{theData.serialNumber}</span>
  356. </FormItem>
  357. <FormItem className="half-item"
  358. {...formItemLayout}
  359. label="需求名称" >
  360. {getFieldDecorator('name', {
  361. rules: [{ required: true, message: '此项为必填项!' }],
  362. initialValue: theData.name
  363. })(
  364. <Input />
  365. )}
  366. </FormItem>
  367. <FormItem className="half-item" style={{ display: theData.username ? 'block' : 'none' }}
  368. {...formItemLayout}
  369. label="雇主名称" >
  370. <span>{theData.username}</span>
  371. </FormItem>
  372. <FormItem className="half-item" style={{ display: theData.username ? 'none' : 'block' }}
  373. {...formItemLayout}
  374. label="雇主名称" >
  375. {getFieldDecorator('employerId', {
  376. initialValue: theData.employerId
  377. })(
  378. <Select
  379. placeholder="请选择"
  380. notFoundContent="未找到"
  381. style={{ width: 260 }}
  382. showSearch
  383. filterOption={companySearch}
  384. onSelect={(e, n) => {
  385. theData.uid = e;
  386. if (this.props.detailApiUrl.indexOf('org') >= 0) {
  387. this.getContactsList(e);
  388. };
  389. }}>
  390. {this.props.detailApiUrl.indexOf('org') >= 0 ? this.props.companyOption : this.props.userOption}
  391. </Select>
  392. )}
  393. </FormItem>
  394. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  395. {...formItemLayout}
  396. label="联系人" >
  397. {getFieldDecorator('contacts', {
  398. initialValue: theData.contacts
  399. })(
  400. <Select style={{ width: 260 }}
  401. placeholder="请选择联系人"
  402. notFoundContent="未获取到联系人列表"
  403. showSearch
  404. filterOption={companySearch}>
  405. {this.state.contactsOption}
  406. </Select>
  407. )}
  408. </FormItem> : <div></div>}
  409. <FormItem className="half-item"
  410. {...formItemLayout}
  411. label="负责人" >
  412. {getFieldDecorator('principalId', {
  413. rules: [{ required: true, message: '此项为必填项!' }],
  414. initialValue: theData.principalId
  415. })(
  416. <Select style={{ width: 260 }}
  417. placeholder="请选择负责人"
  418. notFoundContent="未获取到负责人列表"
  419. showSearch
  420. filterOption={companySearch}>
  421. {this.state.salesmanOption}
  422. </Select>
  423. )}
  424. </FormItem>
  425. </div>
  426. <div className="clearfix">
  427. <FormItem className="half-item"
  428. {...formItemLayout}
  429. label="是否发布" >
  430. {getFieldDecorator('releaseStatus', {
  431. initialValue: theData.releaseStatus
  432. })(
  433. <Radio.Group>
  434. <Radio value="0">未发布</Radio>
  435. <Radio value="1">发布</Radio>
  436. </Radio.Group>
  437. )}
  438. </FormItem>
  439. <FormItem className="half-item"
  440. {...formItemLayout}
  441. label="发布时间" >
  442. <span>{theData.releaseDateFormattedDate}</span>
  443. </FormItem>
  444. <FormItem className="half-item"
  445. {...formItemLayout}
  446. label="需求状态" >
  447. {(() => {
  448. if (theData.status && Number(theData.status) > 1) {
  449. return <Radio.Group
  450. value={this.state.status}
  451. onChange={(e) => { this.setState({ status: e }); }}>
  452. <Radio value="2">未解决</Radio>
  453. <Radio value="3">已解决</Radio>
  454. </Radio.Group>
  455. } else {
  456. switch (theData.status) {
  457. case "0":
  458. return <span>草稿</span>;
  459. case "1":
  460. return <span>进行中</span>;
  461. };
  462. };
  463. })()}
  464. </FormItem>
  465. <FormItem className="half-item"
  466. {...formItemLayout}
  467. label="需求创建时间" >
  468. <span>{theData.createTimeFormattedDate}</span>
  469. </FormItem>
  470. <FormItem className="half-item"
  471. {...formItemLayout}
  472. label="信息来源" >
  473. {getFieldDecorator('infoSources', {
  474. rules: [{ required: true, message: '此项为必填项!' }],
  475. initialValue: theData.infoSources
  476. })(
  477. <Radio.Group>
  478. <Radio value="0">平台采集</Radio>
  479. <Radio value="1">客户发布</Radio>
  480. </Radio.Group>
  481. )}
  482. </FormItem>
  483. </div>
  484. <FormItem
  485. labelCol={{ span: 3 }}
  486. wrapperCol={{ span: 20 }}
  487. label="关键词" >
  488. <KeyWordTagGroup
  489. keyWordArr={this.state.tags}
  490. tagsArr={this.getTagsArr}
  491. visible={this.props.visible} />
  492. </FormItem>
  493. <FormItem
  494. labelCol={{ span: 3 }}
  495. wrapperCol={{ span: 18 }}
  496. label="行业类别" >
  497. {getFieldDecorator('industryCategory', {
  498. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  499. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  500. })(
  501. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  502. )}
  503. </FormItem>
  504. <div className="clearfix">
  505. <FormItem className="half-item"
  506. {...formItemLayout}
  507. label="需求类型" >
  508. {getFieldDecorator('demandType', {
  509. rules: [{ required: true, message: '此项为必填项!' }],
  510. initialValue: theData.demandType
  511. })(
  512. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  513. {this.props.demandTypeOption}
  514. </Select>
  515. )}
  516. </FormItem>
  517. </div>
  518. <FormItem
  519. labelCol={{ span: 3 }}
  520. wrapperCol={{ span: 18 }}
  521. label="问题说明" >
  522. {getFieldDecorator('problemDes', {
  523. rules: [{ required: true, message: '此项为必填项!' }],
  524. initialValue: theData.problemDes
  525. })(
  526. <Input type="textarea" rows={4} />
  527. )}
  528. </FormItem>
  529. <FormItem
  530. labelCol={{ span: 3 }}
  531. wrapperCol={{ span: 18 }}
  532. label="技术指标要求" >
  533. {getFieldDecorator('technicalRequirements', {
  534. initialValue: theData.technicalRequirements
  535. })(
  536. <Input type="textarea" rows={2} />
  537. )}
  538. </FormItem>
  539. <FormItem
  540. labelCol={{ span: 3 }}
  541. wrapperCol={{ span: 18 }}
  542. label="需求文件(图片)" >
  543. <PicturesWall
  544. uid={theData.uid}
  545. fileList={this.getPictureUrl}
  546. pictureUrl={this.state.pictureUrl}
  547. visible={this.props.visible} />
  548. </FormItem>
  549. <FormItem
  550. labelCol={{ span: 3 }}
  551. wrapperCol={{ span: 6 }}
  552. label="需求文件(文本)" >
  553. <Upload
  554. name="ratepay"
  555. action={globalConfig.context + "/api/admin/demand/uploadTextFile"}
  556. data={{ 'sign': 'demand_text_file', 'uid': theData.uid }}
  557. beforeUpload={beforeUploadFile}
  558. fileList={this.state.textFileList}
  559. onChange={(info) => {
  560. if (info.file.status !== 'uploading') {
  561. console.log(info.file, info.fileList);
  562. }
  563. if (info.file.status === 'done') {
  564. if (!info.file.response.error.length) {
  565. message.success(`${info.file.name} 文件上传成功!`);
  566. } else {
  567. message.warning(info.file.response.error[0].message);
  568. return;
  569. };
  570. this.state.textFileUrl = info.file.response.data;
  571. } else if (info.file.status === 'error') {
  572. message.error(`${info.file.name} 文件上传失败。`);
  573. };
  574. this.setState({ textFileList: info.fileList.slice(-1) });
  575. }} >
  576. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  577. </Upload>
  578. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  579. <span className="download-file">
  580. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  581. </span>
  582. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  583. </FormItem>
  584. <FormItem
  585. labelCol={{ span: 3 }}
  586. wrapperCol={{ span: 18 }}
  587. label="需求文件(视频地址)" >
  588. {getFieldDecorator('videoUrl', {
  589. initialValue: theData.videoUrl
  590. })(
  591. <Input />
  592. )}
  593. </FormItem>
  594. <div className="clearfix">
  595. <FormItem className="half-item"
  596. {...formItemLayout}
  597. label="固定周期" >
  598. {getFieldDecorator('fixedCycle', {
  599. initialValue: theData.fixedCycle
  600. })(
  601. <Input />
  602. )}
  603. </FormItem>
  604. <FormItem className="half-item"
  605. {...formItemLayout}
  606. label="固定人数" >
  607. {getFieldDecorator('peopleNumber', {
  608. initialValue: theData.peopleNumber
  609. })(
  610. <InputNumber />
  611. )}
  612. <span style={{ marginLeft: '20px' }}>人</span>
  613. </FormItem>
  614. </div>
  615. <FormItem
  616. labelCol={{ span: 3 }}
  617. wrapperCol={{ span: 18 }}
  618. label="固定方案" >
  619. {getFieldDecorator('fixedScheme', {
  620. initialValue: theData.fixedScheme
  621. })(
  622. <Input type="textarea" rows={2} />
  623. )}
  624. </FormItem>
  625. <div className="clearfix">
  626. <FormItem className="half-item"
  627. {...formItemLayout}
  628. label="预算费用" >
  629. {getFieldDecorator('budgetCost', {
  630. initialValue: theData.budgetCost
  631. })(
  632. <InputNumber />
  633. )}
  634. <span style={{ marginLeft: '20px' }}>万元</span>
  635. </FormItem>
  636. <FormItem className="half-item"
  637. {...formItemLayout}
  638. label="费用托管" >
  639. {getFieldDecorator('costEscrow', {
  640. initialValue: theData.costEscrow
  641. })(
  642. <Radio.Group>
  643. <Radio value={0}>否</Radio>
  644. <Radio value={1}>是</Radio>
  645. </Radio.Group>
  646. )}
  647. </FormItem>
  648. <FormItem className="half-item"
  649. {...formItemLayout}
  650. label="有效期限" >
  651. {getFieldDecorator('validityPeriod', {
  652. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  653. })(
  654. <DatePicker />
  655. )}
  656. </FormItem>
  657. </div>
  658. <div className="clearfix" style={{display:'none'}}>
  659. <FormItem className="half-item"
  660. {...formItemLayout}
  661. label="雇主地址" >
  662. <span>{theData.employerAddress}</span>
  663. </FormItem>
  664. <FormItem className="half-item"
  665. {...formItemLayout}
  666. label="雇主联系人名称" >
  667. <span>{theData.employerContacts}</span>
  668. </FormItem>
  669. <FormItem className="half-item"
  670. {...formItemLayout}
  671. label="雇主联系人电话" >
  672. <span>{theData.employerContactsMobile}</span>
  673. </FormItem>
  674. <FormItem className="half-item"
  675. {...formItemLayout}
  676. label="雇主联系人邮箱" >
  677. <span>{theData.employerContactsMailbox}</span>
  678. </FormItem>
  679. </div>
  680. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  681. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  682. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  683. </FormItem>
  684. </Form >
  685. )
  686. }
  687. }));
  688. const DemandDetail = React.createClass({
  689. getInitialState() {
  690. return {
  691. visible: false
  692. };
  693. },
  694. showModal() {
  695. this.setState({
  696. visible: true,
  697. });
  698. },
  699. handleCancel(e) {
  700. this.setState({
  701. visible: false,
  702. });
  703. this.props.closeDesc(false);
  704. },
  705. handleOk(e) {
  706. this.setState({
  707. visible: false,
  708. });
  709. this.props.closeDesc(false, true);
  710. },
  711. componentWillReceiveProps(nextProps) {
  712. this.state.visible = nextProps.showDesc;
  713. },
  714. render() {
  715. if (this.props.data) {
  716. return (
  717. <div className="patent-desc">
  718. <Modal maskClosable={false} title="用户需求详情" visible={this.state.visible}
  719. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  720. width='1000px'
  721. footer=''
  722. className="admin-desc-content">
  723. <DemandDetailForm
  724. data={this.props.data}
  725. detailApiUrl={this.props.detailApiUrl}
  726. companyOption={this.props.companyOption}
  727. userOption={this.props.userOption}
  728. demandTypeOption={this.props.demandTypeOption}
  729. closeDesc={this.handleCancel}
  730. visible={this.state.visible}
  731. handleOk={this.handleOk} />
  732. </Modal>
  733. </div>
  734. );
  735. } else {
  736. return <div></div>
  737. }
  738. },
  739. });
  740. export default DemandDetail;