techDemandDesc.jsx 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  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 { beforeUploadFile, getTechAuditStatus, splitUrl, companySearch, getTechField, getDemandType, getAchievementCategory } from '../../tools.js';
  9. import throttle from '../../throttle.js';
  10. const KeyWordTagGroup = React.createClass({
  11. getInitialState() {
  12. return {
  13. tags: [],
  14. inputVisible: false,
  15. inputValue: ''
  16. };
  17. },
  18. handleClose(removedTag) {
  19. const tags = this.state.tags.filter(tag => tag !== removedTag);
  20. this.props.tagsArr(tags);
  21. this.setState({ tags });
  22. },
  23. showInput() {
  24. this.setState({ inputVisible: true }, () => this.input.focus());
  25. },
  26. handleInputChange(e) {
  27. this.setState({ inputValue: e.target.value });
  28. },
  29. handleInputConfirm() {
  30. const state = this.state;
  31. const inputValue = state.inputValue;
  32. let tags = state.tags;
  33. if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
  34. tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
  35. }
  36. this.props.tagsArr(tags);
  37. this.setState({
  38. tags,
  39. inputVisible: false,
  40. inputValue: '',
  41. });
  42. },
  43. componentWillMount() {
  44. this.state.tags = this.props.keyWordArr;
  45. },
  46. componentWillReceiveProps(nextProps) {
  47. if (this.props.keyWordArr != nextProps.keyWordArr) {
  48. this.state.tags = nextProps.keyWordArr;
  49. };
  50. },
  51. render() {
  52. const { tags, inputVisible, inputValue } = this.state;
  53. return (
  54. <div className="keyWord-tips">
  55. {tags.map((tag, index) => {
  56. const isLongTag = tag.length > 10;
  57. const tagElem = (
  58. <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
  59. {isLongTag ? `${tag.slice(0, 10)}...` : tag}
  60. </Tag>
  61. );
  62. return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
  63. })}
  64. {inputVisible && (
  65. <Input
  66. ref={input => this.input = input}
  67. type="text"
  68. style={{ width: 78 }}
  69. value={inputValue}
  70. onChange={this.handleInputChange}
  71. onBlur={this.handleInputConfirm}
  72. onPressEnter={this.handleInputConfirm}
  73. />
  74. )}
  75. {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
  76. </div>
  77. );
  78. }
  79. });
  80. const PicturesWall = React.createClass({
  81. getInitialState() {
  82. return {
  83. previewVisible: false,
  84. previewImage: '',
  85. fileList: [],
  86. }
  87. },
  88. handleCancel() {
  89. this.setState({ previewVisible: false })
  90. },
  91. handlePreview(file) {
  92. this.setState({
  93. previewImage: file.url || file.thumbUrl,
  94. previewVisible: true,
  95. });
  96. },
  97. handleChange(info) {
  98. let fileList = info.fileList;
  99. this.setState({ fileList });
  100. this.props.fileList(fileList);
  101. },
  102. componentWillReceiveProps(nextProps) {
  103. this.state.fileList = nextProps.pictureUrl;
  104. },
  105. render() {
  106. const { previewVisible, previewImage, fileList } = this.state;
  107. const uploadButton = (
  108. <div>
  109. <Icon type="plus" />
  110. <div className="ant-upload-text">点击上传</div>
  111. </div>
  112. );
  113. return (
  114. <div className="clearfix">
  115. <Upload
  116. action={globalConfig.context + "/api/admin/demand/uploadPicture"}
  117. data={{ 'sign': 'demand_picture', 'uid': this.props.uid }}
  118. listType="picture-card"
  119. fileList={fileList}
  120. onPreview={this.handlePreview}
  121. onChange={this.handleChange} >
  122. {fileList.length >= 5 ? null : uploadButton}
  123. </Upload>
  124. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  125. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  126. </Modal>
  127. </div>
  128. );
  129. }
  130. });
  131. const DemandDetailShow = Form.create()(React.createClass({
  132. getInitialState() {
  133. return {
  134. visible: false,
  135. loading: false,
  136. contactsObj: {},
  137. salesmanObj: {},
  138. data: {},
  139. tags: [],
  140. pictureUrl: []
  141. };
  142. },
  143. loadData(id, detailApiUrl) {
  144. this.setState({
  145. loading: true
  146. });
  147. $.ajax({
  148. method: "get",
  149. dataType: "json",
  150. crossDomain: false,
  151. url: globalConfig.context + detailApiUrl,
  152. data: {
  153. id: id
  154. },
  155. success: function (data) {
  156. let thisData = data.data;
  157. if (!thisData) {
  158. if (data.error && data.error.length) {
  159. message.warning(data.error[0].message);
  160. };
  161. thisData = {};
  162. };
  163. this.setState({
  164. data: thisData,
  165. switchValue: Boolean(!thisData.employerId),
  166. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  167. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  168. });
  169. }.bind(this),
  170. }).always(function () {
  171. this.setState({
  172. loading: false
  173. });
  174. }.bind(this));
  175. },
  176. getContactsList(theUid) {
  177. $.ajax({
  178. method: "get",
  179. dataType: "json",
  180. crossDomain: false,
  181. url: globalConfig.context + "/api/admin/getContacts",
  182. data: {
  183. uid: theUid
  184. },
  185. success: function (data) {
  186. let theOption = [];
  187. if (!data.data) {
  188. if (data.error && data.error.length) {
  189. message.warning(data.error[0].message);
  190. };
  191. } else {
  192. this.setState({
  193. contactsObj: data.data
  194. });
  195. };
  196. }.bind(this),
  197. });
  198. },
  199. offShelf() {
  200. this.setState({
  201. loading: true
  202. });
  203. $.ajax({
  204. method: "post",
  205. dataType: "json",
  206. crossDomain: false,
  207. url: globalConfig.context + "/api/admin/demand/offShelf",
  208. data: { "id": this.props.data.id }
  209. }).done(function (data) {
  210. if (!data.error.length) {
  211. message.success('撤销成功!');
  212. this.props.handleOk();
  213. } else {
  214. message.warning(data.error[0].message);
  215. };
  216. this.setState({
  217. loading: false,
  218. releaseSubmitVisible: false
  219. });
  220. }.bind(this));
  221. },
  222. modifyBroker() {
  223. this.props.form.validateFields((err, values) => {
  224. debugger
  225. if (!err) {
  226. this.setState({
  227. loading: true
  228. });
  229. $.ajax({
  230. method: "POST",
  231. dataType: "json",
  232. crossDomain: false,
  233. url: globalConfig.context + '/api/admin/audit/modifyDemandTechBroker',
  234. data: {
  235. id: this.props.data.id,
  236. techBrokerId: values.modifyTechBrokerId
  237. }
  238. }).done(function (data) {
  239. this.state.auditStatus = 0;
  240. this.setState({
  241. loading: false
  242. });
  243. if (data.error && data.error.length) {
  244. message.warning(data.error[0].message);
  245. } else {
  246. message.success('保存成功!');
  247. this.props.handleOk();
  248. };
  249. }.bind(this));
  250. }
  251. });
  252. },
  253. formSubmit() {
  254. this.props.form.validateFields((err, values) => {
  255. if (values.auditStatus == 3 && !values.techBrokerId) {
  256. message.warning('必须选择一个技术经纪人!');
  257. return
  258. };
  259. if (!err) {
  260. this.setState({
  261. loading: true
  262. });
  263. $.ajax({
  264. method: "POST",
  265. dataType: "json",
  266. crossDomain: false,
  267. url: globalConfig.context + '/api/admin/audit/demand',
  268. data: {
  269. id: this.props.data.id,
  270. techBroderId: values.techBrokerId,
  271. auditStatus: values.auditStatus
  272. }
  273. }).done(function (data) {
  274. this.state.auditStatus = 0;
  275. if (!data.error.length) {
  276. message.success('保存成功!');
  277. this.setState({ formSubmitVisible: false });
  278. this.props.handleOk();
  279. } else {
  280. message.warning(data.error[0].message);
  281. this.setState({
  282. loading: false,
  283. });
  284. }
  285. }.bind(this));
  286. }
  287. });
  288. },
  289. handleSubmit(e) {
  290. e.preventDefault();
  291. this.props.form.validateFields((err, values) => {
  292. if (values.auditStatus == 4) {
  293. this.setState({
  294. formSubmitVisible: true
  295. });
  296. } else {
  297. this.formSubmit();
  298. };
  299. });
  300. },
  301. buildMatchList() {
  302. this.setState({
  303. buttonLoading: true
  304. });
  305. $.ajax({
  306. method: "POST",
  307. dataType: "json",
  308. crossDomain: false,
  309. url: globalConfig.context + '/api/admin/demand/matchAchievement',
  310. data: {
  311. id: this.props.data.id,
  312. }
  313. }).done(function (data) {
  314. this.setState({
  315. buttonLoading: false
  316. });
  317. if (!data.error.length) {
  318. message.success('匹配完成!匹配到' + data.data + '条记录');
  319. } else {
  320. message.warning(data.error[0].message);
  321. };
  322. }.bind(this));
  323. },
  324. componentWillMount() {
  325. this.loadData(this.props.data.id, this.props.detailApiUrl);
  326. if (this.props.data.employerId) {
  327. this.getContactsList(this.props.data.employerId);
  328. };
  329. },
  330. componentWillReceiveProps(nextProps) {
  331. if (!this.props.visible && nextProps.visible) {
  332. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  333. if (nextProps.data.employerId) {
  334. this.getContactsList(nextProps.data.employerId);
  335. };
  336. this.props.form.resetFields();
  337. };
  338. },
  339. render() {
  340. const theData = this.state.data || {};
  341. const { getFieldDecorator } = this.props.form;
  342. const FormItem = Form.Item
  343. const formItemLayout = {
  344. labelCol: { span: 6 },
  345. wrapperCol: { span: 12 },
  346. };
  347. return (
  348. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  349. <Spin spinning={this.state.loading}>
  350. <div className="clearfix">
  351. <FormItem className="half-item"
  352. {...formItemLayout}
  353. label="编号" >
  354. <span>{theData.serialNumber}</span>
  355. </FormItem>
  356. <FormItem className="half-item"
  357. {...formItemLayout}
  358. label="需求名称" >
  359. <span>{theData.name}</span>
  360. </FormItem>
  361. </div>
  362. {this.state.switchValue ? <div>
  363. <FormItem className="half-item"
  364. {...formItemLayout}
  365. label="雇主名称" >
  366. <span>{theData.employerName}</span>
  367. </FormItem>
  368. <FormItem className="half-item"
  369. {...formItemLayout}
  370. label="联系电话" >
  371. <span>{theData.employerContactsMobile}</span>
  372. </FormItem>
  373. <FormItem className="half-item"
  374. {...formItemLayout}
  375. label="电子邮箱" >
  376. <span>{theData.employerContactsMailbox}</span>
  377. </FormItem>
  378. <FormItem className="half-item"
  379. {...formItemLayout}
  380. label="通讯地址" >
  381. <span>{theData.employerAddress}</span>
  382. </FormItem>
  383. </div> : <div className="clearfix">
  384. <FormItem className="half-item"
  385. {...formItemLayout}
  386. label="雇主名称" >
  387. <span>{theData.username}</span>
  388. </FormItem>
  389. <FormItem className="half-item"
  390. {...formItemLayout}
  391. label="联系人" >
  392. <span>{this.state.contactsObj[theData.contacts]}</span>
  393. </FormItem>
  394. </div>}
  395. <div className="clearfix">
  396. <FormItem className="half-item"
  397. {...formItemLayout}
  398. label="负责人" >
  399. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  400. </FormItem>
  401. </div>
  402. <div className="clearfix">
  403. <FormItem className="half-item"
  404. {...formItemLayout}
  405. label="是否发布" >
  406. {(() => {
  407. switch (theData.releaseStatus) {
  408. case "0":
  409. return <span>未发布</span>;
  410. case "1":
  411. return <div>
  412. <span>已发布</span>
  413. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  414. <Modal maskClosable={false} title="确认"
  415. visible={this.state.releaseSubmitVisible}
  416. width='300px'
  417. footer={null}
  418. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  419. <span>确认要撤销发布吗?</span>
  420. <Button className="modal-submit" type="primary" onClick={this.offShelf} >确认</Button>
  421. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  422. </Modal>
  423. </div>;
  424. }
  425. })()}
  426. </FormItem>
  427. <FormItem className="half-item"
  428. {...formItemLayout}
  429. label="发布时间" >
  430. <span>{theData.releaseDateFormattedDate}</span>
  431. </FormItem>
  432. </div>
  433. <div className="clearfix">
  434. <FormItem className="half-item"
  435. {...formItemLayout}
  436. label="需求状态" >
  437. {(() => {
  438. switch (theData.status) {
  439. case "0":
  440. return <span>未解决</span>;
  441. case "1":
  442. return <span>已解决</span>;
  443. }
  444. })()}
  445. </FormItem>
  446. <FormItem className="half-item"
  447. {...formItemLayout}
  448. label="审核状态" >
  449. {(() => {
  450. switch (theData.auditStatus) {
  451. case "0":
  452. return <span>未提交审核(草稿)</span>;
  453. case "1":
  454. return <span>提交审核</span>;
  455. case "2":
  456. return <span>审核中</span>;
  457. case "3":
  458. return <span>审核通过</span>;
  459. case "4":
  460. return <span>审核未通过</span>;
  461. }
  462. })()}
  463. </FormItem>
  464. </div>
  465. <div className="clearfix">
  466. <FormItem className="half-item"
  467. {...formItemLayout}
  468. label="信息来源" >
  469. {(() => {
  470. switch (theData.infoSources) {
  471. case "0":
  472. return <span>平台采集</span>;
  473. case "1":
  474. return <span>客户发布</span>;
  475. case "2":
  476. return <span>批量导入</span>;
  477. case "3":
  478. return <span>三方对接</span>;
  479. }
  480. })()}
  481. </FormItem>
  482. </div>
  483. <FormItem
  484. labelCol={{ span: 3 }}
  485. wrapperCol={{ span: 20 }}
  486. label="关键词" >
  487. {this.state.tags.map((tag) => {
  488. return <Tooltip key={tag} title={tag}>
  489. <Tag key={tag}>{tag}</Tag>
  490. </Tooltip>;
  491. })}
  492. </FormItem>
  493. <FormItem
  494. labelCol={{ span: 3 }}
  495. wrapperCol={{ span: 18 }}
  496. label="行业类别" >
  497. <span>{getIndustryCategory(theData.industryCategoryA, theData.industryCategoryB)}</span>
  498. </FormItem>
  499. <div className="clearfix">
  500. <FormItem className="half-item"
  501. {...formItemLayout}
  502. label="需求类型" >
  503. <span>{getDemandType(theData.demandType)}</span>
  504. </FormItem>
  505. </div>
  506. <FormItem
  507. labelCol={{ span: 3 }}
  508. wrapperCol={{ span: 18 }}
  509. label="问题说明" >
  510. <span>{theData.problemDes}</span>
  511. </FormItem>
  512. <FormItem
  513. labelCol={{ span: 3 }}
  514. wrapperCol={{ span: 18 }}
  515. label="技术指标要求" >
  516. <span>{theData.technicalRequirements}</span>
  517. </FormItem>
  518. <FormItem
  519. labelCol={{ span: 3 }}
  520. wrapperCol={{ span: 18 }}
  521. label="需求文件(图片)" >
  522. <div className="clearfix">
  523. <Upload className="demandDetailShow-upload"
  524. listType="picture-card"
  525. fileList={this.state.pictureUrl}
  526. onPreview={(file) => {
  527. this.setState({
  528. previewImage: file.url || file.thumbUrl,
  529. previewVisible: true,
  530. });
  531. }} >
  532. </Upload>
  533. <Modal maskClosable={false} footer={null}
  534. visible={this.state.previewVisible}
  535. onCancel={() => { this.setState({ previewVisible: false }) }}>
  536. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  537. </Modal>
  538. </div>
  539. </FormItem>
  540. <FormItem
  541. labelCol={{ span: 3 }}
  542. wrapperCol={{ span: 6 }}
  543. label="需求文件(文本)" >
  544. <div>{theData.textFileUrl ?
  545. <span className="download-file">
  546. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  547. </span>
  548. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</div>
  549. </FormItem>
  550. <FormItem
  551. labelCol={{ span: 3 }}
  552. wrapperCol={{ span: 18 }}
  553. label="需求文件(视频地址)" >
  554. <span>{theData.videoUrl}</span>
  555. </FormItem>
  556. <div className="clearfix">
  557. <FormItem className="half-item"
  558. {...formItemLayout}
  559. label="固定周期" >
  560. <span>{theData.fixedCycle}</span>
  561. </FormItem>
  562. <FormItem className="half-item"
  563. {...formItemLayout}
  564. label="固定人数" >
  565. <span>{theData.peopleNumber} 人</span>
  566. </FormItem>
  567. </div>
  568. <FormItem
  569. labelCol={{ span: 3 }}
  570. wrapperCol={{ span: 18 }}
  571. label="固定方案" >
  572. <span>{theData.fixedScheme}</span>
  573. </FormItem>
  574. <div className="clearfix">
  575. <FormItem className="half-item"
  576. {...formItemLayout}
  577. label="预算费用" >
  578. <span>{theData.budgetCost} 万元</span>
  579. </FormItem>
  580. <FormItem className="half-item"
  581. {...formItemLayout}
  582. label="费用托管" >
  583. {(() => {
  584. switch (theData.costEscrow) {
  585. case 0:
  586. return <span>否</span>;
  587. case 1:
  588. return <span>是</span>;
  589. }
  590. })()}
  591. </FormItem>
  592. <FormItem className="half-item"
  593. {...formItemLayout}
  594. label="有效期限" >
  595. <span>{theData.validityPeriodFormattedDate}</span>
  596. </FormItem>
  597. </div>
  598. {window.showAuditStatus && theData.auditStatus == 2 ? <div className="clearfix">
  599. <FormItem className="half-item"
  600. {...formItemLayout}
  601. label="审核状态" >
  602. {getFieldDecorator('auditStatus')(
  603. <Radio.Group>
  604. <Radio value={3}>审核通过</Radio>
  605. <Radio value={4}>审核未通过</Radio>
  606. </Radio.Group>
  607. )}
  608. </FormItem>
  609. <FormItem className="half-item"
  610. {...formItemLayout}
  611. label="技术经纪人" >
  612. {getFieldDecorator('techBrokerId', {
  613. initialValue: theData.techBrokerId
  614. })(
  615. <Select style={{ width: 260 }}
  616. placeholder="请选择技术经纪人"
  617. notFoundContent="未获取到经纪人列表"
  618. showSearch
  619. filterOption={companySearch}>
  620. {this.props.techBrodersOption}
  621. </Select>
  622. )}
  623. </FormItem>
  624. </div> : <div></div>}
  625. {window.showAuditStatus && theData.auditStatus == 3 ? <div className="clearfix">
  626. <FormItem className="half-item"
  627. {...formItemLayout}
  628. label="指派新经纪人" >
  629. {getFieldDecorator('modifyTechBrokerId', {
  630. initialValue: theData.techBrokerId
  631. })(
  632. <Select style={{ width: 260 }}
  633. placeholder="请选择要指派的新经纪人"
  634. notFoundContent="未获取到经纪人列表"
  635. showSearch
  636. filterOption={companySearch}>
  637. {this.props.techBrodersOption}
  638. </Select>
  639. )}
  640. </FormItem>
  641. </div> : <div></div>}
  642. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  643. {theData.auditStatus == 2 ? <Button className="set-submit" type="primary" htmlType="submit">保存</Button> : <span></span>}
  644. {theData.auditStatus == 3 ? <Button className="set-submit" type="primary" onClick={() => { this.modifyBroker(); }}>保存</Button> : <span></span>}
  645. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  646. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList}>生成匹配列表</Button> : <span></span>}
  647. </FormItem>
  648. <Modal maskClosable={false} title="确认"
  649. visible={this.state.formSubmitVisible}
  650. width='360px'
  651. footer={null}
  652. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  653. <span>确认该需求审核未通过?</span>
  654. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  655. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  656. </Modal>
  657. </Spin>
  658. </Form >
  659. )
  660. }
  661. }));
  662. const DemandDetailForm = Form.create()(React.createClass({
  663. getInitialState() {
  664. return {
  665. visible: false,
  666. loading: false,
  667. auditStatus: 0,
  668. switchValue: false,
  669. textFileList: [],
  670. videoFileList: [],
  671. contactsOption: [],
  672. data: {},
  673. tags: [],
  674. pictureUrl: [],
  675. dataSource: []
  676. };
  677. },
  678. getContactsList(theUid) {
  679. $.ajax({
  680. method: "get",
  681. dataType: "json",
  682. crossDomain: false,
  683. url: globalConfig.context + "/api/admin/getContacts",
  684. data: {
  685. uid: theUid
  686. },
  687. success: function (data) {
  688. let theOption = [];
  689. if (!data.data) {
  690. if (data.error && data.error.length) {
  691. message.warning(data.error[0].message);
  692. return;
  693. };
  694. };
  695. for (let item in data.data) {
  696. let theData = data.data[item];
  697. theOption.push(
  698. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  699. );
  700. };
  701. this.setState({
  702. contactsOption: theOption
  703. });
  704. }.bind(this),
  705. });
  706. },
  707. loadData(id, detailApiUrl) {
  708. this.setState({
  709. loading: true
  710. });
  711. $.ajax({
  712. method: "get",
  713. dataType: "json",
  714. crossDomain: false,
  715. url: globalConfig.context + detailApiUrl,
  716. data: {
  717. id: id
  718. },
  719. success: function (data) {
  720. let thisData = data.data;
  721. if (!thisData) {
  722. if (data.error && data.error.length) {
  723. message.warning(data.error[0].message);
  724. };
  725. thisData = {};
  726. };
  727. if (thisData.employerId) {
  728. this.getContactsList(thisData.employerId)
  729. };
  730. this.setState({
  731. data: thisData,
  732. switchValue: Boolean(!thisData.employerId),
  733. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  734. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  735. });
  736. }.bind(this),
  737. }).always(function () {
  738. this.setState({
  739. loading: false
  740. });
  741. }.bind(this));
  742. },
  743. getTagsArr(e) {
  744. this.setState({ tags: e });
  745. },
  746. getPictureUrl(e) {
  747. this.setState({ pictureUrl: e });
  748. },
  749. handleSubmit(e) {
  750. e.preventDefault();
  751. this.props.form.validateFields((err, values) => {
  752. //keyword长度判断
  753. if ((this.state.tags ? this.state.tags.length : this.props.tags.length) < 3) {
  754. message.warning('关键词数量不能小于3个!');
  755. return;
  756. };
  757. //url转化
  758. let thePictureUrl = [];
  759. if (this.state.pictureUrl.length) {
  760. let picArr = [];
  761. this.state.pictureUrl.map(function (item) {
  762. picArr.push(item.response.data);
  763. });
  764. thePictureUrl = picArr.join(",");
  765. };
  766. if (!err) {
  767. this.setState({
  768. loading: true
  769. });
  770. $.ajax({
  771. method: "POST",
  772. dataType: "json",
  773. crossDomain: false,
  774. url: this.props.data.id ? globalConfig.context + '/api/admin/demand/update' : globalConfig.context + '/api/admin/demand/apply',
  775. data: {
  776. id: this.props.data.id,
  777. dataCategory: this.props.detailApiUrl.indexOf('org') >= 0 ? 1 : 0,
  778. serialNumber: this.props.data.serialNumber,
  779. name: values.name,
  780. keyword: this.state.tags ? this.state.tags.join(",") : this.props.tags.join(","),
  781. keywords: this.state.tags ? this.state.tags : this.props.tags,
  782. infoSources: 0,
  783. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  784. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  785. demandType: values.demandType,
  786. problemDes: values.problemDes,
  787. technicalRequirements: values.technicalRequirements,
  788. pictureUrl: thePictureUrl,
  789. textFileUrl: this.state.textFileUrl,
  790. videoUrl: values.videoUrl,
  791. fixedBudget: values.fixedBudget,
  792. fixedCycle: values.fixedCycle,
  793. peopleNumber: values.peopleNumber,
  794. fixedScheme: values.fixedScheme,
  795. costEscrow: values.costEscrow,
  796. budgetCost: values.budgetCost,
  797. //
  798. switchSign: this.state.switchValue ? 1 : 0,
  799. //
  800. employerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.employerId] : this.props.data.employerId) : null,
  801. contacts: !this.state.switchValue ? values.contacts : null,
  802. //自定义
  803. employerName: this.state.switchValue ? values.employerName : null,
  804. employerAddress: this.state.switchValue ? values.employerAddress : null,
  805. employerContactsMobile: this.state.switchValue ? values.employerContactsMobile : null,
  806. employerContactsMailbox: this.state.switchValue ? values.employerContactsMailbox : null,
  807. //
  808. releaseStatus: values.releaseStatus,
  809. principalId: values.principalId,
  810. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  811. //
  812. status: this.state.status,
  813. auditStatus: this.state.auditStatus
  814. }
  815. }).done(function (data) {
  816. this.state.auditStatus = 0;
  817. if (!data.error.length) {
  818. message.success('保存成功!');
  819. this.props.handleOk();
  820. } else {
  821. message.warning(data.error[0].message);
  822. };
  823. this.setState({
  824. loading: false
  825. });
  826. }.bind(this));
  827. }
  828. });
  829. },
  830. handleSearch(e) {
  831. if (this.props.detailApiUrl.indexOf('org') != -1) {
  832. $.ajax({
  833. method: "get",
  834. dataType: "json",
  835. crossDomain: false,
  836. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  837. data: { name: e },
  838. success: function (data) {
  839. let theArr = [];
  840. let theObj = {};
  841. if (!data.data) {
  842. if (data.error && data.error.length) {
  843. message.warning(data.error[0].message);
  844. };
  845. } else if (!$.isEmptyObject(data.data)) {
  846. data.data.map(function (item) {
  847. theArr.push(item.unitName);
  848. theObj[item.unitName] = item.uid;
  849. });
  850. };
  851. this.setState({
  852. dataSource: theArr,
  853. dataSourceObj: theObj
  854. });
  855. }.bind(this),
  856. });
  857. } else {
  858. $.ajax({
  859. method: "get",
  860. dataType: "json",
  861. crossDomain: false,
  862. url: globalConfig.context + "/api/admin/achievement/userOwner",
  863. data: { name: e },
  864. success: function (data) {
  865. let theArr = [];
  866. let theObj = {};
  867. if (!data.data) {
  868. if (data.error && data.error.length) {
  869. message.warning(data.error[0].message);
  870. };
  871. } else if (!$.isEmptyObject(data.data)) {
  872. for (let item in data.data) {
  873. theArr.push(data.data[item]);
  874. theObj[data.data[item]] = item;
  875. };
  876. };
  877. this.setState({
  878. dataSource: theArr,
  879. dataSourceObj: theObj
  880. });
  881. }.bind(this),
  882. });
  883. };
  884. },
  885. componentWillMount() {
  886. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  887. if (this.props.data && this.props.data.id) {
  888. this.loadData(this.props.data.id, this.props.detailApiUrl);
  889. };
  890. },
  891. componentWillReceiveProps(nextProps) {
  892. if (!this.props.visible && nextProps.visible) {
  893. if (nextProps.data && nextProps.data.id) {
  894. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  895. };
  896. this.state.contactsOption = [];
  897. this.state.data = {};
  898. this.state.tags = [];
  899. this.state.switchValue = false;
  900. this.state.pictureUrl = [];
  901. this.state.textFileList = [];
  902. this.state.videoFileList = [];
  903. this.state.textFileUrl = undefined;
  904. this.props.form.resetFields();
  905. };
  906. },
  907. render() {
  908. const theData = this.state.data || {};
  909. const { getFieldDecorator } = this.props.form;
  910. const FormItem = Form.Item
  911. const formItemLayout = {
  912. labelCol: { span: 6 },
  913. wrapperCol: { span: 12 },
  914. };
  915. return (
  916. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  917. <Spin spinning={this.state.loading}>
  918. <div className="clearfix">
  919. <FormItem className="half-item"
  920. {...formItemLayout}
  921. label="编号" >
  922. <span>{theData.serialNumber}</span>
  923. </FormItem>
  924. <FormItem className="half-item"
  925. {...formItemLayout}
  926. label="需求名称" >
  927. {getFieldDecorator('name', {
  928. rules: [{ required: true, message: '此项为必填项!' }],
  929. initialValue: theData.name
  930. })(
  931. <Input />
  932. )}
  933. </FormItem>
  934. </div>
  935. <FormItem style={{ marginBottom: '10px' }} labelCol={{ span: 3 }}
  936. label="自定义雇主" >
  937. <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
  938. </FormItem>
  939. {this.state.switchValue ? <div className="clearfix" >
  940. <FormItem className="half-item"
  941. {...formItemLayout}
  942. label="雇主名称" >
  943. {getFieldDecorator('employerName', {
  944. initialValue: theData.employerName
  945. })(
  946. <Input />
  947. )}
  948. </FormItem>
  949. <FormItem className="half-item"
  950. {...formItemLayout}
  951. label="联系电话" >
  952. {getFieldDecorator('employerContactsMobile', {
  953. initialValue: theData.employerContactsMobile
  954. })(
  955. <Input />
  956. )}
  957. </FormItem>
  958. <FormItem className="half-item"
  959. {...formItemLayout}
  960. label="电子邮箱" >
  961. {getFieldDecorator('employerContactsMailbox', {
  962. initialValue: theData.employerContactsMailbox
  963. })(
  964. <Input />
  965. )}
  966. </FormItem>
  967. <FormItem className="half-item"
  968. {...formItemLayout}
  969. label="通讯地址" >
  970. {getFieldDecorator('employerAddress', {
  971. initialValue: theData.employerAddress
  972. })(
  973. <Input />
  974. )}
  975. </FormItem>
  976. </div> : <div className="clearfix">
  977. <FormItem className="half-item"
  978. {...formItemLayout}
  979. label="雇主名称" >
  980. {getFieldDecorator('employerId', {
  981. initialValue: theData.username || ''
  982. })(
  983. <AutoComplete
  984. dataSource={this.state.dataSource}
  985. style={{ width: 200 }}
  986. onSearch={this.state.therottleSearch}
  987. placeholder="雇主名称"
  988. onSelect={(e) => {
  989. this.getContactsList(this.state.dataSourceObj[e]);
  990. }} />
  991. )}
  992. </FormItem>
  993. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  994. {...formItemLayout}
  995. label="联系人" >
  996. {getFieldDecorator('contacts', {
  997. initialValue: theData.contacts
  998. })(
  999. <Select style={{ width: 260 }}
  1000. placeholder="请选择联系人"
  1001. notFoundContent="未获取到联系人列表"
  1002. showSearch
  1003. filterOption={companySearch}>
  1004. {this.state.contactsOption}
  1005. </Select>
  1006. )}
  1007. </FormItem> : <div></div>}
  1008. </div>}
  1009. <div className="clearfix">
  1010. {theData.techBrokerId ? <FormItem className="half-item"
  1011. {...formItemLayout}
  1012. label="负责人" >
  1013. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  1014. </FormItem> : <div></div>}
  1015. </div>
  1016. {theData.releaseStatus ? <div className="clearfix">
  1017. <FormItem className="half-item"
  1018. {...formItemLayout}
  1019. label="是否发布" >
  1020. {(() => {
  1021. switch (theData.releaseStatus) {
  1022. case "0":
  1023. return <span>未发布</span>;
  1024. case "1":
  1025. return <span>已发布</span>;
  1026. }
  1027. })()}
  1028. </FormItem>
  1029. <FormItem className="half-item"
  1030. {...formItemLayout}
  1031. label="发布时间" >
  1032. <span>{theData.releaseDateFormattedDate}</span>
  1033. </FormItem>
  1034. </div> : <div></div>}
  1035. <div className="clearfix">
  1036. {theData.releaseStatus == "1" ? <FormItem className="half-item"
  1037. {...formItemLayout}
  1038. label="需求状态" >
  1039. {getFieldDecorator('status', {
  1040. initialValue: theData.status
  1041. })(
  1042. <Radio.Group>
  1043. <Radio value="0">未解决</Radio>
  1044. <Radio value="1">已解决</Radio>
  1045. </Radio.Group>
  1046. )}
  1047. </FormItem> : <div></div>}
  1048. <FormItem className="half-item"
  1049. {...formItemLayout}
  1050. label="审核状态" >
  1051. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  1052. </FormItem>
  1053. </div>
  1054. <FormItem
  1055. labelCol={{ span: 3 }}
  1056. wrapperCol={{ span: 20 }}
  1057. label="关键词" >
  1058. <KeyWordTagGroup
  1059. keyWordArr={this.state.tags}
  1060. tagsArr={this.getTagsArr}
  1061. visible={this.props.visible} />
  1062. </FormItem>
  1063. <FormItem
  1064. labelCol={{ span: 3 }}
  1065. wrapperCol={{ span: 18 }}
  1066. label="行业类别" >
  1067. {getFieldDecorator('industryCategory', {
  1068. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  1069. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  1070. })(
  1071. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  1072. )}
  1073. </FormItem>
  1074. <div className="clearfix">
  1075. <FormItem className="half-item"
  1076. {...formItemLayout}
  1077. label="需求类型" >
  1078. {getFieldDecorator('demandType', {
  1079. rules: [{ required: true, message: '此项为必填项!' }],
  1080. initialValue: theData.demandType
  1081. })(
  1082. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  1083. {this.props.demandTypeOption}
  1084. </Select>
  1085. )}
  1086. </FormItem>
  1087. </div>
  1088. <FormItem
  1089. labelCol={{ span: 3 }}
  1090. wrapperCol={{ span: 18 }}
  1091. label="问题说明" >
  1092. {getFieldDecorator('problemDes', {
  1093. rules: [{ required: true, message: '此项为必填项!' }],
  1094. initialValue: theData.problemDes
  1095. })(
  1096. <Input type="textarea" rows={4} />
  1097. )}
  1098. </FormItem>
  1099. <FormItem
  1100. labelCol={{ span: 3 }}
  1101. wrapperCol={{ span: 18 }}
  1102. label="技术指标要求" >
  1103. {getFieldDecorator('technicalRequirements', {
  1104. initialValue: theData.technicalRequirements
  1105. })(
  1106. <Input type="textarea" rows={2} />
  1107. )}
  1108. </FormItem>
  1109. <FormItem
  1110. labelCol={{ span: 3 }}
  1111. wrapperCol={{ span: 18 }}
  1112. label="需求文件(图片)" >
  1113. <PicturesWall
  1114. uid={theData.employerId}
  1115. fileList={this.getPictureUrl}
  1116. pictureUrl={this.state.pictureUrl}
  1117. visible={this.props.visible} />
  1118. </FormItem>
  1119. <FormItem
  1120. labelCol={{ span: 3 }}
  1121. wrapperCol={{ span: 6 }}
  1122. label="需求文件(文本)" >
  1123. <Upload
  1124. name="ratepay"
  1125. action={globalConfig.context + "/api/admin/demand/uploadTextFile"}
  1126. data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
  1127. beforeUpload={beforeUploadFile}
  1128. fileList={this.state.textFileList}
  1129. onChange={(info) => {
  1130. if (info.file.status !== 'uploading') {
  1131. console.log(info.file, info.fileList);
  1132. }
  1133. if (info.file.status === 'done') {
  1134. if (!info.file.response.error.length) {
  1135. message.success(`${info.file.name} 文件上传成功!`);
  1136. } else {
  1137. message.warning(info.file.response.error[0].message);
  1138. return;
  1139. };
  1140. this.state.textFileUrl = info.file.response.data;
  1141. } else if (info.file.status === 'error') {
  1142. message.error(`${info.file.name} 文件上传失败。`);
  1143. };
  1144. this.setState({ textFileList: info.fileList.slice(-1) });
  1145. }} >
  1146. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  1147. </Upload>
  1148. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  1149. <span className="download-file">
  1150. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  1151. </span>
  1152. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1153. </FormItem>
  1154. <FormItem
  1155. labelCol={{ span: 3 }}
  1156. wrapperCol={{ span: 18 }}
  1157. label="需求文件(视频地址)" >
  1158. {getFieldDecorator('videoUrl', {
  1159. initialValue: theData.videoUrl
  1160. })(
  1161. <Input />
  1162. )}
  1163. </FormItem>
  1164. <div className="clearfix">
  1165. <FormItem className="half-item"
  1166. {...formItemLayout}
  1167. label="固定周期" >
  1168. {getFieldDecorator('fixedCycle', {
  1169. initialValue: theData.fixedCycle
  1170. })(
  1171. <Input />
  1172. )}
  1173. </FormItem>
  1174. <FormItem className="half-item"
  1175. {...formItemLayout}
  1176. label="固定人数" >
  1177. {getFieldDecorator('peopleNumber', {
  1178. initialValue: theData.peopleNumber || 0
  1179. })(
  1180. <InputNumber />
  1181. )}
  1182. <span style={{ marginLeft: '20px' }}>人</span>
  1183. </FormItem>
  1184. </div>
  1185. <FormItem
  1186. labelCol={{ span: 3 }}
  1187. wrapperCol={{ span: 18 }}
  1188. label="固定方案" >
  1189. {getFieldDecorator('fixedScheme', {
  1190. initialValue: theData.fixedScheme
  1191. })(
  1192. <Input type="textarea" rows={2} />
  1193. )}
  1194. </FormItem>
  1195. <div className="clearfix">
  1196. <FormItem className="half-item"
  1197. {...formItemLayout}
  1198. label="预算费用" >
  1199. {getFieldDecorator('budgetCost', {
  1200. initialValue: theData.budgetCost || 0
  1201. })(
  1202. <InputNumber min={0} max={999999} step={0.01} />
  1203. )}
  1204. <span style={{ marginLeft: '20px' }}>万元</span>
  1205. </FormItem>
  1206. <FormItem className="half-item"
  1207. {...formItemLayout}
  1208. label="费用托管" >
  1209. {getFieldDecorator('costEscrow', {
  1210. initialValue: theData.costEscrow
  1211. })(
  1212. <Radio.Group>
  1213. <Radio value={0}>否</Radio>
  1214. <Radio value={1}>是</Radio>
  1215. </Radio.Group>
  1216. )}
  1217. </FormItem>
  1218. <FormItem className="half-item"
  1219. {...formItemLayout}
  1220. label="有效期限" >
  1221. {getFieldDecorator('validityPeriod', {
  1222. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  1223. })(
  1224. <DatePicker />
  1225. )}
  1226. </FormItem>
  1227. </div>
  1228. <div className="clearfix" style={{ display: 'none' }}>
  1229. <FormItem className="half-item"
  1230. {...formItemLayout}
  1231. label="雇主地址" >
  1232. <span>{theData.employerAddress}</span>
  1233. </FormItem>
  1234. <FormItem className="half-item"
  1235. {...formItemLayout}
  1236. label="雇主联系人名称" >
  1237. <span>{theData.employerContacts}</span>
  1238. </FormItem>
  1239. <FormItem className="half-item"
  1240. {...formItemLayout}
  1241. label="雇主联系人电话" >
  1242. <span>{theData.employerContactsMobile}</span>
  1243. </FormItem>
  1244. <FormItem className="half-item"
  1245. {...formItemLayout}
  1246. label="雇主联系人邮箱" >
  1247. <span>{theData.employerContactsMailbox}</span>
  1248. </FormItem>
  1249. </div>
  1250. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  1251. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1252. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1253. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1254. </FormItem>
  1255. </Spin>
  1256. </Form >
  1257. )
  1258. }
  1259. }));
  1260. const DemandDetail = React.createClass({
  1261. getInitialState() {
  1262. return {
  1263. visible: false,
  1264. techBrodersObj: {},
  1265. tabsKey: "1",
  1266. columns: [
  1267. {
  1268. title: '编号',
  1269. dataIndex: 'serialNumber',
  1270. key: 'serialNumber',
  1271. }, {
  1272. title: '数据类型',
  1273. dataIndex: 'dataCategory',
  1274. key: 'dataCategory',
  1275. render: text => {
  1276. switch (text) {
  1277. case "0":
  1278. return <span>个人需求</span>;
  1279. case "1":
  1280. return <span>团体需求</span>;
  1281. }
  1282. }
  1283. }, {
  1284. title: '名称',
  1285. dataIndex: 'name',
  1286. key: 'name',
  1287. }, {
  1288. title: '关键字',
  1289. dataIndex: 'keyword',
  1290. key: 'keyword',
  1291. }, {
  1292. title: '类型',
  1293. dataIndex: 'category',
  1294. key: 'category',
  1295. render: text => { return getAchievementCategory(text); }
  1296. }, {
  1297. title: '所有人名称',
  1298. dataIndex: 'theName',
  1299. key: 'theName',
  1300. }, {
  1301. title: '所有人类型',
  1302. dataIndex: 'ownerType',
  1303. key: 'ownerType',
  1304. render: text => {
  1305. switch (text) {
  1306. case "0":
  1307. return <span>个人</span>;
  1308. case "1":
  1309. return <span>组织</span>
  1310. }
  1311. }
  1312. }, {
  1313. title: '发布时间',
  1314. dataIndex: 'releaseDateFormattedDate',
  1315. key: 'releaseDateFormattedDate',
  1316. }
  1317. ],
  1318. dataSource: [],
  1319. };
  1320. },
  1321. getTechBrodersList() {
  1322. this.setState({
  1323. loading: true
  1324. });
  1325. $.ajax({
  1326. method: "get",
  1327. dataType: "json",
  1328. crossDomain: false,
  1329. url: globalConfig.context + "/api/admin/audit/techBroders",
  1330. success: function (data) {
  1331. if (!data.data) {
  1332. if (data.error && data.error.length) {
  1333. message.warning(data.error[0].message);
  1334. }
  1335. return;
  1336. };
  1337. let _me = this, theArr = [];
  1338. for (var item in data.data) {
  1339. theArr.push(
  1340. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1341. )
  1342. };
  1343. this.setState({
  1344. techBrodersOption: theArr,
  1345. techBrodersObj: data.data
  1346. });
  1347. }.bind(this),
  1348. }).always(function () {
  1349. this.setState({
  1350. loading: false
  1351. });
  1352. }.bind(this));
  1353. },
  1354. getTableList() {
  1355. this.setState({
  1356. loading: true
  1357. });
  1358. $.ajax({
  1359. method: "get",
  1360. dataType: "json",
  1361. crossDomain: false,
  1362. url: globalConfig.context + "/api/admin/demand/achievementDemand",
  1363. data: { id: this.props.data.id },
  1364. success: function (data) {
  1365. let theArr = [];
  1366. if (!data.data) {
  1367. if (data.error && data.error.length) {
  1368. message.warning(data.error[0].message);
  1369. };
  1370. } else if (data.data.length) {
  1371. for (let i = 0; i < data.data.length; i++) {
  1372. let thisdata = data.data[i];
  1373. theArr.push({
  1374. key: i,
  1375. id: thisdata.id,
  1376. serialNumber: thisdata.serialNumber,
  1377. dataCategory: thisdata.dataCategory,
  1378. name: thisdata.name,
  1379. keyword: thisdata.keyword,
  1380. category: thisdata.category,
  1381. ownerType: thisdata.ownerType,
  1382. theName: thisdata.username || thisdata.unitName,
  1383. releaseDate: thisdata.releaseDate,
  1384. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1385. });
  1386. };
  1387. };
  1388. this.setState({
  1389. dataSource: theArr,
  1390. });
  1391. }.bind(this),
  1392. }).always(function () {
  1393. this.setState({
  1394. loading: false
  1395. });
  1396. }.bind(this));
  1397. },
  1398. tableRowClick(record, index) {
  1399. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1400. },
  1401. handleCancel(e) {
  1402. this.setState({
  1403. visible: false,
  1404. });
  1405. this.props.closeDesc(false);
  1406. },
  1407. handleOk(e) {
  1408. this.setState({
  1409. visible: false,
  1410. });
  1411. this.props.closeDesc(false, true);
  1412. },
  1413. componentWillMount() {
  1414. this.getTechBrodersList();
  1415. },
  1416. componentWillReceiveProps(nextProps) {
  1417. if (!this.state.visible && nextProps.showDesc) {
  1418. this.state.tabsKey = "1";
  1419. };
  1420. this.state.visible = nextProps.showDesc;
  1421. },
  1422. render() {
  1423. if (this.props.data) {
  1424. return (
  1425. <div className="patent-desc">
  1426. <Modal maskClosable={false} visible={this.state.visible}
  1427. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1428. width='1000px'
  1429. footer=''
  1430. className="admin-desc-content">
  1431. <Spin spinning={this.state.loading}>
  1432. <Tabs activeKey={this.state.tabsKey}
  1433. onChange={(e) => {
  1434. this.setState({ tabsKey: e });
  1435. if (e == "2") {
  1436. this.getTableList();
  1437. };
  1438. }} >
  1439. <Tabs.TabPane tab="需求详情" key="1">
  1440. {(() => {
  1441. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1442. return <DemandDetailShow
  1443. data={this.props.data}
  1444. detailApiUrl={this.props.detailApiUrl}
  1445. techBrodersOption={this.state.techBrodersOption}
  1446. techBrodersObj={this.state.techBrodersObj}
  1447. demandTypeOption={this.props.demandTypeOption}
  1448. closeDesc={this.handleCancel}
  1449. visible={this.state.visible}
  1450. handleOk={this.handleOk} />
  1451. } else {
  1452. return <DemandDetailForm
  1453. data={this.props.data}
  1454. detailApiUrl={this.props.detailApiUrl}
  1455. companyOption={this.props.companyOption}
  1456. userOption={this.props.userOption}
  1457. techBrodersObj={this.state.techBrodersObj}
  1458. demandTypeOption={this.props.demandTypeOption}
  1459. closeDesc={this.handleCancel}
  1460. visible={this.state.visible}
  1461. handleOk={this.handleOk} />
  1462. }
  1463. })()}
  1464. </Tabs.TabPane>
  1465. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  1466. <Table columns={this.state.columns}
  1467. dataSource={this.state.dataSource}
  1468. pagination={false}
  1469. onRowClick={this.tableRowClick} />
  1470. </Tabs.TabPane>
  1471. </Tabs>
  1472. </Spin>
  1473. </Modal>
  1474. </div>
  1475. );
  1476. } else {
  1477. return <div></div>
  1478. }
  1479. },
  1480. });
  1481. export default DemandDetail;