techAchievementDesc.jsx 80 KB

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