achievementDesc.jsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. import React from 'react';
  2. import { Icon, Modal, message, Spin, Button, Row, Col, Upload, Tooltip, Tag, Table, Input } from 'antd';
  3. import '../portal.less';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. import { getIndustryCategory } from '../../DicIndustryList.js';
  7. import { splitUrl, getAchievementCategory, getMaturity, getInnovation, getOrderStatus, beforeUploadFile } from '../../tools.js';
  8. import ImgList from "../../common/imgList";
  9. const AchievementDetail = React.createClass({
  10. getInitialState() {
  11. return {
  12. visible: false,
  13. loading: false,
  14. buttonLoading: false,
  15. dataSource: [],
  16. orderVisible: false,
  17. tags: [],
  18. technicalPictureUrl: [],
  19. maturityPictureUrl: [],
  20. columns: [
  21. {
  22. title: '状态',
  23. dataIndex: 'status',
  24. key: 'status',
  25. render: (text) => { return getOrderStatus(text) }
  26. }, {
  27. title: '处理时间',
  28. dataIndex: 'recordTimeFormattedDate',
  29. key: 'recordTimeFormattedDate',
  30. }, {
  31. title: '备注',
  32. dataIndex: 'comment',
  33. key: 'comment',
  34. }
  35. ],
  36. logsOrderStatus: 0
  37. };
  38. },
  39. handleCancel(e) {
  40. this.props.closeDesc(false);
  41. },
  42. loadData(id) {
  43. this.setState({
  44. loading: true
  45. });
  46. $.ajax({
  47. method: "get",
  48. dataType: "json",
  49. crossDomain: false,
  50. url: globalConfig.context + '/api/user/portal/achievementDetail',
  51. data: {
  52. id: id
  53. },
  54. success: function (data) {
  55. let thisData = data.data;
  56. if (!thisData) {
  57. if (data.error && data.error.length) {
  58. message.warning(data.error[0].message);
  59. };
  60. thisData = {};
  61. };
  62. this.setState({
  63. data: thisData,
  64. tags: thisData.keyword ? thisData.keyword.split(",") : [],
  65. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  66. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  67. });
  68. }.bind(this),
  69. }).always(function () {
  70. this.setState({
  71. loading: false
  72. });
  73. }.bind(this));
  74. },
  75. loadLogsData(id) {
  76. this.setState({
  77. loading: true
  78. });
  79. $.ajax({
  80. method: "get",
  81. dataType: "json",
  82. crossDomain: false,
  83. url: globalConfig.context + '/api/user/portal/order/achievementOrderLog',
  84. data: {
  85. achievementOrderId: id
  86. },
  87. success: function (data) {
  88. let thisData = data.data, theArr = [], _me = this;
  89. if (!thisData) {
  90. if (data.error && data.error.length) {
  91. message.warning(data.error[0].message);
  92. };
  93. } else {
  94. thisData.map(function (item, i) {
  95. theArr.push({
  96. key: i,
  97. recordTime: item.recordTime,
  98. recordTimeFormattedDate: item.recordTimeFormattedDate,
  99. status: item.status,
  100. comment: item.comment
  101. });
  102. _me.state.logsOrderStatus = item.status;
  103. });
  104. };
  105. this.setState({
  106. dataSource: theArr
  107. });
  108. }.bind(this),
  109. }).always(function () {
  110. this.setState({
  111. loading: false
  112. });
  113. }.bind(this));
  114. },
  115. interestClick() {
  116. this.setState({
  117. loading: true
  118. });
  119. $.ajax({
  120. method: "post",
  121. dataType: "json",
  122. crossDomain: false,
  123. url: globalConfig.context + '/api/user/portal/achievementInterest',
  124. data: {
  125. id: this.props.data.id
  126. },
  127. success: function (data) {
  128. if (data.error && data.error.length) {
  129. message.warning(data.error[0].message);
  130. } else {
  131. this.loadData(this.props.data.id);
  132. };
  133. }.bind(this),
  134. }).always(function () {
  135. this.setState({
  136. loading: false
  137. });
  138. }.bind(this));;
  139. },
  140. cancelInterestClick() {
  141. this.setState({
  142. loading: true
  143. });
  144. $.ajax({
  145. method: "post",
  146. dataType: "json",
  147. crossDomain: false,
  148. url: globalConfig.context + '/api/user/portal/achievementCancelInterest',
  149. data: {
  150. id: this.state.data.achievementInterestId
  151. },
  152. success: function (data) {
  153. if (data.error && data.error.length) {
  154. message.warning(data.error[0].message);
  155. } else {
  156. this.loadData(this.props.data.id);
  157. };
  158. }.bind(this),
  159. }).always(function () {
  160. this.setState({
  161. loading: false
  162. });
  163. }.bind(this));;
  164. },
  165. handleSubmit() {
  166. this.setState({
  167. buttonLoading: true
  168. });
  169. $.ajax({
  170. method: "post",
  171. dataType: "json",
  172. crossDomain: false,
  173. url: globalConfig.context + '/api/user/portal/order/orderAchievement',
  174. data: {
  175. achievementId: this.state.data.id,
  176. comment: this.state.comment
  177. },
  178. success: function (data) {
  179. if (data.error && data.error.length) {
  180. message.warning(data.error[0].message);
  181. } else { message.success("提交成功!") };
  182. }.bind(this),
  183. }).always(function () {
  184. this.loadData(this.state.data.id);
  185. this.setState({
  186. orderVisible: false,
  187. buttonLoading: false
  188. });
  189. }.bind(this));
  190. },
  191. cancelSubmit() {
  192. this.setState({
  193. buttonLoading: true
  194. });
  195. $.ajax({
  196. method: "post",
  197. dataType: "json",
  198. crossDomain: false,
  199. url: globalConfig.context + '/api/user/portal/order/achievementShutdown',
  200. data: {
  201. id: this.state.data.achievementOrderId
  202. },
  203. success: function (data) {
  204. if (data.error && data.error.length) {
  205. message.warning(data.error[0].message);
  206. } else { message.success("撤销成功!") };
  207. }.bind(this),
  208. }).always(function () {
  209. this.loadData(this.state.data.id);
  210. this.setState({
  211. buttonLoading: false
  212. });
  213. }.bind(this));
  214. },
  215. componentWillReceiveProps(nextProps) {
  216. if (!this.props.showDesc && nextProps.showDesc) {
  217. if (nextProps.data.id) {
  218. this.loadData(nextProps.data.id);
  219. if (nextProps.data.orderId) {
  220. this.loadLogsData(nextProps.data.orderId)
  221. }
  222. } else {
  223. this.state.data = {};
  224. this.state.tags = [];
  225. this.state.maturityPictureUrl = [];
  226. this.state.technicalPictureUrl = [];
  227. };
  228. };
  229. },
  230. render() {
  231. const theData = this.state.data || {};
  232. if (this.props.data) {
  233. return (
  234. <Modal maskClosable={false}
  235. visible={this.props.showDesc}
  236. onCancel={this.handleCancel}
  237. title={<div className="interest clearfix">
  238. <span>成果详情</span>
  239. {theData.achievementInterestId ? <a onClick={this.cancelInterestClick}><Icon type="heart" /> 不感兴趣</a>
  240. : <a onClick={this.interestClick}><Icon type="heart-o" /> 感兴趣</a>}
  241. </div>}
  242. width='1200px'
  243. footer=''
  244. className="portal-desc-content">
  245. <Spin spinning={this.state.loading} className="portal-desc">
  246. <Row>
  247. <Col span={4}>编号</Col>
  248. <Col span={8}>{theData.serialNumber}</Col>
  249. <Col span={4}>名称</Col>
  250. <Col span={8}>{theData.name}</Col>
  251. </Row>
  252. <Row>
  253. <Col span={4}>数据类别</Col>
  254. <Col span={8}>
  255. {(() => {
  256. switch (theData.dataCategory) {
  257. case "0":
  258. return <span>成果</span>;
  259. case "1":
  260. return <span>技术</span>;
  261. case "2":
  262. return <span>项目</span>;
  263. }
  264. })()}
  265. </Col>
  266. <Col span={4}>类型</Col>
  267. <Col span={8}>{getAchievementCategory(theData.category)}</Col>
  268. </Row>
  269. <Row>
  270. <Col span={4}>应用领域</Col>
  271. <Col span={8}>{getIndustryCategory(theData.fieldA, theData.fieldB)}</Col>
  272. <Col span={4}>发布时间</Col>
  273. <Col span={8}>{theData.releaseDateFormattedDate}</Col>
  274. </Row>
  275. <Row>
  276. <Col span={4}>关键词</Col>
  277. <Col span={20}>
  278. {this.state.tags.map((tag) => {
  279. return <Tooltip key={tag} title={tag}>
  280. <Tag key={tag}>{tag}</Tag>
  281. </Tooltip>;
  282. })}
  283. </Col>
  284. </Row>
  285. <Row>
  286. <Col span={4}>摘要</Col>
  287. <Col span={20}>{theData.summary}</Col>
  288. </Row>
  289. <Row>
  290. <Col span={4}>成果简介</Col>
  291. <Col span={20}>{theData.introduction}</Col>
  292. </Row>
  293. <Row>
  294. <Col span={4}>技术图片</Col>
  295. <Col span={20}>
  296. <div className="clearfix">
  297. <Upload
  298. listType="picture-card"
  299. fileList={this.state.technicalPictureUrl}
  300. onPreview={(file) => {
  301. this.setState({
  302. previewImage: file.url || file.thumbUrl,
  303. previewVisible: true,
  304. });
  305. }} />
  306. {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
  307. {/* <ImgList fileList={this.state.technicalPictureUrl} ItemWidth={'96px'}/>*/}
  308. {/*</div>*/}
  309. <Modal maskClosable={false} footer={null}
  310. visible={this.state.previewVisible}
  311. onCancel={() => { this.setState({ previewVisible: false }) }}>
  312. <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
  313. </Modal>
  314. </div>
  315. </Col>
  316. </Row>
  317. <Row>
  318. <Col span={4}>成熟度</Col>
  319. <Col span={8}>{getMaturity(theData.maturity)}</Col>
  320. <Col span={4}>创新度</Col>
  321. <Col span={8}>{getInnovation(theData.innovation)}</Col>
  322. </Row>
  323. <Row>
  324. <Col span={4}>成熟度证明材料(图片)</Col>
  325. <Col span={20}>
  326. <Upload className="demandDetailShow-upload"
  327. listType="picture-card"
  328. fileList={this.state.maturityPictureUrl}
  329. onPreview={(file) => {
  330. this.setState({
  331. previewImage: file.url || file.thumbUrl,
  332. previewVisible: true,
  333. });
  334. }} />
  335. {/*<div style={{paddingTop:'10px',paddingBottom:'10px'}}>*/}
  336. {/* <ImgList fileList={this.state.maturityPictureUrl} ItemWidth={'96px'}/>*/}
  337. {/*</div>*/}
  338. </Col>
  339. </Row>
  340. <Row>
  341. <Col span={4}>成熟度证明材料(文本)</Col>
  342. <Col span={20}>
  343. {theData.maturityTextFileUrl ?
  344. <span className="download-file">
  345. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + theData.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  346. </span>
  347. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}
  348. </Col>
  349. </Row>
  350. <Row>
  351. <Col span={4}>成熟度证明材料(视频地址)</Col>
  352. <Col span={20}>{theData.maturityVideoUrl}</Col>
  353. </Row>
  354. <Row>
  355. <Col span={4}>成果所有人名称</Col>
  356. <Col span={8}>{theData.ownerName}</Col>
  357. <Col span={4}>合作方式</Col>
  358. <Col span={8}>
  359. {(() => {
  360. switch (theData.cooperationMode) {
  361. case "0":
  362. return <span>技术转让</span>;
  363. case "1":
  364. return <span>授权生产</span>;
  365. }
  366. })()}
  367. </Col>
  368. </Row>
  369. <Row>
  370. <Col span={4}>转让方式</Col>
  371. <Col span={8}>
  372. {(() => {
  373. switch (theData.transferMode) {
  374. case "0":
  375. return <span>完全转让</span>;
  376. case "1":
  377. return <span>许可转让</span>;
  378. case "2":
  379. return <span>技术入股</span>;
  380. }
  381. })()}
  382. </Col>
  383. <Col span={4}>转让价格</Col>
  384. <Col span={8}>
  385. {(() => {
  386. switch (theData.bargainingMode) {
  387. case "0":
  388. return <span>面议</span>;
  389. case "1":
  390. return <span>{theData.transferPrice} 万元</span>;
  391. }
  392. })()}
  393. </Col>
  394. </Row>
  395. <Row>
  396. <Col span={4}>技术场景</Col>
  397. <Col span={20}>{theData.technicalScene}</Col>
  398. </Row>
  399. <Row>
  400. <Col span={4}>技术突破</Col>
  401. <Col span={20}>{theData.breakthrough}</Col>
  402. </Row>
  403. <Row>
  404. <Col span={4}>专利情况</Col>
  405. <Col span={20}>{theData.patentCase}</Col>
  406. </Row>
  407. <Row>
  408. <Col span={4}>获奖情况</Col>
  409. <Col span={20}>{theData.awards}</Col>
  410. </Row>
  411. <Row>
  412. <Col span={4}>技术团队情况</Col>
  413. <Col span={20}>{theData.teamDes}</Col>
  414. </Row>
  415. <Row>
  416. <Col span={4}>技术参数</Col>
  417. <Col span={20}>{theData.parameter}</Col>
  418. </Row>
  419. <Row>
  420. <Col span={4}>技术方案</Col>
  421. <Col span={20}>
  422. {theData.techPlanUrl ?
  423. <span className="download-file">
  424. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + theData.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  425. </span>
  426. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}
  427. </Col>
  428. </Row>
  429. <Row>
  430. <Col span={4}>商业计划书</Col>
  431. <Col span={20}>
  432. {theData.businessPlanUrl ?
  433. <span className="download-file">
  434. <a onClick={() => { window.open(globalConfig.context + '/api/user/achievement/download?id=' + theData.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  435. </span>
  436. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}
  437. </Col>
  438. </Row>
  439. {this.props.data.orderId ? <div>
  440. <p>状态流转记录: </p>
  441. <Table style={{ margin: '10px 0', background: "#eee" }}
  442. pagination={false}
  443. dataSource={this.state.dataSource}
  444. columns={this.state.columns} />
  445. </div> : <div></div>}
  446. {this.state.logsOrderStatus == 6 ? <div>
  447. <Button type="ghost" onClick={() => { this.handleCancel() }}>取消</Button>
  448. </div> : <div>
  449. {theData.achievementOrderId ? <Button type="ghost" loading={this.state.buttonLoading}
  450. disabled={Boolean(theData.orderStatus != "0")}
  451. onClick={this.cancelSubmit}>我要撤销</Button>
  452. : <Button type="primary" onClick={() => {
  453. if (window.userData.number) {
  454. this.setState({ orderVisible: true });
  455. } else {
  456. message.warning("请先登录!");
  457. }
  458. }}>我要购买</Button>}
  459. </div>}
  460. <Modal maskClosable={false}
  461. title="我要购买"
  462. width={600}
  463. style={{ 'top': '160px' }}
  464. visible={this.state.orderVisible}
  465. footer={null}
  466. onCancel={() => { this.setState({ orderVisible: false }); }}>
  467. <Row>
  468. <Col span={2}>备注 : </Col>
  469. <Col span={22}>
  470. <Input type="textarea" rows={4} onChange={(e) => { this.state.comment = e.target.value }} />
  471. </Col>
  472. </Row>
  473. <Button loading={this.state.buttonLoading} style={{ marginTop: '20px' }} type="primary" onClick={this.handleSubmit}>提交</Button>
  474. </Modal>
  475. </Spin>
  476. </Modal>
  477. );
  478. } else {
  479. return <div></div>
  480. }
  481. },
  482. });
  483. export default AchievementDetail;