techAchievementDesc.jsx 67 KB

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