techAchievementDesc.jsx 78 KB

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