demandReleaseDesc.jsx 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  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. </div>
  392. {this.state.radios==true ? <div>
  393. <FormItem
  394. labelCol={{ span: 3 }}
  395. wrapperCol={{ span: 18 }}
  396. label="首页展示图片:" >
  397. <div className="clearfix">
  398. <Upload className="demandDetailShow-upload"
  399. listType="picture-card"
  400. fileList={this.state.coverImg}
  401. onPreview={(file) => {
  402. this.setState({
  403. previewImage: file.url || file.thumbUrl,
  404. previewVisible: true,
  405. });
  406. }} >
  407. </Upload>
  408. <Modal maskClosable={false} footer={null}
  409. visible={this.state.previewVisible}
  410. onCancel={() => { this.setState({ previewVisible: false }) }}>
  411. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  412. </Modal>
  413. </div>
  414. </FormItem>
  415. </div> :<div></div>}
  416. {this.state.switchValue ? <div>
  417. <FormItem className="half-item"
  418. {...formItemLayout}
  419. label="雇主名称" >
  420. <span>{theData.employerName}</span>
  421. </FormItem>
  422. <FormItem className="half-item"
  423. {...formItemLayout}
  424. label="联系电话" >
  425. <span>{theData.employerContactsMobile}</span>
  426. </FormItem>
  427. <FormItem className="half-item"
  428. {...formItemLayout}
  429. label="电子邮箱" >
  430. <span>{theData.employerContactsMailbox}</span>
  431. </FormItem>
  432. <FormItem className="half-item"
  433. {...formItemLayout}
  434. label="通讯地址" >
  435. <span>{theData.employerAddress}</span>
  436. </FormItem>
  437. </div> : <div className="clearfix">
  438. <FormItem className="half-item"
  439. {...formItemLayout}
  440. label="雇主名称" >
  441. <span>{theData.username}</span>
  442. </FormItem>
  443. {this.props.data.dataCategory ? <FormItem className="half-item"
  444. {...formItemLayout}
  445. label="联系人" >
  446. <span>{this.state.contactsObj[theData.contacts]}</span>
  447. </FormItem> : <FormItem className="half-item"
  448. {...formItemLayout}
  449. label="联系人" >
  450. <span>{theData.contactsName}</span>
  451. </FormItem>}
  452. </div>}
  453. <div className="clearfix">
  454. <FormItem className="half-item"
  455. {...formItemLayout}
  456. label="负责人" >
  457. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  458. </FormItem>
  459. </div>
  460. <div className="clearfix">
  461. <FormItem className="half-item"
  462. {...formItemLayout}
  463. label="是否发布" >
  464. {(() => {
  465. switch (theData.releaseStatus) {
  466. case "0":
  467. return <div><span>未发布</span>
  468. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>发布</Button>
  469. <Modal maskClosable={false} title="确认"
  470. visible={this.state.releaseSubmitVisible}
  471. width='400px'
  472. footer={null}
  473. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  474. <span>确认要发布吗?</span>
  475. <Button className="modal-submit" type="primary" onClick={this.ShelfOk} >确认</Button>
  476. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  477. </Modal></div>
  478. ;
  479. case "1":
  480. return <div>
  481. <span>已发布</span>
  482. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  483. <Modal maskClosable={false} title="确认"
  484. visible={this.state.releaseSubmitVisible}
  485. width='400px'
  486. footer={null}
  487. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  488. <span>确认要撤销发布吗?</span>
  489. <Button className="modal-submit" type="primary" onClick={this.ShelfCancel} >确认</Button>
  490. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  491. </Modal>
  492. </div>;
  493. }
  494. })()}
  495. </FormItem>
  496. <FormItem className="half-item"
  497. {...formItemLayout}
  498. label="发布时间" >
  499. <span>{theData.releaseDateFormattedDate}</span>
  500. </FormItem>
  501. </div>
  502. <FormItem className="half-item"
  503. {...formItemLayout}
  504. label="加急天数" >
  505. <span>{theData.urgentDays}</span>
  506. </FormItem>
  507. <FormItem className="half-item"
  508. {...formItemLayout}
  509. label="加急报酬" >
  510. <span>{theData.urgentMoney}</span>
  511. </FormItem>
  512. <div className="clearfix">
  513. <FormItem className="half-item"
  514. {...formItemLayout}
  515. label="需求状态" >
  516. {(() => {
  517. switch (theData.status) {
  518. case "0":
  519. return <span>未解决</span>;
  520. case "1":
  521. return <span>已解决</span>;
  522. }
  523. })()}
  524. </FormItem>
  525. <FormItem className="half-item"
  526. {...formItemLayout}
  527. label="审核状态" >
  528. {(() => {
  529. switch (theData.auditStatus) {
  530. case 0:
  531. return <span>未提交审核(草稿)</span>;
  532. case 1:
  533. return <span>提交审核</span>;
  534. case 2:
  535. return <span>审核中</span>;
  536. case 3:
  537. return <span>审核通过</span>;
  538. case 4:
  539. return <span>审核未通过</span>;
  540. }
  541. })()}
  542. </FormItem>
  543. </div>
  544. <div className="clearfix">
  545. <FormItem className="half-item"
  546. {...formItemLayout}
  547. label="信息来源" >
  548. {(() => {
  549. switch (theData.infoSources) {
  550. case "0":
  551. return <span>平台采集</span>;
  552. case "1":
  553. return <span>客户发布</span>;
  554. case "2":
  555. return <span>批量导入</span>;
  556. case "3":
  557. return <span>三方对接</span>;
  558. }
  559. })()}
  560. </FormItem>
  561. </div>
  562. <FormItem
  563. labelCol={{ span: 3 }}
  564. wrapperCol={{ span: 20 }}
  565. label="关键词" >
  566. {this.state.tags.map((tag) => {
  567. return <Tooltip key={tag} title={tag}>
  568. <Tag key={tag}>{tag}</Tag>
  569. </Tooltip>;
  570. })}
  571. </FormItem>
  572. <FormItem
  573. labelCol={{ span: 3 }}
  574. wrapperCol={{ span: 18 }}
  575. label="行业类别" >
  576. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  577. </FormItem>
  578. <div className="clearfix">
  579. <FormItem className="half-item"
  580. {...formItemLayout}
  581. label="需求类型" >
  582. <span>{getDemandType(theData.demandType)}</span>
  583. </FormItem>
  584. </div>
  585. <FormItem
  586. labelCol={{ span: 3 }}
  587. wrapperCol={{ span: 18 }}
  588. label="问题说明" >
  589. <span>{theData.problemDes}</span>
  590. </FormItem>
  591. <FormItem
  592. labelCol={{ span: 3 }}
  593. wrapperCol={{ span: 18 }}
  594. label="备注" >
  595. <span>{theData.remark}</span>
  596. </FormItem>
  597. <FormItem
  598. labelCol={{ span: 3 }}
  599. wrapperCol={{ span: 18 }}
  600. label="技术指标要求" >
  601. <span>{theData.technicalRequirements}</span>
  602. </FormItem>
  603. <FormItem
  604. labelCol={{ span: 3 }}
  605. wrapperCol={{ span: 18 }}
  606. label="需求文件(图片)" >
  607. <div className="clearfix">
  608. <Upload className="demandDetailShow-upload"
  609. listType="picture-card"
  610. fileList={this.state.pictureUrl}
  611. onPreview={(file) => {
  612. this.setState({
  613. previewImage: file.url || file.thumbUrl,
  614. previewVisible: true,
  615. });
  616. }} >
  617. </Upload>
  618. <Modal maskClosable={false} footer={null}
  619. visible={this.state.previewVisible}
  620. onCancel={() => { this.setState({ previewVisible: false }) }}>
  621. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  622. </Modal>
  623. </div>
  624. </FormItem>
  625. <FormItem
  626. labelCol={{ span: 3 }}
  627. wrapperCol={{ span: 6 }}
  628. label="需求文件(文本)" >
  629. <div>{theData.textFileUrl ?
  630. <span className="download-file">
  631. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  632. </span>
  633. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  634. </FormItem>
  635. <FormItem
  636. labelCol={{ span: 3 }}
  637. wrapperCol={{ span: 18 }}
  638. label="需求文件(视频地址)" >
  639. <span>{theData.videoUrl}</span>
  640. </FormItem>
  641. <div className="clearfix">
  642. <FormItem className="half-item"
  643. {...formItemLayout}
  644. label="固定周期" >
  645. <span>{theData.fixedCycle}</span>
  646. </FormItem>
  647. <FormItem className="half-item"
  648. {...formItemLayout}
  649. label="固定人数" >
  650. <span>{theData.peopleNumber || 0} 人</span>
  651. </FormItem>
  652. </div>
  653. <FormItem
  654. labelCol={{ span: 3 }}
  655. wrapperCol={{ span: 18 }}
  656. label="固定方案" >
  657. <span>{theData.fixedScheme}</span>
  658. </FormItem>
  659. <div className="clearfix">
  660. <FormItem className="half-item"
  661. {...formItemLayout}
  662. label="预算费用" >
  663. <span>{theData.budgetCost || 0} 万元</span>
  664. </FormItem>
  665. <FormItem className="half-item"
  666. {...formItemLayout}
  667. label="费用托管" >
  668. {(() => {
  669. switch (theData.costEscrow) {
  670. case 0:
  671. return <span>否</span>;
  672. case 1:
  673. return <span>是</span>;
  674. }
  675. })()}
  676. </FormItem>
  677. <FormItem className="half-item"
  678. {...formItemLayout}
  679. label="有效期限" >
  680. <span>{theData.validityPeriodFormattedDate}</span>
  681. </FormItem>
  682. </div>
  683. </Spin>
  684. </Form >
  685. )
  686. }
  687. }));
  688. const DemandDetail = React.createClass({
  689. getInitialState() {
  690. return {
  691. visible: false,
  692. techBrodersObj: {},
  693. tabsKey: "1",
  694. columns: [
  695. {
  696. title: '编号',
  697. dataIndex: 'serialNumber',
  698. key: 'serialNumber',
  699. }, {
  700. title: '名称',
  701. dataIndex: 'name',
  702. key: 'name',
  703. }, {
  704. title: '关键字',
  705. dataIndex: 'keyword',
  706. key: 'keyword',
  707. }, {
  708. title: '类型',
  709. dataIndex: 'category',
  710. key: 'category',
  711. render: text => { return getAchievementCategory(text); }
  712. }, {
  713. title: '所有人名称',
  714. dataIndex: 'theName',
  715. key: 'theName',
  716. }, {
  717. title: '所有人类型',
  718. dataIndex: 'ownerType',
  719. key: 'ownerType',
  720. render: text => {
  721. switch (text) {
  722. case "0":
  723. return <span>个人</span>;
  724. case "1":
  725. return <span>组织</span>
  726. }
  727. }
  728. }, {
  729. title: '发布时间',
  730. dataIndex: 'releaseDateFormattedDate',
  731. key: 'releaseDateFormattedDate',
  732. }
  733. ],
  734. dataSource: [],
  735. };
  736. },
  737. getTechBrodersList() {
  738. this.setState({
  739. loading: true
  740. });
  741. $.ajax({
  742. method: "get",
  743. dataType: "json",
  744. crossDomain: false,
  745. url: globalConfig.context + "/api/admin/audit/techBroders",
  746. success: function (data) {
  747. if (!data.data) {
  748. if (data.error && data.error.length) {
  749. message.warning(data.error[0].message);
  750. }
  751. return;
  752. };
  753. let _me = this, theArr = [];
  754. for (var item in data.data) {
  755. theArr.push(
  756. <Select.Option key={item}>{data.data[item]}</Select.Option>
  757. )
  758. };
  759. this.setState({
  760. techBrodersOption: theArr,
  761. techBrodersObj: data.data
  762. });
  763. }.bind(this),
  764. }).always(function () {
  765. this.setState({
  766. loading: false
  767. });
  768. }.bind(this));
  769. },
  770. getTableList() {
  771. this.setState({
  772. loading: true
  773. });
  774. $.ajax({
  775. method: "get",
  776. dataType: "json",
  777. crossDomain: false,
  778. url: globalConfig.context + "/api/admin/demand/achievementDemand",
  779. data: { id: this.props.data.id },
  780. success: function (data) {
  781. let theArr = [];
  782. if (!data.data) {
  783. if (data.error && data.error.length) {
  784. message.warning(data.error[0].message);
  785. };
  786. } else if (data.data.length) {
  787. for (let i = 0; i < data.data.length; i++) {
  788. let thisdata = data.data[i];
  789. theArr.push({
  790. key: i,
  791. id: thisdata.id,
  792. serialNumber: thisdata.serialNumber,
  793. dataCategory: thisdata.dataCategory,
  794. name: thisdata.name,
  795. keyword: thisdata.keyword,
  796. category: thisdata.category,
  797. ownerType: thisdata.ownerType,
  798. theName: thisdata.username || thisdata.unitName,
  799. releaseDate: thisdata.releaseDate,
  800. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  801. });
  802. };
  803. };
  804. this.setState({
  805. dataSource: theArr,
  806. });
  807. }.bind(this),
  808. }).always(function () {
  809. this.setState({
  810. loading: false
  811. });
  812. }.bind(this));
  813. },
  814. tableRowClick(record, index) {
  815. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  816. },
  817. handleCancel(e) {
  818. this.setState({
  819. visible: false,
  820. });
  821. this.props.closeDesc(false);
  822. },
  823. handleOk(e) {
  824. this.setState({
  825. visible: false,
  826. });
  827. this.props.closeDesc(false, true);
  828. },
  829. componentWillMount() {
  830. this.getTechBrodersList();
  831. },
  832. componentWillReceiveProps(nextProps) {
  833. if (!this.state.visible && nextProps.showDesc) {
  834. this.state.tabsKey = "1";
  835. };
  836. this.state.visible = nextProps.showDesc;
  837. },
  838. render() {
  839. if (this.props.data) {
  840. return (
  841. <div className="patent-desc">
  842. <Modal maskClosable={false} visible={this.state.visible}
  843. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  844. width='1200px'
  845. footer=''
  846. className="admin-desc-content">
  847. <Spin spinning={this.state.loading}>
  848. <Tabs activeKey={this.state.tabsKey}
  849. onChange={(e) => {
  850. this.setState({ tabsKey: e });
  851. if (e == "2") {
  852. this.getTableList();
  853. };
  854. }} >
  855. <Tabs.TabPane tab="需求详情" key="1">
  856. <DemandDetailShow
  857. data={this.props.data}
  858. detailApiUrl={this.props.detailApiUrl}
  859. techBrodersOption={this.state.techBrodersOption}
  860. techBrodersObj={this.state.techBrodersObj}
  861. demandTypeOption={this.props.demandTypeOption}
  862. closeDesc={this.handleCancel}
  863. visible={this.state.visible}
  864. handleOk={this.handleOk} />
  865. </Tabs.TabPane>
  866. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  867. <Table columns={this.state.columns}
  868. dataSource={this.state.dataSource}
  869. pagination={false}
  870. style={{
  871. cursor: 'pointer',
  872. }}
  873. onRowClick={this.tableRowClick} />
  874. </Tabs.TabPane>
  875. </Tabs>
  876. </Spin>
  877. </Modal>
  878. </div>
  879. );
  880. } else {
  881. return <div></div>
  882. }
  883. },
  884. });
  885. export default DemandDetail;