techAchievementDesc.jsx 72 KB

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