techAchievementDesc.jsx 75 KB

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