activityCostList.jsx 30 KB

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