techAchievementDesc.jsx 67 KB

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