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