techAchievementDesc.jsx 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414
  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. {userData.type ? <FormItem className="half-item"
  248. {...formItemLayout}
  249. label="联系人" >
  250. <span>{this.props.contactsObj[theData.contacts]}</span>
  251. </FormItem> : <div></div>}
  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. {userData.type ?
  806. <FormItem className="half-item"
  807. {...formItemLayout}
  808. label="联系人" >
  809. {getFieldDecorator('contacts', {
  810. rules: [{ required: true, message: '此项为必填项!' }],
  811. initialValue: theData.contacts
  812. })(
  813. <Select placeholder="选择联系人" style={{ width: 260 }} >
  814. {this.props.contactsOption}
  815. </Select>
  816. )}
  817. </FormItem> : <div></div>}
  818. <FormItem className="half-item"
  819. {...formItemLayout}
  820. label="数据类别" >
  821. {getFieldDecorator('dataCategory', {
  822. rules: [{ required: true, message: '此项为必填项!' }],
  823. initialValue: theData.dataCategory
  824. })(
  825. <Select placeholder="选择数据类型" style={{ width: 160 }} >
  826. <Select.Option value="0" >成果</Select.Option>
  827. <Select.Option value="1" >技术</Select.Option>
  828. <Select.Option value="2" >项目</Select.Option>
  829. </Select>
  830. )}
  831. </FormItem>
  832. <FormItem className="half-item"
  833. {...formItemLayout}
  834. label="类型" >
  835. {getFieldDecorator('category', {
  836. rules: [{ required: true, message: '此项为必填项!' }],
  837. initialValue: theData.category
  838. })(
  839. <Select style={{ width: 160 }} placeholder="请选择成果类型">
  840. {this.props.achievementCategoryOption}
  841. </Select>
  842. )}
  843. </FormItem>
  844. <div className="clearfix">
  845. <FormItem className="half-item"
  846. {...formItemLayout}
  847. label="是否发布" >
  848. {(() => {
  849. switch (theData.releaseStatus) {
  850. case "0":
  851. return <span>未发布</span>;
  852. case "1":
  853. return <span>已发布</span>;
  854. }
  855. })()}
  856. </FormItem>
  857. <FormItem className="half-item"
  858. {...formItemLayout}
  859. label="发布时间" >
  860. <span>{theData.releaseDateFormattedDate}</span>
  861. </FormItem>
  862. <FormItem className="half-item"
  863. {...formItemLayout}
  864. label="审核状态" >
  865. {(() => {
  866. switch (theData.auditStatus) {
  867. case "0":
  868. return <span>未提交审核(草稿)</span>;
  869. case "1":
  870. return <span>提交审核</span>;
  871. case "2":
  872. return <span>审核中</span>;
  873. case "3":
  874. return <span>审核通过</span>;
  875. case "4":
  876. return <span>审核未通过</span>;
  877. }
  878. })()}
  879. </FormItem>
  880. </div>
  881. </div>
  882. <FormItem
  883. labelCol={{ span: 4 }}
  884. wrapperCol={{ span: 18 }}
  885. label="关键词" >
  886. <KeyWordTagGroup
  887. keyWordArr={this.state.tags}
  888. tagsArr={this.getTagsArr}
  889. visible={this.props.visible} />
  890. </FormItem>
  891. <FormItem
  892. labelCol={{ span: 4 }}
  893. wrapperCol={{ span: 18 }}
  894. label="摘要" >
  895. {getFieldDecorator('summary', {
  896. initialValue: theData.summary
  897. })(
  898. <Input type="textarea" rows={4} />
  899. )}
  900. </FormItem>
  901. <FormItem
  902. labelCol={{ span: 4 }}
  903. wrapperCol={{ span: 18 }}
  904. label="成果简介" >
  905. {getFieldDecorator('introduction', {
  906. initialValue: theData.introduction
  907. })(
  908. <Input type="textarea" rows={4} placeholder="项目成果简介;项目核心创新点;项目详细用途;预期效益说明;主要技术(性能)指标;市场前景;应用范围;发展历程。" />
  909. )}
  910. </FormItem>
  911. <FormItem
  912. labelCol={{ span: 4 }}
  913. wrapperCol={{ span: 18 }}
  914. label="技术图片" >
  915. <PicturesWall
  916. pictureSign="achievement_technical_picture"
  917. fileList={this.getTechnicalPictureUrl}
  918. pictureUrl={this.state.technicalPictureUrl} />
  919. <p>图片建议:专利证书或专利申请书图片、技术图纸、样品图片、技术相关网络图片;成熟度处于非研发阶段的项目,必须上传样品图片,如未上传,成熟度将视为处在研发阶段。</p>
  920. </FormItem>
  921. <FormItem
  922. labelCol={{ span: 4 }}
  923. wrapperCol={{ span: 18 }}
  924. label="应用领域" >
  925. {getFieldDecorator('field', {
  926. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  927. initialValue: [theData.fieldA, theData.fieldB]
  928. })(
  929. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="应用领域" />
  930. )}
  931. </FormItem>
  932. <div className="clearfix">
  933. <FormItem className="half-item"
  934. {...formItemLayout}
  935. label="成熟度" >
  936. {getFieldDecorator('maturity', {
  937. rules: [{ type: 'string', required: true, message: '此项为必填项!' }],
  938. initialValue: theData.maturity
  939. })(
  940. <Select placeholder="选择成熟度" style={{ width: 160 }} >
  941. <Select.Option value="0" >正在研发</Select.Option>
  942. <Select.Option value="1" >已有样品</Select.Option>
  943. <Select.Option value="2" >通过小试</Select.Option>
  944. <Select.Option value="3" >通过中试</Select.Option>
  945. <Select.Option value="4" >可以量产</Select.Option>
  946. </Select>
  947. )}
  948. </FormItem>
  949. <FormItem className="half-item"
  950. {...formItemLayout}
  951. label="创新度" >
  952. {getFieldDecorator('innovation', {
  953. initialValue: theData.innovation
  954. })(
  955. <Select placeholder="选择创新度" style={{ width: 160 }} >
  956. <Select.Option value="0" >行业先进</Select.Option>
  957. <Select.Option value="1" >行业领先</Select.Option>
  958. <Select.Option value="2" >国内先进</Select.Option>
  959. <Select.Option value="3" >国内领先</Select.Option>
  960. <Select.Option value="4" >国际先进</Select.Option>
  961. <Select.Option value="5" >国际领先</Select.Option>
  962. </Select>
  963. )}
  964. </FormItem>
  965. </div>
  966. <FormItem
  967. labelCol={{ span: 4 }}
  968. wrapperCol={{ span: 18 }}
  969. label="成熟度证明材料(图片)" >
  970. <PicturesWall
  971. pictureSign="achievement_maturity_picture"
  972. fileList={this.getMaturityPictureUrl}
  973. pictureUrl={this.state.maturityPictureUrl} />
  974. </FormItem>
  975. <FormItem
  976. labelCol={{ span: 4 }}
  977. wrapperCol={{ span: 6 }}
  978. label="成熟度证明材料(文本)" >
  979. <Upload
  980. name="ratepay"
  981. action={globalConfig.context + "/api/user/achievement/uploadTextFile"}
  982. data={{ 'sign': 'achievement_maturity_text_file' }}
  983. beforeUpload={beforeUploadFile}
  984. fileList={this.state.textFileList}
  985. onChange={(info) => {
  986. if (info.file.status !== 'uploading') {
  987. console.log(info.file, info.fileList);
  988. }
  989. if (info.file.status === 'done') {
  990. if (!info.file.response.error.length) {
  991. message.success(`${info.file.name} 文件上传成功!`);
  992. } else {
  993. message.warning(info.file.response.error[0].message);
  994. return;
  995. };
  996. this.state.maturityTextFileUrl = info.file.response.data;
  997. } else if (info.file.status === 'error') {
  998. message.error(`${info.file.name} 文件上传失败。`);
  999. };
  1000. this.setState({ textFileList: info.fileList.slice(-1) });
  1001. }} >
  1002. <Button><Icon type="upload" /> 上传成熟度证明文本 </Button>
  1003. </Upload>
  1004. <p style={{ marginTop: '10px' }}>{theData.maturityTextFileUrl ?
  1005. <span className="download-file">
  1006. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  1007. </span>
  1008. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1009. </FormItem>
  1010. <FormItem
  1011. labelCol={{ span: 4 }}
  1012. wrapperCol={{ span: 18 }}
  1013. label="成熟度证明材料(视频地址)" >
  1014. {getFieldDecorator('maturityVideoUrl', {
  1015. initialValue: theData.maturityVideoUrl
  1016. })(
  1017. <Input />
  1018. )}
  1019. </FormItem>
  1020. <div className="clearfix">
  1021. <FormItem className="half-item"
  1022. {...formItemLayout}
  1023. label="合作方式" >
  1024. {getFieldDecorator('cooperationMode', {
  1025. rules: [{ required: true, message: '此项为必填项!' }],
  1026. initialValue: theData.cooperationMode
  1027. })(
  1028. <Radio.Group>
  1029. <Radio value="0">技术转让</Radio>
  1030. <Radio value="1">授权生产</Radio>
  1031. </Radio.Group>
  1032. )}
  1033. </FormItem>
  1034. <FormItem className="half-item"
  1035. {...formItemLayout}
  1036. label="转让方式" >
  1037. {getFieldDecorator('transferMode', {
  1038. initialValue: theData.transferMode
  1039. })(
  1040. <Select placeholder="选择转让方式" style={{ width: 160 }} >
  1041. <Select.Option value="0" >完全转让</Select.Option>
  1042. <Select.Option value="1" >许可转让</Select.Option>
  1043. <Select.Option value="2" >技术入股</Select.Option>
  1044. </Select>
  1045. )}
  1046. </FormItem>
  1047. </div>
  1048. <div className="clearfix">
  1049. <FormItem className="half-item"
  1050. {...formItemLayout}
  1051. label="议价方式" >
  1052. {getFieldDecorator('bargainingMode', {
  1053. initialValue: theData.bargainingMode
  1054. })(
  1055. <Radio.Group onChange={((e) => { this.setState({ transferPriceDis: (e.target.value == 1 ? true : false) }) })}>
  1056. <Radio value="0">面议</Radio>
  1057. <Radio value="1">定价</Radio>
  1058. </Radio.Group>
  1059. )}
  1060. </FormItem>
  1061. {this.state.transferPriceDis ? <FormItem className="half-item"
  1062. {...formItemLayout}
  1063. label="转让价格" >
  1064. {getFieldDecorator('transferPrice', {
  1065. initialValue: theData.transferPrice
  1066. })(
  1067. <InputNumber min={0} max={999999} step={0.01} />
  1068. )}
  1069. <span style={{ marginLeft: '20px' }}>万元</span>
  1070. </FormItem> : <div></div>}
  1071. </div>
  1072. <FormItem
  1073. labelCol={{ span: 4 }}
  1074. wrapperCol={{ span: 18 }}
  1075. label="技术场景" >
  1076. {getFieldDecorator('technicalScene', {
  1077. initialValue: theData.technicalScene
  1078. })(
  1079. <Input type="textarea" rows={2} placeholder="说明解决了什么问题。" />
  1080. )}
  1081. </FormItem>
  1082. <FormItem
  1083. labelCol={{ span: 4 }}
  1084. wrapperCol={{ span: 18 }}
  1085. label="技术突破" >
  1086. {getFieldDecorator('breakthrough', {
  1087. initialValue: theData.breakthrough
  1088. })(
  1089. <Input type="textarea" rows={2} placeholder="说明该技术成果突破性的研究。" />
  1090. )}
  1091. </FormItem>
  1092. <FormItem
  1093. labelCol={{ span: 4 }}
  1094. wrapperCol={{ span: 18 }}
  1095. label="专利情况" >
  1096. {getFieldDecorator('patentCase', {
  1097. initialValue: theData.patentCase
  1098. })(
  1099. <Input type="textarea" rows={2} placeholder="一个“技术”可能由多个专利构成,需要说明技术-专利的关系。" />
  1100. )}
  1101. </FormItem>
  1102. <FormItem
  1103. labelCol={{ span: 4 }}
  1104. wrapperCol={{ span: 18 }}
  1105. label="获奖情况" >
  1106. {getFieldDecorator('awards', {
  1107. initialValue: theData.awards
  1108. })(
  1109. <Input type="textarea" rows={2} placeholder="一个“技术”可能存在社会奖励情况,需要说明社会奖励情况。" />
  1110. )}
  1111. </FormItem>
  1112. <FormItem
  1113. labelCol={{ span: 4 }}
  1114. wrapperCol={{ span: 18 }}
  1115. label="技术团队情况" >
  1116. {getFieldDecorator('teamDes', {
  1117. initialValue: theData.teamDes
  1118. })(
  1119. <Input type="textarea" rows={2} placeholder="一个“技术”、“项目”可能存在团队,需要说明团队情况。" />
  1120. )}
  1121. </FormItem>
  1122. <FormItem
  1123. labelCol={{ span: 4 }}
  1124. wrapperCol={{ span: 18 }}
  1125. label="技术参数" >
  1126. {getFieldDecorator('parameter', {
  1127. initialValue: theData.parameter
  1128. })(
  1129. <Input type="textarea" rows={2} placeholder="描述技术参数信息" />
  1130. )}
  1131. </FormItem>
  1132. <FormItem
  1133. labelCol={{ span: 4 }}
  1134. wrapperCol={{ span: 6 }}
  1135. label="技术方案" >
  1136. <Upload
  1137. name="ratepay"
  1138. action={globalConfig.context + "/api/user/achievement/uploadTextFile"}
  1139. data={{ 'sign': 'achievement_tech_plan' }}
  1140. beforeUpload={beforeUploadFile}
  1141. fileList={this.state.techPlanFileList}
  1142. onChange={(info) => {
  1143. if (info.file.status !== 'uploading') {
  1144. console.log(info.file, info.fileList);
  1145. }
  1146. if (info.file.status === 'done') {
  1147. if (!info.file.response.error.length) {
  1148. message.success(`${info.file.name} 文件上传成功!`);
  1149. } else {
  1150. message.warning(info.file.response.error[0].message);
  1151. return;
  1152. };
  1153. this.state.techPlanUrl = info.file.response.data;
  1154. } else if (info.file.status === 'error') {
  1155. message.error(`${info.file.name} 文件上传失败。`);
  1156. };
  1157. this.setState({ techPlanFileList: info.fileList.slice(-1) });
  1158. }} >
  1159. <Button><Icon type="upload" /> 上传技术方案文件 </Button>
  1160. </Upload>
  1161. <p style={{ marginTop: '10px' }}>{theData.techPlanUrl ?
  1162. <span className="download-file">
  1163. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  1164. </span>
  1165. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1166. </FormItem>
  1167. <FormItem
  1168. labelCol={{ span: 4 }}
  1169. wrapperCol={{ span: 6 }}
  1170. label="商业计划书" >
  1171. <Upload
  1172. name="ratepay"
  1173. action={globalConfig.context + "/api/user/achievement/uploadTextFile"}
  1174. data={{ 'sign': 'achievement_business_plan' }}
  1175. beforeUpload={beforeUploadFile}
  1176. fileList={this.state.businessPlanFileList}
  1177. onChange={(info) => {
  1178. if (info.file.status !== 'uploading') {
  1179. console.log(info.file, info.fileList);
  1180. }
  1181. if (info.file.status === 'done') {
  1182. if (!info.file.response.error.length) {
  1183. message.success(`${info.file.name} 文件上传成功!`);
  1184. } else {
  1185. message.warning(info.file.response.error[0].message);
  1186. return;
  1187. };
  1188. this.state.businessPlanUrl = info.file.response.data;
  1189. } else if (info.file.status === 'error') {
  1190. message.error(`${info.file.name} 文件上传失败。`);
  1191. };
  1192. this.setState({ businessPlanFileList: info.fileList.slice(-1) });
  1193. }} >
  1194. <Button><Icon type="upload" /> 上传商业计划书文件 </Button>
  1195. </Upload>
  1196. <p style={{ marginTop: '10px' }}>{theData.businessPlanUrl ?
  1197. <span className="download-file">
  1198. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  1199. </span>
  1200. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1201. </FormItem>
  1202. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1203. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1204. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1205. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1206. </FormItem>
  1207. </Spin>
  1208. </Form >
  1209. )
  1210. }
  1211. }));
  1212. const AchievementDetail = React.createClass({
  1213. getInitialState() {
  1214. return {
  1215. visible: false,
  1216. tabsKey: 1,
  1217. contactsObj: {},
  1218. columns: [
  1219. {
  1220. title: '编号',
  1221. dataIndex: 'serialNumber',
  1222. key: 'serialNumber',
  1223. }, {
  1224. title: '名称',
  1225. dataIndex: 'name',
  1226. key: 'name',
  1227. }, {
  1228. title: '关键字',
  1229. dataIndex: 'keyword',
  1230. key: 'keyword',
  1231. }, {
  1232. title: '类型',
  1233. dataIndex: 'demandType',
  1234. key: 'demandType',
  1235. render: text => { return getDemandType(text); }
  1236. }, {
  1237. title: '所有人名称',
  1238. dataIndex: 'theName',
  1239. key: 'theName',
  1240. }, {
  1241. title: '发布时间',
  1242. dataIndex: 'releaseDateFormattedDate',
  1243. key: 'releaseDateFormattedDate',
  1244. }, {
  1245. title: '有效期限',
  1246. dataIndex: 'validityPeriodFormattedDate',
  1247. key: 'validityPeriodFormattedDate',
  1248. },
  1249. ],
  1250. dataSource: [],
  1251. };
  1252. },
  1253. getTableList() {
  1254. this.setState({
  1255. loading: true
  1256. });
  1257. $.ajax({
  1258. method: "get",
  1259. dataType: "json",
  1260. crossDomain: false,
  1261. url: globalConfig.context + "/api/user/achievement/achievementDemand",
  1262. data: { id: this.props.data.id },
  1263. success: function (data) {
  1264. let theArr = [];
  1265. if (!data.data) {
  1266. if (data.error && data.error.length) {
  1267. message.warning(data.error[0].message);
  1268. };
  1269. } else if (data.data.length) {
  1270. for (let i = 0; i < data.data.length; i++) {
  1271. let thisdata = data.data[i];
  1272. theArr.push({
  1273. key: i,
  1274. id: thisdata.id,
  1275. serialNumber: thisdata.serialNumber,
  1276. dataCategory: thisdata.dataCategory,
  1277. name: thisdata.name,
  1278. keyword: thisdata.keyword,
  1279. demandType: thisdata.demandType,
  1280. theName: thisdata.username || thisdata.unitName,
  1281. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1282. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate
  1283. });
  1284. };
  1285. };
  1286. this.setState({
  1287. dataSource: theArr,
  1288. });
  1289. }.bind(this),
  1290. }).always(function () {
  1291. this.setState({
  1292. loading: false
  1293. });
  1294. }.bind(this));
  1295. },
  1296. tableRowClick(record, index) {
  1297. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1298. },
  1299. showModal() {
  1300. this.setState({
  1301. visible: true,
  1302. });
  1303. },
  1304. handleCancel(e) {
  1305. this.setState({
  1306. visible: false,
  1307. });
  1308. this.props.closeDesc(false);
  1309. },
  1310. handleOk(e) {
  1311. this.setState({
  1312. visible: false,
  1313. });
  1314. this.props.closeDesc(false, true);
  1315. },
  1316. componentWillMount() {
  1317. this.getContactsOption();
  1318. },
  1319. getContactsOption() {
  1320. let theOption = [], theObj = {};
  1321. $.ajax({
  1322. method: "get",
  1323. dataType: "json",
  1324. crossDomain: false,
  1325. url: globalConfig.context + '/api/user/getContacts',
  1326. success: function (data) {
  1327. if (!data.data) {
  1328. if (data.error && data.error.length) {
  1329. message.warning(data.error[0].message);
  1330. };
  1331. } else {
  1332. for (let item in data.data) {
  1333. let theData = data.data[item];
  1334. theOption.push(
  1335. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  1336. );
  1337. };
  1338. theObj = data.data;
  1339. };
  1340. this.setState({
  1341. contactsOption: theOption,
  1342. contactsObj: theObj
  1343. });
  1344. }.bind(this)
  1345. });
  1346. },
  1347. componentWillReceiveProps(nextProps) {
  1348. if (nextProps.showDesc) {
  1349. this.state.tabsKey = "1";
  1350. this.state.tabBool = true;
  1351. };
  1352. this.state.visible = nextProps.showDesc;
  1353. },
  1354. render() {
  1355. if (this.props.data) {
  1356. return (
  1357. <div className="patent-desc">
  1358. <Modal maskClosable={false} visible={this.state.visible}
  1359. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1360. width='1000px'
  1361. footer=''
  1362. className="admin-desc-content">
  1363. <Tabs activeKey={this.state.tabsKey}
  1364. onChange={(e) => {
  1365. this.setState({ tabsKey: e });
  1366. if (e == "2" && this.state.tabBool) {
  1367. this.getTableList();
  1368. this.state.tabBool = false;
  1369. };
  1370. }} >
  1371. <Tabs.TabPane tab="成果详情" key="1">
  1372. {(() => {
  1373. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1374. return <AchievementDetailShow
  1375. data={this.props.data}
  1376. closeDesc={this.handleCancel}
  1377. visible={this.state.visible}
  1378. contactsObj={this.state.contactsObj}
  1379. handleOk={this.handleOk} />
  1380. } else {
  1381. return <AchievementDetailForm
  1382. data={this.props.data}
  1383. achievementCategoryOption={this.props.achievementCategoryOption}
  1384. closeDesc={this.handleCancel}
  1385. contactsOption={this.state.contactsOption}
  1386. visible={this.state.visible}
  1387. handleOk={this.handleOk} />
  1388. }
  1389. })()}
  1390. </Tabs.TabPane>
  1391. <Tabs.TabPane tab="匹配列表" key="2">
  1392. <Table columns={this.state.columns}
  1393. dataSource={this.state.dataSource}
  1394. pagination={false}
  1395. onRowClick={this.tableRowClick} />
  1396. </Tabs.TabPane>
  1397. </Tabs>
  1398. </Modal>
  1399. </div>
  1400. );
  1401. } else {
  1402. return <div></div>
  1403. }
  1404. },
  1405. });
  1406. export default AchievementDetail;