techAchievementDesc.jsx 70 KB

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