techDemandDesc.jsx 71 KB

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