demandAuditDesc.jsx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  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. offShelf() {
  205. this.setState({
  206. loading: true
  207. });
  208. $.ajax({
  209. method: "post",
  210. dataType: "json",
  211. crossDomain: false,
  212. url: globalConfig.context + "/api/admin/demand/offShelf",
  213. data: { "id": this.props.data.id }
  214. }).done(function (data) {
  215. if (!data.error.length) {
  216. message.success('撤销成功!');
  217. this.props.handleOk();
  218. } else {
  219. message.warning(data.error[0].message);
  220. };
  221. this.setState({
  222. loading: false,
  223. releaseSubmitVisible: false
  224. });
  225. }.bind(this));
  226. },
  227. modifyBroker() {
  228. this.props.form.validateFields((err, values) => {
  229. if (!err) {
  230. this.setState({
  231. loading: true
  232. });
  233. $.ajax({
  234. method: "POST",
  235. dataType: "json",
  236. crossDomain: false,
  237. url: globalConfig.context + '/api/admin/audit/modifyDemandTechBroker',
  238. data: {
  239. id: this.props.data.id,
  240. techBrokerId: values.modifyTechBrokerId
  241. }
  242. }).done(function (data) {
  243. this.state.auditStatus = 0;
  244. this.setState({
  245. loading: false
  246. });
  247. if (data.error && data.error.length) {
  248. message.warning(data.error[0].message);
  249. } else {
  250. message.success('保存成功!');
  251. this.props.handleOk();
  252. };
  253. }.bind(this));
  254. }
  255. });
  256. },
  257. formSubmit() {
  258. this.props.form.validateFields((err, values) => {
  259. if (values.auditStatus == 3 && !values.techBrokerId) {
  260. message.warning('必须选择一个技术经纪人!');
  261. return
  262. };
  263. if (!err) {
  264. this.setState({
  265. loading: true
  266. });
  267. $.ajax({
  268. method: "POST",
  269. dataType: "json",
  270. crossDomain: false,
  271. url: globalConfig.context + '/api/admin/audit/demand',
  272. data: {
  273. id: this.props.data.id,
  274. techBroderId: values.techBrokerId,
  275. auditStatus: values.auditStatus,
  276. releaseStatus:0
  277. }
  278. }).done(function (data) {
  279. this.state.auditStatus = 0;
  280. if (!data.error.length) {
  281. message.success('操作成功!');
  282. this.setState({ formSubmitVisible: false });
  283. this.props.handleOk();
  284. } else {
  285. message.warning(data.error[0].message);
  286. this.setState({
  287. loading: false,
  288. });
  289. }
  290. }.bind(this));
  291. }
  292. });
  293. },
  294. handleSubmit(e) {
  295. e.preventDefault();
  296. this.props.form.validateFields((err, values) => {
  297. if (values.auditStatus == 4) {
  298. this.setState({
  299. formSubmitVisible: true
  300. });
  301. } else {
  302. this.formSubmit();
  303. };
  304. });
  305. },
  306. buildMatchList() {
  307. this.setState({
  308. buttonLoading: true
  309. });
  310. $.ajax({
  311. method: "POST",
  312. dataType: "json",
  313. crossDomain: false,
  314. url: globalConfig.context + '/api/admin/demand/matchAchievement',
  315. data: {
  316. id: this.props.data.id,
  317. }
  318. }).done(function (data) {
  319. this.setState({
  320. buttonLoading: false
  321. });
  322. if (!data.error.length) {
  323. message.success('匹配完成!匹配到' + data.data + '条记录');
  324. } else {
  325. message.warning(data.error[0].message);
  326. };
  327. }.bind(this));
  328. },
  329. componentWillMount() {
  330. this.loadData(this.props.data.id, this.props.detailApiUrl);
  331. if (this.props.data.employerId && this.props.data.dataCategory) {
  332. this.getContactsList(this.props.data.employerId);
  333. };
  334. },
  335. componentWillReceiveProps(nextProps) {
  336. if (!this.props.visible && nextProps.visible) {
  337. this.loadData(nextProps.data.id, nextProps.detailApiUrl,nextProps.data.dataCategory);
  338. if (nextProps.data.employerId && nextProps.data.dataCategory) {
  339. this.getContactsList(nextProps.data.employerId);
  340. };
  341. this.props.form.resetFields();
  342. };
  343. },
  344. render() {
  345. const theData = this.state.data || {};
  346. const { getFieldDecorator } = this.props.form;
  347. const FormItem = Form.Item
  348. const formItemLayout = {
  349. labelCol: { span: 6 },
  350. wrapperCol: { span: 12 },
  351. };
  352. return (
  353. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  354. <Spin spinning={this.state.loading}>
  355. <div className="clearfix">
  356. <FormItem className="half-item"
  357. {...formItemLayout}
  358. label="编号" >
  359. <span>{theData.serialNumber}</span>
  360. </FormItem>
  361. <FormItem className="half-item"
  362. {...formItemLayout}
  363. label="需求名称" >
  364. <span>{theData.name}</span>
  365. </FormItem>
  366. </div>
  367. <div>
  368. <FormItem className="half-item"
  369. {...formItemLayout}
  370. label="精品需求" >
  371. {(() => {
  372. switch (theData.boutique) {
  373. case "0":
  374. return <span>否</span>;
  375. case "1":
  376. return <span>是</span>;
  377. }
  378. })()}
  379. </FormItem>
  380. <FormItem className="half-item"
  381. {...formItemLayout}
  382. label="首页展示" >
  383. {(() => {
  384. switch (theData.hot) {
  385. case "0":
  386. return <span>否</span>;
  387. case "1":
  388. return <span>是</span>;
  389. }
  390. })()}
  391. </FormItem>
  392. </div>
  393. {this.state.radios==true ? <div>
  394. <FormItem
  395. labelCol={{ span: 3 }}
  396. wrapperCol={{ span: 18 }}
  397. label="首页展示图片:" >
  398. <div className="clearfix">
  399. <Upload className="demandDetailShow-upload"
  400. listType="picture-card"
  401. fileList={this.state.coverImg}
  402. onPreview={(file) => {
  403. this.setState({
  404. previewImage: file.url || file.thumbUrl,
  405. previewVisible: true,
  406. });
  407. }} >
  408. </Upload>
  409. <Modal maskClosable={false} footer={null}
  410. visible={this.state.previewVisible}
  411. onCancel={() => { this.setState({ previewVisible: false }) }}>
  412. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  413. </Modal>
  414. </div>
  415. </FormItem>
  416. </div> :<div></div>}
  417. {this.state.switchValue ? <div>
  418. <FormItem className="half-item"
  419. {...formItemLayout}
  420. label="雇主名称" >
  421. <span>{theData.employerName}</span>
  422. </FormItem>
  423. <FormItem className="half-item"
  424. {...formItemLayout}
  425. label="联系电话" >
  426. <span>{theData.employerContactsMobile}</span>
  427. </FormItem>
  428. <FormItem className="half-item"
  429. {...formItemLayout}
  430. label="电子邮箱" >
  431. <span>{theData.employerContactsMailbox}</span>
  432. </FormItem>
  433. <FormItem className="half-item"
  434. {...formItemLayout}
  435. label="通讯地址" >
  436. <span>{theData.employerAddress}</span>
  437. </FormItem>
  438. </div> : <div className="clearfix">
  439. <FormItem className="half-item"
  440. {...formItemLayout}
  441. label="雇主名称" >
  442. <span>{theData.username}</span>
  443. </FormItem>
  444. {this.props.data.dataCategory ? <FormItem className="half-item"
  445. {...formItemLayout}
  446. label="联系人" >
  447. <span>{this.state.contactsObj[theData.contacts]}</span>
  448. </FormItem> : <FormItem className="half-item"
  449. {...formItemLayout}
  450. label="联系人" >
  451. <span>{theData.contactsName}</span>
  452. </FormItem>}
  453. </div>}
  454. <div className="clearfix">
  455. <FormItem className="half-item"
  456. {...formItemLayout}
  457. label="负责人" >
  458. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  459. </FormItem>
  460. </div>
  461. <div className="clearfix">
  462. <FormItem className="half-item"
  463. {...formItemLayout}
  464. label="是否发布" >
  465. <span>未发布</span>
  466. </FormItem>
  467. <FormItem className="half-item"
  468. {...formItemLayout}
  469. label="发布时间" >
  470. <span>{theData.releaseDateFormattedDate}</span>
  471. </FormItem>
  472. </div>
  473. <FormItem className="half-item"
  474. {...formItemLayout}
  475. label="加急天数" >
  476. <span>{theData.urgentDays}</span>
  477. </FormItem>
  478. <FormItem className="half-item"
  479. {...formItemLayout}
  480. label="加急报酬" >
  481. <span>{theData.urgentMoney}</span>
  482. </FormItem>
  483. <div className="clearfix">
  484. <FormItem className="half-item"
  485. {...formItemLayout}
  486. label="需求状态" >
  487. {(() => {
  488. switch (theData.status) {
  489. case "0":
  490. return <span>未解决</span>;
  491. case "1":
  492. return <span>已解决</span>;
  493. }
  494. })()}
  495. </FormItem>
  496. <FormItem className="half-item"
  497. {...formItemLayout}
  498. label="审核状态" >
  499. {(() => {
  500. switch (theData.auditStatus) {
  501. case 0:
  502. return <span>未提交审核(草稿)</span>;
  503. case 1:
  504. return <span>提交审核</span>;
  505. case 2:
  506. return <span>审核中</span>;
  507. case 3:
  508. return <span>审核通过</span>;
  509. case 4:
  510. return <span>审核未通过</span>;
  511. }
  512. })()}
  513. </FormItem>
  514. </div>
  515. <div className="clearfix">
  516. <FormItem className="half-item"
  517. {...formItemLayout}
  518. label="信息来源" >
  519. {(() => {
  520. switch (theData.infoSources) {
  521. case "0":
  522. return <span>平台采集</span>;
  523. case "1":
  524. return <span>客户发布</span>;
  525. case "2":
  526. return <span>批量导入</span>;
  527. case "3":
  528. return <span>三方对接</span>;
  529. }
  530. })()}
  531. </FormItem>
  532. </div>
  533. <FormItem
  534. labelCol={{ span: 3 }}
  535. wrapperCol={{ span: 20 }}
  536. label="关键词" >
  537. {this.state.tags.map((tag) => {
  538. return <Tooltip key={tag} title={tag}>
  539. <Tag key={tag}>{tag}</Tag>
  540. </Tooltip>;
  541. })}
  542. </FormItem>
  543. <FormItem
  544. labelCol={{ span: 3 }}
  545. wrapperCol={{ span: 18 }}
  546. label="行业类别" >
  547. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  548. </FormItem>
  549. <div className="clearfix">
  550. <FormItem className="half-item"
  551. {...formItemLayout}
  552. label="需求类型" >
  553. <span>{getDemandType(theData.demandType)}</span>
  554. </FormItem>
  555. </div>
  556. <FormItem
  557. labelCol={{ span: 3 }}
  558. wrapperCol={{ span: 18 }}
  559. label="问题说明" >
  560. <span>{theData.problemDes}</span>
  561. </FormItem>
  562. <FormItem
  563. labelCol={{ span: 3 }}
  564. wrapperCol={{ span: 18 }}
  565. label="备注" >
  566. <span>{theData.remark}</span>
  567. </FormItem>
  568. <FormItem
  569. labelCol={{ span: 3 }}
  570. wrapperCol={{ span: 18 }}
  571. label="技术指标要求" >
  572. <span>{theData.technicalRequirements}</span>
  573. </FormItem>
  574. <FormItem
  575. labelCol={{ span: 3 }}
  576. wrapperCol={{ span: 18 }}
  577. label="需求文件(图片)" >
  578. <div className="clearfix">
  579. <Upload className="demandDetailShow-upload"
  580. listType="picture-card"
  581. fileList={this.state.pictureUrl}
  582. onPreview={(file) => {
  583. this.setState({
  584. previewImage: file.url || file.thumbUrl,
  585. previewVisible: true,
  586. });
  587. }} >
  588. </Upload>
  589. <Modal maskClosable={false} footer={null}
  590. visible={this.state.previewVisible}
  591. onCancel={() => { this.setState({ previewVisible: false }) }}>
  592. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  593. </Modal>
  594. </div>
  595. </FormItem>
  596. <FormItem
  597. labelCol={{ span: 3 }}
  598. wrapperCol={{ span: 6 }}
  599. label="需求文件(文本)" >
  600. <div>{theData.textFileUrl ?
  601. <span className="download-file">
  602. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  603. </span>
  604. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  605. </FormItem>
  606. <FormItem
  607. labelCol={{ span: 3 }}
  608. wrapperCol={{ span: 18 }}
  609. label="需求文件(视频地址)" >
  610. <span>{theData.videoUrl}</span>
  611. </FormItem>
  612. <div className="clearfix">
  613. <FormItem className="half-item"
  614. {...formItemLayout}
  615. label="固定周期" >
  616. <span>{theData.fixedCycle}</span>
  617. </FormItem>
  618. <FormItem className="half-item"
  619. {...formItemLayout}
  620. label="固定人数" >
  621. <span>{theData.peopleNumber || 0} 人</span>
  622. </FormItem>
  623. </div>
  624. <FormItem
  625. labelCol={{ span: 3 }}
  626. wrapperCol={{ span: 18 }}
  627. label="固定方案" >
  628. <span>{theData.fixedScheme}</span>
  629. </FormItem>
  630. <div className="clearfix">
  631. <FormItem className="half-item"
  632. {...formItemLayout}
  633. label="预算费用" >
  634. <span>{theData.budgetCost || 0} 万元</span>
  635. </FormItem>
  636. <FormItem className="half-item"
  637. {...formItemLayout}
  638. label="费用托管" >
  639. {(() => {
  640. switch (theData.costEscrow) {
  641. case 0:
  642. return <span>否</span>;
  643. case 1:
  644. return <span>是</span>;
  645. }
  646. })()}
  647. </FormItem>
  648. <FormItem className="half-item"
  649. {...formItemLayout}
  650. label="有效期限" >
  651. <span>{theData.validityPeriodFormattedDate}</span>
  652. </FormItem>
  653. </div>
  654. <div className="clearfix">
  655. <FormItem className="half-item"
  656. {...formItemLayout}
  657. label="审核状态" >
  658. {getFieldDecorator('auditStatus')(
  659. <Radio.Group>
  660. <Radio value={3}>审核通过</Radio>
  661. <Radio value={4}>审核未通过</Radio>
  662. </Radio.Group>
  663. )}
  664. </FormItem>
  665. <FormItem className="half-item"
  666. {...formItemLayout}
  667. label="技术经纪人" >
  668. {getFieldDecorator('techBrokerId', {
  669. initialValue: theData.techBrokerId
  670. })(
  671. <Select style={{ width: 260 }}
  672. placeholder="请选择技术经纪人"
  673. notFoundContent="未获取到经纪人列表"
  674. showSearch
  675. filterOption={companySearch}>
  676. {this.props.techBrodersOption}
  677. </Select>
  678. )}
  679. </FormItem>
  680. </div>
  681. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  682. <Button className="set-submit" type="primary" htmlType="submit">确认</Button>
  683. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  684. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList} style={{"display":"none"}}>生成匹配列表</Button> : <span></span>}
  685. </FormItem>
  686. <Modal maskClosable={false} title="确认"
  687. visible={this.state.formSubmitVisible}
  688. width='360px'
  689. footer={null}
  690. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  691. <span>确认该需求审核未通过?</span>
  692. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  693. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  694. </Modal>
  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;