techAchievementDesc.jsx 71 KB

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