activityCostList.jsx 30 KB

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