techAchievementDesc.jsx 77 KB

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