techAchievementDesc.jsx 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707
  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. <div className="clearfix" >
  517. <FormItem className="half-item"
  518. {...formItemLayout}
  519. label="成果所有人名称" >
  520. <span>{theData.iOwnerName}</span>
  521. </FormItem>
  522. {this.state.switchValue ?
  523. <div className="clearfix" >
  524. <FormItem className="half-item"
  525. {...formItemLayout}
  526. label="联系电话" >
  527. <span>{theData.ownerMobile}</span>
  528. </FormItem>
  529. <FormItem className="half-item"
  530. {...formItemLayout}
  531. label="证件号" >
  532. <span>{theData.ownerIdNumber}</span>
  533. </FormItem>
  534. <FormItem className="half-item"
  535. {...formItemLayout}
  536. label="电子邮箱" >
  537. <span>{theData.ownerEmail}</span>
  538. </FormItem>
  539. <FormItem className="half-item"
  540. {...formItemLayout}
  541. label="通讯地址" >
  542. <span>{theData.ownerPostalAddress}</span>
  543. </FormItem>
  544. </div> : <div className="clearfix" >
  545. <FormItem className="half-item"
  546. {...formItemLayout}
  547. label="联系电话" >
  548. {theData.ownerType == "1" ? <span>{this.state.contactsObj[theData.contacts]}</span> : <span>{theData.iOwnerMobile}</span>}
  549. </FormItem>
  550. <FormItem className="half-item"
  551. {...formItemLayout}
  552. label="证件号" >
  553. <span>{theData.iOwnerIdNumber}</span>
  554. </FormItem>
  555. <FormItem className="half-item"
  556. {...formItemLayout}
  557. label="电子邮箱" >
  558. <span>{theData.iOwnerEmail}</span>
  559. </FormItem>
  560. <FormItem className="half-item"
  561. {...formItemLayout}
  562. label="通讯地址" >
  563. <span>{theData.iOwnerPostalAddress}</span>
  564. </FormItem>
  565. </div>}
  566. </div>
  567. <div className="clearfix">
  568. <FormItem className="half-item"
  569. {...formItemLayout}
  570. label="合作方式" >
  571. {(() => {
  572. switch (theData.cooperationMode) {
  573. case "0":
  574. return <span>技术转让</span>;
  575. case "1":
  576. return <span>授权生产</span>;
  577. }
  578. })()}
  579. </FormItem>
  580. <FormItem className="half-item"
  581. {...formItemLayout}
  582. label="转让方式" >
  583. <span>{getTransferMode(theData.transferMode)}</span>
  584. </FormItem>
  585. </div>
  586. <div className="clearfix">
  587. <FormItem className="half-item"
  588. {...formItemLayout}
  589. label="议价方式" >
  590. {(() => {
  591. switch (theData.bargainingMode) {
  592. case "0":
  593. return <span>面议</span>;
  594. case "1":
  595. return <span>定价</span>;
  596. }
  597. })()}
  598. </FormItem>
  599. {theData.bargainingMode == 0 ? <div></div> : <FormItem className="half-item"
  600. {...formItemLayout}
  601. label="转让价格" >
  602. <span>{theData.transferPrice} 万元</span>
  603. </FormItem>}
  604. </div>
  605. <FormItem
  606. labelCol={{ span: 4 }}
  607. wrapperCol={{ span: 18 }}
  608. label="技术场景" >
  609. <span>{theData.technicalScene}</span>
  610. </FormItem>
  611. <FormItem
  612. labelCol={{ span: 4 }}
  613. wrapperCol={{ span: 18 }}
  614. label="技术突破" >
  615. <span>{theData.breakthrough}</span>
  616. </FormItem>
  617. <FormItem
  618. labelCol={{ span: 4 }}
  619. wrapperCol={{ span: 18 }}
  620. label="专利情况" >
  621. <span>{theData.patentCase}</span>
  622. </FormItem>
  623. <FormItem
  624. labelCol={{ span: 4 }}
  625. wrapperCol={{ span: 18 }}
  626. label="获奖情况" >
  627. <span>{theData.awards}</span>
  628. </FormItem>
  629. <FormItem
  630. labelCol={{ span: 4 }}
  631. wrapperCol={{ span: 18 }}
  632. label="技术团队情况" >
  633. <span>{theData.teamDes}</span>
  634. </FormItem>
  635. <FormItem
  636. labelCol={{ span: 4 }}
  637. wrapperCol={{ span: 18 }}
  638. label="技术参数" >
  639. <span>{theData.parameter}</span>
  640. </FormItem>
  641. <FormItem
  642. labelCol={{ span: 4 }}
  643. wrapperCol={{ span: 6 }}
  644. label="技术方案" >
  645. <p>{theData.techPlanUrl ?
  646. <span className="download-file">
  647. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  648. </span>
  649. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  650. </FormItem>
  651. <FormItem
  652. labelCol={{ span: 4 }}
  653. wrapperCol={{ span: 6 }}
  654. label="商业计划书" >
  655. <p>{theData.businessPlanUrl ?
  656. <span className="download-file">
  657. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  658. </span>
  659. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  660. </FormItem>
  661. {window.showAuditStatus && theData.auditStatus == 2 ? <div className="clearfix">
  662. <FormItem className="half-item"
  663. {...formItemLayout}
  664. label="审核状态" >
  665. {getFieldDecorator('auditStatus')(
  666. <Radio.Group>
  667. <Radio value={3}>审核通过</Radio>
  668. <Radio value={4}>审核未通过</Radio>
  669. </Radio.Group>
  670. )}
  671. </FormItem>
  672. <FormItem className="half-item"
  673. {...formItemLayout}
  674. label="技术经纪人" >
  675. {getFieldDecorator('techBrokerId', {
  676. initialValue: theData.techBrokerId
  677. })(
  678. <Select style={{ width: 260 }}
  679. placeholder="请选择技术经纪人"
  680. notFoundContent="未获取到经纪人列表"
  681. showSearch
  682. filterOption={companySearch}>
  683. {this.props.techBrodersOption}
  684. </Select>
  685. )}
  686. </FormItem>
  687. </div> : <div></div>}
  688. {window.showAuditStatus && theData.auditStatus == 3 ? <div className="clearfix">
  689. <FormItem className="half-item"
  690. {...formItemLayout}
  691. label="指派新经纪人" >
  692. {getFieldDecorator('modifyTechBrokerId', {
  693. initialValue: theData.techBrokerId
  694. })(
  695. <Select style={{ width: 260 }}
  696. placeholder="请选择要指派的新经纪人"
  697. notFoundContent="未获取到经纪人列表"
  698. showSearch
  699. filterOption={companySearch}>
  700. {this.props.techBrodersOption}
  701. </Select>
  702. )}
  703. </FormItem>
  704. </div> : <div></div>}
  705. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  706. {theData.auditStatus == 2 ? <Button className="set-submit" type="primary" htmlType="submit">保存</Button> : <span></span>}
  707. {theData.auditStatus == 3 ? <Button className="set-submit" type="primary" onClick={() => { this.modifyBroker(); }}>保存</Button> : <span></span>}
  708. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  709. {window.showAuditStatus ? <Button className="set-submit" loading={this.state.buttonLoading} type="primary" onClick={this.buildMatchList}>生成匹配列表</Button> : <span></span>}
  710. </FormItem>
  711. <Modal maskClosable={false} title="确认"
  712. visible={this.state.formSubmitVisible}
  713. width='360px'
  714. footer={null}
  715. onCancel={() => { this.setState({ formSubmitVisible: false }) }} >
  716. <span>确认该需求审核未通过?</span>
  717. <Button className="modal-submit" type="primary" onClick={this.formSubmit}>确认</Button>
  718. <Button className="modal-submit" type="ghost" onClick={() => { this.setState({ formSubmitVisible: false }) }}>取消</Button>
  719. </Modal>
  720. </Spin>
  721. </Form >
  722. )
  723. }
  724. }));
  725. const AchievementDetailForm = Form.create()(React.createClass({
  726. getInitialState() {
  727. return {
  728. loading: false,
  729. auditStatus: 0,
  730. textFileList: [],
  731. switchValue: false,
  732. techPlanFileList: [],
  733. data: {},
  734. tags: [],
  735. technicalPictureUrl: [],
  736. maturityPictureUrl: [],
  737. businessPlanFileList: [],
  738. dataSource: [],
  739. };
  740. },
  741. loadData(id, detailApiUrl) {
  742. this.setState({
  743. loading: true
  744. });
  745. $.ajax({
  746. method: "get",
  747. dataType: "json",
  748. crossDomain: false,
  749. url: globalConfig.context + detailApiUrl,
  750. data: {
  751. id: id
  752. },
  753. success: function (data) {
  754. let thisData = data.data;
  755. if (!thisData) {
  756. if (data.error && data.error.length) {
  757. message.warning(data.error[0].message);
  758. };
  759. thisData = {};
  760. };
  761. this.setState({
  762. data: thisData,
  763. orgDisplay: thisData.ownerType,
  764. switchValue: Boolean(!thisData.ownerId),
  765. transferPriceDis: thisData.transferMode == 1 ? true : false,
  766. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  767. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  768. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : []
  769. });
  770. if (thisData.ownerType == "1" && thisData.ownerId) {
  771. this.getContactsList(thisData.ownerId);
  772. };
  773. }.bind(this),
  774. }).always(function () {
  775. this.setState({
  776. loading: false
  777. });
  778. }.bind(this));
  779. },
  780. getContactsList(theUid) {
  781. $.ajax({
  782. method: "get",
  783. dataType: "json",
  784. crossDomain: false,
  785. url: globalConfig.context + "/api/admin/getContacts",
  786. data: {
  787. uid: theUid
  788. },
  789. success: function (data) {
  790. let theOption = [];
  791. if (!data.data) {
  792. if (data.error && data.error.length) {
  793. message.warning(data.error[0].message);
  794. return;
  795. };
  796. };
  797. for (let item in data.data) {
  798. let theData = data.data[item];
  799. theOption.push(
  800. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  801. );
  802. };
  803. this.setState({
  804. contactsOption: theOption
  805. });
  806. }.bind(this),
  807. });
  808. },
  809. getTagsArr(e) {
  810. this.setState({ tags: e });
  811. },
  812. getMaturityPictureUrl(e) {
  813. this.setState({ maturityPictureUrl: e });
  814. },
  815. getTechnicalPictureUrl(e) {
  816. this.setState({ technicalPictureUrl: e });
  817. },
  818. handleSearch(e) {
  819. if (this.props.detailApiUrl.indexOf('org') != -1) {
  820. $.ajax({
  821. method: "get",
  822. dataType: "json",
  823. crossDomain: false,
  824. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  825. data: { name: e },
  826. success: function (data) {
  827. let theArr = [];
  828. let theObj = {};
  829. if (!data.data) {
  830. if (data.error && data.error.length) {
  831. message.warning(data.error[0].message);
  832. };
  833. } else if (!$.isEmptyObject(data.data)) {
  834. data.data.map(function (item) {
  835. theArr.push(item.unitName);
  836. theObj[item.unitName] = item.uid;
  837. });
  838. };
  839. this.setState({
  840. dataSource: theArr,
  841. dataSourceObj: theObj
  842. });
  843. }.bind(this),
  844. });
  845. } else {
  846. $.ajax({
  847. method: "get",
  848. dataType: "json",
  849. crossDomain: false,
  850. url: globalConfig.context + "/api/admin/achievement/userOwner",
  851. data: { name: e },
  852. success: function (data) {
  853. let theArr = [];
  854. let theObj = {};
  855. if (!data.data) {
  856. if (data.error && data.error.length) {
  857. message.warning(data.error[0].message);
  858. };
  859. } else if (!$.isEmptyObject(data.data)) {
  860. for (let item in data.data) {
  861. theArr.push(data.data[item]);
  862. theObj[data.data[item]] = item;
  863. };
  864. };
  865. this.setState({
  866. dataSource: theArr,
  867. dataSourceObj: theObj
  868. });
  869. }.bind(this),
  870. });
  871. };
  872. },
  873. handleSubmit(e) {
  874. e.preventDefault();
  875. this.props.form.validateFields((err, values) => {
  876. //keyword长度判断
  877. if ((this.state.tags ? this.state.tags.length : this.props.tags.length) < 3) {
  878. message.warning('关键词数量不能小于3个!');
  879. return;
  880. };
  881. if (values.bargainingMode == 1 && !values.transferPrice) {
  882. message.warning('议价方式为[ 定价 ]时, [ 转让价格 ]不能为空!');
  883. return;
  884. }
  885. //url转化
  886. let theTechnicalPictureUrl = [];
  887. if (this.state.technicalPictureUrl.length) {
  888. let picArr = [];
  889. this.state.technicalPictureUrl.map(function (item) {
  890. picArr.push(item.response.data);
  891. });
  892. theTechnicalPictureUrl = picArr.join(",");
  893. };
  894. let theMaturityPictureUrl = [];
  895. if (this.state.maturityPictureUrl.length) {
  896. let picArr = [];
  897. this.state.maturityPictureUrl.map(function (item) {
  898. picArr.push(item.response.data);
  899. });
  900. theMaturityPictureUrl = picArr.join(",");
  901. };
  902. if (!err) {
  903. this.setState({
  904. loading: true
  905. });
  906. $.ajax({
  907. method: "POST",
  908. dataType: "json",
  909. crossDomain: false,
  910. url: this.props.data.id ? globalConfig.context + '/api/admin/achievement/update' : globalConfig.context + '/api/admin/achievement/apply',
  911. data: {
  912. id: this.props.data.id,
  913. dataCategory: values.dataCategory,
  914. serialNumber: this.props.data.serialNumber,
  915. name: values.name,
  916. keyword: this.state.tags ? this.state.tags.join(",") : this.props.tags.join(","),
  917. keywords: this.state.tags ? this.state.tags : this.props.tags,
  918. category: values.category,
  919. summary: values.summary,
  920. introduction: values.introduction,
  921. technicalPictureUrl: theTechnicalPictureUrl,
  922. fieldA: values.field ? values.field[0] : undefined,
  923. fieldB: values.field ? values.field[1] : undefined,
  924. maturity: values.maturity,
  925. maturityPictureUrl: theMaturityPictureUrl,
  926. maturityTextFileUrl: this.state.maturityTextFileUrl,
  927. maturityVideoUrl: values.maturityVideoUrl,
  928. innovation: values.innovation,
  929. //
  930. switchSign: this.state.switchValue ? 1 : 0,
  931. //
  932. ownerId: !this.state.switchValue ? (this.state.dataSourceObj ? this.state.dataSourceObj[values.iOwnerName] : this.state.data.ownerId) : undefined,
  933. contacts: !this.state.switchValue ? values.contacts : undefined,
  934. ownerType: this.props.detailApiUrl.indexOf('org') != -1 ? 1 : 0,
  935. //自定义
  936. ownerName: this.state.switchValue ? values.ownerName : undefined,
  937. ownerIdNumber: this.state.switchValue ? values.ownerIdNumber : undefined,
  938. ownerMobile: this.state.switchValue ? values.ownerMobile : undefined,
  939. ownerEmail: this.state.switchValue ? values.ownerEmail : undefined,
  940. ownerPostalAddress: this.state.switchValue ? values.ownerPostalAddress : undefined,
  941. //
  942. cooperationMode: values.cooperationMode,
  943. transferMode: values.transferMode,
  944. bargainingMode: values.bargainingMode,
  945. transferPrice: values.transferPrice,
  946. technicalScene: values.technicalScene,
  947. breakthrough: values.breakthrough,
  948. patentCase: values.patentCase,
  949. awards: values.awards,
  950. teamDes: values.teamDes,
  951. parameter: values.parameter,
  952. releaseStatus: values.releaseStatus,
  953. techPlanUrl: this.state.techPlanUrl,
  954. businessPlanUrl: this.state.businessPlanUrl,
  955. auditStatus: this.state.auditStatus
  956. }
  957. }).done(function (data) {
  958. this.state.auditStatus = 0;
  959. this.setState({
  960. loading: false
  961. });
  962. if (!data.error.length) {
  963. message.success('保存成功!');
  964. this.props.handleOk();
  965. } else {
  966. message.warning(data.error[0].message);
  967. }
  968. }.bind(this));
  969. }
  970. });
  971. },
  972. componentWillMount() {
  973. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  974. if (this.props.data && this.props.data.id) {
  975. this.loadData(this.props.data.id, this.props.detailApiUrl);
  976. };
  977. },
  978. componentWillReceiveProps(nextProps) {
  979. if (!this.props.visible && nextProps.visible) {
  980. if (nextProps.data && nextProps.data.id) {
  981. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  982. };
  983. this.state.data = {};
  984. this.state.tags = [];
  985. this.state.switchValue = false;
  986. this.state.technicalPictureUrl = [];
  987. this.state.maturityPictureUrl = [];
  988. this.state.textFileList = [];
  989. this.state.techPlanFileList = [];
  990. this.state.businessPlanFileList = [];
  991. this.props.form.resetFields();
  992. };
  993. },
  994. render() {
  995. const theData = this.state.data || {};
  996. const { getFieldDecorator } = this.props.form;
  997. const FormItem = Form.Item
  998. const formItemLayout = {
  999. labelCol: { span: 8 },
  1000. wrapperCol: { span: 14 },
  1001. };
  1002. return (
  1003. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  1004. <Spin spinning={this.state.loading}>
  1005. <div className="clearfix">
  1006. <FormItem className="half-item"
  1007. {...formItemLayout}
  1008. label="编号" >
  1009. <span>{theData.serialNumber}</span>
  1010. </FormItem>
  1011. <FormItem className="half-item"
  1012. {...formItemLayout}
  1013. label="名称" >
  1014. {getFieldDecorator('name', {
  1015. rules: [{ required: true, message: '此项为必填项!' }],
  1016. initialValue: theData.name
  1017. })(
  1018. <Input />
  1019. )}
  1020. </FormItem>
  1021. <FormItem className="half-item"
  1022. {...formItemLayout}
  1023. label="数据类别" >
  1024. {getFieldDecorator('dataCategory', {
  1025. rules: [{ required: true, message: '此项为必填项!' }],
  1026. initialValue: theData.dataCategory
  1027. })(
  1028. <Select placeholder="选择数据类型" style={{ width: 160 }} >
  1029. <Select.Option value="0" >成果</Select.Option>
  1030. <Select.Option value="1" >技术</Select.Option>
  1031. <Select.Option value="2" >项目</Select.Option>
  1032. </Select>
  1033. )}
  1034. </FormItem>
  1035. <FormItem className="half-item"
  1036. {...formItemLayout}
  1037. label="类型" >
  1038. {getFieldDecorator('category', {
  1039. rules: [{ required: true, message: '此项为必填项!' }],
  1040. initialValue: theData.category
  1041. })(
  1042. <Select style={{ width: 160 }} placeholder="请选择成果类型">
  1043. {this.props.achievementCategoryOption}
  1044. </Select>
  1045. )}
  1046. </FormItem>
  1047. <div className="clearfix">
  1048. <FormItem className="half-item"
  1049. {...formItemLayout}
  1050. label="是否发布" >
  1051. {(() => {
  1052. switch (theData.releaseStatus) {
  1053. case "0":
  1054. return <span>未发布</span>;
  1055. case "1":
  1056. return <span>已发布</span>;
  1057. }
  1058. })()}
  1059. </FormItem>
  1060. <FormItem className="half-item"
  1061. {...formItemLayout}
  1062. label="发布时间" >
  1063. <span>{theData.releaseDateFormattedDate}</span>
  1064. </FormItem>
  1065. <FormItem className="half-item"
  1066. {...formItemLayout}
  1067. label="审核状态" >
  1068. <span>{getTechAuditStatus(theData.auditStatus)}</span>
  1069. </FormItem>
  1070. </div>
  1071. </div>
  1072. <FormItem
  1073. labelCol={{ span: 4 }}
  1074. wrapperCol={{ span: 18 }}
  1075. label="关键词" >
  1076. <KeyWordTagGroup
  1077. keyWordArr={this.state.tags}
  1078. tagsArr={this.getTagsArr} />
  1079. </FormItem>
  1080. <FormItem
  1081. labelCol={{ span: 4 }}
  1082. wrapperCol={{ span: 18 }}
  1083. label="摘要" >
  1084. {getFieldDecorator('summary', {
  1085. initialValue: theData.summary
  1086. })(
  1087. <Input type="textarea" rows={4} />
  1088. )}
  1089. </FormItem>
  1090. <FormItem
  1091. labelCol={{ span: 4 }}
  1092. wrapperCol={{ span: 18 }}
  1093. label="成果简介" >
  1094. {getFieldDecorator('introduction', {
  1095. initialValue: theData.introduction
  1096. })(
  1097. <Input type="textarea" rows={4} placeholder="项目成果简介;项目核心创新点;项目详细用途;预期效益说明;主要技术(性能)指标;市场前景;应用范围;发展历程。" />
  1098. )}
  1099. </FormItem>
  1100. <FormItem
  1101. labelCol={{ span: 4 }}
  1102. wrapperCol={{ span: 18 }}
  1103. label="技术图片" >
  1104. <PicturesWall
  1105. pictureSign="achievement_technical_picture"
  1106. fileList={this.getTechnicalPictureUrl}
  1107. pictureUrl={this.state.technicalPictureUrl} />
  1108. <p>图片建议:专利证书或专利申请书图片、技术图纸、样品图片、技术相关网络图片;成熟度处于非研发阶段的项目,必须上传样品图片,如未上传,成熟度将视为处在研发阶段。</p>
  1109. </FormItem>
  1110. <FormItem
  1111. labelCol={{ span: 4 }}
  1112. wrapperCol={{ span: 18 }}
  1113. label="应用领域" >
  1114. {getFieldDecorator('field', {
  1115. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  1116. initialValue: [theData.fieldA, theData.fieldB]
  1117. })(
  1118. <Cascader style={{ width: 300 }} options={IndustryObject} placeholder="应用领域" />
  1119. )}
  1120. </FormItem>
  1121. <div className="clearfix">
  1122. <FormItem className="half-item"
  1123. {...formItemLayout}
  1124. label="成熟度" >
  1125. {getFieldDecorator('maturity', {
  1126. initialValue: theData.maturity
  1127. })(
  1128. <Select placeholder="选择成熟度" style={{ width: 160 }} >
  1129. {
  1130. maturityList.map(function (item) {
  1131. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1132. })
  1133. }
  1134. </Select>
  1135. )}
  1136. </FormItem>
  1137. <FormItem className="half-item"
  1138. {...formItemLayout}
  1139. label="创新度" >
  1140. {getFieldDecorator('innovation', {
  1141. initialValue: theData.innovation
  1142. })(
  1143. <Select placeholder="选择创新度" style={{ width: 160 }} >
  1144. {
  1145. innovationList.map(function (item) {
  1146. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1147. })
  1148. }
  1149. </Select>
  1150. )}
  1151. </FormItem>
  1152. </div>
  1153. <FormItem
  1154. labelCol={{ span: 4 }}
  1155. wrapperCol={{ span: 18 }}
  1156. label="成熟度证明材料(图片)" >
  1157. <PicturesWall
  1158. pictureSign="achievement_maturity_picture"
  1159. fileList={this.getMaturityPictureUrl}
  1160. pictureUrl={this.state.maturityPictureUrl} />
  1161. </FormItem>
  1162. <FormItem
  1163. labelCol={{ span: 4 }}
  1164. wrapperCol={{ span: 6 }}
  1165. label="成熟度证明材料(文本)" >
  1166. <Upload
  1167. name="ratepay"
  1168. action={globalConfig.context + "/api/admin/achievement/uploadTextFile"}
  1169. data={{ 'sign': 'achievement_maturity_text_file' }}
  1170. beforeUpload={beforeUploadFile}
  1171. fileList={this.state.textFileList}
  1172. onChange={(info) => {
  1173. if (info.file.status !== 'uploading') {
  1174. console.log(info.file, info.fileList);
  1175. }
  1176. if (info.file.status === 'done') {
  1177. if (!info.file.response.error.length) {
  1178. message.success(`${info.file.name} 文件上传成功!`);
  1179. } else {
  1180. message.warning(info.file.response.error[0].message);
  1181. return;
  1182. };
  1183. this.state.maturityTextFileUrl = info.file.response.data;
  1184. } else if (info.file.status === 'error') {
  1185. message.error(`${info.file.name} 文件上传失败。`);
  1186. };
  1187. this.setState({ textFileList: info.fileList.slice(-1) });
  1188. }} >
  1189. <Button><Icon type="upload" /> 上传成熟度证明文本 </Button>
  1190. </Upload>
  1191. <p style={{ marginTop: '10px' }}>{theData.maturityTextFileUrl ?
  1192. <span className="download-file">
  1193. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_maturity_text_file') }}>成熟度证明材料(文本文件)</a>
  1194. </span>
  1195. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1196. </FormItem>
  1197. <FormItem
  1198. labelCol={{ span: 4 }}
  1199. wrapperCol={{ span: 18 }}
  1200. label="成熟度证明材料(视频地址)" >
  1201. {getFieldDecorator('maturityVideoUrl', {
  1202. initialValue: theData.maturityVideoUrl
  1203. })(
  1204. <Input />
  1205. )}
  1206. </FormItem>
  1207. <FormItem
  1208. labelCol={{ span: 4 }}
  1209. wrapperCol={{ span: 18 }}
  1210. label="自定义成果所有人" >
  1211. <Switch checked={this.state.switchValue} onChange={(e) => { this.setState({ switchValue: e }); }} />
  1212. </FormItem>
  1213. {this.state.switchValue ? <div className="clearfix" >
  1214. <FormItem className="half-item"
  1215. {...formItemLayout}
  1216. label="成果所有人" >
  1217. {getFieldDecorator('ownerName', {
  1218. initialValue: theData.ownerName
  1219. })(
  1220. <Input />
  1221. )}
  1222. </FormItem>
  1223. <FormItem className="half-item"
  1224. {...formItemLayout}
  1225. label="联系电话" >
  1226. {getFieldDecorator('ownerMobile', {
  1227. initialValue: theData.ownerMobile
  1228. })(
  1229. <Input />
  1230. )}
  1231. </FormItem>
  1232. <FormItem className="half-item"
  1233. {...formItemLayout}
  1234. label="证件号" >
  1235. {getFieldDecorator('ownerIdNumber', {
  1236. initialValue: theData.ownerIdNumber
  1237. })(
  1238. <Input />
  1239. )}
  1240. </FormItem>
  1241. <FormItem className="half-item"
  1242. {...formItemLayout}
  1243. label="电子邮箱" >
  1244. {getFieldDecorator('ownerEmail', {
  1245. initialValue: theData.ownerEmail
  1246. })(
  1247. <Input />
  1248. )}
  1249. </FormItem>
  1250. <FormItem className="half-item"
  1251. {...formItemLayout}
  1252. label="通讯地址" >
  1253. {getFieldDecorator('ownerPostalAddress', {
  1254. initialValue: theData.ownerPostalAddress
  1255. })(
  1256. <Input />
  1257. )}
  1258. </FormItem>
  1259. </div> : <div className="clearfix" >
  1260. <FormItem className="half-item"
  1261. {...formItemLayout}
  1262. label="成果所有人" >
  1263. {getFieldDecorator('iOwnerName', {
  1264. initialValue: theData.iOwnerName || ''
  1265. })(
  1266. <AutoComplete
  1267. dataSource={this.state.dataSource}
  1268. style={{ width: 200 }}
  1269. onSearch={this.state.therottleSearch}
  1270. placeholder="输入成果所有人"
  1271. onSelect={(e) => {
  1272. this.getContactsList(this.state.dataSourceObj[e]);
  1273. }} />
  1274. )}
  1275. </FormItem>
  1276. {this.props.detailApiUrl.indexOf('org') >= 0 ? <FormItem className="half-item"
  1277. {...formItemLayout}
  1278. label="联系人" >
  1279. {getFieldDecorator('contacts', {
  1280. initialValue: theData.contacts
  1281. })(
  1282. <Select style={{ width: 260 }}
  1283. placeholder="请选择联系人"
  1284. notFoundContent="未获取到联系人列表"
  1285. showSearch
  1286. filterOption={companySearch}>
  1287. {this.state.contactsOption}
  1288. </Select>
  1289. )}
  1290. </FormItem> : <div></div>}
  1291. </div>}
  1292. <div className="clearfix">
  1293. <FormItem className="half-item"
  1294. {...formItemLayout}
  1295. label="合作方式" >
  1296. {getFieldDecorator('cooperationMode', {
  1297. rules: [{ required: true, message: '此项为必填项!' }],
  1298. initialValue: theData.cooperationMode
  1299. })(
  1300. <Radio.Group>
  1301. <Radio value="0">技术转让</Radio>
  1302. <Radio value="1">授权生产</Radio>
  1303. </Radio.Group>
  1304. )}
  1305. </FormItem>
  1306. <FormItem className="half-item"
  1307. {...formItemLayout}
  1308. label="转让方式" >
  1309. {getFieldDecorator('transferMode', {
  1310. initialValue: theData.transferMode
  1311. })(
  1312. <Select placeholder="选择转让方式" style={{ width: 160 }} >
  1313. {
  1314. transferModeList.map(function (item) {
  1315. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1316. })
  1317. }
  1318. </Select>
  1319. )}
  1320. </FormItem>
  1321. </div>
  1322. <div className="clearfix">
  1323. <FormItem className="half-item"
  1324. {...formItemLayout}
  1325. label="议价方式" >
  1326. {getFieldDecorator('bargainingMode', {
  1327. initialValue: theData.bargainingMode
  1328. })(
  1329. <Radio.Group onChange={(e) => {
  1330. this.setState({
  1331. transferPriceDis: (e.target.value == 1 ? true : false)
  1332. })
  1333. }}>
  1334. <Radio value="0">面议</Radio>
  1335. <Radio value="1">定价</Radio>
  1336. </Radio.Group>
  1337. )}
  1338. </FormItem>
  1339. {this.state.transferPriceDis ? <FormItem className="half-item"
  1340. {...formItemLayout}
  1341. label="转让价格" >
  1342. {getFieldDecorator('transferPrice', {
  1343. initialValue: theData.transferPrice || 0
  1344. })(
  1345. <InputNumber min={0} max={999999} step={0.01} />
  1346. )}
  1347. <span style={{ marginLeft: '20px' }}>万元</span>
  1348. </FormItem> : <div></div>}
  1349. </div>
  1350. <FormItem
  1351. labelCol={{ span: 4 }}
  1352. wrapperCol={{ span: 18 }}
  1353. label="技术场景" >
  1354. {getFieldDecorator('technicalScene', {
  1355. initialValue: theData.technicalScene
  1356. })(
  1357. <Input type="textarea" rows={2} placeholder="说明解决了什么问题。" />
  1358. )}
  1359. </FormItem>
  1360. <FormItem
  1361. labelCol={{ span: 4 }}
  1362. wrapperCol={{ span: 18 }}
  1363. label="技术突破" >
  1364. {getFieldDecorator('breakthrough', {
  1365. initialValue: theData.breakthrough
  1366. })(
  1367. <Input type="textarea" rows={2} placeholder="说明该技术成果突破性的研究。" />
  1368. )}
  1369. </FormItem>
  1370. <FormItem
  1371. labelCol={{ span: 4 }}
  1372. wrapperCol={{ span: 18 }}
  1373. label="专利情况" >
  1374. {getFieldDecorator('patentCase', {
  1375. initialValue: theData.patentCase
  1376. })(
  1377. <Input type="textarea" rows={2} placeholder="一个“技术”可能由多个专利构成,需要说明技术-专利的关系。" />
  1378. )}
  1379. </FormItem>
  1380. <FormItem
  1381. labelCol={{ span: 4 }}
  1382. wrapperCol={{ span: 18 }}
  1383. label="获奖情况" >
  1384. {getFieldDecorator('awards', {
  1385. initialValue: theData.awards
  1386. })(
  1387. <Input type="textarea" rows={2} placeholder="一个“技术”可能存在社会奖励情况,需要说明社会奖励情况。" />
  1388. )}
  1389. </FormItem>
  1390. <FormItem
  1391. labelCol={{ span: 4 }}
  1392. wrapperCol={{ span: 18 }}
  1393. label="技术团队情况" >
  1394. {getFieldDecorator('teamDes', {
  1395. initialValue: theData.teamDes
  1396. })(
  1397. <Input type="textarea" rows={2} placeholder="一个“技术”、“项目”可能存在团队,需要说明团队情况。" />
  1398. )}
  1399. </FormItem>
  1400. <FormItem
  1401. labelCol={{ span: 4 }}
  1402. wrapperCol={{ span: 18 }}
  1403. label="技术参数" >
  1404. {getFieldDecorator('parameter', {
  1405. initialValue: theData.parameter
  1406. })(
  1407. <Input type="textarea" rows={2} placeholder="描述技术参数信息" />
  1408. )}
  1409. </FormItem>
  1410. <FormItem
  1411. labelCol={{ span: 4 }}
  1412. wrapperCol={{ span: 6 }}
  1413. label="技术方案" >
  1414. <Upload
  1415. name="ratepay"
  1416. action={globalConfig.context + "/api/admin/achievement/uploadTextFile"}
  1417. data={{ 'sign': 'achievement_tech_plan' }}
  1418. beforeUpload={beforeUploadFile}
  1419. fileList={this.state.techPlanFileList}
  1420. onChange={(info) => {
  1421. if (info.file.status !== 'uploading') {
  1422. console.log(info.file, info.fileList);
  1423. }
  1424. if (info.file.status === 'done') {
  1425. if (!info.file.response.error.length) {
  1426. message.success(`${info.file.name} 文件上传成功!`);
  1427. } else {
  1428. message.warning(info.file.response.error[0].message);
  1429. return;
  1430. };
  1431. this.state.techPlanUrl = info.file.response.data;
  1432. } else if (info.file.status === 'error') {
  1433. message.error(`${info.file.name} 文件上传失败。`);
  1434. };
  1435. this.setState({ techPlanFileList: info.fileList.slice(-1) });
  1436. }} >
  1437. <Button><Icon type="upload" /> 上传技术方案文件 </Button>
  1438. </Upload>
  1439. <p style={{ marginTop: '10px' }}>{theData.techPlanUrl ?
  1440. <span className="download-file">
  1441. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_tech_plan') }}>技术方案</a>
  1442. </span>
  1443. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1444. </FormItem>
  1445. <FormItem
  1446. labelCol={{ span: 4 }}
  1447. wrapperCol={{ span: 6 }}
  1448. label="商业计划书" >
  1449. <Upload
  1450. name="ratepay"
  1451. action={globalConfig.context + "/api/admin/achievement/uploadTextFile"}
  1452. data={{ 'sign': 'achievement_business_plan' }}
  1453. beforeUpload={beforeUploadFile}
  1454. fileList={this.state.businessPlanFileList}
  1455. onChange={(info) => {
  1456. if (info.file.status !== 'uploading') {
  1457. console.log(info.file, info.fileList);
  1458. }
  1459. if (info.file.status === 'done') {
  1460. if (!info.file.response.error.length) {
  1461. message.success(`${info.file.name} 文件上传成功!`);
  1462. } else {
  1463. message.warning(info.file.response.error[0].message);
  1464. return;
  1465. };
  1466. this.state.businessPlanUrl = info.file.response.data;
  1467. } else if (info.file.status === 'error') {
  1468. message.error(`${info.file.name} 文件上传失败。`);
  1469. };
  1470. this.setState({ businessPlanFileList: info.fileList.slice(-1) });
  1471. }} >
  1472. <Button><Icon type="upload" /> 上传商业计划书文件 </Button>
  1473. </Upload>
  1474. <p style={{ marginTop: '10px' }}>{theData.businessPlanUrl ?
  1475. <span className="download-file">
  1476. <a onClick={() => { window.open(globalConfig.context + '/api/admin/achievement/download?id=' + this.props.data.id + '&sign=achievement_business_plan') }}>商业计划书</a>
  1477. </span>
  1478. : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  1479. </FormItem>
  1480. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1481. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1482. <Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>
  1483. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1484. </FormItem>
  1485. </Spin>
  1486. </Form >
  1487. )
  1488. }
  1489. }));
  1490. const AchievementDetail = React.createClass({
  1491. getInitialState() {
  1492. return {
  1493. visible: false,
  1494. tabsKey: 1,
  1495. loading: false,
  1496. columns: [
  1497. {
  1498. title: '编号',
  1499. dataIndex: 'serialNumber',
  1500. key: 'serialNumber',
  1501. }, {
  1502. title: '数据类型',
  1503. dataIndex: 'dataCategory',
  1504. key: 'dataCategory',
  1505. render: text => {
  1506. switch (text) {
  1507. case "0":
  1508. return <span>成果</span>;
  1509. case "1":
  1510. return <span>技术</span>;
  1511. case "2":
  1512. return <span>项目</span>;
  1513. }
  1514. }
  1515. }, {
  1516. title: '名称',
  1517. dataIndex: 'name',
  1518. key: 'name',
  1519. }, {
  1520. title: '关键字',
  1521. dataIndex: 'keyword',
  1522. key: 'keyword',
  1523. }, {
  1524. title: '类型',
  1525. dataIndex: 'demandType',
  1526. key: 'demandType',
  1527. render: text => { return getDemandType(text); }
  1528. }, {
  1529. title: '所有人名称',
  1530. dataIndex: 'theName',
  1531. key: 'theName',
  1532. }, {
  1533. title: '发布时间',
  1534. dataIndex: 'releaseDateFormattedDate',
  1535. key: 'releaseDateFormattedDate',
  1536. }, {
  1537. title: '有效期限',
  1538. dataIndex: 'validityPeriodFormattedDate',
  1539. key: 'validityPeriodFormattedDate',
  1540. },
  1541. ],
  1542. dataSource: [],
  1543. };
  1544. },
  1545. getTechBrodersList() {
  1546. this.setState({
  1547. loading: true
  1548. });
  1549. $.ajax({
  1550. method: "get",
  1551. dataType: "json",
  1552. crossDomain: false,
  1553. url: globalConfig.context + "/api/admin/audit/techBroders",
  1554. success: function (data) {
  1555. if (!data.data) {
  1556. if (data.error && data.error.length) {
  1557. message.warning(data.error[0].message);
  1558. }
  1559. return;
  1560. };
  1561. let _me = this, theArr = [];
  1562. for (var item in data.data) {
  1563. theArr.push(
  1564. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1565. )
  1566. };
  1567. this.setState({
  1568. techBrodersOption: theArr,
  1569. techBrodersObj: data.data
  1570. });
  1571. }.bind(this),
  1572. }).always(function () {
  1573. this.setState({
  1574. loading: false
  1575. });
  1576. }.bind(this));
  1577. },
  1578. getTableList() {
  1579. this.setState({
  1580. loading: true
  1581. });
  1582. $.ajax({
  1583. method: "get",
  1584. dataType: "json",
  1585. crossDomain: false,
  1586. url: globalConfig.context + "/api/admin/achievement/achievementDemand",
  1587. data: { id: this.props.data.id },
  1588. success: function (data) {
  1589. let theArr = [];
  1590. if (!data.data) {
  1591. if (data.error && data.error.length) {
  1592. message.warning(data.error[0].message);
  1593. };
  1594. } else if (data.data.length) {
  1595. for (let i = 0; i < data.data.length; i++) {
  1596. let thisdata = data.data[i];
  1597. theArr.push({
  1598. key: i,
  1599. id: thisdata.id,
  1600. serialNumber: thisdata.serialNumber,
  1601. dataCategory: thisdata.dataCategory,
  1602. name: thisdata.name,
  1603. keyword: thisdata.keyword,
  1604. demandType: thisdata.demandType,
  1605. theName: thisdata.username || thisdata.unitName,
  1606. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1607. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate
  1608. });
  1609. };
  1610. };
  1611. this.setState({
  1612. dataSource: theArr,
  1613. });
  1614. }.bind(this),
  1615. }).always(function () {
  1616. this.setState({
  1617. loading: false
  1618. });
  1619. }.bind(this));
  1620. },
  1621. tableRowClick(record, index) {
  1622. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1623. },
  1624. handleCancel(e) {
  1625. this.setState({
  1626. visible: false,
  1627. });
  1628. this.props.closeDesc(false);
  1629. },
  1630. handleOk(e) {
  1631. this.setState({
  1632. visible: false,
  1633. });
  1634. this.props.closeDesc(false, true);
  1635. },
  1636. componentWillMount() {
  1637. this.getTechBrodersList();
  1638. },
  1639. componentWillReceiveProps(nextProps) {
  1640. if (!this.state.visible && nextProps.showDesc) {
  1641. this.state.tabsKey = "1";
  1642. };
  1643. this.state.visible = nextProps.showDesc;
  1644. },
  1645. render() {
  1646. if (this.props.data) {
  1647. return (
  1648. <div className="patent-desc">
  1649. <Modal maskClosable={false} visible={this.state.visible}
  1650. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1651. width='1000px'
  1652. footer=''
  1653. className="admin-desc-content">
  1654. <Spin spinning={this.state.loading}>
  1655. <Tabs activeKey={this.state.tabsKey}
  1656. onChange={(e) => {
  1657. this.setState({ tabsKey: e });
  1658. if (e == "2") {
  1659. this.getTableList();
  1660. };
  1661. }} >
  1662. <Tabs.TabPane tab="成果详情" key="1">
  1663. {(() => {
  1664. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1665. return <AchievementDetailShow
  1666. data={this.props.data}
  1667. detailApiUrl={this.props.detailApiUrl}
  1668. techBrodersOption={this.state.techBrodersOption}
  1669. techBrodersObj={this.state.techBrodersObj}
  1670. closeDesc={this.handleCancel}
  1671. visible={this.state.visible}
  1672. handleOk={this.handleOk} />
  1673. } else {
  1674. return <AchievementDetailForm
  1675. data={this.props.data}
  1676. detailApiUrl={this.props.detailApiUrl}
  1677. achievementCategoryOption={this.props.achievementCategoryOption}
  1678. techBrodersObj={this.state.techBrodersObj}
  1679. closeDesc={this.handleCancel}
  1680. visible={this.state.visible}
  1681. handleOk={this.handleOk} />
  1682. };
  1683. })()}
  1684. </Tabs.TabPane>
  1685. <Tabs.TabPane tab="匹配列表" key="2" disabled={!this.props.data.id}>
  1686. <Table columns={this.state.columns}
  1687. dataSource={this.state.dataSource}
  1688. pagination={false}
  1689. onRowClick={this.tableRowClick} />
  1690. </Tabs.TabPane>
  1691. </Tabs>
  1692. </Spin>
  1693. </Modal>
  1694. </div>
  1695. );
  1696. } else {
  1697. return <div></div>
  1698. }
  1699. },
  1700. });
  1701. export default AchievementDetail;