techAchievementDesc.jsx 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. import React from 'react';
  2. import { Icon, Tabs, Table, Tooltip, Modal, message, Spin, Upload, Input, InputNumber, Select, DatePicker, Button, Radio, Form, Cascader, Tag } from 'antd';
  3. import moment from 'moment';
  4. import './techAchievement.less';
  5. import ajax from 'jquery/src/ajax/xhr.js';
  6. import $ from 'jquery/src/ajax';
  7. import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
  8. import { beforeUploadFile, splitUrl, getAchievementCategory, getDemandType } from '../../tools.js';
  9. const KeyWordTagGroup = React.createClass({
  10. getInitialState() {
  11. return {
  12. tags: [],
  13. inputVisible: false,
  14. inputValue: ''
  15. };
  16. },
  17. handleClose(removedTag) {
  18. const tags = this.state.tags.filter(tag => tag !== removedTag);
  19. this.props.tagsArr(tags);
  20. this.setState({ tags });
  21. },
  22. showInput() {
  23. this.setState({ inputVisible: true }, () => this.input.focus());
  24. },
  25. handleInputChange(e) {
  26. this.setState({ inputValue: e.target.value });
  27. },
  28. handleInputConfirm() {
  29. const state = this.state;
  30. const inputValue = state.inputValue;
  31. let tags = state.tags;
  32. if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
  33. tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
  34. }
  35. this.props.tagsArr(tags);
  36. this.setState({
  37. tags,
  38. inputVisible: false,
  39. inputValue: '',
  40. });
  41. },
  42. componentWillMount() {
  43. this.state.tags = this.props.keyWordArr;
  44. },
  45. componentWillReceiveProps(nextProps) {
  46. if (this.props.keyWordArr != nextProps.keyWordArr) {
  47. this.state.tags = nextProps.keyWordArr;
  48. };
  49. },
  50. render() {
  51. const { tags, inputVisible, inputValue } = this.state;
  52. return (
  53. <div className="keyWord-tips">
  54. {tags.map((tag, index) => {
  55. const isLongTag = tag.length > 10;
  56. const tagElem = (
  57. <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
  58. {isLongTag ? `${tag.slice(0, 10)}...` : tag}
  59. </Tag>
  60. );
  61. return isLongTag ? <Tooltip title={tag}>{tagElem}</Tooltip> : tagElem;
  62. })}
  63. {inputVisible && (
  64. <Input
  65. ref={input => this.input = input}
  66. type="text"
  67. style={{ width: 78 }}
  68. value={inputValue}
  69. onChange={this.handleInputChange}
  70. onBlur={this.handleInputConfirm}
  71. onPressEnter={this.handleInputConfirm}
  72. />
  73. )}
  74. {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
  75. </div>
  76. );
  77. }
  78. });
  79. const PicturesWall = React.createClass({
  80. getInitialState() {
  81. return {
  82. previewVisible: false,
  83. previewImage: '',
  84. fileList: [],
  85. }
  86. },
  87. handleCancel() {
  88. this.setState({ previewVisible: false })
  89. },
  90. handlePreview(file) {
  91. this.setState({
  92. previewImage: file.url || file.thumbUrl,
  93. previewVisible: true,
  94. });
  95. },
  96. handleChange(info) {
  97. let fileList = info.fileList;
  98. this.setState({ fileList });
  99. this.props.fileList(fileList);
  100. },
  101. componentWillReceiveProps(nextProps) {
  102. this.state.fileList = nextProps.pictureUrl;
  103. },
  104. render() {
  105. const { previewVisible, previewImage, fileList } = this.state;
  106. const uploadButton = (
  107. <div>
  108. <Icon type="plus" />
  109. <div className="ant-upload-text">点击上传</div>
  110. </div>
  111. );
  112. return (
  113. <div className="clearfix">
  114. <Upload
  115. action={globalConfig.context + "/api/user/achievement/uploadPicture"}
  116. data={{ 'sign': this.props.pictureSign }}
  117. listType="picture-card"
  118. fileList={fileList}
  119. onPreview={this.handlePreview}
  120. onChange={this.handleChange} >
  121. {fileList.length >= 5 ? null : uploadButton}
  122. </Upload>
  123. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  124. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  125. </Modal>
  126. </div>
  127. );
  128. }
  129. });
  130. const AchievementDetailShow = Form.create()(React.createClass({
  131. getInitialState() {
  132. return {
  133. visible: false,
  134. loading: false,
  135. textFileList: [],
  136. techPlanFileList: [],
  137. businessPlanFileList: [],
  138. maturityPictureUrl: [],
  139. technicalPictureUrl: [],
  140. tags: []
  141. };
  142. },
  143. loadData(id) {
  144. this.setState({
  145. loading: true
  146. });
  147. $.ajax({
  148. method: "get",
  149. dataType: "json",
  150. crossDomain: false,
  151. url: globalConfig.context + (window.userData.type == "1" ? "/api/user/achievement/orgDetail" : "/api/user/achievement/userDetail"),
  152. data: {
  153. id: id
  154. },
  155. success: function (data) {
  156. let thisData = data.data;
  157. if (!thisData) {
  158. if (data.error && data.error.length) {
  159. message.warning(data.error[0].message);
  160. };
  161. thisData = {};
  162. };
  163. this.setState({
  164. data: thisData,
  165. tags: thisData.keyword ? thisData.keyword.split(",") : [],
  166. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  167. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  168. });
  169. }.bind(this),
  170. }).always(function () {
  171. this.setState({
  172. loading: false
  173. });
  174. }.bind(this));
  175. },
  176. offShelf() {
  177. this.setState({
  178. loading: true
  179. });
  180. $.ajax({
  181. method: "post",
  182. dataType: "json",
  183. crossDomain: false,
  184. url: globalConfig.context + "/api/user/achievement/offShelf",
  185. data: { "id": this.props.data.id }
  186. }).done(function (data) {
  187. this.setState({
  188. loading: false
  189. });
  190. if (!data.error.length) {
  191. message.success('撤销成功!');
  192. this.setState({
  193. visible: false,
  194. releaseSubmitVisible: false
  195. });
  196. this.props.handleOk();
  197. } else {
  198. message.warning(data.error[0].message);
  199. }
  200. }.bind(this));
  201. },
  202. componentWillMount() {
  203. if (this.props.data.id) {
  204. this.loadData(this.props.data.id);
  205. } else {
  206. this.state.data = {};
  207. };
  208. },
  209. componentWillReceiveProps(nextProps) {
  210. if (!this.props.visible && nextProps.visible) {
  211. this.state.textFileList = [];
  212. this.state.techPlanFileList = [];
  213. this.state.businessPlanFileList = [];
  214. if (nextProps.data.id) {
  215. this.loadData(nextProps.data.id);
  216. } else {
  217. this.state.data = {};
  218. this.state.tags = [];
  219. this.state.maturityPictureUrl = [];
  220. this.state.technicalPictureUrl = [];
  221. };
  222. this.props.form.resetFields();
  223. };
  224. },
  225. render() {
  226. const theData = this.state.data || {};
  227. const { getFieldDecorator } = this.props.form;
  228. const FormItem = Form.Item
  229. const formItemLayout = {
  230. labelCol: { span: 8 },
  231. wrapperCol: { span: 14 },
  232. };
  233. return (
  234. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  235. <Spin spinning={this.state.loading}>
  236. <div className="clearfix">
  237. <FormItem className="half-item"
  238. {...formItemLayout}
  239. label="编号" >
  240. <span>{theData.serialNumber}</span>
  241. </FormItem>
  242. <FormItem className="half-item"
  243. {...formItemLayout}
  244. label="名称" >
  245. <span>{theData.name}</span>
  246. </FormItem>
  247. {userData.type ? <FormItem className="half-item"
  248. {...formItemLayout}
  249. label="联系人" >
  250. <span>{this.props.contactsObj[theData.contacts]}</span>
  251. </FormItem> : <div></div>}
  252. <FormItem className="half-item"
  253. {...formItemLayout}
  254. label="数据类别" >
  255. {(() => {
  256. switch (theData.dataCategory) {
  257. case "0":
  258. return <span>成果</span>;
  259. case "1":
  260. return <span>技术</span>;
  261. case "2":
  262. return <span>项目</span>;
  263. }
  264. })()}
  265. </FormItem>
  266. <FormItem className="half-item"
  267. {...formItemLayout}
  268. label="类型" >
  269. <span>{getAchievementCategory(theData.category)}</span>
  270. </FormItem>
  271. </div>
  272. <div className="clearfix">
  273. <FormItem className="half-item"
  274. {...formItemLayout}
  275. label="是否发布" >
  276. {(() => {
  277. switch (theData.releaseStatus) {
  278. case "0":
  279. return <span>未发布</span>;
  280. case "1":
  281. return <div>
  282. <span>已发布</span>
  283. <Button style={{ marginLeft: '10px' }} onClick={() => { this.setState({ releaseSubmitVisible: true }); }}>撤消发布</Button>
  284. <Modal maskClosable={false} title="确认"
  285. visible={this.state.releaseSubmitVisible}
  286. width='300px'
  287. footer={null}
  288. onCancel={() => { this.setState({ releaseSubmitVisible: false }) }} >
  289. <span>确认要撤销发布吗?</span>
  290. <Button className="modal-submit" type="primary" onClick={this.offShelf} >确认</Button>
  291. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ releaseSubmitVisible: false }) }}>取消</Button>
  292. </Modal>
  293. </div>;
  294. }
  295. })()}
  296. </FormItem>
  297. <FormItem className="half-item"
  298. {...formItemLayout}
  299. label="发布时间" >
  300. <span>{theData.releaseDateFormattedDate}</span>
  301. </FormItem>
  302. <FormItem className="half-item"
  303. {...formItemLayout}
  304. label="审核状态" >
  305. {(() => {
  306. switch (theData.auditStatus) {
  307. case "0":
  308. return <span>未提交审核(草稿)</span>;
  309. case "1":
  310. return <span>提交审核</span>;
  311. case "2":
  312. return <span>审核中</span>;
  313. case "3":
  314. return <span>审核通过</span>;
  315. case "4":
  316. return <span>审核未通过</span>;
  317. }
  318. })()}
  319. </FormItem>
  320. </div>
  321. <FormItem
  322. labelCol={{ span: 4 }}
  323. wrapperCol={{ span: 18 }}
  324. label="关键词" >
  325. {this.state.tags.map((tag) => {
  326. return <Tooltip key={tag} title={tag}>
  327. <Tag key={tag}>{tag}</Tag>
  328. </Tooltip>;
  329. })}
  330. </FormItem>
  331. <FormItem
  332. labelCol={{ span: 4 }}
  333. wrapperCol={{ span: 18 }}
  334. label="摘要" >
  335. <span>{theData.summary}</span>
  336. </FormItem>
  337. <FormItem
  338. labelCol={{ span: 4 }}
  339. wrapperCol={{ span: 18 }}
  340. label="成果简介" >
  341. <span>{theData.introduction}</span>
  342. </FormItem>
  343. <FormItem
  344. labelCol={{ span: 4 }}
  345. wrapperCol={{ span: 18 }}
  346. label="技术图片" >
  347. <div className="clearfix">
  348. <Upload className="demandDetailShow-upload"
  349. listType="picture-card"
  350. fileList={this.state.technicalPictureUrl}
  351. onPreview={(file) => {
  352. this.setState({
  353. previewImage: file.url || file.thumbUrl,
  354. previewVisible: true,
  355. });
  356. }} >
  357. </Upload>
  358. <Modal maskClosable={false} footer={null}
  359. visible={this.state.previewVisible}
  360. onCancel={() => { this.setState({ previewVisible: false }) }}>
  361. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  362. </Modal>
  363. </div>
  364. </FormItem>
  365. <FormItem
  366. labelCol={{ span: 4 }}
  367. wrapperCol={{ span: 18 }}
  368. label="应用领域" >
  369. <span>{getIndustryCategory(theData.fieldA, theData.fieldB)}</span>
  370. </FormItem>
  371. <div className="clearfix">
  372. <FormItem className="half-item"
  373. {...formItemLayout}
  374. label="成熟度" >
  375. {(() => {
  376. switch (theData.maturity) {
  377. case "0":
  378. return <span>正在研发</span>;
  379. case "1":
  380. return <span>已有样品</span>;
  381. case "2":
  382. return <span>通过小试</span>;
  383. case "3":
  384. return <span>通过中试</span>;
  385. case "4":
  386. return <span>可以量产</span>;
  387. }
  388. })()}
  389. </FormItem>
  390. <FormItem className="half-item"
  391. {...formItemLayout}
  392. label="创新度" >
  393. {(() => {
  394. switch (theData.innovation) {
  395. case "0":
  396. return <span>行业先进</span>;
  397. case "1":
  398. return <span>行业领先</span>;
  399. case "2":
  400. return <span>国内先进</span>;
  401. case "3":
  402. return <span>国内领先</span>;
  403. case "4":
  404. return <span>国际先进</span>;
  405. case "5":
  406. return <span>国际领先</span>;
  407. }
  408. })()}
  409. </FormItem>
  410. </div>
  411. <FormItem
  412. labelCol={{ span: 4 }}
  413. wrapperCol={{ span: 18 }}
  414. label="成熟度证明材料(图片)" >
  415. <Upload className="demandDetailShow-upload"
  416. listType="picture-card"
  417. fileList={this.state.maturityPictureUrl}
  418. onPreview={(file) => {
  419. this.setState({
  420. previewImage: file.url || file.thumbUrl,
  421. previewVisible: true,
  422. });
  423. }} >
  424. </Upload>
  425. </FormItem>
  426. <FormItem
  427. labelCol={{ span: 4 }}
  428. wrapperCol={{ span: 6 }}
  429. label="成熟度证明材料(文本)" >
  430. <p>{theData.maturityTextFileUrl ?
  431. <span className="download-file">
  432. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  433. </span>
  434. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  435. </FormItem>
  436. <FormItem
  437. labelCol={{ span: 4 }}
  438. wrapperCol={{ span: 18 }}
  439. label="成熟度证明材料(视频地址)" >
  440. <span>{theData.maturityVideoUrl}</span>
  441. </FormItem>
  442. <div className="clearfix" >
  443. <FormItem className="half-item"
  444. {...formItemLayout}
  445. label="成果所有人名称" >
  446. <span>{theData.iOwnerName || theData.ownerName}</span>
  447. </FormItem>
  448. <FormItem className="half-item"
  449. {...formItemLayout}
  450. label="所有人证件号" >
  451. <span>{theData.iOwnerIdNumber || theData.ownerIdNumber}</span>
  452. </FormItem>
  453. <FormItem className="half-item"
  454. {...formItemLayout}
  455. label="所有人联系电话" >
  456. <span>{theData.iOwnerMobile || theData.ownerMobile}</span>
  457. </FormItem>
  458. <FormItem className="half-item"
  459. {...formItemLayout}
  460. label="所有人电子邮箱" >
  461. <span>{theData.iOwnerEmail || theData.ownerEmail}</span>
  462. </FormItem>
  463. <FormItem className="half-item"
  464. {...formItemLayout}
  465. label="所有人通信地址" >
  466. <span>{theData.iOwnerPostalAddress || theData.ownerPostalAddress}</span>
  467. </FormItem>
  468. </div>
  469. <div className="clearfix">
  470. <FormItem className="half-item"
  471. {...formItemLayout}
  472. label="所有人类型" >
  473. {(() => {
  474. switch (theData.ownerType) {
  475. case "0":
  476. return <span>个人</span>;
  477. case "1":
  478. return <span>组织</span>;
  479. }
  480. })()}
  481. </FormItem>
  482. </div>
  483. {theData.ownerType == "9" ? <div className="clearfix">
  484. <FormItem className="half-item"
  485. {...formItemLayout}
  486. label="所属组织名称" >
  487. <span>{theData.orgName}</span>
  488. </FormItem>
  489. <FormItem className="half-item"
  490. {...formItemLayout}
  491. label="所属组织地址" >
  492. <span>{theData.orgAddress}</span>
  493. </FormItem>
  494. <FormItem className="half-item"
  495. {...formItemLayout}
  496. label="所属组织邮箱" >
  497. <span>{theData.orgEmail}</span>
  498. </FormItem>
  499. <FormItem className="half-item"
  500. {...formItemLayout}
  501. label="所属组织联系人名称" >
  502. <span>{theData.orgContacts}</span>
  503. </FormItem>
  504. <FormItem className="half-item"
  505. {...formItemLayout}
  506. label="所属组织联系人电话" >
  507. <span>{theData.orgContactsMobile}</span>
  508. </FormItem>
  509. </div> : <div></div>}
  510. <div className="clearfix">
  511. <FormItem className="half-item"
  512. {...formItemLayout}
  513. label="合作方式" >
  514. {(() => {
  515. switch (theData.cooperationMode) {
  516. case "0":
  517. return <span>技术转让</span>;
  518. case "1":
  519. return <span>授权生产</span>;
  520. }
  521. })()}
  522. </FormItem>
  523. <FormItem className="half-item"
  524. {...formItemLayout}
  525. label="转让方式" >
  526. {(() => {
  527. switch (theData.transferMode) {
  528. case "0":
  529. return <span>完全转让</span>;
  530. case "1":
  531. return <span>许可转让</span>;
  532. case "2":
  533. return <span>技术入股</span>;
  534. }
  535. })()}
  536. </FormItem>
  537. </div>
  538. <div className="clearfix">
  539. {theData.bargainingMode == 1 ? <FormItem className="half-item"
  540. {...formItemLayout}
  541. label="转让价格" >
  542. <span>{theData.transferPrice} 万元</span>
  543. </FormItem> : <FormItem className="half-item"
  544. {...formItemLayout}
  545. label="转让价格" >
  546. <span>面议</span>
  547. </FormItem>}
  548. </div>
  549. <FormItem
  550. labelCol={{ span: 4 }}
  551. wrapperCol={{ span: 18 }}
  552. label="技术场景" >
  553. <span>{theData.technicalScene}</span>
  554. </FormItem>
  555. <FormItem
  556. labelCol={{ span: 4 }}
  557. wrapperCol={{ span: 18 }}
  558. label="技术突破" >
  559. <span>{theData.breakthrough}</span>
  560. </FormItem>
  561. <FormItem
  562. labelCol={{ span: 4 }}
  563. wrapperCol={{ span: 18 }}
  564. label="专利情况" >
  565. <span>{theData.patentCase}</span>
  566. </FormItem>
  567. <FormItem
  568. labelCol={{ span: 4 }}
  569. wrapperCol={{ span: 18 }}
  570. label="获奖情况" >
  571. <span>{theData.awards}</span>
  572. </FormItem>
  573. <FormItem
  574. labelCol={{ span: 4 }}
  575. wrapperCol={{ span: 18 }}
  576. label="技术团队情况" >
  577. <span>{theData.teamDes}</span>
  578. </FormItem>
  579. <FormItem
  580. labelCol={{ span: 4 }}
  581. wrapperCol={{ span: 18 }}
  582. label="技术参数" >
  583. <span>{theData.parameter}</span>
  584. </FormItem>
  585. <FormItem
  586. labelCol={{ span: 4 }}
  587. wrapperCol={{ span: 6 }}
  588. label="技术方案" >
  589. <p>{theData.techPlanUrl ?
  590. <span className="download-file">
  591. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  592. </span>
  593. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  594. </FormItem>
  595. <FormItem
  596. labelCol={{ span: 4 }}
  597. wrapperCol={{ span: 6 }}
  598. label="商业计划书" >
  599. <p>{theData.businessPlanUrl ?
  600. <span className="download-file">
  601. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  602. </span>
  603. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  604. </FormItem>
  605. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  606. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  607. </FormItem>
  608. </Spin>
  609. </Form >
  610. )
  611. }
  612. }));
  613. const AchievementDetailForm = Form.create()(React.createClass({
  614. getInitialState() {
  615. return {
  616. visible: false,
  617. loading: false,
  618. auditStatus: 0,
  619. textFileList: [],
  620. techPlanFileList: [],
  621. businessPlanFileList: [],
  622. maturityPictureUrl: [],
  623. technicalPictureUrl: [],
  624. tags: []
  625. };
  626. },
  627. loadData(id) {
  628. this.setState({
  629. loading: true
  630. });
  631. $.ajax({
  632. method: "get",
  633. dataType: "json",
  634. crossDomain: false,
  635. url: globalConfig.context + (window.userData.type == "1" ? "/api/user/achievement/orgDetail" : "/api/user/achievement/userDetail"),
  636. data: {
  637. id: id
  638. },
  639. success: function (data) {
  640. let thisData = data.data;
  641. if (!thisData) {
  642. if (data.error && data.error.length) {
  643. message.warning(data.error[0].message);
  644. };
  645. thisData = {};
  646. };
  647. this.setState({
  648. data: thisData,
  649. orgDisplay: thisData.ownerType,
  650. transferPriceDis: thisData.transferMode == 1 ? true : false,
  651. tags: thisData.keyword ? thisData.keyword.split(",") : [],
  652. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  653. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  654. });
  655. }.bind(this),
  656. }).always(function () {
  657. this.setState({
  658. loading: false
  659. });
  660. }.bind(this));
  661. },
  662. getTagsArr(e) {
  663. this.setState({ tags: e });
  664. },
  665. getMaturityPictureUrl(e) {
  666. this.setState({ maturityPictureUrl: e });
  667. },
  668. getTechnicalPictureUrl(e) {
  669. this.setState({ technicalPictureUrl: e });
  670. },
  671. handleSubmit(e) {
  672. e.preventDefault();
  673. this.props.form.validateFields((err, values) => {
  674. //keyword长度判断
  675. if (this.state.tags.length < 3) {
  676. message.warning('关键词数量不能小于3个!');
  677. return;
  678. };
  679. //url转化
  680. let theTechnicalPictureUrl = [];
  681. if (this.state.technicalPictureUrl.length) {
  682. let picArr = [];
  683. this.state.technicalPictureUrl.map(function (item) {
  684. picArr.push(item.response.data);
  685. });
  686. theTechnicalPictureUrl = picArr.join(",");
  687. };
  688. let theMaturityPictureUrl = [];
  689. if (this.state.maturityPictureUrl.length) {
  690. let picArr = [];
  691. this.state.maturityPictureUrl.map(function (item) {
  692. picArr.push(item.response.data);
  693. });
  694. theMaturityPictureUrl = picArr.join(",");
  695. };
  696. if (!err) {
  697. this.setState({
  698. loading: true
  699. });
  700. $.ajax({
  701. method: "POST",
  702. dataType: "json",
  703. crossDomain: false,
  704. url: this.props.data.id ? globalConfig.context + '/api/user/achievement/update' : globalConfig.context + '/api/user/achievement/apply',
  705. data: {
  706. id: this.props.data.id,
  707. dataCategory: values.dataCategory,
  708. serialNumber: this.props.data.serialNumber,
  709. name: values.name,
  710. contacts: values.contacts,
  711. keyword: this.state.tags ? this.state.tags.join(",") : [],
  712. keywords: this.state.tags,
  713. category: values.category,
  714. summary: values.summary,
  715. introduction: values.introduction,
  716. technicalPictureUrl: theTechnicalPictureUrl,
  717. fieldA: values.field ? values.field[0] : undefined,
  718. fieldB: values.field ? values.field[1] : undefined,
  719. maturity: values.maturity,
  720. maturityPictureUrl: theMaturityPictureUrl,
  721. maturityTextFileUrl: this.state.maturityTextFileUrl,
  722. maturityVideoUrl: values.maturityVideoUrl,
  723. innovation: values.innovation,
  724. cooperationMode: values.cooperationMode,
  725. transferMode: values.transferMode,
  726. bargainingMode: values.bargainingMode,
  727. transferPrice: values.transferPrice,
  728. technicalScene: values.technicalScene,
  729. breakthrough: values.breakthrough,
  730. patentCase: values.patentCase,
  731. awards: values.awards,
  732. teamDes: values.teamDes,
  733. parameter: values.parameter,
  734. releaseStatus: values.releaseStatus,
  735. techPlanUrl: this.state.techPlanUrl,
  736. businessPlanUrl: this.state.businessPlanUrl,
  737. auditStatus: this.state.auditStatus,
  738. ownerType: window.userData.type // 所有人类型
  739. }
  740. }).done(function (data) {
  741. this.state.auditStatus = 0;
  742. this.setState({
  743. loading: false
  744. });
  745. if (!data.error.length) {
  746. message.success('保存成功!');
  747. this.props.handleOk();
  748. } else {
  749. message.warning(data.error[0].message);
  750. }
  751. }.bind(this));
  752. }
  753. });
  754. },
  755. componentWillMount() {
  756. if (this.props.data.id) {
  757. this.loadData(this.props.data.id);
  758. } else {
  759. this.state.data = {};
  760. };
  761. },
  762. componentWillReceiveProps(nextProps) {
  763. if (!this.props.visible && nextProps.visible) {
  764. this.state.textFileList = [];
  765. this.state.techPlanFileList = [];
  766. this.state.businessPlanFileList = [];
  767. if (nextProps.data.id) {
  768. this.loadData(nextProps.data.id);
  769. } else {
  770. this.state.data = {};
  771. this.state.tags = [];
  772. this.state.maturityPictureUrl = [];
  773. this.state.technicalPictureUrl = [];
  774. };
  775. this.props.form.resetFields();
  776. };
  777. },
  778. render() {
  779. const theData = this.state.data || {};
  780. const { getFieldDecorator } = this.props.form;
  781. const FormItem = Form.Item
  782. const formItemLayout = {
  783. labelCol: { span: 8 },
  784. wrapperCol: { span: 14 },
  785. };
  786. return (
  787. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  788. <Spin spinning={this.state.loading}>
  789. <div className="clearfix">
  790. <FormItem className="half-item"
  791. {...formItemLayout}
  792. label="编号" >
  793. <span>{theData.serialNumber}</span>
  794. </FormItem>
  795. <FormItem className="half-item"
  796. {...formItemLayout}
  797. label="名称" >
  798. {getFieldDecorator('name', {
  799. rules: [{ required: true, message: '此项为必填项!' }],
  800. initialValue: theData.name
  801. })(
  802. <Input />
  803. )}
  804. </FormItem>
  805. {userData.type ?
  806. <FormItem className="half-item"
  807. {...formItemLayout}
  808. label="联系人" >
  809. {getFieldDecorator('contacts', {
  810. rules: [{ required: true, message: '此项为必填项!' }],
  811. initialValue: theData.contacts
  812. })(
  813. <Select placeholder="选择联系人" style={{ width: 260 }} >
  814. {this.props.contactsOption}
  815. </Select>
  816. )}
  817. </FormItem> : <div></div>}
  818. <FormItem className="half-item"
  819. {...formItemLayout}
  820. label="数据类别" >
  821. {getFieldDecorator('dataCategory', {
  822. rules: [{ required: true, message: '此项为必填项!' }],
  823. initialValue: theData.dataCategory
  824. })(
  825. <Select placeholder="选择数据类型" style={{ width: 160 }} >
  826. <Select.Option value="0" >成果</Select.Option>
  827. <Select.Option value="1" >技术</Select.Option>
  828. <Select.Option value="2" >项目</Select.Option>
  829. </Select>
  830. )}
  831. </FormItem>
  832. <FormItem className="half-item"
  833. {...formItemLayout}
  834. label="类型" >
  835. {getFieldDecorator('category', {
  836. rules: [{ required: true, message: '此项为必填项!' }],
  837. initialValue: theData.category
  838. })(
  839. <Select style={{ width: 160 }} placeholder="请选择成果类型">
  840. {this.props.achievementCategoryOption}
  841. </Select>
  842. )}
  843. </FormItem>
  844. <div className="clearfix">
  845. <FormItem className="half-item"
  846. {...formItemLayout}
  847. label="是否发布" >
  848. {(() => {
  849. switch (theData.releaseStatus) {
  850. case "0":
  851. return <span>未发布</span>;
  852. case "1":
  853. return <span>已发布</span>;
  854. }
  855. })()}
  856. </FormItem>
  857. <FormItem className="half-item"
  858. {...formItemLayout}
  859. label="发布时间" >
  860. <span>{theData.releaseDateFormattedDate}</span>
  861. </FormItem>
  862. <FormItem className="half-item"
  863. {...formItemLayout}
  864. label="审核状态" >
  865. {(() => {
  866. switch (theData.auditStatus) {
  867. case "0":
  868. return <span>未提交审核(草稿)</span>;
  869. case "1":
  870. return <span>提交审核</span>;
  871. case "2":
  872. return <span>审核中</span>;
  873. case "3":
  874. return <span>审核通过</span>;
  875. case "4":
  876. return <span>审核未通过</span>;
  877. }
  878. })()}
  879. </FormItem>
  880. </div>
  881. </div>
  882. <FormItem
  883. labelCol={{ span: 4 }}
  884. wrapperCol={{ span: 18 }}
  885. label="关键词" >
  886. <KeyWordTagGroup
  887. keyWordArr={this.state.tags}
  888. tagsArr={this.getTagsArr}
  889. visible={this.props.visible} />
  890. </FormItem>
  891. <FormItem
  892. labelCol={{ span: 4 }}
  893. wrapperCol={{ span: 18 }}
  894. label="摘要" >
  895. {getFieldDecorator('summary', {
  896. initialValue: theData.summary
  897. })(
  898. <Input type="textarea" rows={4} />
  899. )}
  900. </FormItem>
  901. <FormItem
  902. labelCol={{ span: 4 }}
  903. wrapperCol={{ span: 18 }}
  904. label="成果简介" >
  905. {getFieldDecorator('introduction', {
  906. initialValue: theData.introduction
  907. })(
  908. <Input type="textarea" rows={4} placeholder="项目成果简介;项目核心创新点;项目详细用途;预期效益说明;主要技术(性能)指标;市场前景;应用范围;发展历程。" />
  909. )}
  910. </FormItem>
  911. <FormItem
  912. labelCol={{ span: 4 }}
  913. wrapperCol={{ span: 18 }}
  914. label="技术图片" >
  915. <PicturesWall
  916. pictureSign="achievement_technical_picture"
  917. fileList={this.getTechnicalPictureUrl}
  918. pictureUrl={this.state.technicalPictureUrl} />
  919. <p>图片建议:专利证书或专利申请书图片、技术图纸、样品图片、技术相关网络图片;成熟度处于非研发阶段的项目,必须上传样品图片,如未上传,成熟度将视为处在研发阶段。</p>
  920. </FormItem>
  921. <FormItem
  922. labelCol={{ span: 4 }}
  923. wrapperCol={{ span: 18 }}
  924. label="应用领域" >
  925. {getFieldDecorator('field', {
  926. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  927. initialValue: [theData.fieldA, theData.fieldB]
  928. })(
  929. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="应用领域" />
  930. )}
  931. </FormItem>
  932. <div className="clearfix">
  933. <FormItem className="half-item"
  934. {...formItemLayout}
  935. label="成熟度" >
  936. {getFieldDecorator('maturity', {
  937. initialValue: theData.maturity
  938. })(
  939. <Select placeholder="选择成熟度" style={{ width: 160 }} >
  940. <Select.Option value="0" >正在研发</Select.Option>
  941. <Select.Option value="1" >已有样品</Select.Option>
  942. <Select.Option value="2" >通过小试</Select.Option>
  943. <Select.Option value="3" >通过中试</Select.Option>
  944. <Select.Option value="4" >可以量产</Select.Option>
  945. </Select>
  946. )}
  947. </FormItem>
  948. <FormItem className="half-item"
  949. {...formItemLayout}
  950. label="创新度" >
  951. {getFieldDecorator('innovation', {
  952. initialValue: theData.innovation
  953. })(
  954. <Select placeholder="选择创新度" style={{ width: 160 }} >
  955. <Select.Option value="0" >行业先进</Select.Option>
  956. <Select.Option value="1" >行业领先</Select.Option>
  957. <Select.Option value="2" >国内先进</Select.Option>
  958. <Select.Option value="3" >国内领先</Select.Option>
  959. <Select.Option value="4" >国际先进</Select.Option>
  960. <Select.Option value="5" >国际领先</Select.Option>
  961. </Select>
  962. )}
  963. </FormItem>
  964. </div>
  965. <FormItem
  966. labelCol={{ span: 4 }}
  967. wrapperCol={{ span: 18 }}
  968. label="成熟度证明材料(图片)" >
  969. <PicturesWall
  970. pictureSign="achievement_maturity_picture"
  971. fileList={this.getMaturityPictureUrl}
  972. pictureUrl={this.state.maturityPictureUrl} />
  973. </FormItem>
  974. <FormItem
  975. labelCol={{ span: 4 }}
  976. wrapperCol={{ span: 6 }}
  977. label="成熟度证明材料(文本)" >
  978. <Upload
  979. name="ratepay"
  980. action={globalConfig.context + "/api/user/achievement/uploadTextFile"}
  981. data={{ 'sign': 'achievement_maturity_text_file' }}
  982. beforeUpload={beforeUploadFile}
  983. fileList={this.state.textFileList}
  984. onChange={(info) => {
  985. if (info.file.status !== 'uploading') {
  986. console.log(info.file, info.fileList);
  987. }
  988. if (info.file.status === 'done') {
  989. if (!info.file.response.error.length) {
  990. message.success(`${info.file.name} 文件上传成功!`);
  991. } else {
  992. message.warning(info.file.response.error[0].message);
  993. return;
  994. };
  995. this.state.maturityTextFileUrl = info.file.response.data;
  996. } else if (info.file.status === 'error') {
  997. message.error(`${info.file.name} 文件上传失败。`);
  998. };
  999. this.setState({ textFileList: info.fileList.slice(-1) });
  1000. }} >
  1001. <Button><Icon type="upload" /> 上传成熟度证明文本 </Button>
  1002. </Upload>
  1003. <p style={{ marginTop: '10px' }}>{theData.maturityTextFileUrl ?
  1004. <span className="download-file">
  1005. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  1006. </span>
  1007. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1008. </FormItem>
  1009. <FormItem
  1010. labelCol={{ span: 4 }}
  1011. wrapperCol={{ span: 18 }}
  1012. label="成熟度证明材料(视频地址)" >
  1013. {getFieldDecorator('maturityVideoUrl', {
  1014. initialValue: theData.maturityVideoUrl
  1015. })(
  1016. <Input />
  1017. )}
  1018. </FormItem>
  1019. <div className="clearfix">
  1020. <FormItem className="half-item"
  1021. {...formItemLayout}
  1022. label="合作方式" >
  1023. {getFieldDecorator('cooperationMode', {
  1024. rules: [{ required: true, message: '此项为必填项!' }],
  1025. initialValue: theData.cooperationMode
  1026. })(
  1027. <Radio.Group>
  1028. <Radio value="0">技术转让</Radio>
  1029. <Radio value="1">授权生产</Radio>
  1030. </Radio.Group>
  1031. )}
  1032. </FormItem>
  1033. <FormItem className="half-item"
  1034. {...formItemLayout}
  1035. label="转让方式" >
  1036. {getFieldDecorator('transferMode', {
  1037. initialValue: theData.transferMode
  1038. })(
  1039. <Select placeholder="选择转让方式" style={{ width: 160 }} >
  1040. <Select.Option value="0" >完全转让</Select.Option>
  1041. <Select.Option value="1" >许可转让</Select.Option>
  1042. <Select.Option value="2" >技术入股</Select.Option>
  1043. </Select>
  1044. )}
  1045. </FormItem>
  1046. </div>
  1047. <div className="clearfix">
  1048. <FormItem className="half-item"
  1049. {...formItemLayout}
  1050. label="议价方式" >
  1051. {getFieldDecorator('bargainingMode', {
  1052. initialValue: theData.bargainingMode
  1053. })(
  1054. <Radio.Group onChange={((e) => { this.setState({ transferPriceDis: (e.target.value == 1 ? true : false) }) })}>
  1055. <Radio value="0">面议</Radio>
  1056. <Radio value="1">定价</Radio>
  1057. </Radio.Group>
  1058. )}
  1059. </FormItem>
  1060. {this.state.transferPriceDis ? <FormItem className="half-item"
  1061. {...formItemLayout}
  1062. label="转让价格" >
  1063. {getFieldDecorator('transferPrice', {
  1064. initialValue: theData.transferPrice
  1065. })(
  1066. <InputNumber min={0} max={999999} step={0.01} />
  1067. )}
  1068. <span style={{ marginLeft: '20px' }}>万元</span>
  1069. </FormItem> : <div></div>}
  1070. </div>
  1071. <FormItem
  1072. labelCol={{ span: 4 }}
  1073. wrapperCol={{ span: 18 }}
  1074. label="技术场景" >
  1075. {getFieldDecorator('technicalScene', {
  1076. initialValue: theData.technicalScene
  1077. })(
  1078. <Input type="textarea" rows={2} placeholder="说明解决了什么问题。" />
  1079. )}
  1080. </FormItem>
  1081. <FormItem
  1082. labelCol={{ span: 4 }}
  1083. wrapperCol={{ span: 18 }}
  1084. label="技术突破" >
  1085. {getFieldDecorator('breakthrough', {
  1086. initialValue: theData.breakthrough
  1087. })(
  1088. <Input type="textarea" rows={2} placeholder="说明该技术成果突破性的研究。" />
  1089. )}
  1090. </FormItem>
  1091. <FormItem
  1092. labelCol={{ span: 4 }}
  1093. wrapperCol={{ span: 18 }}
  1094. label="专利情况" >
  1095. {getFieldDecorator('patentCase', {
  1096. initialValue: theData.patentCase
  1097. })(
  1098. <Input type="textarea" rows={2} placeholder="一个“技术”可能由多个专利构成,需要说明技术-专利的关系。" />
  1099. )}
  1100. </FormItem>
  1101. <FormItem
  1102. labelCol={{ span: 4 }}
  1103. wrapperCol={{ span: 18 }}
  1104. label="获奖情况" >
  1105. {getFieldDecorator('awards', {
  1106. initialValue: theData.awards
  1107. })(
  1108. <Input type="textarea" rows={2} placeholder="一个“技术”可能存在社会奖励情况,需要说明社会奖励情况。" />
  1109. )}
  1110. </FormItem>
  1111. <FormItem
  1112. labelCol={{ span: 4 }}
  1113. wrapperCol={{ span: 18 }}
  1114. label="技术团队情况" >
  1115. {getFieldDecorator('teamDes', {
  1116. initialValue: theData.teamDes
  1117. })(
  1118. <Input type="textarea" rows={2} placeholder="一个“技术”、“项目”可能存在团队,需要说明团队情况。" />
  1119. )}
  1120. </FormItem>
  1121. <FormItem
  1122. labelCol={{ span: 4 }}
  1123. wrapperCol={{ span: 18 }}
  1124. label="技术参数" >
  1125. {getFieldDecorator('parameter', {
  1126. initialValue: theData.parameter
  1127. })(
  1128. <Input type="textarea" rows={2} placeholder="描述技术参数信息" />
  1129. )}
  1130. </FormItem>
  1131. <FormItem
  1132. labelCol={{ span: 4 }}
  1133. wrapperCol={{ span: 6 }}
  1134. label="技术方案" >
  1135. <Upload
  1136. name="ratepay"
  1137. action={globalConfig.context + "/api/user/achievement/uploadTextFile"}
  1138. data={{ 'sign': 'achievement_tech_plan' }}
  1139. beforeUpload={beforeUploadFile}
  1140. fileList={this.state.techPlanFileList}
  1141. onChange={(info) => {
  1142. if (info.file.status !== 'uploading') {
  1143. console.log(info.file, info.fileList);
  1144. }
  1145. if (info.file.status === 'done') {
  1146. if (!info.file.response.error.length) {
  1147. message.success(`${info.file.name} 文件上传成功!`);
  1148. } else {
  1149. message.warning(info.file.response.error[0].message);
  1150. return;
  1151. };
  1152. this.state.techPlanUrl = info.file.response.data;
  1153. } else if (info.file.status === 'error') {
  1154. message.error(`${info.file.name} 文件上传失败。`);
  1155. };
  1156. this.setState({ techPlanFileList: info.fileList.slice(-1) });
  1157. }} >
  1158. <Button><Icon type="upload" /> 上传技术方案文件 </Button>
  1159. </Upload>
  1160. <p style={{ marginTop: '10px' }}>{theData.techPlanUrl ?
  1161. <span className="download-file">
  1162. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  1163. </span>
  1164. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1165. </FormItem>
  1166. <FormItem
  1167. labelCol={{ span: 4 }}
  1168. wrapperCol={{ span: 6 }}
  1169. label="商业计划书" >
  1170. <Upload
  1171. name="ratepay"
  1172. action={globalConfig.context + "/api/user/achievement/uploadTextFile"}
  1173. data={{ 'sign': 'achievement_business_plan' }}
  1174. beforeUpload={beforeUploadFile}
  1175. fileList={this.state.businessPlanFileList}
  1176. onChange={(info) => {
  1177. if (info.file.status !== 'uploading') {
  1178. console.log(info.file, info.fileList);
  1179. }
  1180. if (info.file.status === 'done') {
  1181. if (!info.file.response.error.length) {
  1182. message.success(`${info.file.name} 文件上传成功!`);
  1183. } else {
  1184. message.warning(info.file.response.error[0].message);
  1185. return;
  1186. };
  1187. this.state.businessPlanUrl = info.file.response.data;
  1188. } else if (info.file.status === 'error') {
  1189. message.error(`${info.file.name} 文件上传失败。`);
  1190. };
  1191. this.setState({ businessPlanFileList: info.fileList.slice(-1) });
  1192. }} >
  1193. <Button><Icon type="upload" /> 上传商业计划书文件 </Button>
  1194. </Upload>
  1195. <p style={{ marginTop: '10px' }}>{theData.businessPlanUrl ?
  1196. <span className="download-file">
  1197. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  1198. </span>
  1199. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1200. </FormItem>
  1201. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1202. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1203. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1204. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1205. </FormItem>
  1206. </Spin>
  1207. </Form >
  1208. )
  1209. }
  1210. }));
  1211. const AchievementDetail = React.createClass({
  1212. getInitialState() {
  1213. return {
  1214. visible: false,
  1215. tabsKey: 1,
  1216. contactsObj: {},
  1217. columns: [
  1218. {
  1219. title: '编号',
  1220. dataIndex: 'serialNumber',
  1221. key: 'serialNumber',
  1222. }, {
  1223. title: '名称',
  1224. dataIndex: 'name',
  1225. key: 'name',
  1226. }, {
  1227. title: '关键字',
  1228. dataIndex: 'keyword',
  1229. key: 'keyword',
  1230. }, {
  1231. title: '类型',
  1232. dataIndex: 'demandType',
  1233. key: 'demandType',
  1234. render: text => { return getDemandType(text); }
  1235. }, {
  1236. title: '所有人名称',
  1237. dataIndex: 'theName',
  1238. key: 'theName',
  1239. }, {
  1240. title: '发布时间',
  1241. dataIndex: 'releaseDateFormattedDate',
  1242. key: 'releaseDateFormattedDate',
  1243. }, {
  1244. title: '有效期限',
  1245. dataIndex: 'validityPeriodFormattedDate',
  1246. key: 'validityPeriodFormattedDate',
  1247. },
  1248. ],
  1249. dataSource: [],
  1250. };
  1251. },
  1252. getTableList() {
  1253. this.setState({
  1254. loading: true
  1255. });
  1256. $.ajax({
  1257. method: "get",
  1258. dataType: "json",
  1259. crossDomain: false,
  1260. url: globalConfig.context + "/api/user/achievement/achievementDemand",
  1261. data: { id: this.props.data.id },
  1262. success: function (data) {
  1263. let theArr = [];
  1264. if (!data.data) {
  1265. if (data.error && data.error.length) {
  1266. message.warning(data.error[0].message);
  1267. };
  1268. } else if (data.data.length) {
  1269. for (let i = 0; i < data.data.length; i++) {
  1270. let thisdata = data.data[i];
  1271. theArr.push({
  1272. key: i,
  1273. id: thisdata.id,
  1274. serialNumber: thisdata.serialNumber,
  1275. dataCategory: thisdata.dataCategory,
  1276. name: thisdata.name,
  1277. keyword: thisdata.keyword,
  1278. demandType: thisdata.demandType,
  1279. theName: thisdata.username || thisdata.unitName,
  1280. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1281. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate
  1282. });
  1283. };
  1284. };
  1285. this.setState({
  1286. dataSource: theArr,
  1287. });
  1288. }.bind(this),
  1289. }).always(function () {
  1290. this.setState({
  1291. loading: false
  1292. });
  1293. }.bind(this));
  1294. },
  1295. tableRowClick(record, index) {
  1296. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1297. },
  1298. showModal() {
  1299. this.setState({
  1300. visible: true,
  1301. });
  1302. },
  1303. handleCancel(e) {
  1304. this.setState({
  1305. visible: false,
  1306. });
  1307. this.props.closeDesc(false);
  1308. },
  1309. handleOk(e) {
  1310. this.setState({
  1311. visible: false,
  1312. });
  1313. this.props.closeDesc(false, true);
  1314. },
  1315. componentWillMount() {
  1316. this.getContactsOption();
  1317. },
  1318. getContactsOption() {
  1319. let theOption = [], theObj = {};
  1320. $.ajax({
  1321. method: "get",
  1322. dataType: "json",
  1323. crossDomain: false,
  1324. url: globalConfig.context + '/api/user/getContacts',
  1325. success: function (data) {
  1326. if (!data.data) {
  1327. if (data.error && data.error.length) {
  1328. message.warning(data.error[0].message);
  1329. };
  1330. } else {
  1331. for (let item in data.data) {
  1332. let theData = data.data[item];
  1333. theOption.push(
  1334. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  1335. );
  1336. };
  1337. theObj = data.data;
  1338. };
  1339. this.setState({
  1340. contactsOption: theOption,
  1341. contactsObj: theObj
  1342. });
  1343. }.bind(this)
  1344. });
  1345. },
  1346. componentWillReceiveProps(nextProps) {
  1347. if (nextProps.showDesc) {
  1348. this.state.tabsKey = "1";
  1349. this.state.tabBool = true;
  1350. };
  1351. this.state.visible = nextProps.showDesc;
  1352. },
  1353. render() {
  1354. if (this.props.data) {
  1355. return (
  1356. <div className="patent-desc">
  1357. <Modal maskClosable={false} visible={this.state.visible}
  1358. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1359. width='1000px'
  1360. footer=''
  1361. className="admin-desc-content">
  1362. <Tabs activeKey={this.state.tabsKey}
  1363. onChange={(e) => {
  1364. this.setState({ tabsKey: e });
  1365. if (e == "2" && this.state.tabBool) {
  1366. this.getTableList();
  1367. this.state.tabBool = false;
  1368. };
  1369. }} >
  1370. <Tabs.TabPane tab="成果详情" key="1">
  1371. {(() => {
  1372. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1373. return <AchievementDetailShow
  1374. data={this.props.data}
  1375. closeDesc={this.handleCancel}
  1376. visible={this.state.visible}
  1377. contactsObj={this.state.contactsObj}
  1378. handleOk={this.handleOk} />
  1379. } else {
  1380. return <AchievementDetailForm
  1381. data={this.props.data}
  1382. achievementCategoryOption={this.props.achievementCategoryOption}
  1383. closeDesc={this.handleCancel}
  1384. contactsOption={this.state.contactsOption}
  1385. visible={this.state.visible}
  1386. handleOk={this.handleOk} />
  1387. }
  1388. })()}
  1389. </Tabs.TabPane>
  1390. <Tabs.TabPane tab="匹配列表" key="2">
  1391. <Table columns={this.state.columns}
  1392. dataSource={this.state.dataSource}
  1393. pagination={false}
  1394. onRowClick={this.tableRowClick} />
  1395. </Tabs.TabPane>
  1396. </Tabs>
  1397. </Modal>
  1398. </div>
  1399. );
  1400. } else {
  1401. return <div></div>
  1402. }
  1403. },
  1404. });
  1405. export default AchievementDetail;