demandAuditDesc.jsx 38 KB

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