techAchievementDesc.jsx 75 KB

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