techDemandDesc.jsx 76 KB

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