techAchievementDesc.jsx 71 KB

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