activity.jsx 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. import React from 'react';
  2. import { Icon, Button, Upload, Input, Spin, Table, message, Select, Modal, DatePicker, Cascader, Transfer, InputNumber, Switch, Form } from 'antd';
  3. import { technicalSourceList } from '../../dataDic.js';
  4. import { techFieldList, getTechField } from '../../DicTechFieldList.js';
  5. import { getTechnicalSource, beforeUploadFile, newDownloadFile } from '../../tools.js';
  6. import './activity.less';
  7. import moment from 'moment';
  8. import ajax from 'jquery/src/ajax/xhr.js';
  9. import $ from 'jquery/src/ajax';
  10. if (!Array.prototype.includes) {
  11. Object.defineProperty(Array.prototype, 'includes', {
  12. value: function (searchElement, fromIndex) {
  13. // 1. Let O be ? ToObject(this value).
  14. if (this == null) {
  15. throw new TypeError('"this" is null or not defined');
  16. }
  17. var o = Object(this);
  18. // 2. Let len be ? ToLength(? Get(O, "length")).
  19. var len = o.length >>> 0;
  20. // 3. If len is 0, return false.
  21. if (len === 0) {
  22. return false;
  23. }
  24. // 4. Let n be ? ToInteger(fromIndex).
  25. // (If fromIndex is undefined, this step produces the value 0.)
  26. var n = fromIndex | 0;
  27. // 5. If n ≥ 0, then
  28. // a. Let k be n.
  29. // 6. Else n < 0,
  30. // a. Let k be len + n.
  31. // b. If k < 0, let k be 0.
  32. var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
  33. // 7. Repeat, while k < len
  34. while (k < len) {
  35. // a. Let elementK be the result of ? Get(O, ! ToString(k)).
  36. // b. If SameValueZero(searchElement, elementK) is true, return true.
  37. // c. Increase k by 1.
  38. // NOTE: === provides the correct "SameValueZero" comparison needed here.
  39. if (o[k] === searchElement) {
  40. return true;
  41. }
  42. k++;
  43. }
  44. // 8. Return false
  45. return false;
  46. }
  47. });
  48. }
  49. const ActivityForm = Form.create()(React.createClass({
  50. getInitialState() {
  51. return {
  52. loading: false,
  53. targetKeys: [],
  54. selectedKeys: []
  55. };
  56. },
  57. loadData(id) {
  58. this.setState({ loading: true });
  59. $.ajax({
  60. method: "get",
  61. dataType: "json",
  62. crossDomain: false,
  63. url: globalConfig.context + "/api/user/cognizance/activityDetail",
  64. data: {
  65. id: id || this.props.data.id
  66. }
  67. }).done(function (data) {
  68. if (!data.data) {
  69. if (data.error && data.error.length) {
  70. message.warning(data.error[0].message);
  71. };
  72. } else {
  73. this.setState({
  74. data: data.data,
  75. targetKeys: data.data.intellectualPropertyNumber ? data.data.intellectualPropertyNumber.split(",") : [],
  76. techField: [data.data.technicalField1, data.data.technicalField2, data.data.technicalField3]
  77. });
  78. };
  79. }.bind(this)).always(function (data) {
  80. this.setState({ loading: false });
  81. }.bind(this));
  82. },
  83. handleSubmit(e) {
  84. e.preventDefault();
  85. this.props.form.validateFields((err, values) => {
  86. if (!err) {
  87. this.setState({ loading: true });
  88. $.ajax({
  89. method: "POST",
  90. dataType: "json",
  91. crossDomain: false,
  92. url: globalConfig.context + "/api/user/cognizance/activity",
  93. data: {
  94. id: this.props.data.id,
  95. uid: this.props.uid,
  96. activityName: values.activityName,
  97. activityNumber: values.activityNumber,
  98. projectMode: values.projectMode,
  99. startDateFormattedDate: values.startDate ? values.startDate.format("YYYY-MM-DD") : null,
  100. endDateFormattedDate: values.endDate ? values.endDate.format("YYYY-MM-DD") : null,
  101. technicalField1: values.techField[0],
  102. technicalField2: values.techField[1],
  103. technicalField3: values.techField[2],
  104. technicalSource: values.technicalSource,
  105. intellectualPropertyNumber: this.state.targetKeys.join(","),
  106. budget: values.budget,
  107. implement: values.implement,
  108. technologyInnovation: values.technologyInnovation,
  109. achievement: values.achievement,
  110. proofUrl: this.state.proofUrl
  111. }
  112. }).done(function (data) {
  113. if (!data.error.length) {
  114. message.success('保存成功!');
  115. this.props.closeModal(true);
  116. } else {
  117. message.warning(data.error[0].message);
  118. };
  119. this.setState({ loading: false });
  120. }.bind(this));
  121. }
  122. });
  123. },
  124. componentWillMount() {
  125. if (this.props.data.id) {
  126. this.loadData();
  127. } else {
  128. this.state.data = {};
  129. this.state.targetKeys = [];
  130. this.state.techField = undefined;
  131. };
  132. },
  133. componentWillReceiveProps(nextProps) {
  134. if (!this.props.visible && nextProps.visible) {
  135. this.state.mockData = nextProps.data.mockData;
  136. this.props.form.resetFields();
  137. this.state.proofUrl = undefined;
  138. this.state.fileList = [];
  139. if (nextProps.data.id) {
  140. this.loadData(nextProps.data.id);
  141. } else {
  142. this.state.data = {};
  143. this.state.targetKeys = [];
  144. this.state.techField = undefined;
  145. };
  146. };
  147. },
  148. intellectualChange(nextTargetKeys, direction, moveKeys) {
  149. this.setState({ targetKeys: nextTargetKeys });
  150. },
  151. intellectualSelectChange(sourceSelectedKeys, targetSelectedKeys) {
  152. this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys] });
  153. },
  154. render() {
  155. const FormItem = Form.Item;
  156. const { getFieldDecorator } = this.props.form;
  157. const theData = this.state.data;
  158. const formItemLayout = {
  159. labelCol: { span: 6 },
  160. wrapperCol: { span: 12 },
  161. };
  162. if (theData) {
  163. return (
  164. <Spin spinning={this.state.loading} className='spin-box'>
  165. <Form onSubmit={this.handleSubmit} id="admin-desc-content">
  166. <div className="clearfix">
  167. <FormItem className="half-item"
  168. {...formItemLayout}
  169. label="研发活动编号"
  170. >
  171. {getFieldDecorator('activityNumber', {
  172. initialValue: theData.activityNumber
  173. })(
  174. <Input />
  175. )}
  176. </FormItem>
  177. <FormItem className="half-item"
  178. {...formItemLayout}
  179. label="研发活动名称"
  180. >
  181. {getFieldDecorator('activityName', {
  182. initialValue: theData.activityName
  183. })(
  184. <Input />
  185. )}
  186. </FormItem>
  187. <FormItem className="half-item"
  188. {...formItemLayout}
  189. label="开始日期"
  190. >
  191. {getFieldDecorator('startDate', {
  192. initialValue: theData.startDateFormattedDate ? moment(theData.startDateFormattedDate) : null
  193. })(
  194. <DatePicker />
  195. )}
  196. </FormItem>
  197. <FormItem className="half-item"
  198. {...formItemLayout}
  199. label="结束日期"
  200. >
  201. {getFieldDecorator('endDate', {
  202. initialValue: theData.endDateFormattedDate ? moment(theData.endDateFormattedDate) : null
  203. })(
  204. <DatePicker />
  205. )}
  206. </FormItem>
  207. </div>
  208. <div className="clearfix">
  209. <FormItem className="half-item"
  210. {...formItemLayout}
  211. label="技术领域"
  212. >
  213. {getFieldDecorator('techField', {
  214. initialValue: this.state.techField || []
  215. })(
  216. <Cascader
  217. style={{ width: 500 }}
  218. options={techFieldList}
  219. placeholder="选择技术领域"
  220. showSearch
  221. />
  222. )}
  223. </FormItem>
  224. </div>
  225. <div className="clearfix">
  226. <FormItem className="half-item"
  227. {...formItemLayout}
  228. label="技术来源"
  229. >
  230. {getFieldDecorator('technicalSource', {
  231. initialValue: theData.technicalSource ? String(theData.technicalSource) : undefined,
  232. })(
  233. <Select placeholder="选择技术来源" style={{ width: 230 }}>
  234. {
  235. technicalSourceList.map(function (item, i) {
  236. return <Select.Option key={1000 + i} value={item.value} >{item.key}</Select.Option>
  237. })
  238. }
  239. </Select>
  240. )}
  241. </FormItem>
  242. <FormItem className="half-item"
  243. {...formItemLayout}
  244. label="立项类型"
  245. >
  246. {getFieldDecorator('projectMode', {
  247. initialValue: theData.projectMode
  248. })(
  249. <Select style={{ width: 120 }}>
  250. <Select.Option value='0'>内部立项</Select.Option>
  251. <Select.Option value='1'>外部立项</Select.Option>
  252. </Select>
  253. )}
  254. </FormItem>
  255. </div>
  256. <div style={{ marginBottom: '20px' }}>
  257. <p>知识产权编号:</p>
  258. <Transfer
  259. dataSource={this.props.mockData}
  260. listStyle={{
  261. width: 300,
  262. height: 300,
  263. }}
  264. titles={['未选择', '已选择']}
  265. targetKeys={this.state.targetKeys}
  266. selectedKeys={this.state.selectedKeys}
  267. onChange={this.intellectualChange}
  268. onSelectChange={this.intellectualSelectChange}
  269. render={item => `${item.name}-${item.number}`}
  270. />
  271. </div>
  272. <FormItem className="half-div"
  273. labelCol={{ span: 8 }}
  274. wrapperCol={{ span: 12 }}
  275. label="研发经费总预算"
  276. >
  277. {getFieldDecorator('budget', {
  278. initialValue: theData.budget
  279. })(
  280. <InputNumber min={0} max={999999} step={0.01} />
  281. )}
  282. <span>万元</span>
  283. </FormItem>
  284. <div className="clearfix" >
  285. <p>研发经费近三年总支出:</p>
  286. <FormItem className="half-item"
  287. labelCol={{ span: 8 }}
  288. wrapperCol={{ span: 12 }}
  289. label="总计"
  290. >
  291. <span>{
  292. (theData.firstYearExpenditure || 0) +
  293. (theData.secondYearExpenditure || 0) +
  294. (theData.thirdYearExpenditure || 0)
  295. }</span>
  296. <span>万元</span>
  297. </FormItem>
  298. <FormItem className="half-item"
  299. labelCol={{ span: 8 }}
  300. wrapperCol={{ span: 12 }}
  301. label="其中(前一年)"
  302. >
  303. <span>{theData.firstYearExpenditure}</span>
  304. <span>万元</span>
  305. </FormItem>
  306. <FormItem className="half-item"
  307. labelCol={{ span: 8 }}
  308. wrapperCol={{ span: 12 }}
  309. label="其中(前二年)"
  310. >
  311. <span>{theData.secondYearExpenditure}</span>
  312. <span>万元</span>
  313. </FormItem>
  314. <FormItem className="half-item"
  315. labelCol={{ span: 8 }}
  316. wrapperCol={{ span: 12 }}
  317. label="其中(前三年)"
  318. >
  319. <span>{theData.thirdYearExpenditure}</span>
  320. <span>万元</span>
  321. </FormItem>
  322. </div>
  323. <div className="clearfix">
  324. <div className="half-div">
  325. <p>目的及组织实施方式(限400字):</p>
  326. {getFieldDecorator('implement', {
  327. initialValue: theData.implement
  328. })(
  329. <Input type="textarea" rows={6} />
  330. )}
  331. </div>
  332. <div className="half-div">
  333. <p>核心技术及创新点(限400字):</p>
  334. {getFieldDecorator('technologyInnovation', {
  335. initialValue: theData.technologyInnovation
  336. })(
  337. <Input type="textarea" rows={6} />
  338. )}
  339. </div>
  340. <div className="half-div">
  341. <p>取得的阶段性成果(限400字):</p>
  342. {getFieldDecorator('achievement', {
  343. initialValue: theData.achievement
  344. })(
  345. <Input type="textarea" rows={6} />
  346. )}
  347. </div>
  348. </div>
  349. <div style={{ width: '50%' }}>
  350. <Upload
  351. name="ratepay"
  352. action={globalConfig.context + "/api/user/cognizance/uploadProof"}
  353. data={{ 'sign': 'proof', 'uid': this.props.uid }}
  354. beforeUpload={beforeUploadFile}
  355. fileList={this.state.fileList}
  356. onChange={(info) => {
  357. if (info.file.status !== 'uploading') {
  358. console.log(info.file, info.fileList);
  359. }
  360. if (info.file.status === 'done') {
  361. if (!info.file.response.error.length) {
  362. message.success(`${info.file.name} 文件上传成功!`);
  363. } else {
  364. message.warning(info.file.response.error[0].message);
  365. return;
  366. };
  367. this.state.proofUrl = info.file.response.data;
  368. } else if (info.file.status === 'error') {
  369. message.error(`${info.file.name} 文件上传失败。`);
  370. };
  371. this.setState({ fileList: info.fileList.slice(-1) });
  372. }}
  373. >
  374. <Button><Icon type="upload" /> 上传立项证明材料 </Button>
  375. </Upload>
  376. <p>{theData.proofUrl ? <a onClick={newDownloadFile.bind(null, theData.id, 'proof', '/api/user/cognizance/downloadProof')}>{theData.proofDownloadFileName}</a> : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  377. </div>
  378. <FormItem style={{ marginTop: '20px' }}>
  379. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  380. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  381. </FormItem>
  382. </Form >
  383. </Spin >
  384. )
  385. } else {
  386. return (<div></div>)
  387. };
  388. }
  389. }));
  390. const ActivityDesc = React.createClass({
  391. getInitialState() {
  392. return {
  393. visible: false,
  394. loading: false
  395. };
  396. },
  397. handleCancel(e) {
  398. this.setState({
  399. visible: false,
  400. });
  401. this.props.closeDesc(false);
  402. if (e) {
  403. this.props.closeDesc(false, true);
  404. };
  405. },
  406. componentWillReceiveProps(nextProps) {
  407. this.state.visible = nextProps.showDesc;
  408. },
  409. render() {
  410. return (
  411. <div className="admin-desc">
  412. <Modal maskClosable={false} title="企业研究开发活动情况详情"
  413. visible={this.state.visible}
  414. onCancel={this.handleCancel}
  415. width='800px'
  416. footer=''
  417. className="admin-desc-content">
  418. <ActivityForm
  419. visible={this.state.visible}
  420. data={this.props.data}
  421. uid={this.props.uid}
  422. mockData={this.props.mockData}
  423. spinState={this.spinChange}
  424. closeModal={this.handleCancel} />
  425. </Modal>
  426. </div>
  427. );
  428. },
  429. });
  430. const Activity = React.createClass({
  431. loadData(pageNo) {
  432. this.state.data = [];
  433. this.setState({
  434. loading: true
  435. });
  436. $.when($.ajax({
  437. method: "post",
  438. dataType: "json",
  439. crossDomain: false,
  440. url: globalConfig.context + "/api/user/cognizance/activityList",
  441. data: {
  442. pageNo: pageNo || 1,
  443. pageSize: this.state.pagination.pageSize,
  444. activityNumber: this.state.activityNumber,
  445. activityName: this.state.activityName
  446. }
  447. }), $.ajax({
  448. method: "get",
  449. dataType: "json",
  450. crossDomain: false,
  451. url: globalConfig.context + "/api/user/cognizance/intellectualList",
  452. data: {
  453. pageNo: pageNo || 1,
  454. pageSize: 99,
  455. }
  456. })).done((data1, data2) => {
  457. let data = data1[0];
  458. let intellectualList = data2[0];
  459. let theArr = [], theObj = {};
  460. if (data.error.length || !data.data || !data.data.list) {
  461. message.warning(data.error[0].message);
  462. } else {
  463. for (let i = 0; i < data.data.list.length; i++) {
  464. let thisdata = data.data.list[i];
  465. this.state.data.push({
  466. key: i,
  467. id: thisdata.id,
  468. uid: thisdata.uid,
  469. activityNumber: thisdata.activityNumber,
  470. activityName: thisdata.activityName,
  471. startDate: thisdata.startDate,
  472. endDate: thisdata.endDate,
  473. mockData: this.state.mockData,
  474. techField: [thisdata.technicalField1, thisdata.technicalField2, thisdata.technicalField3],
  475. technicalField: getTechField(thisdata.technicalField1, thisdata.technicalField2, thisdata.technicalField3),
  476. technicalField1: thisdata.technicalField1,
  477. technicalField2: thisdata.technicalField2,
  478. technicalField3: thisdata.technicalField3,
  479. technicalSource: thisdata.technicalSource ? String(thisdata.technicalSource) : undefined,
  480. intellectualPropertyNumber: thisdata.intellectualPropertyNumber ? thisdata.intellectualPropertyNumber.split(",") : [],
  481. intellectualPropertyNumberText: thisdata.intellectualPropertyNumber,
  482. budget: thisdata.budget,
  483. firstYearExpenditure: thisdata.firstYearExpenditure,
  484. secondYearExpenditure: thisdata.secondYearExpenditure,
  485. thirdYearExpenditure: thisdata.thirdYearExpenditure,
  486. implement: thisdata.implement,
  487. technologyInnovation: thisdata.technologyInnovation,
  488. achievement: thisdata.achievement,
  489. internalLaborCost: thisdata.internalLaborCost,
  490. internalDirectCost: thisdata.internalDirectCost,
  491. internalDepreciationCost: thisdata.internalDepreciationCost,
  492. internalAmortizationCost: thisdata.internalAmortizationCost,
  493. internalDesignCost: thisdata.internalDesignCost,
  494. internalEquipmentCost: thisdata.internalEquipmentCost,
  495. internalOtherCost: thisdata.internalOtherCost,
  496. externalTotalCost: thisdata.externalTotalCost,
  497. externalAbroadCost: thisdata.externalAbroadCost,
  498. enterpriseFiller: thisdata.enterpriseFiller,
  499. signDate: thisdata.signDate,
  500. sortNumber: thisdata.sortNumber,
  501. startDateFormattedDate: thisdata.startDateFormattedDate,
  502. endDateFormattedDate: thisdata.endDateFormattedDate,
  503. projectMode: thisdata.projectMode,
  504. proofUrl: thisdata.proofUrl,
  505. proofDownloadFileName: thisdata.proofDownloadFileName
  506. });
  507. };
  508. this.state.pagination.current = data.data.pageNo;
  509. this.state.pagination.total = data.data.totalCount;
  510. };
  511. if (intellectualList.error.length || !intellectualList.data || !intellectualList.data.list) {
  512. message.warning(intellectualList.error[0].message);
  513. } else {
  514. for (let i = 0; i < intellectualList.data.list.length; i++) {
  515. theArr.push({
  516. key: intellectualList.data.list[i].id,
  517. number: intellectualList.data.list[i].intellectualPropertyNumber,
  518. name: intellectualList.data.list[i].intellectualPropertyName
  519. });
  520. theObj[intellectualList.data.list[i].id] = intellectualList.data.list[i].intellectualPropertyNumber;
  521. };
  522. };
  523. this.setState({
  524. dataSource: this.state.data,
  525. pagination: this.state.pagination,
  526. mockData: theArr,
  527. mockDataObj: theObj
  528. });
  529. }).always(function () {
  530. this.setState({
  531. loading: false
  532. });
  533. }.bind(this));
  534. },
  535. getInitialState() {
  536. return {
  537. mockData: [],
  538. mockDataObj: {},
  539. selectedRowKeys: [],
  540. selectedRows: [],
  541. loading: false,
  542. pagination: {
  543. defaultCurrent: 1,
  544. defaultPageSize: 10,
  545. showQuickJumper: true,
  546. pageSize: 10,
  547. onChange: function (page) {
  548. this.loadData(page);
  549. }.bind(this),
  550. showTotal: function (total) {
  551. return '共' + total + '条数据';
  552. }
  553. },
  554. columns: [
  555. {
  556. title: '研发活动编号',
  557. dataIndex: 'activityNumber',
  558. key: 'activityNumber'
  559. }, {
  560. title: '研发活动名称',
  561. dataIndex: 'activityName',
  562. key: 'activityName'
  563. }, {
  564. title: '技术领域',
  565. dataIndex: 'technicalField',
  566. key: 'technicalField'
  567. }, {
  568. title: '技术来源',
  569. dataIndex: 'technicalSource',
  570. key: 'technicalSource',
  571. render: (text) => { return getTechnicalSource(text) }
  572. }, {
  573. title: '知识产权编号',
  574. dataIndex: 'intellectualPropertyNumberText',
  575. key: 'intellectualPropertyNumberText',
  576. render: (text) => {
  577. let arr = [], _me = this;
  578. if (text && text.split(',').length) {
  579. text.split(',').map((item) => {
  580. arr.push(_me.state.mockDataObj[item]);
  581. });
  582. };
  583. return arr.join(',');
  584. }
  585. }, {
  586. title: '开始时间',
  587. dataIndex: 'startDateFormattedDate',
  588. key: 'startDateFormattedDate'
  589. }, {
  590. title: '结束时间',
  591. dataIndex: 'endDateFormattedDate',
  592. key: 'endDateFormattedDate'
  593. }
  594. ],
  595. dataSource: []
  596. };
  597. },
  598. componentWillMount() {
  599. this.loadData();
  600. },
  601. tableRowClick(record, index) {
  602. this.state.RowData = record;
  603. this.setState({
  604. showDesc: true
  605. });
  606. },
  607. delectRow() {
  608. let deletedIds = [];
  609. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  610. let rowItem = this.state.selectedRows[idx];
  611. if (rowItem.id) {
  612. deletedIds.push(rowItem.id)
  613. }
  614. }
  615. this.setState({
  616. selectedRowKeys: [],
  617. loading: deletedIds.length > 0
  618. });
  619. $.ajax({
  620. method: "POST",
  621. dataType: "json",
  622. crossDomain: false,
  623. url: globalConfig.context + "/api/user/cognizance/deleteActivity",
  624. data: {
  625. ids: deletedIds
  626. }
  627. }).done(function (data) {
  628. if (!data.error.length) {
  629. message.success('删除成功!');
  630. this.setState({
  631. loading: false,
  632. });
  633. } else {
  634. message.warning(data.error[0].message);
  635. };
  636. this.loadData();
  637. }.bind(this));
  638. },
  639. closeDesc(e, s) {
  640. this.state.showDesc = e;
  641. if (s) {
  642. this.loadData();
  643. };
  644. },
  645. search() {
  646. this.loadData();
  647. },
  648. reset() {
  649. this.state.activityName = undefined;
  650. this.state.activityNumber = undefined;
  651. this.loadData();
  652. },
  653. render() {
  654. const rowSelection = {
  655. selectedRowKeys: this.state.selectedRowKeys,
  656. onChange: (selectedRowKeys, selectedRows) => {
  657. this.setState({
  658. selectedRows: selectedRows,
  659. selectedRowKeys: selectedRowKeys
  660. });
  661. }
  662. };
  663. const hasSelected = this.state.selectedRowKeys.length > 0;
  664. return (
  665. <div className="user-content" >
  666. <div className="content-title">
  667. <span>企业研究开发活动情况表</span>
  668. </div>
  669. <div className="user-search">
  670. <Input placeholder="研发活动名称" value={this.state.activityName}
  671. onChange={(e) => { this.setState({ activityName: e.target.value }); }} />
  672. <Input placeholder="研发活动编号" value={this.state.activityNumber}
  673. onChange={(e) => { this.setState({ activityNumber: e.target.value }); }} />
  674. <Button type="primary" onClick={this.search}>搜索</Button>
  675. <Button onClick={this.reset}>重置</Button>
  676. <p>
  677. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  678. onClick={this.tableRowClick}>添加<Icon type="plus" /></Button>
  679. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  680. disabled={!hasSelected}
  681. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  682. </p>
  683. </div>
  684. <div className="patent-table">
  685. <Spin spinning={this.state.loading}>
  686. <Table columns={this.state.columns}
  687. dataSource={this.state.dataSource}
  688. pagination={this.state.pagination}
  689. rowSelection={rowSelection}
  690. onRowClick={this.tableRowClick} />
  691. </Spin>
  692. </div>
  693. <ActivityDesc data={this.state.RowData}
  694. mockData={this.state.mockData}
  695. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  696. </div >
  697. );
  698. }
  699. });
  700. export default Activity;