techDemandDesc.jsx 66 KB

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