techDemandDesc.jsx 75 KB

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