techAchievementDesc.jsx 70 KB

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