demandReleaseDesc.jsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. import React from 'react';
  2. import { AutoComplete, Switch, Tabs, Table, 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 { getTechField } from '../../../DicTechFieldList.js';
  9. import { beforeUploadFile, getTechAuditStatus, splitUrl, companySearch, getDemandType, getAchievementCategory,beforeUpload, getBase64 } from '../../../tools.js';
  10. import throttle from '../../../throttle.js';
  11. const KeyWordTagGroup = React.createClass({
  12. getInitialState() {
  13. return {
  14. tags: [],
  15. inputVisible: false,
  16. inputValue: ''
  17. };
  18. },
  19. handleClose(removedTag) {
  20. const tags = this.state.tags.filter(tag => tag !== removedTag);
  21. this.props.tagsArr(tags);
  22. this.setState({ tags });
  23. },
  24. showInput() {
  25. this.setState({ inputVisible: true }, () => this.input.focus());
  26. },
  27. handleInputChange(e) {
  28. this.setState({ inputValue: e.target.value });
  29. },
  30. handleInputConfirm() {
  31. const state = this.state;
  32. const inputValue = state.inputValue;
  33. let tags = state.tags;
  34. if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
  35. tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
  36. }
  37. this.props.tagsArr(tags);
  38. this.setState({
  39. tags,
  40. inputVisible: false,
  41. inputValue: '',
  42. });
  43. },
  44. componentWillMount() {
  45. this.state.tags = this.props.keyWordArr;
  46. },
  47. componentWillReceiveProps(nextProps) {
  48. if (this.props.keyWordArr != nextProps.keyWordArr) {
  49. this.state.tags = nextProps.keyWordArr;
  50. };
  51. },
  52. render() {
  53. const { tags, inputVisible, inputValue } = this.state;
  54. return (
  55. <div className="keyWord-tips">
  56. {tags.map((tag, index) => {
  57. const isLongTag = tag.length > 10;
  58. const tagElem = (
  59. <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
  60. {isLongTag ? `${tag.slice(0, 10)}...` : tag}
  61. </Tag>
  62. );
  63. return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
  64. })}
  65. {inputVisible && (
  66. <Input
  67. ref={input => this.input = input}
  68. type="text"
  69. style={{ width: 78 }}
  70. value={inputValue}
  71. onChange={this.handleInputChange}
  72. onBlur={this.handleInputConfirm}
  73. onPressEnter={this.handleInputConfirm}
  74. />
  75. )}
  76. {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
  77. </div>
  78. );
  79. }
  80. });
  81. const PicturesWall = React.createClass({
  82. getInitialState() {
  83. return {
  84. previewVisible: false,
  85. previewImage: '',
  86. fileList: [],
  87. }
  88. },
  89. handleCancel() {
  90. this.setState({ previewVisible: false })
  91. },
  92. handlePreview(file) {
  93. this.setState({
  94. previewImage: file.url || file.thumbUrl,
  95. previewVisible: true,
  96. });
  97. },
  98. handleChange(info) {
  99. let fileList = info.fileList;
  100. this.setState({ fileList });
  101. this.props.fileList(fileList);
  102. },
  103. componentWillReceiveProps(nextProps) {
  104. this.state.fileList = nextProps.pictureUrl;
  105. },
  106. render() {
  107. const { previewVisible, previewImage, fileList } = this.state;
  108. const uploadButton = (
  109. <div>
  110. <Icon type="plus" />
  111. <div className="ant-upload-text">点击上传</div>
  112. </div>
  113. );
  114. return (
  115. <div className="clearfix">
  116. <Upload
  117. action={globalConfig.context + "/api/admin/demand/uploadPicture"}
  118. data={{ 'sign': this.props.pictureSign, 'uid': this.props.uid}}
  119. listType="picture-card"
  120. fileList={fileList}
  121. onPreview={this.handlePreview}
  122. onChange={this.handleChange} >
  123. {fileList.length >= 5 ? null : uploadButton}
  124. </Upload>
  125. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  126. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  127. </Modal>
  128. </div>
  129. );
  130. }
  131. });
  132. const DemandDetailShow = Form.create()(React.createClass({
  133. getInitialState() {
  134. return {
  135. visible: false,
  136. loading: false,
  137. contactsObj: {},
  138. salesmanObj: {},
  139. data: {},
  140. tags: [],
  141. pictureUrl: [],
  142. coverImg: []
  143. };
  144. },
  145. loadData(id, detailApiUrl,dataCategory) {
  146. this.setState({
  147. loading: true
  148. });
  149. $.ajax({
  150. method: "get",
  151. dataType: "json",
  152. crossDomain: false,
  153. url: globalConfig.context + "/api/admin/demand/orgDemandDetail",
  154. data: {
  155. id: id,
  156. dataCategory:dataCategory?dataCategory:this.props.data.dataCategory
  157. },
  158. success: function (data) {
  159. let thisData = data.data;
  160. if (!thisData) {
  161. if (data.error && data.error.length) {
  162. message.warning(data.error[0].message);
  163. };
  164. thisData = {};
  165. };
  166. this.setState({
  167. data: thisData,
  168. switchValue: Boolean(!thisData.employerId),
  169. radios: thisData.hot == '1' ? true : false,
  170. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  171. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  172. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : []
  173. });
  174. }.bind(this),
  175. }).always(function () {
  176. this.setState({
  177. loading: false
  178. });
  179. }.bind(this));
  180. },
  181. getContactsList(theUid) {
  182. $.ajax({
  183. method: "get",
  184. dataType: "json",
  185. crossDomain: false,
  186. url: globalConfig.context + "/api/admin/getContacts",
  187. data: {
  188. uid: theUid
  189. },
  190. success: function (data) {
  191. let theOption = [];
  192. if (!data.data) {
  193. if (data.error && data.error.length) {
  194. message.warning(data.error[0].message);
  195. };
  196. } else {
  197. this.setState({
  198. contactsObj: data.data
  199. });
  200. };
  201. }.bind(this),
  202. });
  203. },
  204. ShelfCancel(){
  205. let api=0;
  206. this.offShelf(api);
  207. },
  208. ShelfOk(){
  209. let api=1;
  210. this.offShelf(api);
  211. },
  212. offShelf(nub) {
  213. this.setState({
  214. loading: true
  215. });
  216. $.ajax({
  217. method: "post",
  218. dataType: "json",
  219. crossDomain: false,
  220. url: globalConfig.context + "/api/admin/demand/offShelf",
  221. data: {
  222. "id": this.props.data.id,
  223. releaseStatus:nub,
  224. auditStatus:3
  225. }
  226. }).done(function (data) {
  227. if (!data.error.length) {
  228. message.success('操作成功!');
  229. this.props.handleOk();
  230. } else {
  231. message.warning(data.error[0].message);
  232. };
  233. this.setState({
  234. loading: false,
  235. releaseSubmitVisible: false
  236. });
  237. }.bind(this));
  238. },
  239. modifyBroker() {
  240. this.props.form.validateFields((err, values) => {
  241. if (!err) {
  242. this.setState({
  243. loading: true
  244. });
  245. $.ajax({
  246. method: "POST",
  247. dataType: "json",
  248. crossDomain: false,
  249. url: globalConfig.context + '/api/admin/audit/modifyDemandTechBroker',
  250. data: {
  251. id: this.props.data.id,
  252. techBrokerId: values.modifyTechBrokerId
  253. }
  254. }).done(function (data) {
  255. this.state.auditStatus = 0;
  256. this.setState({
  257. loading: false
  258. });
  259. if (data.error && data.error.length) {
  260. message.warning(data.error[0].message);
  261. } else {
  262. message.success('保存成功!');
  263. this.props.handleOk();
  264. };
  265. }.bind(this));
  266. }
  267. });
  268. },
  269. formSubmit() {
  270. this.props.form.validateFields((err, values) => {
  271. if (values.auditStatus == 3 && !values.techBrokerId) {
  272. message.warning('必须选择一个技术经纪人!');
  273. return
  274. };
  275. if (!err) {
  276. this.setState({
  277. loading: true
  278. });
  279. $.ajax({
  280. method: "POST",
  281. dataType: "json",
  282. crossDomain: false,
  283. url: globalConfig.context + '/api/admin/audit/demand',
  284. data: {
  285. id: this.props.data.id,
  286. techBroderId: values.techBrokerId,
  287. auditStatus: values.auditStatus
  288. }
  289. }).done(function (data) {
  290. this.state.auditStatus = 0;
  291. if (!data.error.length) {
  292. message.success('保存成功!');
  293. this.setState({ formSubmitVisible: false });
  294. this.props.handleOk();
  295. } else {
  296. message.warning(data.error[0].message);
  297. this.setState({
  298. loading: false,
  299. });
  300. }
  301. }.bind(this));
  302. }
  303. });
  304. },
  305. handleSubmit(e) {
  306. e.preventDefault();
  307. this.props.form.validateFields((err, values) => {
  308. if (values.auditStatus == 4) {
  309. this.setState({
  310. formSubmitVisible: true
  311. });
  312. } else {
  313. this.formSubmit();
  314. };
  315. });
  316. },
  317. buildMatchList() {
  318. this.setState({
  319. buttonLoading: true
  320. });
  321. $.ajax({
  322. method: "POST",
  323. dataType: "json",
  324. crossDomain: false,
  325. url: globalConfig.context + '/api/admin/demand/matchAchievement',
  326. data: {
  327. id: this.props.data.id,
  328. }
  329. }).done(function (data) {
  330. this.setState({
  331. buttonLoading: false
  332. });
  333. if (!data.error.length) {
  334. message.success('匹配完成!匹配到' + data.data + '条记录');
  335. } else {
  336. message.warning(data.error[0].message);
  337. };
  338. }.bind(this));
  339. },
  340. componentWillMount() {
  341. this.loadData(this.props.data.id, this.props.detailApiUrl);
  342. if (this.props.data.employerId && this.props.data.dataCategory) {
  343. this.getContactsList(this.props.data.employerId);
  344. };
  345. },
  346. componentWillReceiveProps(nextProps) {
  347. if (!this.props.visible && nextProps.visible) {
  348. this.loadData(nextProps.data.id, nextProps.detailApiUrl,nextProps.data.dataCategory);
  349. if (nextProps.data.employerId && nextProps.data.dataCategory) {
  350. this.getContactsList(nextProps.data.employerId);
  351. };
  352. this.props.form.resetFields();
  353. };
  354. },
  355. render() {
  356. const theData = this.state.data || {};
  357. const { getFieldDecorator } = this.props.form;
  358. const FormItem = Form.Item
  359. const formItemLayout = {
  360. labelCol: { span: 6 },
  361. wrapperCol: { span: 12 },
  362. };
  363. return (
  364. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  365. <Spin spinning={this.state.loading}>
  366. <div className="clearfix">
  367. <FormItem className="half-item"
  368. {...formItemLayout}
  369. label="编号" >
  370. <span>{theData.serialNumber}</span>
  371. </FormItem>
  372. <FormItem className="half-item"
  373. {...formItemLayout}
  374. label="需求名称" >
  375. <span>{theData.name}</span>
  376. </FormItem>
  377. </div>
  378. <div>
  379. <FormItem className="half-item"
  380. {...formItemLayout}
  381. label="精品需求" >
  382. {(() => {
  383. switch (theData.boutique) {
  384. case "0":
  385. return <span>否</span>;
  386. case "1":
  387. return <span>是</span>;
  388. }
  389. })()}
  390. </FormItem>
  391. <FormItem className="half-item"
  392. {...formItemLayout}
  393. label="首页展示" >
  394. {(() => {
  395. switch (theData.hot) {
  396. case "0":
  397. return <span>否</span>;
  398. case "1":
  399. return <span>是</span>;
  400. }
  401. })()}
  402. </FormItem>
  403. </div>
  404. {this.state.radios==true ? <div>
  405. <FormItem
  406. labelCol={{ span: 3 }}
  407. wrapperCol={{ span: 18 }}
  408. label="首页展示图片:" >
  409. <div className="clearfix">
  410. <Upload className="demandDetailShow-upload"
  411. listType="picture-card"
  412. fileList={this.state.coverImg}
  413. onPreview={(file) => {
  414. this.setState({
  415. previewImage: file.url || file.thumbUrl,
  416. previewVisible: true,
  417. });
  418. }} >
  419. </Upload>
  420. <Modal maskClosable={false} footer={null}
  421. visible={this.state.previewVisible}
  422. onCancel={() => { this.setState({ previewVisible: false }) }}>
  423. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  424. </Modal>
  425. </div>
  426. </FormItem>
  427. </div> :<div></div>}
  428. {this.state.switchValue ? <div>
  429. <FormItem className="half-item"
  430. {...formItemLayout}
  431. label="雇主名称" >
  432. <span>{theData.employerName}</span>
  433. </FormItem>
  434. <FormItem className="half-item"
  435. {...formItemLayout}
  436. label="联系电话" >
  437. <span>{theData.employerContactsMobile}</span>
  438. </FormItem>
  439. <FormItem className="half-item"
  440. {...formItemLayout}
  441. label="电子邮箱" >
  442. <span>{theData.employerContactsMailbox}</span>
  443. </FormItem>
  444. <FormItem className="half-item"
  445. {...formItemLayout}
  446. label="通讯地址" >
  447. <span>{theData.employerAddress}</span>
  448. </FormItem>
  449. </div> : <div className="clearfix">
  450. <FormItem className="half-item"
  451. {...formItemLayout}
  452. label="雇主名称" >
  453. <span>{theData.username}</span>
  454. </FormItem>
  455. {this.props.data.dataCategory ? <FormItem className="half-item"
  456. {...formItemLayout}
  457. label="联系人" >
  458. <span>{this.state.contactsObj[theData.contacts]}</span>
  459. </FormItem> : <FormItem className="half-item"
  460. {...formItemLayout}
  461. label="联系人" >
  462. <span>{theData.contactsName}</span>
  463. </FormItem>}
  464. </div>}
  465. <div className="clearfix">
  466. <FormItem className="half-item"
  467. {...formItemLayout}
  468. label="负责人" >
  469. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  470. </FormItem>
  471. </div>
  472. <div className="clearfix">
  473. <FormItem className="half-item"
  474. {...formItemLayout}
  475. label="是否发布" >
  476. {(() => {
  477. switch (theData.releaseStatus) {
  478. case "0":
  479. return <div><span>未发布</span>
  480. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>发布</Button>
  481. <Modal maskClosable={false} title="确认"
  482. visible={this.state.releaseSubmitVisible}
  483. width='400px'
  484. footer={null}
  485. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  486. <span>确认要发布吗?</span>
  487. <Button className="modal-submit" type="primary" onClick={this.ShelfOk} >确认</Button>
  488. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  489. </Modal></div>
  490. ;
  491. case "1":
  492. return <div>
  493. <span>已发布</span>
  494. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  495. <Modal maskClosable={false} title="确认"
  496. visible={this.state.releaseSubmitVisible}
  497. width='400px'
  498. footer={null}
  499. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  500. <span>确认要撤销发布吗?</span>
  501. <Button className="modal-submit" type="primary" onClick={this.ShelfCancel} >确认</Button>
  502. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  503. </Modal>
  504. </div>;
  505. }
  506. })()}
  507. </FormItem>
  508. <FormItem className="half-item"
  509. {...formItemLayout}
  510. label="发布时间" >
  511. <span>{theData.releaseDateFormattedDate}</span>
  512. </FormItem>
  513. </div>
  514. <FormItem className="half-item"
  515. {...formItemLayout}
  516. label="加急天数" >
  517. <span>{theData.urgentDays}</span>
  518. </FormItem>
  519. <FormItem className="half-item"
  520. {...formItemLayout}
  521. label="加急报酬" >
  522. <span>{theData.urgentMoney}</span>
  523. </FormItem>
  524. <div className="clearfix">
  525. <FormItem className="half-item"
  526. {...formItemLayout}
  527. label="需求状态" >
  528. {(() => {
  529. switch (theData.status) {
  530. case "0":
  531. return <span>未解决</span>;
  532. case "1":
  533. return <span>已解决</span>;
  534. }
  535. })()}
  536. </FormItem>
  537. <FormItem className="half-item"
  538. {...formItemLayout}
  539. label="审核状态" >
  540. {(() => {
  541. switch (theData.auditStatus) {
  542. case 0:
  543. return <span>未提交审核(草稿)</span>;
  544. case 1:
  545. return <span>提交审核</span>;
  546. case 2:
  547. return <span>审核中</span>;
  548. case 3:
  549. return <span>审核通过</span>;
  550. case 4:
  551. return <span>审核未通过</span>;
  552. }
  553. })()}
  554. </FormItem>
  555. </div>
  556. <div className="clearfix">
  557. <FormItem className="half-item"
  558. {...formItemLayout}
  559. label="信息来源" >
  560. {(() => {
  561. switch (theData.infoSources) {
  562. case "0":
  563. return <span>平台采集</span>;
  564. case "1":
  565. return <span>客户发布</span>;
  566. case "2":
  567. return <span>批量导入</span>;
  568. case "3":
  569. return <span>三方对接</span>;
  570. }
  571. })()}
  572. </FormItem>
  573. </div>
  574. <FormItem
  575. labelCol={{ span: 3 }}
  576. wrapperCol={{ span: 20 }}
  577. label="关键词" >
  578. {this.state.tags.map((tag) => {
  579. return <Tooltip key={tag} title={tag}>
  580. <Tag key={tag}>{tag}</Tag>
  581. </Tooltip>;
  582. })}
  583. </FormItem>
  584. <FormItem
  585. labelCol={{ span: 3 }}
  586. wrapperCol={{ span: 18 }}
  587. label="行业类别" >
  588. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  589. </FormItem>
  590. <div className="clearfix">
  591. <FormItem className="half-item"
  592. {...formItemLayout}
  593. label="需求类型" >
  594. <span>{getDemandType(theData.demandType)}</span>
  595. </FormItem>
  596. </div>
  597. <FormItem
  598. labelCol={{ span: 3 }}
  599. wrapperCol={{ span: 18 }}
  600. label="问题说明" >
  601. <span>{theData.problemDes}</span>
  602. </FormItem>
  603. <FormItem
  604. labelCol={{ span: 3 }}
  605. wrapperCol={{ span: 18 }}
  606. label="备注" >
  607. <span>{theData.remark}</span>
  608. </FormItem>
  609. <FormItem
  610. labelCol={{ span: 3 }}
  611. wrapperCol={{ span: 18 }}
  612. label="技术指标要求" >
  613. <span>{theData.technicalRequirements}</span>
  614. </FormItem>
  615. <FormItem
  616. labelCol={{ span: 3 }}
  617. wrapperCol={{ span: 18 }}
  618. label="需求文件(图片)" >
  619. <div className="clearfix">
  620. <Upload className="demandDetailShow-upload"
  621. listType="picture-card"
  622. fileList={this.state.pictureUrl}
  623. onPreview={(file) => {
  624. this.setState({
  625. previewImage: file.url || file.thumbUrl,
  626. previewVisible: true,
  627. });
  628. }} >
  629. </Upload>
  630. <Modal maskClosable={false} footer={null}
  631. visible={this.state.previewVisible}
  632. onCancel={() => { this.setState({ previewVisible: false }) }}>
  633. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  634. </Modal>
  635. </div>
  636. </FormItem>
  637. <FormItem
  638. labelCol={{ span: 3 }}
  639. wrapperCol={{ span: 6 }}
  640. label="需求文件(文本)" >
  641. <div>{theData.textFileUrl ?
  642. <span className="download-file">
  643. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  644. </span>
  645. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  646. </FormItem>
  647. <FormItem
  648. labelCol={{ span: 3 }}
  649. wrapperCol={{ span: 18 }}
  650. label="需求文件(视频地址)" >
  651. <span>{theData.videoUrl}</span>
  652. </FormItem>
  653. <div className="clearfix">
  654. <FormItem className="half-item"
  655. {...formItemLayout}
  656. label="固定周期" >
  657. <span>{theData.fixedCycle}</span>
  658. </FormItem>
  659. <FormItem className="half-item"
  660. {...formItemLayout}
  661. label="固定人数" >
  662. <span>{theData.peopleNumber || 0} 人</span>
  663. </FormItem>
  664. </div>
  665. <FormItem
  666. labelCol={{ span: 3 }}
  667. wrapperCol={{ span: 18 }}
  668. label="固定方案" >
  669. <span>{theData.fixedScheme}</span>
  670. </FormItem>
  671. <div className="clearfix">
  672. <FormItem className="half-item"
  673. {...formItemLayout}
  674. label="预算费用" >
  675. <span>{theData.budgetCost || 0} 万元</span>
  676. </FormItem>
  677. <FormItem className="half-item"
  678. {...formItemLayout}
  679. label="费用托管" >
  680. {(() => {
  681. switch (theData.costEscrow) {
  682. case 0:
  683. return <span>否</span>;
  684. case 1:
  685. return <span>是</span>;
  686. }
  687. })()}
  688. </FormItem>
  689. <FormItem className="half-item"
  690. {...formItemLayout}
  691. label="有效期限" >
  692. <span>{theData.validityPeriodFormattedDate}</span>
  693. </FormItem>
  694. </div>
  695. </Spin>
  696. </Form >
  697. )
  698. }
  699. }));
  700. const DemandDetail = React.createClass({
  701. getInitialState() {
  702. return {
  703. visible: false,
  704. techBrodersObj: {},
  705. tabsKey: "1",
  706. columns: [
  707. {
  708. title: '编号',
  709. dataIndex: 'serialNumber',
  710. key: 'serialNumber',
  711. }, {
  712. title: '名称',
  713. dataIndex: 'name',
  714. key: 'name',
  715. }, {
  716. title: '关键字',
  717. dataIndex: 'keyword',
  718. key: 'keyword',
  719. }, {
  720. title: '类型',
  721. dataIndex: 'category',
  722. key: 'category',
  723. render: text => { return getAchievementCategory(text); }
  724. }, {
  725. title: '所有人名称',
  726. dataIndex: 'theName',
  727. key: 'theName',
  728. }, {
  729. title: '所有人类型',
  730. dataIndex: 'ownerType',
  731. key: 'ownerType',
  732. render: text => {
  733. switch (text) {
  734. case "0":
  735. return <span>个人</span>;
  736. case "1":
  737. return <span>组织</span>
  738. }
  739. }
  740. }, {
  741. title: '发布时间',
  742. dataIndex: 'releaseDateFormattedDate',
  743. key: 'releaseDateFormattedDate',
  744. }
  745. ],
  746. dataSource: [],
  747. };
  748. },
  749. getTechBrodersList() {
  750. this.setState({
  751. loading: true
  752. });
  753. $.ajax({
  754. method: "get",
  755. dataType: "json",
  756. crossDomain: false,
  757. url: globalConfig.context + "/api/admin/audit/techBroders",
  758. success: function (data) {
  759. if (!data.data) {
  760. if (data.error && data.error.length) {
  761. message.warning(data.error[0].message);
  762. }
  763. return;
  764. };
  765. let _me = this, theArr = [];
  766. for (var item in data.data) {
  767. theArr.push(
  768. <Select.Option key={item}>{data.data[item]}</Select.Option>
  769. )
  770. };
  771. this.setState({
  772. techBrodersOption: theArr,
  773. techBrodersObj: data.data
  774. });
  775. }.bind(this),
  776. }).always(function () {
  777. this.setState({
  778. loading: false
  779. });
  780. }.bind(this));
  781. },
  782. getTableList() {
  783. this.setState({
  784. loading: true
  785. });
  786. $.ajax({
  787. method: "get",
  788. dataType: "json",
  789. crossDomain: false,
  790. url: globalConfig.context + "/api/admin/demand/achievementDemand",
  791. data: { id: this.props.data.id },
  792. success: function (data) {
  793. let theArr = [];
  794. if (!data.data) {
  795. if (data.error && data.error.length) {
  796. message.warning(data.error[0].message);
  797. };
  798. } else if (data.data.length) {
  799. for (let i = 0; i < data.data.length; i++) {
  800. let thisdata = data.data[i];
  801. theArr.push({
  802. key: i,
  803. id: thisdata.id,
  804. serialNumber: thisdata.serialNumber,
  805. dataCategory: thisdata.dataCategory,
  806. name: thisdata.name,
  807. keyword: thisdata.keyword,
  808. category: thisdata.category,
  809. ownerType: thisdata.ownerType,
  810. theName: thisdata.username || thisdata.unitName,
  811. releaseDate: thisdata.releaseDate,
  812. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  813. });
  814. };
  815. };
  816. this.setState({
  817. dataSource: theArr,
  818. });
  819. }.bind(this),
  820. }).always(function () {
  821. this.setState({
  822. loading: false
  823. });
  824. }.bind(this));
  825. },
  826. tableRowClick(record, index) {
  827. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  828. },
  829. handleCancel(e) {
  830. this.setState({
  831. visible: false,
  832. });
  833. this.props.closeDesc(false);
  834. },
  835. handleOk(e) {
  836. this.setState({
  837. visible: false,
  838. });
  839. this.props.closeDesc(false, true);
  840. },
  841. componentWillMount() {
  842. this.getTechBrodersList();
  843. },
  844. componentWillReceiveProps(nextProps) {
  845. if (!this.state.visible && nextProps.showDesc) {
  846. this.state.tabsKey = "1";
  847. };
  848. this.state.visible = nextProps.showDesc;
  849. },
  850. render() {
  851. if (this.props.data) {
  852. return (
  853. <div className="patent-desc">
  854. <Modal maskClosable={false} visible={this.state.visible}
  855. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  856. width='1000px'
  857. footer=''
  858. className="admin-desc-content">
  859. <Spin spinning={this.state.loading}>
  860. <Tabs activeKey={this.state.tabsKey}
  861. onChange={(e) => {
  862. this.setState({ tabsKey: e });
  863. if (e == "2") {
  864. this.getTableList();
  865. };
  866. }} >
  867. <Tabs.TabPane tab="需求详情" key="1">
  868. <DemandDetailShow
  869. data={this.props.data}
  870. detailApiUrl={this.props.detailApiUrl}
  871. techBrodersOption={this.state.techBrodersOption}
  872. techBrodersObj={this.state.techBrodersObj}
  873. demandTypeOption={this.props.demandTypeOption}
  874. closeDesc={this.handleCancel}
  875. visible={this.state.visible}
  876. handleOk={this.handleOk} />
  877. </Tabs.TabPane>
  878. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  879. <Table columns={this.state.columns}
  880. dataSource={this.state.dataSource}
  881. pagination={false}
  882. onRowClick={this.tableRowClick} />
  883. </Tabs.TabPane>
  884. </Tabs>
  885. </Spin>
  886. </Modal>
  887. </div>
  888. );
  889. } else {
  890. return <div></div>
  891. }
  892. },
  893. });
  894. export default DemandDetail;