techDemandQueryDesc.jsx 72 KB

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