demandAuditDesc.jsx 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  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. </div>
  381. {this.state.radios==true ? <div>
  382. <FormItem
  383. labelCol={{ span: 3 }}
  384. wrapperCol={{ span: 18 }}
  385. label="首页展示图片:" >
  386. <div className="clearfix">
  387. <Upload className="demandDetailShow-upload"
  388. listType="picture-card"
  389. fileList={this.state.coverImg}
  390. onPreview={(file) => {
  391. this.setState({
  392. previewImage: file.url || file.thumbUrl,
  393. previewVisible: true,
  394. });
  395. }} >
  396. </Upload>
  397. <Modal maskClosable={false} footer={null}
  398. visible={this.state.previewVisible}
  399. onCancel={() => { this.setState({ previewVisible: false }) }}>
  400. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  401. </Modal>
  402. </div>
  403. </FormItem>
  404. </div> :<div></div>}
  405. {this.state.switchValue ? <div>
  406. <FormItem className="half-item"
  407. {...formItemLayout}
  408. label="雇主名称" >
  409. <span>{theData.employerName}</span>
  410. </FormItem>
  411. <FormItem className="half-item"
  412. {...formItemLayout}
  413. label="联系电话" >
  414. <span>{theData.employerContactsMobile}</span>
  415. </FormItem>
  416. <FormItem className="half-item"
  417. {...formItemLayout}
  418. label="电子邮箱" >
  419. <span>{theData.employerContactsMailbox}</span>
  420. </FormItem>
  421. <FormItem className="half-item"
  422. {...formItemLayout}
  423. label="通讯地址" >
  424. <span>{theData.employerAddress}</span>
  425. </FormItem>
  426. </div> : <div className="clearfix">
  427. <FormItem className="half-item"
  428. {...formItemLayout}
  429. label="雇主名称" >
  430. <span>{theData.username}</span>
  431. </FormItem>
  432. {this.props.data.dataCategory ? <FormItem className="half-item"
  433. {...formItemLayout}
  434. label="联系人" >
  435. <span>{this.state.contactsObj[theData.contacts]}</span>
  436. </FormItem> : <FormItem className="half-item"
  437. {...formItemLayout}
  438. label="联系人" >
  439. <span>{theData.contactsName}</span>
  440. </FormItem>}
  441. </div>}
  442. <div className="clearfix">
  443. <FormItem className="half-item"
  444. {...formItemLayout}
  445. label="负责人" >
  446. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  447. </FormItem>
  448. </div>
  449. <div className="clearfix">
  450. <FormItem className="half-item"
  451. {...formItemLayout}
  452. label="是否发布" >
  453. <span>未发布</span>
  454. </FormItem>
  455. <FormItem className="half-item"
  456. {...formItemLayout}
  457. label="发布时间" >
  458. <span>{theData.releaseDateFormattedDate}</span>
  459. </FormItem>
  460. </div>
  461. <FormItem className="half-item"
  462. {...formItemLayout}
  463. label="加急天数" >
  464. <span>{theData.urgentDays}</span>
  465. </FormItem>
  466. <FormItem className="half-item"
  467. {...formItemLayout}
  468. label="加急报酬" >
  469. <span>{theData.urgentMoney}</span>
  470. </FormItem>
  471. <div className="clearfix">
  472. <FormItem className="half-item"
  473. {...formItemLayout}
  474. label="需求状态" >
  475. {(() => {
  476. switch (theData.status) {
  477. case "0":
  478. return <span>未解决</span>;
  479. case "1":
  480. return <span>已解决</span>;
  481. }
  482. })()}
  483. </FormItem>
  484. <FormItem className="half-item"
  485. {...formItemLayout}
  486. label="审核状态" >
  487. {(() => {
  488. switch (theData.auditStatus) {
  489. case 0:
  490. return <span>未提交审核(草稿)</span>;
  491. case 1:
  492. return <span>提交审核</span>;
  493. case 2:
  494. return <span>审核中</span>;
  495. case 3:
  496. return <span>审核通过</span>;
  497. case 4:
  498. return <span>审核未通过</span>;
  499. }
  500. })()}
  501. </FormItem>
  502. </div>
  503. <div className="clearfix">
  504. <FormItem className="half-item"
  505. {...formItemLayout}
  506. label="信息来源" >
  507. {(() => {
  508. switch (theData.infoSources) {
  509. case "0":
  510. return <span>平台采集</span>;
  511. case "1":
  512. return <span>客户发布</span>;
  513. case "2":
  514. return <span>批量导入</span>;
  515. case "3":
  516. return <span>三方对接</span>;
  517. }
  518. })()}
  519. </FormItem>
  520. </div>
  521. <FormItem
  522. labelCol={{ span: 3 }}
  523. wrapperCol={{ span: 20 }}
  524. label="关键词" >
  525. {this.state.tags.map((tag) => {
  526. return <Tooltip key={tag} title={tag}>
  527. <Tag key={tag}>{tag}</Tag>
  528. </Tooltip>;
  529. })}
  530. </FormItem>
  531. <FormItem
  532. labelCol={{ span: 3 }}
  533. wrapperCol={{ span: 18 }}
  534. label="行业类别" >
  535. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  536. </FormItem>
  537. <div className="clearfix">
  538. <FormItem className="half-item"
  539. {...formItemLayout}
  540. label="需求类型" >
  541. <span>{getDemandType(theData.demandType)}</span>
  542. </FormItem>
  543. </div>
  544. <FormItem
  545. labelCol={{ span: 3 }}
  546. wrapperCol={{ span: 18 }}
  547. label="问题说明" >
  548. <span>{theData.problemDes}</span>
  549. </FormItem>
  550. <FormItem
  551. labelCol={{ span: 3 }}
  552. wrapperCol={{ span: 18 }}
  553. label="备注" >
  554. <span>{theData.remark}</span>
  555. </FormItem>
  556. <FormItem
  557. labelCol={{ span: 3 }}
  558. wrapperCol={{ span: 18 }}
  559. label="技术指标要求" >
  560. <span>{theData.technicalRequirements}</span>
  561. </FormItem>
  562. <FormItem
  563. labelCol={{ span: 3 }}
  564. wrapperCol={{ span: 18 }}
  565. label="需求文件(图片)" >
  566. <div className="clearfix">
  567. <Upload className="demandDetailShow-upload"
  568. listType="picture-card"
  569. fileList={this.state.pictureUrl}
  570. onPreview={(file) => {
  571. this.setState({
  572. previewImage: file.url || file.thumbUrl,
  573. previewVisible: true,
  574. });
  575. }} >
  576. </Upload>
  577. <Modal maskClosable={false} footer={null}
  578. visible={this.state.previewVisible}
  579. onCancel={() => { this.setState({ previewVisible: false }) }}>
  580. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  581. </Modal>
  582. </div>
  583. </FormItem>
  584. <FormItem
  585. labelCol={{ span: 3 }}
  586. wrapperCol={{ span: 6 }}
  587. label="需求文件(文本)" >
  588. <div>{theData.textFileUrl ?
  589. <span className="download-file">
  590. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  591. </span>
  592. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  593. </FormItem>
  594. <FormItem
  595. labelCol={{ span: 3 }}
  596. wrapperCol={{ span: 18 }}
  597. label="需求文件(视频地址)" >
  598. <span>{theData.videoUrl}</span>
  599. </FormItem>
  600. <div className="clearfix">
  601. <FormItem className="half-item"
  602. {...formItemLayout}
  603. label="固定周期" >
  604. <span>{theData.fixedCycle}</span>
  605. </FormItem>
  606. <FormItem className="half-item"
  607. {...formItemLayout}
  608. label="固定人数" >
  609. <span>{theData.peopleNumber || 0} 人</span>
  610. </FormItem>
  611. </div>
  612. <FormItem
  613. labelCol={{ span: 3 }}
  614. wrapperCol={{ span: 18 }}
  615. label="固定方案" >
  616. <span>{theData.fixedScheme}</span>
  617. </FormItem>
  618. <div className="clearfix">
  619. <FormItem className="half-item"
  620. {...formItemLayout}
  621. label="预算费用" >
  622. <span>{theData.budgetCost || 0} 万元</span>
  623. </FormItem>
  624. <FormItem className="half-item"
  625. {...formItemLayout}
  626. label="费用托管" >
  627. {(() => {
  628. switch (theData.costEscrow) {
  629. case 0:
  630. return <span>否</span>;
  631. case 1:
  632. return <span>是</span>;
  633. }
  634. })()}
  635. </FormItem>
  636. <FormItem className="half-item"
  637. {...formItemLayout}
  638. label="有效期限" >
  639. <span>{theData.validityPeriodFormattedDate}</span>
  640. </FormItem>
  641. </div>
  642. <div className="clearfix">
  643. <FormItem className="half-item"
  644. {...formItemLayout}
  645. label="审核状态" >
  646. {getFieldDecorator('auditStatus')(
  647. <Radio.Group>
  648. <Radio value={3}>审核通过</Radio>
  649. <Radio value={4}>审核未通过</Radio>
  650. </Radio.Group>
  651. )}
  652. </FormItem>
  653. <FormItem className="half-item"
  654. {...formItemLayout}
  655. label="技术经纪人" >
  656. {getFieldDecorator('techBrokerId', {
  657. initialValue: theData.techBrokerId
  658. })(
  659. <Select style={{ width: 260 }}
  660. placeholder="请选择技术经纪人"
  661. notFoundContent="未获取到经纪人列表"
  662. showSearch
  663. filterOption={companySearch}>
  664. {this.props.techBrodersOption}
  665. </Select>
  666. )}
  667. </FormItem>
  668. </div>
  669. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  670. <Button className="set-submit" type="primary" htmlType="submit">确认</Button>
  671. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  672. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList} style={{"display":"none"}}>生成匹配列表</Button> : <span></span>}
  673. </FormItem>
  674. <Modal maskClosable={false} title="确认"
  675. visible={this.state.formSubmitVisible}
  676. width='360px'
  677. footer={null}
  678. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  679. <span>确认该需求审核未通过?</span>
  680. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  681. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  682. </Modal>
  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='1000px'
  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. onRowClick={this.tableRowClick} />
  871. </Tabs.TabPane>
  872. </Tabs>
  873. </Spin>
  874. </Modal>
  875. </div>
  876. );
  877. } else {
  878. return <div></div>
  879. }
  880. },
  881. });
  882. export default DemandDetail;