demandReleaseDesc.jsx 38 KB

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