techAchievementDesc.jsx 80 KB

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