techAchievementDesc.jsx 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846
  1. import React from 'react';
  2. import { Tabs, Table, Icon, Tooltip, Modal, message, AutoComplete, Spin, Upload, Input, InputNumber, Select, Button, Radio, Form, Cascader, Tag, Switch } 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,beforeUpload, getBase64,getboutique } 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. contactsObj: {},
  137. data: {},
  138. tags: [],
  139. technicalPictureUrl: [],
  140. coverImg: [],
  141. maturityPictureUrl: [],
  142. textFileList: [],
  143. techPlanFileList: [],
  144. businessPlanFileList: []
  145. };
  146. },
  147. loadData(id, detailApiUrl) {
  148. this.setState({
  149. loading: true
  150. });
  151. $.ajax({
  152. method: "get",
  153. dataType: "json",
  154. crossDomain: false,
  155. url: globalConfig.context + detailApiUrl,
  156. data: {
  157. id: id
  158. },
  159. success: function (data) {
  160. let thisData = data.data;
  161. if (!thisData) {
  162. if (data.error && data.error.length) {
  163. message.warning(data.error[0].message);
  164. };
  165. thisData = {};
  166. };
  167. this.setState({
  168. data: thisData,
  169. orgDisplay: thisData.ownerType,
  170. switchValue: Boolean(!thisData.ownerId),
  171. radios:thisData.hot==='1'?true:false,
  172. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  173. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  174. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : [],
  175. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  176. });
  177. if (thisData.ownerId) {
  178. this.getContactsList(thisData.ownerId);
  179. };
  180. }.bind(this),
  181. }).always(function () {
  182. this.setState({
  183. loading: false
  184. });
  185. }.bind(this));
  186. },
  187. offShelf() {
  188. this.setState({
  189. loading: true
  190. });
  191. $.ajax({
  192. method: "post",
  193. dataType: "json",
  194. crossDomain: false,
  195. url: globalConfig.context + "/api/admin/achievement/offShelf",
  196. data: { "id": this.props.data.id }
  197. }).done(function (data) {
  198. if (!data.error.length) {
  199. message.success('撤销成功!');
  200. this.setState({
  201. visible: false,
  202. releaseSubmitVisible: false
  203. });
  204. this.props.handleOk();
  205. } else {
  206. message.warning(data.error[0].message);
  207. }
  208. }.bind(this));
  209. },
  210. modifyBroker() {
  211. this.props.form.validateFields((err, values) => {
  212. if (!err) {
  213. this.setState({
  214. loading: true
  215. });
  216. $.ajax({
  217. method: "POST",
  218. dataType: "json",
  219. crossDomain: false,
  220. url: globalConfig.context + '/api/admin/audit/modifyAchievementTechBroker',
  221. data: {
  222. id: this.props.data.id,
  223. techBrokerId: values.modifyTechBrokerId
  224. }
  225. }).done(function (data) {
  226. this.state.auditStatus = 0;
  227. this.setState({
  228. loading: false
  229. });
  230. if (data.error && data.error.length) {
  231. message.warning(data.error[0].message);
  232. } else {
  233. message.success('保存成功!');
  234. this.props.handleOk();
  235. };
  236. }.bind(this));
  237. }
  238. });
  239. },
  240. formSubmit() {
  241. this.props.form.validateFields((err, values) => {
  242. if (values.auditStatus == 3 && !values.techBrokerId) {
  243. message.warning('必须选择一个技术经纪人!');
  244. return
  245. };
  246. if (!err) {
  247. this.setState({
  248. loading: true
  249. });
  250. $.ajax({
  251. method: "POST",
  252. dataType: "json",
  253. crossDomain: false,
  254. url: globalConfig.context + '/api/admin/audit/achievement',
  255. data: {
  256. id: this.props.data.id,
  257. techBroderId: values.techBrokerId,
  258. auditStatus: values.auditStatus
  259. }
  260. }).done(function (data) {
  261. this.state.auditStatus = 0;
  262. this.setState({
  263. loading: false
  264. });
  265. if (!data.error.length) {
  266. message.success('保存成功!');
  267. this.setState({
  268. formSubmitVisible: false
  269. });
  270. this.props.handleOk();
  271. } else {
  272. message.warning(data.error[0].message);
  273. };
  274. }.bind(this));
  275. }
  276. });
  277. },
  278. handleSubmit(e) {
  279. e.preventDefault();
  280. this.props.form.validateFields((err, values) => {
  281. if (values.auditStatus == 4) {
  282. this.setState({
  283. formSubmitVisible: true
  284. });
  285. } else {
  286. this.formSubmit();
  287. };
  288. });
  289. },
  290. buildMatchList() {
  291. this.setState({
  292. buttonLoading: true
  293. });
  294. $.ajax({
  295. method: "POST",
  296. dataType: "json",
  297. crossDomain: false,
  298. url: globalConfig.context + '/api/admin/achievement/matchDemand',
  299. data: {
  300. id: this.props.data.id,
  301. }
  302. }).done(function (data) {
  303. this.setState({
  304. buttonLoading: false
  305. });
  306. if (!data.error.length) {
  307. message.success('匹配完成!匹配到' + data.data + '条记录');
  308. } else {
  309. message.warning(data.error[0].message);
  310. };
  311. }.bind(this));
  312. },
  313. getContactsList(theUid) {
  314. $.ajax({
  315. method: "get",
  316. dataType: "json",
  317. crossDomain: false,
  318. url: globalConfig.context + "/api/admin/getContacts",
  319. data: {
  320. uid: theUid
  321. },
  322. success: function (data) {
  323. if (!data.data) {
  324. if (data.error && data.error.length) {
  325. message.warning(data.error[0].message);
  326. return;
  327. };
  328. } else {
  329. this.setState({
  330. contactsObj: data.data || {}
  331. });
  332. };
  333. }.bind(this),
  334. });
  335. },
  336. componentWillMount() {
  337. this.loadData(this.props.data.id, this.props.detailApiUrl);
  338. },
  339. componentWillReceiveProps(nextProps) {
  340. if (!this.props.visible && nextProps.visible) {
  341. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  342. this.state.textFileList = [];
  343. this.state.techPlanFileList = [];
  344. this.state.businessPlanFileList = [];
  345. this.props.form.resetFields();
  346. };
  347. },
  348. render() {
  349. const theData = this.state.data || {};
  350. const { getFieldDecorator } = this.props.form;
  351. const FormItem = Form.Item
  352. const formItemLayout = {
  353. labelCol: { span: 8 },
  354. wrapperCol: { span: 14 },
  355. };
  356. return (
  357. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  358. <Spin spinning={this.state.loading}>
  359. <div className="clearfix">
  360. <FormItem className="half-item"
  361. {...formItemLayout}
  362. label="编号" >
  363. <span>{theData.serialNumber}</span>
  364. </FormItem>
  365. <FormItem className="half-item"
  366. {...formItemLayout}
  367. label="名称" >
  368. <span>{theData.name}</span>
  369. </FormItem>
  370. <FormItem className="half-item"
  371. {...formItemLayout}
  372. label="数据类别" >
  373. {(() => {
  374. switch (theData.dataCategory) {
  375. case "0":
  376. return <span>成果</span>;
  377. case "1":
  378. return <span>技术</span>;
  379. case "2":
  380. return <span>项目</span>;
  381. }
  382. })()}
  383. </FormItem>
  384. <FormItem className="half-item"
  385. {...formItemLayout}
  386. label="类型" >
  387. <span>{getAchievementCategory(theData.category)}</span>
  388. </FormItem>
  389. <FormItem className="half-item"
  390. {...formItemLayout}
  391. label="精品成果" >
  392. {(() => {
  393. switch (theData.boutique) {
  394. case "0":
  395. return <span>否</span>;
  396. case "1":
  397. return <span>是</span>;
  398. }
  399. })()}
  400. </FormItem>
  401. <FormItem className="half-item"
  402. {...formItemLayout}
  403. label="首页展示" >
  404. {(() => {
  405. switch (theData.hot) {
  406. case "0":
  407. return <span>否</span>;
  408. case "1":
  409. return <span>是</span>;
  410. }
  411. })()}
  412. </FormItem>
  413. </div>
  414. {this.state.radios==true ?<FormItem
  415. labelCol={{ span: 4 }}
  416. wrapperCol={{ span: 18 }}
  417. label="首页展示图片:" >
  418. <div className="clearfix">
  419. <Upload className="demandDetailShow-upload"
  420. listType="picture-card"
  421. fileList={this.state.coverImg}
  422. onPreview={(file) => {
  423. this.setState({
  424. previewImage: file.url || file.thumbUrl,
  425. previewVisible: true,
  426. });
  427. }} >
  428. </Upload>
  429. <Modal maskClosable={false} footer={null}
  430. visible={this.state.previewVisible}
  431. onCancel={() => { this.setState({ previewVisible: false }) }}>
  432. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  433. </Modal>
  434. </div>
  435. </FormItem>:<div></div>}
  436. <div className="clearfix">
  437. <FormItem className="half-item"
  438. {...formItemLayout}
  439. label="是否发布" >
  440. {(() => {
  441. switch (theData.releaseStatus) {
  442. case "0":
  443. return <span>未发布</span>;
  444. case "1":
  445. return <div>
  446. <span>已发布</span>
  447. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  448. <Modal maskClosable={false} title="确认"
  449. visible={this.state.releaseSubmitVisible}
  450. width='300px'
  451. footer={null}
  452. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  453. <span>确认要撤销发布吗?</span>
  454. <Button className="modal-submit" type="primary" onClick={this.offShelf} >确认</Button>
  455. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  456. </Modal>
  457. </div>;
  458. }
  459. })()}
  460. </FormItem>
  461. <FormItem className="half-item"
  462. {...formItemLayout}
  463. label="发布时间" >
  464. <span>{theData.releaseDateFormattedDate}</span>
  465. </FormItem>
  466. <FormItem className="half-item"
  467. {...formItemLayout}
  468. label="审核状态" >
  469. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  470. </FormItem>
  471. <FormItem className="half-item"
  472. {...formItemLayout}
  473. label="是否国际" >
  474. <span>{getboutique(theData.internationalFlag)}</span>
  475. </FormItem>
  476. </div>
  477. <FormItem
  478. labelCol={{ span: 4 }}
  479. wrapperCol={{ span: 18 }}
  480. label="关键词" >
  481. {this.state.tags.map((tag) => {
  482. return <Tooltip key={tag} title={tag}>
  483. <Tag key={tag}>{tag}</Tag>
  484. </Tooltip>;
  485. })}
  486. </FormItem>
  487. <FormItem
  488. labelCol={{ span: 4 }}
  489. wrapperCol={{ span: 18 }}
  490. label="摘要" >
  491. <span>{theData.summary}</span>
  492. </FormItem>
  493. <FormItem
  494. labelCol={{ span: 4 }}
  495. wrapperCol={{ span: 18 }}
  496. label="成果简介" >
  497. <span>{theData.introduction}</span>
  498. </FormItem>
  499. <FormItem
  500. labelCol={{ span: 4 }}
  501. wrapperCol={{ span: 18 }}
  502. label="技术图片" >
  503. <div className="clearfix">
  504. <Upload className="demandDetailShow-upload"
  505. listType="picture-card"
  506. fileList={this.state.technicalPictureUrl}
  507. onPreview={(file) => {
  508. this.setState({
  509. previewImage: file.url || file.thumbUrl,
  510. previewVisible: true,
  511. });
  512. }} >
  513. </Upload>
  514. <Modal maskClosable={false} footer={null}
  515. visible={this.state.previewVisible}
  516. onCancel={() => { this.setState({ previewVisible: false }) }}>
  517. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  518. </Modal>
  519. </div>
  520. </FormItem>
  521. <FormItem
  522. labelCol={{ span: 4 }}
  523. wrapperCol={{ span: 18 }}
  524. label="应用领域" >
  525. <span>{getIndustryCategory(theData.fieldA, theData.fieldB)}</span>
  526. </FormItem>
  527. <div className="clearfix">
  528. <FormItem className="half-item"
  529. {...formItemLayout}
  530. label="成熟度" >
  531. <span>{getMaturity(theData.maturity)}</span>
  532. </FormItem>
  533. <FormItem className="half-item"
  534. {...formItemLayout}
  535. label="创新度" >
  536. <span>{getInnovation(theData.innovation)}</span>
  537. </FormItem>
  538. </div>
  539. <FormItem
  540. labelCol={{ span: 4 }}
  541. wrapperCol={{ span: 18 }}
  542. label="成熟度证明材料(图片)" >
  543. <Upload className="demandDetailShow-upload"
  544. listType="picture-card"
  545. fileList={this.state.maturityPictureUrl}
  546. onPreview={(file) => {
  547. this.setState({
  548. previewImage: file.url || file.thumbUrl,
  549. previewVisible: true,
  550. });
  551. }} >
  552. </Upload>
  553. </FormItem>
  554. <FormItem
  555. labelCol={{ span: 4 }}
  556. wrapperCol={{ span: 6 }}
  557. label="成熟度证明材料(文本)" >
  558. <p>{theData.maturityTextFileUrl ?
  559. <span className="download-file">
  560. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  561. </span>
  562. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  563. </FormItem>
  564. <FormItem
  565. labelCol={{ span: 4 }}
  566. wrapperCol={{ span: 18 }}
  567. label="成熟度证明材料(视频地址)" >
  568. <span>{theData.maturityVideoUrl}</span>
  569. </FormItem>
  570. {this.state.switchValue ?
  571. <div className="clearfix" >
  572. <FormItem className="half-item"
  573. {...formItemLayout}
  574. label="成果所有人名称" >
  575. <span>{theData.ownerName}</span>
  576. </FormItem>
  577. <FormItem className="half-item"
  578. {...formItemLayout}
  579. label="联系电话" >
  580. <span>{theData.ownerMobile}</span>
  581. </FormItem>
  582. <FormItem className="half-item"
  583. {...formItemLayout}
  584. label="证件号" >
  585. <span>{theData.ownerIdNumber}</span>
  586. </FormItem>
  587. <FormItem className="half-item"
  588. {...formItemLayout}
  589. label="电子邮箱" >
  590. <span>{theData.ownerEmail}</span>
  591. </FormItem>
  592. <FormItem className="half-item"
  593. {...formItemLayout}
  594. label="通讯地址" >
  595. <span>{theData.ownerPostalAddress}</span>
  596. </FormItem>
  597. </div> : <div className="clearfix" >
  598. <FormItem className="half-item"
  599. {...formItemLayout}
  600. label="成果所有人名称" >
  601. <span>{theData.iOwnerName}</span>
  602. </FormItem>
  603. <FormItem className="half-item"
  604. {...formItemLayout}
  605. label="联系电话" >
  606. {theData.ownerType == "1" ? <span>{this.state.contactsObj[theData.contacts]}</span> : <span>{theData.iOwnerMobile}</span>}
  607. </FormItem>
  608. <FormItem className="half-item"
  609. {...formItemLayout}
  610. label="证件号" >
  611. <span>{theData.iOwnerIdNumber}</span>
  612. </FormItem>
  613. <FormItem className="half-item"
  614. {...formItemLayout}
  615. label="电子邮箱" >
  616. <span>{theData.iOwnerEmail}</span>
  617. </FormItem>
  618. <FormItem className="half-item"
  619. {...formItemLayout}
  620. label="通讯地址" >
  621. <span>{theData.iOwnerPostalAddress}</span>
  622. </FormItem>
  623. </div>}
  624. <div className="clearfix">
  625. <FormItem className="half-item"
  626. {...formItemLayout}
  627. label="合作方式" >
  628. {(() => {
  629. switch (theData.cooperationMode) {
  630. case "0":
  631. return <span>技术转让</span>;
  632. case "1":
  633. return <span>授权生产</span>;
  634. }
  635. })()}
  636. </FormItem>
  637. <FormItem className="half-item"
  638. {...formItemLayout}
  639. label="转让方式" >
  640. <span>{getTransferMode(theData.transferMode)}</span>
  641. </FormItem>
  642. </div>
  643. <div className="clearfix">
  644. <FormItem className="half-item"
  645. {...formItemLayout}
  646. label="议价方式" >
  647. {(() => {
  648. switch (theData.bargainingMode) {
  649. case "0":
  650. return <span>面议</span>;
  651. case "1":
  652. return <span>定价</span>;
  653. }
  654. })()}
  655. </FormItem>
  656. {theData.bargainingMode == 0 ? <div></div> : <FormItem className="half-item"
  657. {...formItemLayout}
  658. label="转让价格" >
  659. <span>{theData.transferPrice} 万元</span>
  660. </FormItem>}
  661. </div>
  662. <FormItem
  663. labelCol={{ span: 4 }}
  664. wrapperCol={{ span: 18 }}
  665. label="技术场景" >
  666. <span>{theData.technicalScene}</span>
  667. </FormItem>
  668. <FormItem
  669. labelCol={{ span: 4 }}
  670. wrapperCol={{ span: 18 }}
  671. label="技术突破" >
  672. <span>{theData.breakthrough}</span>
  673. </FormItem>
  674. <FormItem
  675. labelCol={{ span: 4 }}
  676. wrapperCol={{ span: 18 }}
  677. label="专利情况" >
  678. <span>{theData.patentCase}</span>
  679. </FormItem>
  680. <FormItem
  681. labelCol={{ span: 4 }}
  682. wrapperCol={{ span: 18 }}
  683. label="获奖情况" >
  684. <span>{theData.awards}</span>
  685. </FormItem>
  686. <FormItem
  687. labelCol={{ span: 4 }}
  688. wrapperCol={{ span: 18 }}
  689. label="技术团队情况" >
  690. <span>{theData.teamDes}</span>
  691. </FormItem>
  692. <FormItem
  693. labelCol={{ span: 4 }}
  694. wrapperCol={{ span: 18 }}
  695. label="技术参数" >
  696. <span>{theData.parameter}</span>
  697. </FormItem>
  698. <FormItem
  699. labelCol={{ span: 4 }}
  700. wrapperCol={{ span: 6 }}
  701. label="技术方案" >
  702. <p>{theData.techPlanUrl ?
  703. <span className="download-file">
  704. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  705. </span>
  706. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  707. </FormItem>
  708. <FormItem
  709. labelCol={{ span: 4 }}
  710. wrapperCol={{ span: 6 }}
  711. label="商业计划书" >
  712. <p>{theData.businessPlanUrl ?
  713. <span className="download-file">
  714. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  715. </span>
  716. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  717. </FormItem>
  718. {window.showAuditStatus && theData.auditStatus == 2 ? <div className="clearfix">
  719. <FormItem className="half-item"
  720. {...formItemLayout}
  721. label="审核状态" >
  722. {getFieldDecorator('auditStatus')(
  723. <Radio.Group>
  724. <Radio value={3}>审核通过</Radio>
  725. <Radio value={4}>审核未通过</Radio>
  726. </Radio.Group>
  727. )}
  728. </FormItem>
  729. <FormItem className="half-item"
  730. {...formItemLayout}
  731. label="技术经纪人" >
  732. {getFieldDecorator('techBrokerId', {
  733. initialValue: theData.techBrokerId
  734. })(
  735. <Select style={{ width: 260 }}
  736. placeholder="请选择技术经纪人"
  737. notFoundContent="未获取到经纪人列表"
  738. showSearch
  739. filterOption={companySearch}>
  740. {this.props.techBrodersOption}
  741. </Select>
  742. )}
  743. </FormItem>
  744. </div> : <div></div>}
  745. {window.showAuditStatus && theData.auditStatus == 3 ? <div className="clearfix">
  746. <FormItem className="half-item"
  747. {...formItemLayout}
  748. label="指派新经纪人" >
  749. {getFieldDecorator('modifyTechBrokerId', {
  750. initialValue: theData.techBrokerId
  751. })(
  752. <Select style={{ width: 260 }}
  753. placeholder="请选择要指派的新经纪人"
  754. notFoundContent="未获取到经纪人列表"
  755. showSearch
  756. filterOption={companySearch}>
  757. {this.props.techBrodersOption}
  758. </Select>
  759. )}
  760. </FormItem>
  761. </div> : <div></div>}
  762. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  763. {theData.auditStatus == 2 ? <Button className="set-submit" type="primary" htmlType="submit">保存</Button> : <span></span>}
  764. {theData.auditStatus == 3 ? <Button className="set-submit" type="primary" onClick={() => { this.modifyBroker(); }}>保存</Button> : <span></span>}
  765. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  766. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList}>生成匹配列表</Button> : <span></span>}
  767. </FormItem>
  768. <Modal maskClosable={false} title="确认"
  769. visible={this.state.formSubmitVisible}
  770. width='360px'
  771. footer={null}
  772. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  773. <span>确认该需求审核未通过?</span>
  774. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  775. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  776. </Modal>
  777. </Spin>
  778. </Form >
  779. )
  780. }
  781. }));
  782. const AchievementDetailForm = Form.create()(React.createClass({
  783. getInitialState() {
  784. return {
  785. loading: false,
  786. auditStatus: 0,
  787. textFileList: [],
  788. switchValue: false,
  789. radios: false,
  790. techPlanFileList: [],
  791. data: {},
  792. tags: [],
  793. technicalPictureUrl: [],
  794. coverImg: [],
  795. maturityPictureUrl: [],
  796. businessPlanFileList: [],
  797. dataSource: [],
  798. };
  799. },
  800. loadData(id, detailApiUrl) {
  801. this.setState({
  802. loading: true
  803. });
  804. $.ajax({
  805. method: "get",
  806. dataType: "json",
  807. crossDomain: false,
  808. url: globalConfig.context + detailApiUrl,
  809. data: {
  810. id: id
  811. },
  812. success: function (data) {
  813. let thisData = data.data;
  814. if (!thisData) {
  815. if (data.error && data.error.length) {
  816. message.warning(data.error[0].message);
  817. };
  818. thisData = {};
  819. };
  820. this.setState({
  821. data: thisData,
  822. orgDisplay: thisData.ownerType,
  823. switchValue: Boolean(!thisData.ownerId),
  824. radios: thisData.hot == '1' ? true : false,
  825. transferPriceDis: thisData.transferMode == 1 ? true : false,
  826. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  827. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  828. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : [],
  829. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  830. });
  831. if (thisData.ownerType == "1" && thisData.ownerId) {
  832. this.getContactsList(thisData.ownerId);
  833. };
  834. }.bind(this),
  835. }).always(function () {
  836. this.setState({
  837. loading: false
  838. });
  839. }.bind(this));
  840. },
  841. getContactsList(theUid) {
  842. $.ajax({
  843. method: "get",
  844. dataType: "json",
  845. crossDomain: false,
  846. url: globalConfig.context + "/api/admin/getContacts",
  847. data: {
  848. uid: theUid
  849. },
  850. success: function (data) {
  851. let theOption = [];
  852. if (!data.data) {
  853. if (data.error && data.error.length) {
  854. message.warning(data.error[0].message);
  855. return;
  856. };
  857. };
  858. for (let item in data.data) {
  859. let theData = data.data[item];
  860. theOption.push(
  861. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  862. );
  863. };
  864. this.setState({
  865. contactsOption: theOption
  866. });
  867. }.bind(this),
  868. });
  869. },
  870. getTagsArr(e) {
  871. this.setState({ tags: e });
  872. },
  873. getMaturityPictureUrl(e) {
  874. this.setState({ maturityPictureUrl: e });
  875. },
  876. getTechnicalPictureUrl(e) {
  877. this.setState({ technicalPictureUrl: e });
  878. },
  879. getcoverImg(e) {
  880. this.setState({coverImg: e });
  881. },
  882. handleSearch(e) {
  883. if (this.props.detailApiUrl.indexOf('org') != -1) {
  884. $.ajax({
  885. method: "get",
  886. dataType: "json",
  887. crossDomain: false,
  888. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  889. data: { name: e },
  890. success: function (data) {
  891. let theArr = [];
  892. let theObj = {};
  893. if (!data.data) {
  894. if (data.error && data.error.length) {
  895. message.warning(data.error[0].message);
  896. };
  897. } else if (!$.isEmptyObject(data.data)) {
  898. data.data.map(function (item) {
  899. theArr.push(item.unitName);
  900. theObj[item.unitName] = item.uid;
  901. });
  902. };
  903. this.setState({
  904. dataSource: theArr,
  905. dataSourceObj: theObj
  906. });
  907. }.bind(this),
  908. });
  909. } else {
  910. $.ajax({
  911. method: "get",
  912. dataType: "json",
  913. crossDomain: false,
  914. url: globalConfig.context + "/api/admin/achievement/userOwner",
  915. data: { name: e },
  916. success: function (data) {
  917. let theArr = [];
  918. let theObj = {};
  919. if (!data.data) {
  920. if (data.error && data.error.length) {
  921. message.warning(data.error[0].message);
  922. };
  923. } else if (!$.isEmptyObject(data.data)) {
  924. for (let item in data.data) {
  925. theArr.push(data.data[item]);
  926. theObj[data.data[item]] = item;
  927. };
  928. };
  929. this.setState({
  930. dataSource: theArr,
  931. dataSourceObj: theObj
  932. });
  933. }.bind(this),
  934. });
  935. };
  936. },
  937. handleSubmit(e) {
  938. e.preventDefault();
  939. this.props.form.validateFields((err, values) => {
  940. //keyword长度判断
  941. console.log(typeof values.field[0])
  942. if ((this.state.tags ? this.state.tags.length : this.props.tags.length) < 3) {
  943. message.warning('关键词数量不能小于3个!');
  944. return;
  945. };
  946. if (values.bargainingMode == 1 && !values.transferPrice) {
  947. message.warning('议价方式为[ 定价 ]时, [ 转让价格 ]不能为空!');
  948. return;
  949. }
  950. if(values.field[0]==undefined){
  951. message.warning('应用领域不能为空!')
  952. return false;
  953. }
  954. //url转化
  955. let theTechnicalPictureUrl = [];
  956. if (this.state.technicalPictureUrl.length) {
  957. let picArr = [];
  958. this.state.technicalPictureUrl.map(function (item) {
  959. picArr.push(item.response.data);
  960. });
  961. theTechnicalPictureUrl = picArr.join(",");
  962. };
  963. let thecoverImg = [];
  964. if (this.state.coverImg.length) {
  965. let picArr = [];
  966. this.state.coverImg.map(function (item) {
  967. picArr.push(item.response.data);
  968. });
  969. thecoverImg = picArr.join(",");
  970. };
  971. let theMaturityPictureUrl = [];
  972. if (this.state.maturityPictureUrl.length) {
  973. let picArr = [];
  974. this.state.maturityPictureUrl.map(function (item) {
  975. picArr.push(item.response.data);
  976. });
  977. theMaturityPictureUrl = picArr.join(",");
  978. };
  979. if (!err) {
  980. this.setState({
  981. loading: true
  982. });
  983. $.ajax({
  984. method: "POST",
  985. dataType: "json",
  986. crossDomain: false,
  987. url: this.props.data.id ? globalConfig.context + '/api/admin/achievement/update' : globalConfig.context + '/api/admin/achievement/apply',
  988. data: {
  989. id: this.props.data.id,
  990. dataCategory: values.dataCategory,
  991. serialNumber: this.props.data.serialNumber,
  992. name: values.name,
  993. keyword: this.state.tags ? this.state.tags.join(",") : this.props.tags.join(","),
  994. keywords: this.state.tags ? this.state.tags : this.props.tags,
  995. category: values.category,
  996. summary: values.summary,
  997. introduction: values.introduction,
  998. technicalPictureUrl: theTechnicalPictureUrl,
  999. coverImg: thecoverImg,
  1000. fieldA: values.field ? values.field[0] : undefined,
  1001. fieldB: values.field ? values.field[1] : undefined,
  1002. maturity: values.maturity,
  1003. maturityPictureUrl: theMaturityPictureUrl,
  1004. maturityTextFileUrl: this.state.maturityTextFileUrl,
  1005. maturityVideoUrl: values.maturityVideoUrl,
  1006. innovation: values.innovation,
  1007. //
  1008. switchSign: this.state.switchValue ? 1 : 0,
  1009. //
  1010. ownerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.iOwnerName] : this.state.data.ownerId) : undefined,
  1011. contacts: !this.state.switchValue ? values.contacts : undefined,
  1012. ownerType: this.props.detailApiUrl.indexOf('org') != -1 ? 1 : 0,
  1013. //自定义
  1014. ownerName: this.state.switchValue ? values.ownerName : undefined,
  1015. ownerIdNumber: this.state.switchValue ? values.ownerIdNumber : undefined,
  1016. ownerMobile: this.state.switchValue ? values.ownerMobile : undefined,
  1017. ownerEmail: this.state.switchValue ? values.ownerEmail : undefined,
  1018. ownerPostalAddress: this.state.switchValue ? values.ownerPostalAddress : undefined,
  1019. //
  1020. cooperationMode: values.cooperationMode,
  1021. transferMode: values.transferMode,
  1022. bargainingMode: values.bargainingMode,
  1023. transferPrice: values.transferPrice,
  1024. technicalScene: values.technicalScene,
  1025. breakthrough: values.breakthrough,
  1026. patentCase: values.patentCase,
  1027. awards: values.awards,
  1028. teamDes: values.teamDes,
  1029. parameter: values.parameter,
  1030. releaseStatus: values.releaseStatus,
  1031. techPlanUrl: this.state.techPlanUrl,
  1032. businessPlanUrl: this.state.businessPlanUrl,
  1033. auditStatus: this.state.auditStatus,
  1034. boutique: values.boutique,
  1035. internationalFlag:values.internationalFlag,
  1036. hot: values.hot,
  1037. }
  1038. }).done(function (data) {
  1039. this.state.auditStatus = 0;
  1040. this.setState({
  1041. loading: false
  1042. });
  1043. if (!data.error.length) {
  1044. message.success('保存成功!');
  1045. this.props.handleOk();
  1046. } else {
  1047. message.warning(data.error[0].message);
  1048. }
  1049. }.bind(this));
  1050. }
  1051. });
  1052. },
  1053. componentWillMount() {
  1054. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  1055. if (this.props.data && this.props.data.id) {
  1056. this.loadData(this.props.data.id, this.props.detailApiUrl);
  1057. };
  1058. },
  1059. componentWillReceiveProps(nextProps) {
  1060. if (!this.props.visible && nextProps.visible) {
  1061. if (nextProps.data && nextProps.data.id) {
  1062. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  1063. };
  1064. this.state.data = {};
  1065. this.state.tags = [];
  1066. this.state.switchValue = false;
  1067. this.state.radios = false;
  1068. this.state.technicalPictureUrl = [];
  1069. this.state.coverImg = [];
  1070. this.state.maturityPictureUrl = [];
  1071. this.state.textFileList = [];
  1072. this.state.techPlanFileList = [];
  1073. this.state.businessPlanFileList = [];
  1074. this.props.form.resetFields();
  1075. };
  1076. },
  1077. render() {
  1078. const theData = this.state.data || {};
  1079. const { getFieldDecorator } = this.props.form;
  1080. const FormItem = Form.Item
  1081. const formItemLayout = {
  1082. labelCol: { span: 8 },
  1083. wrapperCol: { span: 14 },
  1084. };
  1085. return (
  1086. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  1087. <Spin spinning={this.state.loading}>
  1088. <div className="clearfix">
  1089. <FormItem className="half-item"
  1090. {...formItemLayout}
  1091. label="编号" >
  1092. <span>{theData.serialNumber}</span>
  1093. </FormItem>
  1094. <FormItem className="half-item"
  1095. {...formItemLayout}
  1096. label="名称" >
  1097. {getFieldDecorator('name', {
  1098. rules: [{ required: true, message: '此项为必填项!' }],
  1099. initialValue: theData.name
  1100. })(
  1101. <Input />
  1102. )}
  1103. </FormItem>
  1104. <FormItem className="half-item"
  1105. {...formItemLayout}
  1106. label="数据类别" >
  1107. {getFieldDecorator('dataCategory', {
  1108. rules: [{ required: true, message: '此项为必填项!' }],
  1109. initialValue: theData.dataCategory
  1110. })(
  1111. <Select placeholder="选择数据类型" style={{ width: 160 }} >
  1112. <Select.Option value="0" >成果</Select.Option>
  1113. <Select.Option value="1" >技术</Select.Option>
  1114. <Select.Option value="2" >项目</Select.Option>
  1115. </Select>
  1116. )}
  1117. </FormItem>
  1118. <FormItem className="half-item"
  1119. {...formItemLayout}
  1120. label="类型" >
  1121. {getFieldDecorator('category', {
  1122. rules: [{ required: true, message: '此项为必填项!' }],
  1123. initialValue: theData.category
  1124. })(
  1125. <Select style={{ width: 160 }} placeholder="请选择成果类型">
  1126. {this.props.achievementCategoryOption}
  1127. </Select>
  1128. )}
  1129. </FormItem>
  1130. <FormItem className="half-item"
  1131. {...formItemLayout}
  1132. label="精品成果" >
  1133. {getFieldDecorator('boutique', {
  1134. initialValue: theData.boutique
  1135. })(
  1136. <Radio.Group>
  1137. <Radio value="0">否</Radio>
  1138. <Radio value="1">是</Radio>
  1139. </Radio.Group>
  1140. )}
  1141. </FormItem>
  1142. <FormItem className="half-item"
  1143. {...formItemLayout}
  1144. label="首页展示:" >
  1145. {getFieldDecorator('hot', {
  1146. initialValue: theData.hot
  1147. })(
  1148. <Radio.Group onChange={(e) => { this.setState({ radios: e.target.value }); }}>
  1149. <Radio value="0">否</Radio>
  1150. <Radio value="1">是</Radio>
  1151. </Radio.Group>
  1152. )}
  1153. </FormItem>
  1154. {this.state.radios==true ? <FormItem
  1155. labelCol={{ span: 4 }}
  1156. wrapperCol={{ span: 18 }}
  1157. label="首页展示图片:"
  1158. style={{display:'block'}}
  1159. >
  1160. <PicturesWall
  1161. pictureSign="achievement_cover_picture"
  1162. fileList={this.getcoverImg}
  1163. pictureUrl={this.state.coverImg} />
  1164. <p>图片尺寸建议:220X140(像素)</p>
  1165. </FormItem>:<div></div>}
  1166. <div className="clearfix">
  1167. <FormItem className="half-item"
  1168. {...formItemLayout}
  1169. label="是否发布" >
  1170. {(() => {
  1171. switch (theData.releaseStatus) {
  1172. case "0":
  1173. return <span>未发布</span>;
  1174. case "1":
  1175. return <span>已发布</span>;
  1176. }
  1177. })()}
  1178. </FormItem>
  1179. <FormItem className="half-item"
  1180. {...formItemLayout}
  1181. label="发布时间" >
  1182. <span>{theData.releaseDateFormattedDate}</span>
  1183. </FormItem>
  1184. <FormItem className="half-item"
  1185. {...formItemLayout}
  1186. label="审核状态" >
  1187. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  1188. </FormItem>
  1189. <FormItem className="half-item"
  1190. {...formItemLayout}
  1191. label="是否国际" >
  1192. {getFieldDecorator('internationalFlag', {
  1193. initialValue: theData.internationalFlag
  1194. })(
  1195. <Radio.Group>
  1196. <Radio value="0">否</Radio>
  1197. <Radio value="1">是</Radio>
  1198. </Radio.Group>
  1199. )}
  1200. </FormItem>
  1201. </div>
  1202. </div>
  1203. <FormItem
  1204. labelCol={{ span: 4 }}
  1205. wrapperCol={{ span: 18 }}
  1206. label="关键词" >
  1207. <KeyWordTagGroup
  1208. keyWordArr={this.state.tags}
  1209. tagsArr={this.getTagsArr} />
  1210. </FormItem>
  1211. <FormItem
  1212. labelCol={{ span: 4 }}
  1213. wrapperCol={{ span: 18 }}
  1214. label="摘要" >
  1215. {getFieldDecorator('summary', {
  1216. initialValue: theData.summary
  1217. })(
  1218. <Input type="textarea" rows={4} />
  1219. )}
  1220. </FormItem>
  1221. <FormItem
  1222. labelCol={{ span: 4 }}
  1223. wrapperCol={{ span: 18 }}
  1224. label="成果简介" >
  1225. {getFieldDecorator('introduction', {
  1226. initialValue: theData.introduction
  1227. })(
  1228. <Input type="textarea" rows={4} placeholder="项目成果简介;项目核心创新点;项目详细用途;预期效益说明;主要技术(性能)指标;市场前景;应用范围;发展历程。" />
  1229. )}
  1230. </FormItem>
  1231. <FormItem
  1232. labelCol={{ span: 4 }}
  1233. wrapperCol={{ span: 18 }}
  1234. label="技术图片" >
  1235. <PicturesWall
  1236. pictureSign="achievement_technical_picture"
  1237. fileList={this.getTechnicalPictureUrl}
  1238. pictureUrl={this.state.technicalPictureUrl} />
  1239. <p>图片建议:专利证书或专利申请书图片、技术图纸、样品图片、技术相关网络图片;成熟度处于非研发阶段的项目,必须上传样品图片,如未上传,成熟度将视为处在研发阶段。</p>
  1240. </FormItem>
  1241. <FormItem
  1242. labelCol={{ span: 4 }}
  1243. wrapperCol={{ span: 18 }}
  1244. label="应用领域" >
  1245. {getFieldDecorator('field', {
  1246. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  1247. initialValue: [theData.fieldA, theData.fieldB]
  1248. })(
  1249. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="应用领域" />
  1250. )}
  1251. </FormItem>
  1252. <div className="clearfix">
  1253. <FormItem className="half-item"
  1254. {...formItemLayout}
  1255. label="成熟度" >
  1256. {getFieldDecorator('maturity', {
  1257. initialValue: theData.maturity
  1258. })(
  1259. <Select placeholder="选择成熟度" style={{ width: 160 }} >
  1260. {
  1261. maturityList.map(function (item) {
  1262. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1263. })
  1264. }
  1265. </Select>
  1266. )}
  1267. </FormItem>
  1268. <FormItem className="half-item"
  1269. {...formItemLayout}
  1270. label="创新度" >
  1271. {getFieldDecorator('innovation', {
  1272. initialValue: theData.innovation
  1273. })(
  1274. <Select placeholder="选择创新度" style={{ width: 160 }} >
  1275. {
  1276. innovationList.map(function (item) {
  1277. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1278. })
  1279. }
  1280. </Select>
  1281. )}
  1282. </FormItem>
  1283. </div>
  1284. <FormItem
  1285. labelCol={{ span: 4 }}
  1286. wrapperCol={{ span: 18 }}
  1287. label="成熟度证明材料(图片)" >
  1288. <PicturesWall
  1289. pictureSign="achievement_maturity_picture"
  1290. fileList={this.getMaturityPictureUrl}
  1291. pictureUrl={this.state.maturityPictureUrl} />
  1292. </FormItem>
  1293. <FormItem
  1294. labelCol={{ span: 4 }}
  1295. wrapperCol={{ span: 6 }}
  1296. label="成熟度证明材料(文本)" >
  1297. <Upload
  1298. name="ratepay"
  1299. action={globalConfig.context + "/api/admin/achievement/uploadTextFile"}
  1300. data={{ 'sign': 'achievement_maturity_text_file' }}
  1301. beforeUpload={beforeUploadFile}
  1302. fileList={this.state.textFileList}
  1303. onChange={(info) => {
  1304. if (info.file.status !== 'uploading') {
  1305. console.log(info.file, info.fileList);
  1306. }
  1307. if (info.file.status === 'done') {
  1308. if (!info.file.response.error.length) {
  1309. message.success(`${info.file.name} 文件上传成功!`);
  1310. } else {
  1311. message.warning(info.file.response.error[0].message);
  1312. return;
  1313. };
  1314. this.state.maturityTextFileUrl = info.file.response.data;
  1315. } else if (info.file.status === 'error') {
  1316. message.error(`${info.file.name} 文件上传失败。`);
  1317. };
  1318. this.setState({ textFileList: info.fileList.slice(-1) });
  1319. }} >
  1320. <Button><Icon type="upload" /> 上传成熟度证明文本 </Button>
  1321. </Upload>
  1322. <p style={{ marginTop: '10px' }}>{theData.maturityTextFileUrl ?
  1323. <span className="download-file">
  1324. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  1325. </span>
  1326. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1327. </FormItem>
  1328. <FormItem
  1329. labelCol={{ span: 4 }}
  1330. wrapperCol={{ span: 18 }}
  1331. label="成熟度证明材料(视频地址)" >
  1332. {getFieldDecorator('maturityVideoUrl', {
  1333. initialValue: theData.maturityVideoUrl
  1334. })(
  1335. <Input />
  1336. )}
  1337. </FormItem>
  1338. <FormItem
  1339. labelCol={{ span: 4 }}
  1340. wrapperCol={{ span: 18 }}
  1341. label="自定义成果所有人" >
  1342. <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
  1343. </FormItem>
  1344. {this.state.switchValue ? <div className="clearfix" >
  1345. <FormItem className="half-item"
  1346. {...formItemLayout}
  1347. label="成果所有人" >
  1348. {getFieldDecorator('ownerName', {
  1349. initialValue: theData.ownerName
  1350. })(
  1351. <Input />
  1352. )}
  1353. </FormItem>
  1354. <FormItem className="half-item"
  1355. {...formItemLayout}
  1356. label="联系电话" >
  1357. {getFieldDecorator('ownerMobile', {
  1358. initialValue: theData.ownerMobile
  1359. })(
  1360. <Input />
  1361. )}
  1362. </FormItem>
  1363. <FormItem className="half-item"
  1364. {...formItemLayout}
  1365. label="证件号" >
  1366. {getFieldDecorator('ownerIdNumber', {
  1367. initialValue: theData.ownerIdNumber
  1368. })(
  1369. <Input />
  1370. )}
  1371. </FormItem>
  1372. <FormItem className="half-item"
  1373. {...formItemLayout}
  1374. label="电子邮箱" >
  1375. {getFieldDecorator('ownerEmail', {
  1376. initialValue: theData.ownerEmail
  1377. })(
  1378. <Input />
  1379. )}
  1380. </FormItem>
  1381. <FormItem className="half-item"
  1382. {...formItemLayout}
  1383. label="通讯地址" >
  1384. {getFieldDecorator('ownerPostalAddress', {
  1385. initialValue: theData.ownerPostalAddress
  1386. })(
  1387. <Input />
  1388. )}
  1389. </FormItem>
  1390. </div> : <div className="clearfix" >
  1391. <FormItem className="half-item"
  1392. {...formItemLayout}
  1393. label="成果所有人" >
  1394. {getFieldDecorator('iOwnerName', {
  1395. initialValue: theData.iOwnerName || ''
  1396. })(
  1397. <AutoComplete
  1398. dataSource={this.state.dataSource}
  1399. style={{ width: 200 }}
  1400. onSearch={this.state.therottleSearch}
  1401. placeholder="输入成果所有人"
  1402. onSelect={(e) => {
  1403. this.getContactsList(this.state.dataSourceObj[e]);
  1404. }} />
  1405. )}
  1406. </FormItem>
  1407. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  1408. {...formItemLayout}
  1409. label="联系人" >
  1410. {getFieldDecorator('contacts', {
  1411. initialValue: theData.contacts
  1412. })(
  1413. <Select style={{ width: 260 }}
  1414. placeholder="请选择联系人"
  1415. notFoundContent="未获取到联系人列表"
  1416. showSearch
  1417. filterOption={companySearch}>
  1418. {this.state.contactsOption}
  1419. </Select>
  1420. )}
  1421. </FormItem> : <div></div>}
  1422. </div>}
  1423. <div className="clearfix">
  1424. <FormItem className="half-item"
  1425. {...formItemLayout}
  1426. label="合作方式" >
  1427. {getFieldDecorator('cooperationMode', {
  1428. rules: [{ required: true, message: '此项为必填项!' }],
  1429. initialValue: theData.cooperationMode
  1430. })(
  1431. <Radio.Group>
  1432. <Radio value="0">技术转让</Radio>
  1433. <Radio value="1">授权生产</Radio>
  1434. </Radio.Group>
  1435. )}
  1436. </FormItem>
  1437. <FormItem className="half-item"
  1438. {...formItemLayout}
  1439. label="转让方式" >
  1440. {getFieldDecorator('transferMode', {
  1441. initialValue: theData.transferMode
  1442. })(
  1443. <Select placeholder="选择转让方式" style={{ width: 160 }} >
  1444. {
  1445. transferModeList.map(function (item) {
  1446. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1447. })
  1448. }
  1449. </Select>
  1450. )}
  1451. </FormItem>
  1452. </div>
  1453. <div className="clearfix">
  1454. <FormItem className="half-item"
  1455. {...formItemLayout}
  1456. label="议价方式" >
  1457. {getFieldDecorator('bargainingMode', {
  1458. initialValue: theData.bargainingMode
  1459. })(
  1460. <Radio.Group onChange={(e) => {
  1461. this.setState({
  1462. transferPriceDis: (e.target.value == 1 ? true : false)
  1463. })
  1464. }}>
  1465. <Radio value="0">面议</Radio>
  1466. <Radio value="1">定价</Radio>
  1467. </Radio.Group>
  1468. )}
  1469. </FormItem>
  1470. {this.state.transferPriceDis ? <FormItem className="half-item"
  1471. {...formItemLayout}
  1472. label="转让价格" >
  1473. {getFieldDecorator('transferPrice', {
  1474. initialValue: theData.transferPrice || 0
  1475. })(
  1476. <InputNumber min={0} max={999999} step={0.01} />
  1477. )}
  1478. <span style={{ marginLeft: '20px' }}>万元</span>
  1479. </FormItem> : <div></div>}
  1480. </div>
  1481. <FormItem
  1482. labelCol={{ span: 4 }}
  1483. wrapperCol={{ span: 18 }}
  1484. label="技术场景" >
  1485. {getFieldDecorator('technicalScene', {
  1486. initialValue: theData.technicalScene
  1487. })(
  1488. <Input type="textarea" rows={2} placeholder="说明解决了什么问题。" />
  1489. )}
  1490. </FormItem>
  1491. <FormItem
  1492. labelCol={{ span: 4 }}
  1493. wrapperCol={{ span: 18 }}
  1494. label="技术突破" >
  1495. {getFieldDecorator('breakthrough', {
  1496. initialValue: theData.breakthrough
  1497. })(
  1498. <Input type="textarea" rows={2} placeholder="说明该技术成果突破性的研究。" />
  1499. )}
  1500. </FormItem>
  1501. <FormItem
  1502. labelCol={{ span: 4 }}
  1503. wrapperCol={{ span: 18 }}
  1504. label="专利情况" >
  1505. {getFieldDecorator('patentCase', {
  1506. initialValue: theData.patentCase
  1507. })(
  1508. <Input type="textarea" rows={2} placeholder="一个“技术”可能由多个专利构成,需要说明技术-专利的关系。" />
  1509. )}
  1510. </FormItem>
  1511. <FormItem
  1512. labelCol={{ span: 4 }}
  1513. wrapperCol={{ span: 18 }}
  1514. label="获奖情况" >
  1515. {getFieldDecorator('awards', {
  1516. initialValue: theData.awards
  1517. })(
  1518. <Input type="textarea" rows={2} placeholder="一个“技术”可能存在社会奖励情况,需要说明社会奖励情况。" />
  1519. )}
  1520. </FormItem>
  1521. <FormItem
  1522. labelCol={{ span: 4 }}
  1523. wrapperCol={{ span: 18 }}
  1524. label="技术团队情况" >
  1525. {getFieldDecorator('teamDes', {
  1526. initialValue: theData.teamDes
  1527. })(
  1528. <Input type="textarea" rows={2} placeholder="一个“技术”、“项目”可能存在团队,需要说明团队情况。" />
  1529. )}
  1530. </FormItem>
  1531. <FormItem
  1532. labelCol={{ span: 4 }}
  1533. wrapperCol={{ span: 18 }}
  1534. label="技术参数" >
  1535. {getFieldDecorator('parameter', {
  1536. initialValue: theData.parameter
  1537. })(
  1538. <Input type="textarea" rows={2} placeholder="描述技术参数信息" />
  1539. )}
  1540. </FormItem>
  1541. <FormItem
  1542. labelCol={{ span: 4 }}
  1543. wrapperCol={{ span: 6 }}
  1544. label="技术方案" >
  1545. <Upload
  1546. name="ratepay"
  1547. action={globalConfig.context + "/api/admin/achievement/uploadTextFile"}
  1548. data={{ 'sign': 'achievement_tech_plan' }}
  1549. beforeUpload={beforeUploadFile}
  1550. fileList={this.state.techPlanFileList}
  1551. onChange={(info) => {
  1552. if (info.file.status !== 'uploading') {
  1553. console.log(info.file, info.fileList);
  1554. }
  1555. if (info.file.status === 'done') {
  1556. if (!info.file.response.error.length) {
  1557. message.success(`${info.file.name} 文件上传成功!`);
  1558. } else {
  1559. message.warning(info.file.response.error[0].message);
  1560. return;
  1561. };
  1562. this.state.techPlanUrl = info.file.response.data;
  1563. } else if (info.file.status === 'error') {
  1564. message.error(`${info.file.name} 文件上传失败。`);
  1565. };
  1566. this.setState({ techPlanFileList: info.fileList.slice(-1) });
  1567. }} >
  1568. <Button><Icon type="upload" /> 上传技术方案文件 </Button>
  1569. </Upload>
  1570. <p style={{ marginTop: '10px' }}>{theData.techPlanUrl ?
  1571. <span className="download-file">
  1572. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  1573. </span>
  1574. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1575. </FormItem>
  1576. <FormItem
  1577. labelCol={{ span: 4 }}
  1578. wrapperCol={{ span: 6 }}
  1579. label="商业计划书" >
  1580. <Upload
  1581. name="ratepay"
  1582. action={globalConfig.context + "/api/admin/achievement/uploadTextFile"}
  1583. data={{ 'sign': 'achievement_business_plan' }}
  1584. beforeUpload={beforeUploadFile}
  1585. fileList={this.state.businessPlanFileList}
  1586. onChange={(info) => {
  1587. if (info.file.status !== 'uploading') {
  1588. console.log(info.file, info.fileList);
  1589. }
  1590. if (info.file.status === 'done') {
  1591. if (!info.file.response.error.length) {
  1592. message.success(`${info.file.name} 文件上传成功!`);
  1593. } else {
  1594. message.warning(info.file.response.error[0].message);
  1595. return;
  1596. };
  1597. this.state.businessPlanUrl = info.file.response.data;
  1598. } else if (info.file.status === 'error') {
  1599. message.error(`${info.file.name} 文件上传失败。`);
  1600. };
  1601. this.setState({ businessPlanFileList: info.fileList.slice(-1) });
  1602. }} >
  1603. <Button><Icon type="upload" /> 上传商业计划书文件 </Button>
  1604. </Upload>
  1605. <p style={{ marginTop: '10px' }}>{theData.businessPlanUrl ?
  1606. <span className="download-file">
  1607. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  1608. </span>
  1609. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1610. </FormItem>
  1611. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1612. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1613. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1614. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1615. </FormItem>
  1616. </Spin>
  1617. </Form >
  1618. )
  1619. }
  1620. }));
  1621. const AchievementDetail = React.createClass({
  1622. getInitialState() {
  1623. return {
  1624. visible: false,
  1625. tabsKey: 1,
  1626. loading: false,
  1627. columns: [
  1628. {
  1629. title: '编号',
  1630. dataIndex: 'serialNumber',
  1631. key: 'serialNumber',
  1632. }, {
  1633. title: '数据类型',
  1634. dataIndex: 'dataCategory',
  1635. key: 'dataCategory',
  1636. render: text => {
  1637. switch (text) {
  1638. case "0":
  1639. return <span>成果</span>;
  1640. case "1":
  1641. return <span>技术</span>;
  1642. case "2":
  1643. return <span>项目</span>;
  1644. }
  1645. }
  1646. }, {
  1647. title: '名称',
  1648. dataIndex: 'name',
  1649. key: 'name',
  1650. }, {
  1651. title: '关键字',
  1652. dataIndex: 'keyword',
  1653. key: 'keyword',
  1654. }, {
  1655. title: '类型',
  1656. dataIndex: 'demandType',
  1657. key: 'demandType',
  1658. render: text => { return getDemandType(text); }
  1659. }, {
  1660. title: '所有人名称',
  1661. dataIndex: 'theName',
  1662. key: 'theName',
  1663. }, {
  1664. title: '发布时间',
  1665. dataIndex: 'releaseDateFormattedDate',
  1666. key: 'releaseDateFormattedDate',
  1667. }, {
  1668. title: '有效期限',
  1669. dataIndex: 'validityPeriodFormattedDate',
  1670. key: 'validityPeriodFormattedDate',
  1671. },
  1672. ],
  1673. dataSource: [],
  1674. };
  1675. },
  1676. getTechBrodersList() {
  1677. this.setState({
  1678. loading: true
  1679. });
  1680. $.ajax({
  1681. method: "get",
  1682. dataType: "json",
  1683. crossDomain: false,
  1684. url: globalConfig.context + "/api/admin/audit/techBroders",
  1685. success: function (data) {
  1686. if (!data.data) {
  1687. if (data.error && data.error.length) {
  1688. message.warning(data.error[0].message);
  1689. }
  1690. return;
  1691. };
  1692. let _me = this, theArr = [];
  1693. for (var item in data.data) {
  1694. theArr.push(
  1695. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1696. )
  1697. };
  1698. this.setState({
  1699. techBrodersOption: theArr,
  1700. techBrodersObj: data.data
  1701. });
  1702. }.bind(this),
  1703. }).always(function () {
  1704. this.setState({
  1705. loading: false
  1706. });
  1707. }.bind(this));
  1708. },
  1709. getTableList() {
  1710. this.setState({
  1711. loading: true
  1712. });
  1713. $.ajax({
  1714. method: "get",
  1715. dataType: "json",
  1716. crossDomain: false,
  1717. url: globalConfig.context + "/api/admin/achievement/achievementDemand",
  1718. data: { id: this.props.data.id },
  1719. success: function (data) {
  1720. let theArr = [];
  1721. if (!data.data) {
  1722. if (data.error && data.error.length) {
  1723. message.warning(data.error[0].message);
  1724. };
  1725. } else if (data.data.length) {
  1726. for (let i = 0; i < data.data.length; i++) {
  1727. let thisdata = data.data[i];
  1728. theArr.push({
  1729. key: i,
  1730. id: thisdata.id,
  1731. serialNumber: thisdata.serialNumber,
  1732. dataCategory: thisdata.dataCategory,
  1733. name: thisdata.name,
  1734. keyword: thisdata.keyword,
  1735. demandType: thisdata.demandType,
  1736. theName: thisdata.username || thisdata.unitName,
  1737. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1738. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate,
  1739. coverImg: thisdata.coverImg,
  1740. hot: thisdata.hot,
  1741. internationalFlag:thisdata.internationalFlag,
  1742. });
  1743. };
  1744. };
  1745. this.setState({
  1746. dataSource: theArr,
  1747. });
  1748. }.bind(this),
  1749. }).always(function () {
  1750. this.setState({
  1751. loading: false
  1752. });
  1753. }.bind(this));
  1754. },
  1755. tableRowClick(record, index) {
  1756. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1757. },
  1758. handleCancel(e) {
  1759. this.setState({
  1760. visible: false,
  1761. });
  1762. this.props.closeDesc(false);
  1763. },
  1764. handleOk(e) {
  1765. this.setState({
  1766. visible: false,
  1767. });
  1768. this.props.closeDesc(false, true);
  1769. },
  1770. componentWillMount() {
  1771. this.getTechBrodersList();
  1772. },
  1773. componentWillReceiveProps(nextProps) {
  1774. if (!this.state.visible && nextProps.showDesc) {
  1775. this.state.tabsKey = "1";
  1776. };
  1777. this.state.visible = nextProps.showDesc;
  1778. },
  1779. render() {
  1780. if (this.props.data) {
  1781. return (
  1782. <div className="patent-desc">
  1783. <Modal maskClosable={false} visible={this.state.visible}
  1784. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1785. width='1000px'
  1786. footer=''
  1787. className="admin-desc-content">
  1788. <Spin spinning={this.state.loading}>
  1789. <Tabs activeKey={this.state.tabsKey}
  1790. onChange={(e) => {
  1791. this.setState({ tabsKey: e });
  1792. if (e == "2") {
  1793. this.getTableList();
  1794. };
  1795. }} >
  1796. <Tabs.TabPane tab="成果详情" key="1">
  1797. {(() => {
  1798. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1799. return <AchievementDetailShow
  1800. data={this.props.data}
  1801. detailApiUrl={this.props.detailApiUrl}
  1802. techBrodersOption={this.state.techBrodersOption}
  1803. techBrodersObj={this.state.techBrodersObj}
  1804. closeDesc={this.handleCancel}
  1805. visible={this.state.visible}
  1806. handleOk={this.handleOk} />
  1807. } else {
  1808. return <AchievementDetailForm
  1809. data={this.props.data}
  1810. detailApiUrl={this.props.detailApiUrl}
  1811. achievementCategoryOption={this.props.achievementCategoryOption}
  1812. techBrodersObj={this.state.techBrodersObj}
  1813. closeDesc={this.handleCancel}
  1814. visible={this.state.visible}
  1815. handleOk={this.handleOk} />
  1816. };
  1817. })()}
  1818. </Tabs.TabPane>
  1819. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  1820. <Table columns={this.state.columns}
  1821. dataSource={this.state.dataSource}
  1822. pagination={false}
  1823. onRowClick={this.tableRowClick} />
  1824. </Tabs.TabPane>
  1825. </Tabs>
  1826. </Spin>
  1827. </Modal>
  1828. </div>
  1829. );
  1830. } else {
  1831. return <div></div>
  1832. }
  1833. },
  1834. });
  1835. export default AchievementDetail;