techDemandDesc.jsx 67 KB

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