activityCostList.jsx 29 KB

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