techDemandDesc.jsx 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677
  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. switchValue: Boolean(!thisData.employerId),
  808. radios: thisData.hot == '1' ? true : false,
  809. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  810. pictureUrl: thisData.pictureUrl ? splitUrl(thisData.pictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  811. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : []
  812. });
  813. }.bind(this),
  814. }).always(function () {
  815. this.setState({
  816. loading: false
  817. });
  818. }.bind(this));
  819. },
  820. getTagsArr(e) {
  821. this.setState({ tags: e });
  822. },
  823. getPictureUrl(e) {
  824. this.setState({ pictureUrl: e });
  825. },
  826. getcoverImg(e) {
  827. this.setState({ coverImg: e });
  828. },
  829. handleSubmit(e) {
  830. e.preventDefault();
  831. this.props.form.validateFields((err, values) => {
  832. //keyword长度判断
  833. if ((this.state.tags ? this.state.tags.length : this.props.tags.length) < 3) {
  834. message.warning('关键词数量不能小于3个!');
  835. return;
  836. };
  837. //url转化
  838. let thePictureUrl = [];
  839. if (this.state.pictureUrl.length) {
  840. let picArr = [];
  841. this.state.pictureUrl.map(function (item) {
  842. if ( item.response && item.response.data && item.response.data.length ){
  843. picArr.push(item.response.data);
  844. }
  845. });
  846. thePictureUrl = picArr.join(",");
  847. };
  848. let thecoverImg = [];
  849. if (this.state.coverImg.length) {
  850. let picArr = [];
  851. this.state.coverImg.map(function (item) {
  852. if ( item.response && item.response.data && item.response.data.length ){
  853. picArr.push(item.response.data);
  854. }
  855. });
  856. thecoverImg = picArr.join(",");
  857. };
  858. if (!err) {
  859. this.setState({
  860. loading: true
  861. });
  862. $.ajax({
  863. method: "POST",
  864. dataType: "json",
  865. crossDomain: false,
  866. url: this.props.data.id ? globalConfig.context + '/api/admin/demand/update' : globalConfig.context + '/api/admin/demand/apply',
  867. data: {
  868. id: this.props.data.id,
  869. dataCategory: this.state.dataCategory,//this.props.detailApiUrl.indexOf('org') >= 0 ? 1 : 0
  870. serialNumber: this.props.data.serialNumber,
  871. name: values.name,
  872. keyword: this.state.tags ? this.state.tags.join(",") : this.props.tags.join(","),
  873. keywords: this.state.tags ? this.state.tags : this.props.tags,
  874. infoSources: 0,
  875. industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
  876. industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
  877. demandType: values.demandType,
  878. problemDes: values.problemDes,
  879. remark: values.remark,
  880. technicalRequirements: values.technicalRequirements,
  881. pictureUrl: thePictureUrl,
  882. coverImg: thecoverImg,
  883. textFileUrl: this.state.textFileUrl,
  884. videoUrl: values.videoUrl,
  885. fixedBudget: values.fixedBudget,
  886. fixedCycle: values.fixedCycle,
  887. peopleNumber: values.peopleNumber,
  888. fixedScheme: values.fixedScheme,
  889. costEscrow: values.costEscrow,
  890. budgetCost: values.budgetCost,
  891. //
  892. switchSign: this.state.switchValue ? 1 : 0,
  893. //
  894. employerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.employerId] : this.props.data.employerId) : null,
  895. contacts: !this.state.switchValue ? values.contacts : null,
  896. //自定义
  897. employerName: this.state.switchValue ? values.employerName : null,
  898. urgentDays: this.state.switchValue ? values.urgentDays : null,
  899. urgentMoney: this.state.switchValue ? values.urgentMoney : null,
  900. employerAddress: this.state.switchValue ? values.employerAddress : null,
  901. employerContactsMobile: this.state.switchValue ? values.employerContactsMobile : null,
  902. employerContactsMailbox: this.state.switchValue ? values.employerContactsMailbox : null,
  903. //
  904. releaseStatus: values.releaseStatus,
  905. principalId: values.principalId,
  906. validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
  907. //
  908. status: this.state.status,
  909. auditStatus: this.state.auditStatus,
  910. boutique: values.boutique,
  911. hot: values.hot,
  912. }
  913. }).done(function (data) {
  914. this.state.auditStatus = 0;
  915. if (!data.error.length) {
  916. message.success('保存成功!');
  917. this.props.handleOk();
  918. } else {
  919. message.warning(data.error[0].message);
  920. };
  921. this.setState({
  922. loading: false
  923. });
  924. }.bind(this));
  925. }
  926. });
  927. },
  928. handleSearch(e) {
  929. if (this.props.detailApiUrl.indexOf('org') != -1) {
  930. $.ajax({
  931. method: "get",
  932. dataType: "json",
  933. crossDomain: false,
  934. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  935. data: { name: e },
  936. success: function (data) {
  937. let theArr = [];
  938. let theObj = {};
  939. if (!data.data) {
  940. if (data.error && data.error.length) {
  941. message.warning(data.error[0].message);
  942. };
  943. } else if (!$.isEmptyObject(data.data)) {
  944. data.data.map(function (item) {
  945. theArr.push(item.unitName);
  946. theObj[item.unitName] = item.uid;
  947. });
  948. };
  949. this.setState({
  950. dataSource: theArr,
  951. dataSourceObj: theObj
  952. });
  953. }.bind(this),
  954. });
  955. } else {
  956. $.ajax({
  957. method: "get",
  958. dataType: "json",
  959. crossDomain: false,
  960. url: globalConfig.context + "/api/admin/achievement/userOwner",
  961. data: { name: e },
  962. success: function (data) {
  963. let theArr = [];
  964. let theObj = {};
  965. if (!data.data) {
  966. if (data.error && data.error.length) {
  967. message.warning(data.error[0].message);
  968. };
  969. } else if (!$.isEmptyObject(data.data)) {
  970. for (let item in data.data) {
  971. theArr.push(data.data[item]);
  972. theObj[data.data[item]] = item;
  973. };
  974. };
  975. this.setState({
  976. dataSource: theArr,
  977. dataSourceObj: theObj
  978. });
  979. }.bind(this),
  980. });
  981. };
  982. },
  983. componentWillMount() {
  984. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  985. if (this.props.data && this.props.data.id) {
  986. this.loadData(this.props.data.id, this.props.detailApiUrl);
  987. };
  988. },
  989. componentWillReceiveProps(nextProps) {
  990. if (!this.props.visible && nextProps.visible) {
  991. if (nextProps.data && nextProps.data.id) {
  992. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  993. };
  994. this.state.contactsOption = [];
  995. this.state.data = {};
  996. this.state.tags = [];
  997. this.state.switchValue = false;
  998. this.state.radios = false;
  999. this.state.pictureUrl = [];
  1000. this.state.coverImg = [];
  1001. this.state.textFileList = [];
  1002. this.state.videoFileList = [];
  1003. this.state.textFileUrl = undefined;
  1004. this.props.form.resetFields();
  1005. };
  1006. },
  1007. render() {
  1008. const theData = this.state.data || {};
  1009. const { getFieldDecorator } = this.props.form;
  1010. const FormItem = Form.Item
  1011. const formItemLayout = {
  1012. labelCol: { span: 6 },
  1013. wrapperCol: { span: 12 },
  1014. };
  1015. return (
  1016. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  1017. <Spin spinning={this.state.loading}>
  1018. <div className="clearfix">
  1019. <FormItem className="half-item"
  1020. {...formItemLayout}
  1021. label="编号" >
  1022. <span>{theData.serialNumber}</span>
  1023. </FormItem>
  1024. <FormItem className="half-item"
  1025. {...formItemLayout}
  1026. label="需求名称111" >
  1027. {getFieldDecorator('name', {
  1028. rules: [{ required: true, message: '此项为必填项!' }],
  1029. initialValue: theData.name
  1030. })(
  1031. <Input />
  1032. )}
  1033. </FormItem>
  1034. </div>
  1035. <div>
  1036. <FormItem className="half-item"
  1037. {...formItemLayout}
  1038. label="精品需求" >
  1039. {getFieldDecorator('boutique', {
  1040. initialValue: theData.boutique
  1041. })(
  1042. <Radio.Group>
  1043. <Radio value="0">否</Radio>
  1044. <Radio value="1">是</Radio>
  1045. </Radio.Group>
  1046. )}
  1047. </FormItem>
  1048. <FormItem className="half-item"
  1049. {...formItemLayout}
  1050. label="首页展示:" >
  1051. {getFieldDecorator('hot', {
  1052. initialValue: theData.hot
  1053. })(
  1054. <Radio.Group onChange={(e) => { this.setState({ radios: e.target.value }); }}>
  1055. <Radio value="0" name='radios'>否</Radio>
  1056. <Radio value="1" name='radios'>是</Radio>
  1057. </Radio.Group>
  1058. )}
  1059. </FormItem>
  1060. </div>
  1061. {this.state.radios==true ? <div>
  1062. <FormItem
  1063. labelCol={{ span: 3 }}
  1064. wrapperCol={{ span: 18 }}
  1065. label="首页展示图片:" >
  1066. <PicturesWall
  1067. pictureSign='demand_cover_picture'
  1068. uid={theData.employerId}
  1069. fileList={this.getcoverImg}
  1070. pictureUrl={this.state.coverImg}
  1071. visible={this.props.visible}
  1072. />
  1073. <span>尺寸为:320x160(像素)</span>
  1074. </FormItem>
  1075. </div> :<div></div>}
  1076. <FormItem style={{ marginBottom: '10px' }} labelCol={{ span: 3 }}
  1077. label="自定义雇主" >
  1078. <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
  1079. </FormItem>
  1080. {this.state.switchValue ? <div className="clearfix" >
  1081. <FormItem className="half-item"
  1082. {...formItemLayout}
  1083. label="雇主名称" >
  1084. {getFieldDecorator('employerName', {
  1085. initialValue: theData.employerName
  1086. })(
  1087. <Input />
  1088. )}
  1089. </FormItem>
  1090. <FormItem className="half-item"
  1091. {...formItemLayout}
  1092. label="联系电话" >
  1093. {getFieldDecorator('employerContactsMobile', {
  1094. initialValue: theData.employerContactsMobile
  1095. })(
  1096. <Input />
  1097. )}
  1098. </FormItem>
  1099. <FormItem className="half-item"
  1100. {...formItemLayout}
  1101. label="电子邮箱" >
  1102. {getFieldDecorator('employerContactsMailbox', {
  1103. initialValue: theData.employerContactsMailbox
  1104. })(
  1105. <Input />
  1106. )}
  1107. </FormItem>
  1108. <FormItem className="half-item"
  1109. {...formItemLayout}
  1110. label="通讯地址" >
  1111. {getFieldDecorator('employerAddress', {
  1112. initialValue: theData.employerAddress
  1113. })(
  1114. <Input />
  1115. )}
  1116. </FormItem>
  1117. </div> : <div className="clearfix">
  1118. <FormItem className="half-item"
  1119. {...formItemLayout}
  1120. label="雇主名称" >
  1121. {getFieldDecorator('employerId', {
  1122. initialValue: theData.username || ''
  1123. })(
  1124. <AutoComplete
  1125. dataSource={this.state.dataSource}
  1126. style={{ width: 200 }}
  1127. onSearch={this.state.therottleSearch}
  1128. placeholder="雇主名称"
  1129. onSelect={(e) => {
  1130. this.getContactsList(this.state.dataSourceObj[e]);
  1131. }} />
  1132. )}
  1133. </FormItem>
  1134. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  1135. {...formItemLayout}
  1136. label="联系人" >
  1137. {getFieldDecorator('contacts', {
  1138. initialValue: theData.contacts
  1139. })(
  1140. <Select style={{ width: 260 }}
  1141. placeholder="请选择联系人"
  1142. notFoundContent="未获取到联系人列表"
  1143. showSearch
  1144. filterOption={companySearch}>
  1145. {this.state.contactsOption}
  1146. </Select>
  1147. )}
  1148. </FormItem> : <div></div>}
  1149. </div>}
  1150. <div className="clearfix">
  1151. {theData.techBrokerId ? <FormItem className="half-item"
  1152. {...formItemLayout}
  1153. label="负责人" >
  1154. <span>{this.props.techBrodersObj[theData.techBrokerId]}</span>
  1155. </FormItem> : <div></div>}
  1156. </div>
  1157. {theData.releaseStatus ? <div className="clearfix">
  1158. <FormItem className="half-item"
  1159. {...formItemLayout}
  1160. label="是否发布" >
  1161. {(() => {
  1162. switch (theData.releaseStatus) {
  1163. case "0":
  1164. return <span>未发布</span>;
  1165. case "1":
  1166. return <span>已发布</span>;
  1167. }
  1168. })()}
  1169. </FormItem>
  1170. <FormItem className="half-item"
  1171. {...formItemLayout}
  1172. label="发布时间" >
  1173. <span>{theData.releaseDateFormattedDate}</span>
  1174. </FormItem>
  1175. </div> : <div></div>}
  1176. <div className="clearfix">
  1177. {theData.releaseStatus == "1" ? <FormItem className="half-item"
  1178. {...formItemLayout}
  1179. label="需求状态" >
  1180. {getFieldDecorator('status', {
  1181. initialValue: theData.status
  1182. })(
  1183. <Radio.Group>
  1184. <Radio value="0">未解决</Radio>
  1185. <Radio value="1">已解决</Radio>
  1186. </Radio.Group>
  1187. )}
  1188. </FormItem> : <div></div>}
  1189. <FormItem className="half-item"
  1190. {...formItemLayout}
  1191. label="审核状态" >
  1192. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  1193. </FormItem>
  1194. </div>
  1195. <FormItem
  1196. labelCol={{ span: 3 }}
  1197. wrapperCol={{ span: 20 }}
  1198. label="关键词" >
  1199. <KeyWordTagGroup
  1200. keyWordArr={this.state.tags}
  1201. tagsArr={this.getTagsArr}
  1202. visible={this.props.visible} />
  1203. </FormItem>
  1204. <FormItem
  1205. labelCol={{ span: 3 }}
  1206. wrapperCol={{ span: 20 }}
  1207. label="需求类别" >
  1208. <Select placeholder="选择需求类别" style={{ width: 120 }}
  1209. value={this.state.dataCategory}
  1210. onChange={(e) => { this.setState({ dataCategory: e }) }}>
  1211. <Select.Option value="0" >个人</Select.Option>
  1212. <Select.Option value="1" >组织</Select.Option>
  1213. </Select>
  1214. </FormItem>
  1215. <FormItem
  1216. labelCol={{ span: 3 }}
  1217. wrapperCol={{ span: 18 }}
  1218. label="行业类别" >
  1219. {getFieldDecorator('industryCategory', {
  1220. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  1221. initialValue: [theData.industryCategoryA, theData.industryCategoryB]
  1222. })(
  1223. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="请选择一个行业" />
  1224. )}
  1225. </FormItem>
  1226. <FormItem className="half-item"
  1227. {...formItemLayout}
  1228. label="加急天数" >
  1229. {getFieldDecorator('urgentDays', {
  1230. initialValue: theData.urgentDays
  1231. })(
  1232. <Input style={{width:'95%'}}/>
  1233. )}
  1234. <span>天</span>
  1235. </FormItem>
  1236. <FormItem className="half-item"
  1237. {...formItemLayout}
  1238. label="加急报酬" >
  1239. {getFieldDecorator('urgentMoney', {
  1240. initialValue: theData.urgentMoney
  1241. })(
  1242. <Input style={{width:'95%'}}/>
  1243. )}
  1244. <span>万</span>
  1245. </FormItem>
  1246. <div className="clearfix">
  1247. <FormItem className="half-item"
  1248. {...formItemLayout}
  1249. label="需求类型" >
  1250. {getFieldDecorator('demandType', {
  1251. rules: [{ required: true, message: '此项为必填项!' }],
  1252. initialValue: theData.demandType
  1253. })(
  1254. <Select style={{ width: 160 }} placeholder="请选择需求类型">
  1255. {this.props.demandTypeOption}
  1256. </Select>
  1257. )}
  1258. </FormItem>
  1259. </div>
  1260. <FormItem
  1261. labelCol={{ span: 3 }}
  1262. wrapperCol={{ span: 18 }}
  1263. label="问题说明" >
  1264. {getFieldDecorator('problemDes', {
  1265. rules: [{ required: true, message: '此项为必填项!' }],
  1266. initialValue: theData.problemDes
  1267. })(
  1268. <Input type="textarea" rows={4} />
  1269. )}
  1270. </FormItem>
  1271. <FormItem
  1272. labelCol={{ span: 3 }}
  1273. wrapperCol={{ span: 18 }}
  1274. label="备注" >
  1275. {getFieldDecorator('remark', {
  1276. initialValue: theData.remark
  1277. })(
  1278. <Input type="textarea" rows={4} />
  1279. )}
  1280. </FormItem>
  1281. <FormItem
  1282. labelCol={{ span: 3 }}
  1283. wrapperCol={{ span: 18 }}
  1284. label="技术指标要求" >
  1285. {getFieldDecorator('technicalRequirements', {
  1286. initialValue: theData.technicalRequirements
  1287. })(
  1288. <Input type="textarea" rows={2} />
  1289. )}
  1290. </FormItem>
  1291. <FormItem
  1292. labelCol={{ span: 3 }}
  1293. wrapperCol={{ span: 18 }}
  1294. label="需求文件(图片)" >
  1295. <PicturesWall
  1296. pictureSign="demand_picture"
  1297. uid={theData.employerId}
  1298. fileList={this.getPictureUrl}
  1299. pictureUrl={this.state.pictureUrl}
  1300. visible={this.props.visible} />
  1301. </FormItem>
  1302. <FormItem
  1303. labelCol={{ span: 3 }}
  1304. wrapperCol={{ span: 6 }}
  1305. label="需求文件(文本)" >
  1306. <Upload
  1307. name="ratepay"
  1308. action={globalConfig.context + "/api/admin/demand/uploadTextFile"}
  1309. data={{ 'sign': 'demand_text_file', 'uid': theData.employerId }}
  1310. beforeUpload={beforeUploadFile}
  1311. fileList={this.state.textFileList}
  1312. onChange={(info) => {
  1313. if (info.file.status !== 'uploading') {
  1314. console.log(info.file, info.fileList);
  1315. }
  1316. if (info.file.status === 'done') {
  1317. if (!info.file.response.error.length) {
  1318. message.success(`${info.file.name} 文件上传成功!`);
  1319. } else {
  1320. message.warning(info.file.response.error[0].message);
  1321. return;
  1322. };
  1323. this.state.textFileUrl = info.file.response.data;
  1324. } else if (info.file.status === 'error') {
  1325. message.error(`${info.file.name} 文件上传失败。`);
  1326. };
  1327. this.setState({ textFileList: info.fileList.slice(-1) });
  1328. }} >
  1329. <Button><Icon type="upload" /> 上传需求文本文件 </Button>
  1330. </Upload>
  1331. <p style={{ marginTop: '10px' }}>{theData.textFileUrl ?
  1332. <span className="download-file">
  1333. <a onClick={() => { window.open(globalConfig.context + '/api/admin/demand/download?id=' + this.props.data.id) }}>需求文件(文本文件)</a>
  1334. </span>
  1335. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1336. </FormItem>
  1337. <FormItem
  1338. labelCol={{ span: 3 }}
  1339. wrapperCol={{ span: 18 }}
  1340. label="需求文件(视频地址)" >
  1341. {getFieldDecorator('videoUrl', {
  1342. initialValue: theData.videoUrl
  1343. })(
  1344. <Input />
  1345. )}
  1346. </FormItem>
  1347. <div className="clearfix">
  1348. <FormItem className="half-item"
  1349. {...formItemLayout}
  1350. label="固定周期" >
  1351. {getFieldDecorator('fixedCycle', {
  1352. initialValue: theData.fixedCycle
  1353. })(
  1354. <Input />
  1355. )}
  1356. </FormItem>
  1357. <FormItem className="half-item"
  1358. {...formItemLayout}
  1359. label="固定人数" >
  1360. {getFieldDecorator('peopleNumber', {
  1361. initialValue: theData.peopleNumber || 0
  1362. })(
  1363. <InputNumber />
  1364. )}
  1365. <span style={{ marginLeft: '20px' }}>人</span>
  1366. </FormItem>
  1367. </div>
  1368. <FormItem
  1369. labelCol={{ span: 3 }}
  1370. wrapperCol={{ span: 18 }}
  1371. label="固定方案" >
  1372. {getFieldDecorator('fixedScheme', {
  1373. initialValue: theData.fixedScheme
  1374. })(
  1375. <Input type="textarea" rows={2} />
  1376. )}
  1377. </FormItem>
  1378. <div className="clearfix">
  1379. <FormItem className="half-item"
  1380. {...formItemLayout}
  1381. label="预算费用" >
  1382. {getFieldDecorator('budgetCost', {
  1383. initialValue: theData.budgetCost || 0
  1384. })(
  1385. <InputNumber min={0} max={999999} step={0.01} />
  1386. )}
  1387. <span style={{ marginLeft: '20px' }}>万元</span>
  1388. </FormItem>
  1389. <FormItem className="half-item"
  1390. {...formItemLayout}
  1391. label="费用托管" >
  1392. {getFieldDecorator('costEscrow', {
  1393. initialValue: theData.costEscrow
  1394. })(
  1395. <Radio.Group>
  1396. <Radio value={0}>否</Radio>
  1397. <Radio value={1}>是</Radio>
  1398. </Radio.Group>
  1399. )}
  1400. </FormItem>
  1401. <FormItem className="half-item"
  1402. {...formItemLayout}
  1403. label="有效期限" >
  1404. {getFieldDecorator('validityPeriod', {
  1405. initialValue: theData.validityPeriod ? moment(theData.validityPeriod) : null
  1406. })(
  1407. <DatePicker />
  1408. )}
  1409. </FormItem>
  1410. </div>
  1411. <div className="clearfix" style={{ display: 'none' }}>
  1412. <FormItem className="half-item"
  1413. {...formItemLayout}
  1414. label="雇主地址" >
  1415. <span>{theData.employerAddress}</span>
  1416. </FormItem>
  1417. <FormItem className="half-item"
  1418. {...formItemLayout}
  1419. label="雇主联系人名称" >
  1420. <span>{theData.employerContacts}</span>
  1421. </FormItem>
  1422. <FormItem className="half-item"
  1423. {...formItemLayout}
  1424. label="雇主联系人电话" >
  1425. <span>{theData.employerContactsMobile}</span>
  1426. </FormItem>
  1427. <FormItem className="half-item"
  1428. {...formItemLayout}
  1429. label="雇主联系人邮箱" >
  1430. <span>{theData.employerContactsMailbox}</span>
  1431. </FormItem>
  1432. </div>
  1433. <FormItem wrapperCol={{ span: 12, offset: 3 }}>
  1434. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1435. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1436. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1437. </FormItem>
  1438. </Spin>
  1439. </Form >
  1440. )
  1441. }
  1442. }));
  1443. const DemandDetail = React.createClass({
  1444. getInitialState() {
  1445. return {
  1446. visible: false,
  1447. techBrodersObj: {},
  1448. tabsKey: "1",
  1449. columns: [
  1450. {
  1451. title: '编号',
  1452. dataIndex: 'serialNumber',
  1453. key: 'serialNumber',
  1454. }, {
  1455. title: '数据类型',
  1456. dataIndex: 'dataCategory',
  1457. key: 'dataCategory',
  1458. render: text => {
  1459. switch (text) {
  1460. case "0":
  1461. return <span>成果</span>;
  1462. case "1":
  1463. return <span>技术</span>;
  1464. case "2":
  1465. return <span>项目</span>;
  1466. }
  1467. }
  1468. }, {
  1469. title: '名称',
  1470. dataIndex: 'name',
  1471. key: 'name',
  1472. }, {
  1473. title: '关键字',
  1474. dataIndex: 'keyword',
  1475. key: 'keyword',
  1476. }, {
  1477. title: '类型',
  1478. dataIndex: 'category',
  1479. key: 'category',
  1480. render: text => { return getAchievementCategory(text); }
  1481. }, {
  1482. title: '所有人名称',
  1483. dataIndex: 'theName',
  1484. key: 'theName',
  1485. }, {
  1486. title: '所有人类型',
  1487. dataIndex: 'ownerType',
  1488. key: 'ownerType',
  1489. render: text => {
  1490. switch (text) {
  1491. case "0":
  1492. return <span>个人</span>;
  1493. case "1":
  1494. return <span>组织</span>
  1495. }
  1496. }
  1497. }, {
  1498. title: '发布时间',
  1499. dataIndex: 'releaseDateFormattedDate',
  1500. key: 'releaseDateFormattedDate',
  1501. }
  1502. ],
  1503. dataSource: [],
  1504. };
  1505. },
  1506. getTechBrodersList() {
  1507. this.setState({
  1508. loading: true
  1509. });
  1510. $.ajax({
  1511. method: "get",
  1512. dataType: "json",
  1513. crossDomain: false,
  1514. url: globalConfig.context + "/api/admin/audit/techBroders",
  1515. success: function (data) {
  1516. if (!data.data) {
  1517. if (data.error && data.error.length) {
  1518. message.warning(data.error[0].message);
  1519. }
  1520. return;
  1521. };
  1522. let _me = this, theArr = [];
  1523. for (var item in data.data) {
  1524. theArr.push(
  1525. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1526. )
  1527. };
  1528. this.setState({
  1529. techBrodersOption: theArr,
  1530. techBrodersObj: data.data
  1531. });
  1532. }.bind(this),
  1533. }).always(function () {
  1534. this.setState({
  1535. loading: false
  1536. });
  1537. }.bind(this));
  1538. },
  1539. getTableList() {
  1540. this.setState({
  1541. loading: true
  1542. });
  1543. $.ajax({
  1544. method: "get",
  1545. dataType: "json",
  1546. crossDomain: false,
  1547. url: globalConfig.context + "/api/admin/demand/achievementDemand",
  1548. data: { id: this.props.data.id },
  1549. success: function (data) {
  1550. let theArr = [];
  1551. if (!data.data) {
  1552. if (data.error && data.error.length) {
  1553. message.warning(data.error[0].message);
  1554. };
  1555. } else if (data.data.length) {
  1556. for (let i = 0; i < data.data.length; i++) {
  1557. let thisdata = data.data[i];
  1558. theArr.push({
  1559. key: i,
  1560. id: thisdata.id,
  1561. serialNumber: thisdata.serialNumber,
  1562. dataCategory: thisdata.dataCategory,
  1563. name: thisdata.name,
  1564. keyword: thisdata.keyword,
  1565. category: thisdata.category,
  1566. ownerType: thisdata.ownerType,
  1567. theName: thisdata.username || thisdata.unitName,
  1568. releaseDate: thisdata.releaseDate,
  1569. releaseDateFormattedDate: thisdata.releaseDateFormattedDate
  1570. });
  1571. };
  1572. };
  1573. this.setState({
  1574. dataSource: theArr,
  1575. });
  1576. }.bind(this),
  1577. }).always(function () {
  1578. this.setState({
  1579. loading: false
  1580. });
  1581. }.bind(this));
  1582. },
  1583. tableRowClick(record, index) {
  1584. window.open(globalConfig.context + '/portal/detail/achievementDetail.html?id=' + record.id + '&type=' + record.ownerType);
  1585. },
  1586. handleCancel(e) {
  1587. this.setState({
  1588. visible: false,
  1589. });
  1590. this.props.closeDesc(false);
  1591. },
  1592. handleOk(e) {
  1593. this.setState({
  1594. visible: false,
  1595. });
  1596. this.props.closeDesc(false, true);
  1597. },
  1598. componentWillMount() {
  1599. this.getTechBrodersList();
  1600. },
  1601. componentWillReceiveProps(nextProps) {
  1602. if (!this.state.visible && nextProps.showDesc) {
  1603. this.state.tabsKey = "1";
  1604. };
  1605. this.state.visible = nextProps.showDesc;
  1606. },
  1607. render() {
  1608. if (this.props.data) {
  1609. return (
  1610. <div className="patent-desc">
  1611. <Modal maskClosable={false} visible={this.state.visible}
  1612. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1613. width='1000px'
  1614. footer=''
  1615. className="admin-desc-content">
  1616. <Spin spinning={this.state.loading}>
  1617. <Tabs activeKey={this.state.tabsKey}
  1618. onChange={(e) => {
  1619. this.setState({ tabsKey: e });
  1620. if (e == "2") {
  1621. this.getTableList();
  1622. };
  1623. }} >
  1624. <Tabs.TabPane tab="需求详情" key="1">
  1625. {(() => {
  1626. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1627. return <DemandDetailShow
  1628. data={this.props.data}
  1629. detailApiUrl={this.props.detailApiUrl}
  1630. techBrodersOption={this.state.techBrodersOption}
  1631. techBrodersObj={this.state.techBrodersObj}
  1632. demandTypeOption={this.props.demandTypeOption}
  1633. closeDesc={this.handleCancel}
  1634. visible={this.state.visible}
  1635. handleOk={this.handleOk} />
  1636. } else {
  1637. return <DemandDetailForm
  1638. data={this.props.data}
  1639. detailApiUrl={this.props.detailApiUrl}
  1640. companyOption={this.props.companyOption}
  1641. userOption={this.props.userOption}
  1642. techBrodersObj={this.state.techBrodersObj}
  1643. demandTypeOption={this.props.demandTypeOption}
  1644. closeDesc={this.handleCancel}
  1645. visible={this.state.visible}
  1646. handleOk={this.handleOk} />
  1647. }
  1648. })()}
  1649. </Tabs.TabPane>
  1650. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  1651. <Table columns={this.state.columns}
  1652. dataSource={this.state.dataSource}
  1653. pagination={false}
  1654. onRowClick={this.tableRowClick} />
  1655. </Tabs.TabPane>
  1656. </Tabs>
  1657. </Spin>
  1658. </Modal>
  1659. </div>
  1660. );
  1661. } else {
  1662. return <div></div>
  1663. }
  1664. },
  1665. });
  1666. export default DemandDetail;