techDemandDesc.jsx 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518
  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. {(() => {
  600. switch (theData.boutique) {
  601. case "0":
  602. return <span>否</span>;
  603. case "1":
  604. return <span>是</span>;
  605. }
  606. })()}
  607. </FormItem>
  608. <FormItem className="half-item"
  609. {...formItemLayout}
  610. label="有效期限" >
  611. <span>{theData.validityPeriodFormattedDate}</span>
  612. </FormItem>
  613. </div>
  614. {window.showAuditStatus && theData.auditStatus == 2 ? <div className="clearfix">
  615. <FormItem className="half-item"
  616. {...formItemLayout}
  617. label="审核状态" >
  618. {getFieldDecorator('auditStatus')(
  619. <Radio.Group>
  620. <Radio value={3}>审核通过</Radio>
  621. <Radio value={4}>审核未通过</Radio>
  622. </Radio.Group>
  623. )}
  624. </FormItem>
  625. <FormItem className="half-item"
  626. {...formItemLayout}
  627. label="技术经纪人" >
  628. {getFieldDecorator('techBrokerId', {
  629. initialValue: theData.techBrokerId
  630. })(
  631. <Select style={{ width: 260 }}
  632. placeholder="请选择技术经纪人"
  633. notFoundContent="未获取到经纪人列表"
  634. showSearch
  635. filterOption={companySearch}>
  636. {this.props.techBrodersOption}
  637. </Select>
  638. )}
  639. </FormItem>
  640. </div> : <div></div>}
  641. {window.showAuditStatus && theData.auditStatus == 3 ? <div className="clearfix">
  642. <FormItem className="half-item"
  643. {...formItemLayout}
  644. label="指派新经纪人" >
  645. {getFieldDecorator('modifyTechBrokerId', {
  646. initialValue: theData.techBrokerId
  647. })(
  648. <Select style={{ width: 260 }}
  649. placeholder="请选择要指派的新经纪人"
  650. notFoundContent="未获取到经纪人列表"
  651. showSearch
  652. filterOption={companySearch}>
  653. {this.props.techBrodersOption}
  654. </Select>
  655. )}
  656. </FormItem>
  657. </div> : <div></div>}
  658. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  659. {theData.auditStatus == 2 ? <Button className="set-submit" type="primary" htmlType="submit">保存</Button> : <span></span>}
  660. {theData.auditStatus == 3 ? <Button className="set-submit" type="primary" onClick={() => { this.modifyBroker(); }}>保存</Button> : <span></span>}
  661. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  662. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList}>生成匹配列表</Button> : <span></span>}
  663. </FormItem>
  664. <Modal maskClosable={false} title="确认"
  665. visible={this.state.formSubmitVisible}
  666. width='360px'
  667. footer={null}
  668. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  669. <span>确认该需求审核未通过?</span>
  670. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  671. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  672. </Modal>
  673. </Spin>
  674. </Form >
  675. )
  676. }
  677. }));
  678. const DemandDetailForm = Form.create()(React.createClass({
  679. getInitialState() {
  680. return {
  681. visible: false,
  682. loading: false,
  683. auditStatus: 0,
  684. switchValue: false,
  685. textFileList: [],
  686. videoFileList: [],
  687. contactsOption: [],
  688. data: {},
  689. tags: [],
  690. pictureUrl: [],
  691. dataSource: []
  692. };
  693. },
  694. getContactsList(theUid) {
  695. $.ajax({
  696. method: "get",
  697. dataType: "json",
  698. crossDomain: false,
  699. url: globalConfig.context + "/api/admin/getContacts",
  700. data: {
  701. uid: theUid
  702. },
  703. success: function (data) {
  704. let theOption = [];
  705. if (!data.data) {
  706. if (data.error && data.error.length) {
  707. message.warning(data.error[0].message);
  708. return;
  709. };
  710. };
  711. for (let item in data.data) {
  712. let theData = data.data[item];
  713. theOption.push(
  714. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  715. );
  716. };
  717. this.setState({
  718. contactsOption: theOption
  719. });
  720. }.bind(this),
  721. });
  722. },
  723. loadData(id, detailApiUrl) {
  724. this.setState({
  725. loading: true
  726. });
  727. $.ajax({
  728. method: "get",
  729. dataType: "json",
  730. crossDomain: false,
  731. url: globalConfig.context + detailApiUrl,
  732. data: {
  733. id: id
  734. },
  735. success: function (data) {
  736. let thisData = data.data;
  737. if (!thisData) {
  738. if (data.error && data.error.length) {
  739. message.warning(data.error[0].message);
  740. };
  741. thisData = {};
  742. };
  743. if (thisData.employerId) {
  744. this.getContactsList(thisData.employerId)
  745. };
  746. this.setState({
  747. data: thisData,
  748. switchValue: Boolean(!thisData.employerId),
  749. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  750. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  751. });
  752. }.bind(this),
  753. }).always(function () {
  754. this.setState({
  755. loading: false
  756. });
  757. }.bind(this));
  758. },
  759. getTagsArr(e) {
  760. this.setState({ tags: e });
  761. },
  762. getPictureUrl(e) {
  763. this.setState({ pictureUrl: e });
  764. },
  765. handleSubmit(e) {
  766. e.preventDefault();
  767. this.props.form.validateFields((err, values) => {
  768. //keyword长度判断
  769. if ((this.state.tags ? this.state.tags.length : this.props.tags.length) < 3) {
  770. message.warning('关键词数量不能小于3个!');
  771. return;
  772. };
  773. //url转化
  774. let thePictureUrl = [];
  775. if (this.state.pictureUrl.length) {
  776. let picArr = [];
  777. this.state.pictureUrl.map(function (item) {
  778. picArr.push(item.response.data);
  779. });
  780. thePictureUrl = picArr.join(",");
  781. };
  782. if (!err) {
  783. this.setState({
  784. loading: true
  785. });
  786. $.ajax({
  787. method: "POST",
  788. dataType: "json",
  789. crossDomain: false,
  790. url: this.props.data.id ? globalConfig.context + '/api/admin/demand/update' : globalConfig.context + '/api/admin/demand/apply',
  791. data: {
  792. id: this.props.data.id,
  793. dataCategory: this.props.detailApiUrl.indexOf('org') >= 0 ? 1 : 0,
  794. serialNumber: this.props.data.serialNumber,
  795. name: values.name,
  796. keyword: this.state.tags ? this.state.tags.join(",") : this.props.tags.join(","),
  797. keywords: this.state.tags ? this.state.tags : this.props.tags,
  798. infoSources: 0,
  799. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  800. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  801. demandType: values.demandType,
  802. problemDes: values.problemDes,
  803. technicalRequirements: values.technicalRequirements,
  804. pictureUrl: thePictureUrl,
  805. textFileUrl: this.state.textFileUrl,
  806. videoUrl: values.videoUrl,
  807. fixedBudget: values.fixedBudget,
  808. fixedCycle: values.fixedCycle,
  809. peopleNumber: values.peopleNumber,
  810. fixedScheme: values.fixedScheme,
  811. costEscrow: values.costEscrow,
  812. budgetCost: values.budgetCost,
  813. //
  814. switchSign: this.state.switchValue ? 1 : 0,
  815. //
  816. employerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.employerId] : this.props.data.employerId) : null,
  817. contacts: !this.state.switchValue ? values.contacts : null,
  818. //自定义
  819. employerName: this.state.switchValue ? values.employerName : null,
  820. employerAddress: this.state.switchValue ? values.employerAddress : null,
  821. employerContactsMobile: this.state.switchValue ? values.employerContactsMobile : null,
  822. employerContactsMailbox: this.state.switchValue ? values.employerContactsMailbox : null,
  823. //
  824. releaseStatus: values.releaseStatus,
  825. principalId: values.principalId,
  826. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  827. //
  828. status: this.state.status,
  829. auditStatus: this.state.auditStatus,
  830. boutique: values.boutique,
  831. }
  832. }).done(function (data) {
  833. this.state.auditStatus = 0;
  834. if (!data.error.length) {
  835. message.success('保存成功!');
  836. this.props.handleOk();
  837. } else {
  838. message.warning(data.error[0].message);
  839. };
  840. this.setState({
  841. loading: false
  842. });
  843. }.bind(this));
  844. }
  845. });
  846. },
  847. handleSearch(e) {
  848. if (this.props.detailApiUrl.indexOf('org') != -1) {
  849. $.ajax({
  850. method: "get",
  851. dataType: "json",
  852. crossDomain: false,
  853. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  854. data: { name: e },
  855. success: function (data) {
  856. let theArr = [];
  857. let theObj = {};
  858. if (!data.data) {
  859. if (data.error && data.error.length) {
  860. message.warning(data.error[0].message);
  861. };
  862. } else if (!$.isEmptyObject(data.data)) {
  863. data.data.map(function (item) {
  864. theArr.push(item.unitName);
  865. theObj[item.unitName] = item.uid;
  866. });
  867. };
  868. this.setState({
  869. dataSource: theArr,
  870. dataSourceObj: theObj
  871. });
  872. }.bind(this),
  873. });
  874. } else {
  875. $.ajax({
  876. method: "get",
  877. dataType: "json",
  878. crossDomain: false,
  879. url: globalConfig.context + "/api/admin/achievement/userOwner",
  880. data: { name: e },
  881. success: function (data) {
  882. let theArr = [];
  883. let theObj = {};
  884. if (!data.data) {
  885. if (data.error && data.error.length) {
  886. message.warning(data.error[0].message);
  887. };
  888. } else if (!$.isEmptyObject(data.data)) {
  889. for (let item in data.data) {
  890. theArr.push(data.data[item]);
  891. theObj[data.data[item]] = item;
  892. };
  893. };
  894. this.setState({
  895. dataSource: theArr,
  896. dataSourceObj: theObj
  897. });
  898. }.bind(this),
  899. });
  900. };
  901. },
  902. componentWillMount() {
  903. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  904. if (this.props.data && this.props.data.id) {
  905. this.loadData(this.props.data.id, this.props.detailApiUrl);
  906. };
  907. },
  908. componentWillReceiveProps(nextProps) {
  909. if (!this.props.visible && nextProps.visible) {
  910. if (nextProps.data && nextProps.data.id) {
  911. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  912. };
  913. this.state.contactsOption = [];
  914. this.state.data = {};
  915. this.state.tags = [];
  916. this.state.switchValue = false;
  917. this.state.pictureUrl = [];
  918. this.state.textFileList = [];
  919. this.state.videoFileList = [];
  920. this.state.textFileUrl = undefined;
  921. this.props.form.resetFields();
  922. };
  923. },
  924. render() {
  925. const theData = this.state.data || {};
  926. const { getFieldDecorator } = this.props.form;
  927. const FormItem = Form.Item
  928. const formItemLayout = {
  929. labelCol: { span: 6 },
  930. wrapperCol: { span: 12 },
  931. };
  932. return (
  933. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  934. <Spin spinning={this.state.loading}>
  935. <div className="clearfix">
  936. <FormItem className="half-item"
  937. {...formItemLayout}
  938. label="编号" >
  939. <span>{theData.serialNumber}</span>
  940. </FormItem>
  941. <FormItem className="half-item"
  942. {...formItemLayout}
  943. label="需求名称" >
  944. {getFieldDecorator('name', {
  945. rules: [{ required: true, message: '此项为必填项!' }],
  946. initialValue: theData.name
  947. })(
  948. <Input />
  949. )}
  950. </FormItem>
  951. </div>
  952. <FormItem style={{ marginBottom: '10px' }} labelCol={{ span: 3 }}
  953. label="自定义雇主" >
  954. <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
  955. </FormItem>
  956. {this.state.switchValue ? <div className="clearfix" >
  957. <FormItem className="half-item"
  958. {...formItemLayout}
  959. label="雇主名称" >
  960. {getFieldDecorator('employerName', {
  961. initialValue: theData.employerName
  962. })(
  963. <Input />
  964. )}
  965. </FormItem>
  966. <FormItem className="half-item"
  967. {...formItemLayout}
  968. label="联系电话" >
  969. {getFieldDecorator('employerContactsMobile', {
  970. initialValue: theData.employerContactsMobile
  971. })(
  972. <Input />
  973. )}
  974. </FormItem>
  975. <FormItem className="half-item"
  976. {...formItemLayout}
  977. label="电子邮箱" >
  978. {getFieldDecorator('employerContactsMailbox', {
  979. initialValue: theData.employerContactsMailbox
  980. })(
  981. <Input />
  982. )}
  983. </FormItem>
  984. <FormItem className="half-item"
  985. {...formItemLayout}
  986. label="通讯地址" >
  987. {getFieldDecorator('employerAddress', {
  988. initialValue: theData.employerAddress
  989. })(
  990. <Input />
  991. )}
  992. </FormItem>
  993. </div> : <div className="clearfix">
  994. <FormItem className="half-item"
  995. {...formItemLayout}
  996. label="雇主名称" >
  997. {getFieldDecorator('employerId', {
  998. initialValue: theData.username || ''
  999. })(
  1000. <AutoComplete
  1001. dataSource={this.state.dataSource}
  1002. style={{ width: 200 }}
  1003. onSearch={this.state.therottleSearch}
  1004. placeholder="雇主名称"
  1005. onSelect={(e) => {
  1006. this.getContactsList(this.state.dataSourceObj[e]);
  1007. }} />
  1008. )}
  1009. </FormItem>
  1010. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  1011. {...formItemLayout}
  1012. label="联系人" >
  1013. {getFieldDecorator('contacts', {
  1014. initialValue: theData.contacts
  1015. })(
  1016. <Select style={{ width: 260 }}
  1017. placeholder="请选择联系人"
  1018. notFoundContent="未获取到联系人列表"
  1019. showSearch
  1020. filterOption={companySearch}>
  1021. {this.state.contactsOption}
  1022. </Select>
  1023. )}
  1024. </FormItem> : <div></div>}
  1025. </div>}
  1026. <div className="clearfix">
  1027. {theData.techBrokerId ? <FormItem className="half-item"
  1028. {...formItemLayout}
  1029. label="负责人" >
  1030. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  1031. </FormItem> : <div></div>}
  1032. </div>
  1033. {theData.releaseStatus ? <div className="clearfix">
  1034. <FormItem className="half-item"
  1035. {...formItemLayout}
  1036. label="是否发布" >
  1037. {(() => {
  1038. switch (theData.releaseStatus) {
  1039. case "0":
  1040. return <span>未发布</span>;
  1041. case "1":
  1042. return <span>已发布</span>;
  1043. }
  1044. })()}
  1045. </FormItem>
  1046. <FormItem className="half-item"
  1047. {...formItemLayout}
  1048. label="发布时间" >
  1049. <span>{theData.releaseDateFormattedDate}</span>
  1050. </FormItem>
  1051. </div> : <div></div>}
  1052. <div className="clearfix">
  1053. {theData.releaseStatus == "1" ? <FormItem className="half-item"
  1054. {...formItemLayout}
  1055. label="需求状态" >
  1056. {getFieldDecorator('status', {
  1057. initialValue: theData.status
  1058. })(
  1059. <Radio.Group>
  1060. <Radio value="0">未解决</Radio>
  1061. <Radio value="1">已解决</Radio>
  1062. </Radio.Group>
  1063. )}
  1064. </FormItem> : <div></div>}
  1065. <FormItem className="half-item"
  1066. {...formItemLayout}
  1067. label="审核状态" >
  1068. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  1069. </FormItem>
  1070. </div>
  1071. <FormItem
  1072. labelCol={{ span: 3 }}
  1073. wrapperCol={{ span: 20 }}
  1074. label="关键词" >
  1075. <KeyWordTagGroup
  1076. keyWordArr={this.state.tags}
  1077. tagsArr={this.getTagsArr}
  1078. visible={this.props.visible} />
  1079. </FormItem>
  1080. <FormItem
  1081. labelCol={{ span: 3 }}
  1082. wrapperCol={{ span: 18 }}
  1083. label="行业类别" >
  1084. {getFieldDecorator('industryCategory', {
  1085. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  1086. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  1087. })(
  1088. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  1089. )}
  1090. </FormItem>
  1091. <div className="clearfix">
  1092. <FormItem className="half-item"
  1093. {...formItemLayout}
  1094. label="需求类型" >
  1095. {getFieldDecorator('demandType', {
  1096. rules: [{ required: true, message: '此项为必填项!' }],
  1097. initialValue: theData.demandType
  1098. })(
  1099. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  1100. {this.props.demandTypeOption}
  1101. </Select>
  1102. )}
  1103. </FormItem>
  1104. </div>
  1105. <FormItem
  1106. labelCol={{ span: 3 }}
  1107. wrapperCol={{ span: 18 }}
  1108. label="问题说明" >
  1109. {getFieldDecorator('problemDes', {
  1110. rules: [{ required: true, message: '此项为必填项!' }],
  1111. initialValue: theData.problemDes
  1112. })(
  1113. <Input type="textarea" rows={4} />
  1114. )}
  1115. </FormItem>
  1116. <FormItem
  1117. labelCol={{ span: 3 }}
  1118. wrapperCol={{ span: 18 }}
  1119. label="技术指标要求" >
  1120. {getFieldDecorator('technicalRequirements', {
  1121. initialValue: theData.technicalRequirements
  1122. })(
  1123. <Input type="textarea" rows={2} />
  1124. )}
  1125. </FormItem>
  1126. <FormItem
  1127. labelCol={{ span: 3 }}
  1128. wrapperCol={{ span: 18 }}
  1129. label="需求文件(图片)" >
  1130. <PicturesWall
  1131. uid={theData.employerId}
  1132. fileList={this.getPictureUrl}
  1133. pictureUrl={this.state.pictureUrl}
  1134. visible={this.props.visible} />
  1135. </FormItem>
  1136. <FormItem
  1137. labelCol={{ span: 3 }}
  1138. wrapperCol={{ span: 6 }}
  1139. label="需求文件(文本)" >
  1140. <Upload
  1141. name="ratepay"
  1142. action={globalConfig.context + "/api/admin/demand/uploadTextFile"}
  1143. data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
  1144. beforeUpload={beforeUploadFile}
  1145. fileList={this.state.textFileList}
  1146. onChange={(info) => {
  1147. if (info.file.status !== 'uploading') {
  1148. console.log(info.file, info.fileList);
  1149. }
  1150. if (info.file.status === 'done') {
  1151. if (!info.file.response.error.length) {
  1152. message.success(`${info.file.name} 文件上传成功!`);
  1153. } else {
  1154. message.warning(info.file.response.error[0].message);
  1155. return;
  1156. };
  1157. this.state.textFileUrl = info.file.response.data;
  1158. } else if (info.file.status === 'error') {
  1159. message.error(`${info.file.name} 文件上传失败。`);
  1160. };
  1161. this.setState({ textFileList: info.fileList.slice(-1) });
  1162. }} >
  1163. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  1164. </Upload>
  1165. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  1166. <span className="download-file">
  1167. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  1168. </span>
  1169. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1170. </FormItem>
  1171. <FormItem
  1172. labelCol={{ span: 3 }}
  1173. wrapperCol={{ span: 18 }}
  1174. label="需求文件(视频地址)" >
  1175. {getFieldDecorator('videoUrl', {
  1176. initialValue: theData.videoUrl
  1177. })(
  1178. <Input />
  1179. )}
  1180. </FormItem>
  1181. <div className="clearfix">
  1182. <FormItem className="half-item"
  1183. {...formItemLayout}
  1184. label="固定周期" >
  1185. {getFieldDecorator('fixedCycle', {
  1186. initialValue: theData.fixedCycle
  1187. })(
  1188. <Input />
  1189. )}
  1190. </FormItem>
  1191. <FormItem className="half-item"
  1192. {...formItemLayout}
  1193. label="固定人数" >
  1194. {getFieldDecorator('peopleNumber', {
  1195. initialValue: theData.peopleNumber || 0
  1196. })(
  1197. <InputNumber />
  1198. )}
  1199. <span style={{ marginLeft: '20px' }}>人</span>
  1200. </FormItem>
  1201. </div>
  1202. <FormItem
  1203. labelCol={{ span: 3 }}
  1204. wrapperCol={{ span: 18 }}
  1205. label="固定方案" >
  1206. {getFieldDecorator('fixedScheme', {
  1207. initialValue: theData.fixedScheme
  1208. })(
  1209. <Input type="textarea" rows={2} />
  1210. )}
  1211. </FormItem>
  1212. <div className="clearfix">
  1213. <FormItem className="half-item"
  1214. {...formItemLayout}
  1215. label="预算费用" >
  1216. {getFieldDecorator('budgetCost', {
  1217. initialValue: theData.budgetCost || 0
  1218. })(
  1219. <InputNumber min={0} max={999999} step={0.01} />
  1220. )}
  1221. <span style={{ marginLeft: '20px' }}>万元</span>
  1222. </FormItem>
  1223. <FormItem className="half-item"
  1224. {...formItemLayout}
  1225. label="费用托管" >
  1226. {getFieldDecorator('costEscrow', {
  1227. initialValue: theData.costEscrow
  1228. })(
  1229. <Radio.Group>
  1230. <Radio value={0}>否</Radio>
  1231. <Radio value={1}>是</Radio>
  1232. </Radio.Group>
  1233. )}
  1234. </FormItem>
  1235. <FormItem className="half-item"
  1236. {...formItemLayout}
  1237. label="精品需求" >
  1238. {getFieldDecorator('boutique', {
  1239. initialValue: theData.boutique
  1240. })(
  1241. <Radio.Group>
  1242. <Radio value="0">否</Radio>
  1243. <Radio value="1">是</Radio>
  1244. </Radio.Group>
  1245. )}
  1246. </FormItem>
  1247. <FormItem className="half-item"
  1248. {...formItemLayout}
  1249. label="有效期限" >
  1250. {getFieldDecorator('validityPeriod', {
  1251. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  1252. })(
  1253. <DatePicker />
  1254. )}
  1255. </FormItem>
  1256. </div>
  1257. <div className="clearfix" style={{ display: 'none' }}>
  1258. <FormItem className="half-item"
  1259. {...formItemLayout}
  1260. label="雇主地址" >
  1261. <span>{theData.employerAddress}</span>
  1262. </FormItem>
  1263. <FormItem className="half-item"
  1264. {...formItemLayout}
  1265. label="雇主联系人名称" >
  1266. <span>{theData.employerContacts}</span>
  1267. </FormItem>
  1268. <FormItem className="half-item"
  1269. {...formItemLayout}
  1270. label="雇主联系人电话" >
  1271. <span>{theData.employerContactsMobile}</span>
  1272. </FormItem>
  1273. <FormItem className="half-item"
  1274. {...formItemLayout}
  1275. label="雇主联系人邮箱" >
  1276. <span>{theData.employerContactsMailbox}</span>
  1277. </FormItem>
  1278. </div>
  1279. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  1280. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1281. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1282. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1283. </FormItem>
  1284. </Spin>
  1285. </Form >
  1286. )
  1287. }
  1288. }));
  1289. const DemandDetail = React.createClass({
  1290. getInitialState() {
  1291. return {
  1292. visible: false,
  1293. techBrodersObj: {},
  1294. tabsKey: "1",
  1295. columns: [
  1296. {
  1297. title: '编号',
  1298. dataIndex: 'serialNumber',
  1299. key: 'serialNumber',
  1300. }, {
  1301. title: '数据类型',
  1302. dataIndex: 'dataCategory',
  1303. key: 'dataCategory',
  1304. render: text => {
  1305. switch (text) {
  1306. case "0":
  1307. return <span>成果</span>;
  1308. case "1":
  1309. return <span>技术</span>;
  1310. case "2":
  1311. return <span>项目</span>;
  1312. }
  1313. }
  1314. }, {
  1315. title: '名称',
  1316. dataIndex: 'name',
  1317. key: 'name',
  1318. }, {
  1319. title: '关键字',
  1320. dataIndex: 'keyword',
  1321. key: 'keyword',
  1322. }, {
  1323. title: '类型',
  1324. dataIndex: 'category',
  1325. key: 'category',
  1326. render: text => { return getAchievementCategory(text); }
  1327. }, {
  1328. title: '所有人名称',
  1329. dataIndex: 'theName',
  1330. key: 'theName',
  1331. }, {
  1332. title: '所有人类型',
  1333. dataIndex: 'ownerType',
  1334. key: 'ownerType',
  1335. render: text => {
  1336. switch (text) {
  1337. case "0":
  1338. return <span>个人</span>;
  1339. case "1":
  1340. return <span>组织</span>
  1341. }
  1342. }
  1343. }, {
  1344. title: '发布时间',
  1345. dataIndex: 'releaseDateFormattedDate',
  1346. key: 'releaseDateFormattedDate',
  1347. }
  1348. ],
  1349. dataSource: [],
  1350. };
  1351. },
  1352. getTechBrodersList() {
  1353. this.setState({
  1354. loading: true
  1355. });
  1356. $.ajax({
  1357. method: "get",
  1358. dataType: "json",
  1359. crossDomain: false,
  1360. url: globalConfig.context + "/api/admin/audit/techBroders",
  1361. success: function (data) {
  1362. if (!data.data) {
  1363. if (data.error && data.error.length) {
  1364. message.warning(data.error[0].message);
  1365. }
  1366. return;
  1367. };
  1368. let _me = this, theArr = [];
  1369. for (var item in data.data) {
  1370. theArr.push(
  1371. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1372. )
  1373. };
  1374. this.setState({
  1375. techBrodersOption: theArr,
  1376. techBrodersObj: data.data
  1377. });
  1378. }.bind(this),
  1379. }).always(function () {
  1380. this.setState({
  1381. loading: false
  1382. });
  1383. }.bind(this));
  1384. },
  1385. getTableList() {
  1386. this.setState({
  1387. loading: true
  1388. });
  1389. $.ajax({
  1390. method: "get",
  1391. dataType: "json",
  1392. crossDomain: false,
  1393. url: globalConfig.context + "/api/admin/demand/achievementDemand",
  1394. data: { id: this.props.data.id },
  1395. success: function (data) {
  1396. let theArr = [];
  1397. if (!data.data) {
  1398. if (data.error && data.error.length) {
  1399. message.warning(data.error[0].message);
  1400. };
  1401. } else if (data.data.length) {
  1402. for (let i = 0; i < data.data.length; i++) {
  1403. let thisdata = data.data[i];
  1404. theArr.push({
  1405. key: i,
  1406. id: thisdata.id,
  1407. serialNumber: thisdata.serialNumber,
  1408. dataCategory: thisdata.dataCategory,
  1409. name: thisdata.name,
  1410. keyword: thisdata.keyword,
  1411. category: thisdata.category,
  1412. ownerType: thisdata.ownerType,
  1413. theName: thisdata.username || thisdata.unitName,
  1414. releaseDate: thisdata.releaseDate,
  1415. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1416. });
  1417. };
  1418. };
  1419. this.setState({
  1420. dataSource: theArr,
  1421. });
  1422. }.bind(this),
  1423. }).always(function () {
  1424. this.setState({
  1425. loading: false
  1426. });
  1427. }.bind(this));
  1428. },
  1429. tableRowClick(record, index) {
  1430. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1431. },
  1432. handleCancel(e) {
  1433. this.setState({
  1434. visible: false,
  1435. });
  1436. this.props.closeDesc(false);
  1437. },
  1438. handleOk(e) {
  1439. this.setState({
  1440. visible: false,
  1441. });
  1442. this.props.closeDesc(false, true);
  1443. },
  1444. componentWillMount() {
  1445. this.getTechBrodersList();
  1446. },
  1447. componentWillReceiveProps(nextProps) {
  1448. if (!this.state.visible && nextProps.showDesc) {
  1449. this.state.tabsKey = "1";
  1450. };
  1451. this.state.visible = nextProps.showDesc;
  1452. },
  1453. render() {
  1454. if (this.props.data) {
  1455. return (
  1456. <div className="patent-desc">
  1457. <Modal maskClosable={false} visible={this.state.visible}
  1458. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1459. width='1000px'
  1460. footer=''
  1461. className="admin-desc-content">
  1462. <Spin spinning={this.state.loading}>
  1463. <Tabs activeKey={this.state.tabsKey}
  1464. onChange={(e) => {
  1465. this.setState({ tabsKey: e });
  1466. if (e == "2") {
  1467. this.getTableList();
  1468. };
  1469. }} >
  1470. <Tabs.TabPane tab="需求详情" key="1">
  1471. {(() => {
  1472. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1473. return <DemandDetailShow
  1474. data={this.props.data}
  1475. detailApiUrl={this.props.detailApiUrl}
  1476. techBrodersOption={this.state.techBrodersOption}
  1477. techBrodersObj={this.state.techBrodersObj}
  1478. demandTypeOption={this.props.demandTypeOption}
  1479. closeDesc={this.handleCancel}
  1480. visible={this.state.visible}
  1481. handleOk={this.handleOk} />
  1482. } else {
  1483. return <DemandDetailForm
  1484. data={this.props.data}
  1485. detailApiUrl={this.props.detailApiUrl}
  1486. companyOption={this.props.companyOption}
  1487. userOption={this.props.userOption}
  1488. techBrodersObj={this.state.techBrodersObj}
  1489. demandTypeOption={this.props.demandTypeOption}
  1490. closeDesc={this.handleCancel}
  1491. visible={this.state.visible}
  1492. handleOk={this.handleOk} />
  1493. }
  1494. })()}
  1495. </Tabs.TabPane>
  1496. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  1497. <Table columns={this.state.columns}
  1498. dataSource={this.state.dataSource}
  1499. pagination={false}
  1500. onRowClick={this.tableRowClick} />
  1501. </Tabs.TabPane>
  1502. </Tabs>
  1503. </Spin>
  1504. </Modal>
  1505. </div>
  1506. );
  1507. } else {
  1508. return <div></div>
  1509. }
  1510. },
  1511. });
  1512. export default DemandDetail;