activityCostList.jsx 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. import React from 'react';
  2. import { Icon, Form, Upload, Button, Input, Spin, Table, message, Select, Modal, DatePicker, InputNumber } from 'antd';
  3. import './activityCostList.less';
  4. import { beforeUploadFile, newDownloadFile } from '../../tools.js';
  5. import YearSelect from '../../yearSelect.jsx';
  6. import moment from 'moment';
  7. import ajax from 'jquery/src/ajax/xhr.js';
  8. import $ from 'jquery/src/ajax';
  9. const mathRound = function(p){
  10. if ( !isNaN(p) ) {
  11. return Math.round(p*100)/100
  12. } else {
  13. return p
  14. }
  15. }
  16. const ActivityDescFrom = Form.create()(React.createClass({
  17. getInitialState() {
  18. return {
  19. loading: false,
  20. activityNumberOption: [],
  21. activityNumberObj: {},
  22. yearOption: []
  23. };
  24. },
  25. getYearOption() {
  26. let Option = Select.Option, d = new Date(), thisYear = d.getFullYear(), theArr = [];
  27. for (let i = thisYear; i >= 2000; i--) {
  28. theArr.push(<Option value={i.toString()} key={i.toString()}>{i}</Option>)
  29. };
  30. this.state.yearOption = theArr;
  31. },
  32. allCostCount(formData) {
  33. let theData = formData || this.props.form;
  34. let internalAllCost = theData.getFieldValue('internalLaborCost') + theData.getFieldValue('internalDirectCost') +
  35. theData.getFieldValue('internalDepreciationCost') + theData.getFieldValue('internalAmortizationCost') +
  36. theData.getFieldValue('internalDesignCost') + theData.getFieldValue('internalEquipmentCost') +
  37. theData.getFieldValue('internalOtherCost');
  38. this.state.internalAllCost = mathRound(internalAllCost)
  39. let allCost = theData.getFieldValue('internalLaborCost') + theData.getFieldValue('internalDirectCost') +
  40. theData.getFieldValue('internalDepreciationCost') + theData.getFieldValue('internalAmortizationCost') +
  41. theData.getFieldValue('internalDesignCost') + theData.getFieldValue('internalEquipmentCost') +
  42. theData.getFieldValue('internalOtherCost') + theData.getFieldValue('externalTotalCost');
  43. this.state.allCost = mathRound(allCost)
  44. },
  45. componentDidMount() {
  46. this.allCostCount();
  47. this.setState({
  48. loading: false
  49. });
  50. },
  51. componentWillMount() {
  52. this.getYearOption();
  53. let _me = this;
  54. if (this.props.activityNumberList) {
  55. this.props.activityNumberList.map(function (item) {
  56. _me.state.activityNumberOption.push(
  57. <Select.Option key={item.aid}>{item.activityNumber}</Select.Option>
  58. );
  59. _me.state.activityNumberObj[item.aid] = item.activityNumber;
  60. });
  61. };
  62. },
  63. componentWillReceiveProps(nextProps) {
  64. this.allCostCount(nextProps.form);
  65. let _me = this;
  66. if (!this.props.visible && nextProps.visible) {
  67. this.state.fileList = [];
  68. this.state.accountUrl = undefined;
  69. let internalAllCost = nextProps.data.internalLaborCost + nextProps.data.internalDirectCost +
  70. nextProps.data.internalDepreciationCost + nextProps.data.internalAmortizationCost +
  71. nextProps.data.internalDesignCost + nextProps.data.internalEquipmentCost +
  72. nextProps.data.internalOtherCost;
  73. this.state.internalAllCost = mathRound(internalAllCost)
  74. this.state.allCost = this.state.internalAllCost + nextProps.data.externalTotalCost;
  75. };
  76. },
  77. handleSubmit(e) {
  78. e.preventDefault();
  79. this.props.form.validateFields((err, values) => {
  80. if (!err) {
  81. this.props.spinState(true);
  82. $.ajax({
  83. method: "POST",
  84. dataType: "json",
  85. crossDomain: false,
  86. url: globalConfig.context + "/api/user/cognizance/activityCost",
  87. data: {
  88. id: this.props.data.id,
  89. aid: values.activityNumber,
  90. activityNumber: this.state.activityNumberObj[values.activityNumber],
  91. year: values.year,
  92. internalLaborCost: values.internalLaborCost,
  93. internalDirectCost: values.internalDirectCost,
  94. internalDepreciationCost: values.internalDepreciationCost,
  95. internalAmortizationCost: values.internalAmortizationCost,
  96. internalDesignCost: values.internalDesignCost,
  97. internalEquipmentCost: values.internalEquipmentCost,
  98. internalOtherCost: values.internalOtherCost,
  99. externalTotalCost: values.externalTotalCost,
  100. externalAbroadCost: values.externalAbroadCost,
  101. //enterpriseFiller: values.enterpriseFiller,
  102. //signDateFormattedDate: values.signDate.format('YYYY-MM-DD'),
  103. sortNumber: values.sortNumber,
  104. accountUrl: this.state.accountUrl
  105. }
  106. }).done(function (data) {
  107. if (!data.error.length) {
  108. message.success('保存成功!');
  109. } else {
  110. message.warning(data.error[0].message);
  111. }
  112. }.bind(this)).always(function () {
  113. this.props.spinState(false);
  114. this.props.clickOk();
  115. this.props.form.resetFields();
  116. }.bind(this));
  117. }
  118. });
  119. },
  120. render() {
  121. const FormItem = Form.Item;
  122. const { getFieldDecorator } = this.props.form;
  123. const theData = this.props.data;
  124. const formItemLayout = {
  125. labelCol: { span: 14 },
  126. wrapperCol: { span: 8 },
  127. };
  128. const _me = this;
  129. return (
  130. <Form onSubmit={this.handleSubmit} className="activityCost-form">
  131. <p className="activityCost-title">项目编号</p>
  132. {getFieldDecorator('activityNumber', {
  133. rules: [{ required: true, message: '此项为必填项!' }],
  134. initialValue: theData.aid
  135. })(
  136. <Select
  137. notFoundContent="无项目可选"
  138. placeholder="请选择项目编号"
  139. style={{ width: 200 }} >
  140. {this.state.activityNumberOption}
  141. </Select>
  142. )}
  143. <p className="activityCost-title">费用年份</p>
  144. {getFieldDecorator('year', {
  145. rules: [{ required: true, message: '此项为必填项!' }],
  146. initialValue: theData.year
  147. })(
  148. <Select
  149. placeholder="请选择年份"
  150. style={{ width: 200 }} >
  151. {this.state.yearOption}
  152. </Select>
  153. )}
  154. <p className="activityCost-title">内部研究开发费用(万元)</p>
  155. <div className="clearfix activityCost-box">
  156. <FormItem className="half-item"
  157. {...formItemLayout}
  158. label="共计(万元)"
  159. >
  160. {getFieldDecorator('internalAllCost')(
  161. <span className="number-box">
  162. {this.state.internalAllCost || 0}
  163. </span>
  164. )}
  165. </FormItem>
  166. <FormItem className="half-item"
  167. {...formItemLayout}
  168. label="人员人工费用(万元)"
  169. >
  170. {getFieldDecorator('internalLaborCost', {
  171. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  172. initialValue: theData.internalLaborCost
  173. })(
  174. <InputNumber min={0} max={999999} step={0.01} />
  175. )}
  176. </FormItem>
  177. <FormItem className="half-item"
  178. {...formItemLayout}
  179. label="直接投入费用(万元)"
  180. >
  181. {getFieldDecorator('internalDirectCost', {
  182. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  183. initialValue: theData.internalDirectCost
  184. })(
  185. <InputNumber min={0} max={999999} step={0.01} />
  186. )}
  187. </FormItem>
  188. <FormItem className="half-item"
  189. {...formItemLayout}
  190. label="折旧费用与长期待摊费用(万元)"
  191. >
  192. {getFieldDecorator('internalDepreciationCost', {
  193. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  194. initialValue: theData.internalDepreciationCost
  195. })(
  196. <InputNumber min={0} max={999999} step={0.01} />
  197. )}
  198. </FormItem>
  199. <FormItem className="half-item"
  200. {...formItemLayout}
  201. label="无形资产摊销费用(万元)"
  202. >
  203. {getFieldDecorator('internalAmortizationCost', {
  204. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  205. initialValue: theData.internalAmortizationCost
  206. })(
  207. <InputNumber min={0} max={999999} step={0.01} />
  208. )}
  209. </FormItem>
  210. <FormItem className="half-item"
  211. {...formItemLayout}
  212. label="设计费用(万元)"
  213. >
  214. {getFieldDecorator('internalDesignCost', {
  215. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  216. initialValue: theData.internalDesignCost
  217. })(
  218. <InputNumber min={0} max={999999} step={0.01} />
  219. )}
  220. </FormItem>
  221. <FormItem className="half-item"
  222. {...formItemLayout}
  223. label="装备调试费用与实验费用(万元)"
  224. >
  225. {getFieldDecorator('internalEquipmentCost', {
  226. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  227. initialValue: theData.internalEquipmentCost
  228. })(
  229. <InputNumber min={0} max={999999} step={0.01} />
  230. )}
  231. </FormItem>
  232. <FormItem className="half-item"
  233. {...formItemLayout}
  234. label="其他费用(万元)"
  235. >
  236. {getFieldDecorator('internalOtherCost', {
  237. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  238. initialValue: theData.internalOtherCost
  239. })(
  240. <InputNumber min={0} max={999999} step={0.01} />
  241. )}
  242. </FormItem>
  243. </div>
  244. <p className="activityCost-title">委托外部研究开发费用(万元)</p>
  245. <div className="clearfix activityCost-box">
  246. <FormItem className="half-item"
  247. {...formItemLayout}
  248. label="共计(万元)"
  249. >
  250. {getFieldDecorator('externalTotalCost', {
  251. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  252. initialValue: theData.externalTotalCost
  253. })(
  254. <InputNumber min={0} max={999999} step={0.01} />
  255. )}
  256. </FormItem>
  257. <FormItem className="half-item"
  258. {...formItemLayout}
  259. label="境内的外部研发费用"
  260. >
  261. {getFieldDecorator('externalAbroadCost', {
  262. rules: [{ type: "number", required: true, message: '此项为必填项!' }],
  263. initialValue: theData.externalAbroadCost
  264. })(
  265. <InputNumber min={0} max={999999} step={0.01} />
  266. )}
  267. </FormItem>
  268. </div>
  269. <p className="activityCost-title">研发开发费用(内、外部)小计(万元)</p>
  270. <div className="clearfix activityCost-box">
  271. <FormItem className="half-item"
  272. {...formItemLayout}
  273. label="共计(万元)"
  274. >
  275. {getFieldDecorator('allCost')(
  276. <span className="number-box">
  277. {this.state.allCost || 0}
  278. </span>
  279. )}
  280. </FormItem>
  281. <FormItem className="half-item"
  282. {...formItemLayout}
  283. label="排序号"
  284. >
  285. {getFieldDecorator('sortNumber', {
  286. rules: [{ required: true, message: '此项为必填项!' }],
  287. initialValue: theData.sortNumber
  288. })(
  289. <Input />
  290. )}
  291. </FormItem>
  292. </div>
  293. <div style={{ width: '50%', marginTop: '20px' }}>
  294. <Upload
  295. name="ratepay"
  296. action={globalConfig.context + "/api/user/cognizance/uploadActivityCost"}
  297. data={{ 'sign': 'activity_cost_account' }}
  298. beforeUpload={beforeUploadFile}
  299. fileList={this.state.fileList}
  300. onChange={(info) => {
  301. if (info.file.status !== 'uploading') {
  302. // console.log(info.file, info.fileList);
  303. }
  304. if (info.file.status === 'done') {
  305. if (!info.file.response.error.length) {
  306. message.success(`${info.file.name} 文件上传成功!`);
  307. } else {
  308. message.warning(info.file.response.error[0].message);
  309. return;
  310. };
  311. this.state.accountUrl = info.file.response.data;
  312. } else if (info.file.status === 'error') {
  313. message.error(`${info.file.name} 文件上传失败。`);
  314. };
  315. this.setState({ fileList: info.fileList.slice(-1) });
  316. }}
  317. >
  318. <Button><Icon type="upload" /> 上传研发费用台账 </Button>
  319. </Upload>
  320. <p style={{ marginTop: '20px' }}>{theData.accountUrl ? <a onClick={newDownloadFile.bind(null, theData.id, 'activity_cost_account', '/api/user/cognizance/downloadActivityCost')}>{theData.accountDownloadFileName}</a> : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  321. </div>
  322. <FormItem style={{ marginTop: '20px' }}>
  323. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  324. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  325. </FormItem>
  326. </Form >
  327. );
  328. },
  329. }));
  330. const ActivityDesc = React.createClass({
  331. getInitialState() {
  332. return {
  333. visible: false,
  334. loading: false
  335. };
  336. },
  337. componentWillReceiveProps(nextProps) {
  338. this.state.visible = nextProps.showDesc
  339. },
  340. showModal() {
  341. this.setState({
  342. visible: true,
  343. });
  344. },
  345. handleOk() {
  346. this.setState({
  347. visible: false,
  348. });
  349. this.props.closeDesc(false, true);
  350. },
  351. handleCancel(e) {
  352. this.setState({
  353. visible: false,
  354. });
  355. this.props.closeDesc(false);
  356. },
  357. spinChange(e) {
  358. this.setState({
  359. loading: e
  360. });
  361. },
  362. render() {
  363. return (
  364. <div className="patent-addNew">
  365. <Modal maskClosable={false} title="企业研究开发费用结构明细" visible={this.state.visible}
  366. onOk={this.handleOk} onCancel={this.handleCancel}
  367. width='800px'
  368. footer='' >
  369. <Spin spinning={this.state.loading} className='spin-box'>
  370. <ActivityDescFrom data={this.props.data}
  371. visible={this.state.visible}
  372. activityNumberList={this.props.activityNumberList}
  373. spinState={this.spinChange}
  374. closeModal={this.handleCancel}
  375. clickOk={this.handleOk} />
  376. </Spin>
  377. </Modal>
  378. </div>
  379. );
  380. },
  381. });
  382. const Activity = React.createClass({
  383. loadData(pageNo) {
  384. this.state.data = [];
  385. this.setState({
  386. loading: true
  387. });
  388. $.when($.ajax({
  389. method: "post",
  390. dataType: "json",
  391. crossDomain: false,
  392. url: globalConfig.context + "/api/user/cognizance/activityCostList",
  393. data: {
  394. pageNo: pageNo || 1,
  395. pageSize: this.state.pagination.pageSize,
  396. activityNumber: this.state.activityNumber,
  397. year: this.state.year
  398. }
  399. }), $.ajax({
  400. method: "get",
  401. dataType: "json",
  402. crossDomain: false,
  403. url: globalConfig.context + "/api/user/cognizance/activityNumber",
  404. })).done((data1, data2) => {
  405. let data = data1[0];
  406. let activityNumber = data2[0];
  407. if (!data.data || !data.data.list) {
  408. if (data.error && data.error.length) {
  409. message.warning(data.error[0].message);
  410. this.state.ButtonDisabled = true;
  411. };
  412. return;
  413. };
  414. if (!activityNumber.data) {
  415. if (activityNumber.error && activityNumber.error.length) {
  416. message.warning(activityNumber.error[0].message);
  417. this.state.ButtonDisabled = true;
  418. };
  419. return;
  420. };
  421. for (let i = 0; i < data.data.list.length; i++) {
  422. let thisdata = data.data.list[i];
  423. this.state.data.push({
  424. key: i,
  425. id: thisdata.id,
  426. uid: thisdata.uid,
  427. aid: thisdata.aid,
  428. activityNumber: thisdata.activityNumber,
  429. year: thisdata.year ? String(thisdata.year) : undefined,
  430. startDate: thisdata.startDate,
  431. endDate: thisdata.endDate,
  432. internalAllCost:
  433. mathRound(thisdata.internalLaborCost + thisdata.internalDirectCost + thisdata.internalDepreciationCost +
  434. thisdata.internalAmortizationCost + thisdata.internalAmortizationCost + thisdata.internalDesignCost +
  435. thisdata.internalEquipmentCost + thisdata.internalOtherCost),
  436. internalLaborCost: thisdata.internalLaborCost,
  437. internalDirectCost: thisdata.internalDirectCost,
  438. internalDepreciationCost: thisdata.internalDepreciationCost,
  439. internalAmortizationCost: thisdata.internalAmortizationCost,
  440. internalDesignCost: thisdata.internalDesignCost,
  441. internalEquipmentCost: thisdata.internalEquipmentCost,
  442. internalOtherCost: thisdata.internalOtherCost,
  443. externalTotalCost: thisdata.externalTotalCost,
  444. externalAbroadCost: thisdata.externalAbroadCost,
  445. allCost:
  446. mathRound(thisdata.internalLaborCost + thisdata.internalDirectCost + thisdata.internalDepreciationCost +
  447. thisdata.internalAmortizationCost + thisdata.internalAmortizationCost + thisdata.internalDesignCost +
  448. thisdata.internalEquipmentCost + thisdata.internalOtherCost + thisdata.externalTotalCost),
  449. //enterpriseFiller: thisdata.enterpriseFiller,
  450. //signDate: thisdata.signDate,
  451. //signDateFormattedDate: thisdata.signDateFormattedDate,
  452. sortNumber: thisdata.sortNumber,
  453. startDateFormattedDate: thisdata.startDateFormattedDate,
  454. endDateFormattedDate: thisdata.endDateFormattedDate,
  455. accountDownloadFileName: thisdata.accountDownloadFileName,
  456. accountUrl: thisdata.accountUrl
  457. });
  458. };
  459. this.state.activityNumberList = activityNumber.data;
  460. this.state.pagination.current = data.data.pageNo;
  461. this.state.pagination.total = data.data.totalCount;
  462. this.setState({
  463. dataSource: this.state.data,
  464. pagination: this.state.pagination
  465. });
  466. }).always(function () {
  467. this.setState({
  468. loading: false
  469. });
  470. }.bind(this));
  471. },
  472. getYearOption() {
  473. let Option = Select.Option, d = new Date(), thisYear = d.getFullYear(), theArr = [];
  474. for (let i = thisYear; i >= 2000; i--) {
  475. theArr.push(<Option value={i.toString()} key={i.toString()}>{i}</Option>)
  476. };
  477. this.state.yearOption = theArr;
  478. },
  479. getInitialState() {
  480. return {
  481. selectedRowKeys: [],
  482. selectedRows: [],
  483. loading: false,
  484. pagination: {
  485. defaultCurrent: 1,
  486. defaultPageSize: 10,
  487. showQuickJumper: true,
  488. pageSize: 10,
  489. onChange: function (page) {
  490. this.loadData(page);
  491. }.bind(this),
  492. showTotal: function (total) {
  493. return '共' + total + '条数据';
  494. }
  495. },
  496. columns: [
  497. {
  498. title: '研发活动编号',
  499. dataIndex: 'activityNumber',
  500. key: 'activityNumber'
  501. }, {
  502. title: '费用年份',
  503. dataIndex: 'year',
  504. key: 'year'
  505. }, {
  506. title: '内部研究开发费用',
  507. dataIndex: 'internalAllCost',
  508. key: 'internalAllCost'
  509. }, {
  510. title: '人员人工费用',
  511. dataIndex: 'internalLaborCost',
  512. key: 'internalLaborCost'
  513. }, {
  514. title: '直接投入费用',
  515. dataIndex: 'internalDirectCost',
  516. key: 'internalDirectCost'
  517. }, {
  518. title: '折旧费用与长期待摊费用',
  519. dataIndex: 'internalDepreciationCost',
  520. key: 'internalDepreciationCost'
  521. }, {
  522. title: '设计费用',
  523. dataIndex: 'internalDesignCost',
  524. key: 'internalDesignCost'
  525. }, {
  526. title: '装备调试费用与试验费用',
  527. dataIndex: 'internalEquipmentCost',
  528. key: 'internalEquipmentCost'
  529. }, {
  530. title: '无形资产摊销费用',
  531. dataIndex: 'internalAmortizationCost',
  532. key: 'internalAmortizationCost'
  533. }, {
  534. title: '其他费用',
  535. dataIndex: 'internalOtherCost',
  536. key: 'internalOtherCost'
  537. }, {
  538. title: '委托外部研究开发费用',
  539. dataIndex: 'externalTotalCost',
  540. key: 'externalTotalCost'
  541. }, {
  542. title: '境内外部研发费用',
  543. dataIndex: 'externalAbroadCost',
  544. key: 'externalAbroadCost'
  545. }, {
  546. title: '研发费用合计',
  547. dataIndex: 'allCost',
  548. key: 'allCost'
  549. }, {
  550. title: '排序号',
  551. dataIndex: 'sortNumber',
  552. key: 'sortNumber'
  553. }
  554. ],
  555. dataSource: []
  556. };
  557. },
  558. componentWillMount() {
  559. this.loadData();
  560. this.getYearOption();
  561. },
  562. tableRowClick(record, index) {
  563. this.state.RowData = record;
  564. this.setState({
  565. showDesc: true
  566. });
  567. },
  568. delectRow() {
  569. let deletedIds = [];
  570. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  571. let rowItem = this.state.selectedRows[idx];
  572. if (rowItem.id) {
  573. deletedIds.push(rowItem.id)
  574. }
  575. }
  576. this.setState({
  577. selectedRowKeys: [],
  578. loading: deletedIds.length > 0
  579. });
  580. $.ajax({
  581. method: "POST",
  582. dataType: "json",
  583. crossDomain: false,
  584. url: globalConfig.context + "/api/user/cognizance/deleteActivityCost",
  585. data: {
  586. ids: deletedIds
  587. }
  588. }).done(function (data) {
  589. if (!data.error.length) {
  590. message.success('删除成功!');
  591. this.setState({
  592. loading: false,
  593. });
  594. } else {
  595. message.warning(data.error[0].message);
  596. };
  597. this.loadData();
  598. }.bind(this));
  599. },
  600. closeDesc(e, s) {
  601. this.state.showDesc = e;
  602. if (s) {
  603. this.loadData();
  604. };
  605. },
  606. search() {
  607. this.loadData();
  608. },
  609. reset() {
  610. this.state.year = undefined;
  611. this.state.activityNumber = undefined;
  612. this.loadData();
  613. },
  614. render() {
  615. const rowSelection = {
  616. selectedRowKeys: this.state.selectedRowKeys,
  617. onChange: (selectedRowKeys, selectedRows) => {
  618. this.setState({
  619. selectedRows: selectedRows,
  620. selectedRowKeys: selectedRowKeys
  621. });
  622. }
  623. };
  624. const hasSelected = this.state.selectedRowKeys.length > 0;
  625. return (
  626. <div className="user-content" >
  627. <div className="content-title">
  628. <span>企业研究开发费用结构明细</span>
  629. </div>
  630. <div className="user-search">
  631. <Input placeholder="研发活动编号" value={this.state.activityNumber}
  632. onChange={(e) => { this.setState({ activityNumber: e.target.value }); }} />
  633. <span>年份:</span>
  634. <Select value={this.state.year}
  635. style={{ width: 100 }}
  636. onChange={(e) => { this.setState({ year: e }); }} >
  637. {this.state.yearOption}
  638. </Select>
  639. <Button type="primary" onClick={this.search}>搜索</Button>
  640. <Button onClick={this.reset}>重置</Button>
  641. <p>
  642. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  643. disabled={this.state.ButtonDisabled}
  644. onClick={this.tableRowClick}>添加<Icon type="plus" /></Button>
  645. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  646. disabled={!hasSelected}
  647. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  648. </p>
  649. </div>
  650. <div className="patent-table">
  651. <Spin spinning={this.state.loading}>
  652. <Table size="middle" columns={this.state.columns}
  653. dataSource={this.state.dataSource}
  654. pagination={this.state.pagination}
  655. rowSelection={rowSelection}
  656. style={{
  657. cursor: 'pointer',
  658. }}
  659. onRowClick={this.tableRowClick} />
  660. </Spin>
  661. </div>
  662. <ActivityDesc data={this.state.RowData}
  663. activityNumberList={this.state.activityNumberList}
  664. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  665. </div >
  666. );
  667. }
  668. });
  669. export default Activity;