annualReport.jsx 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. import React from 'react';
  2. import { Icon, Form, Button, Input, Spin, Table, message, Select, Modal, InputNumber } from 'antd';
  3. import './annualReport.less';
  4. import { annualReportStateList } from '../../../../dataDic.js';
  5. import { beforeUploadFile, getAnnualReportState } from '../../../../tools.js';
  6. import moment from 'moment';
  7. import ajax from 'jquery/src/ajax/xhr.js';
  8. import $ from 'jquery/src/ajax';
  9. const AnnualReportDescFrom = Form.create()(React.createClass({
  10. getInitialState() {
  11. return {
  12. loading: false,
  13. yearOption: [],
  14. };
  15. },
  16. handleSubmit(e) {
  17. e.preventDefault();
  18. this.props.form.validateFields((err, values) => {
  19. if (!err) {
  20. this.props.spinState(true);
  21. $.ajax({
  22. method: "POST",
  23. dataType: "json",
  24. crossDomain: false,
  25. url: globalConfig.context + "/api/admin/disposeAnnualReport",
  26. data: {
  27. id: this.props.data.id,
  28. uid: this.props.uid,
  29. year: this.props.data.year,
  30. totalTax: values.totalTax,
  31. incomeTaxRelief: values.incomeTaxRelief,
  32. totalExportVolume: values.totalExportVolume,
  33. basicResearchCost: values.basicResearchCost,
  34. state: 0,
  35. }
  36. }).done(function (data) {
  37. if (!data.error.length) {
  38. message.success('保存成功!');
  39. this.props.clickOk();
  40. this.props.spinState(false);
  41. this.props.form.resetFields();
  42. } else {
  43. message.warning(data.error[0].message);
  44. this.props.spinState(false);
  45. }
  46. }.bind(this));
  47. }
  48. });
  49. },
  50. render() {
  51. const FormItem = Form.Item;
  52. const { getFieldDecorator } = this.props.form;
  53. const theData = this.props.detailData;
  54. const formItemLayout = {
  55. labelCol: { span: 0 },
  56. wrapperCol: { span: 20 },
  57. };
  58. const _me = this;
  59. if (theData) {
  60. return (
  61. <Form onSubmit={this.handleSubmit} className="annualReport-form">
  62. <div className="activityCost-title">
  63. <span>年份: </span>
  64. <span>{this.props.data.year}</span>
  65. </div>
  66. <div className="clearfix" style={{ padding: '0 10px' }}>
  67. <div className="half-item" style={{ marginRight: "50%" }}>
  68. <p className="item-title">企业名称: </p>
  69. <p>{theData.unitName}</p>
  70. </div>
  71. <div className="half-item">
  72. <p className="item-title">组织机构代码或统一社会信用代码: </p>
  73. <p>{theData.orgCode}</p>
  74. </div>
  75. <div className="half-item">
  76. <p className="item-title">所属地区: </p>
  77. <p>{theData.location || " "}</p>
  78. </div>
  79. <div className="half-item">
  80. <p className="item-title">高新技术企业认定证书编号: </p>
  81. <p>{theData.certificateNumber}</p>
  82. </div>
  83. <div className="half-item">
  84. <p className="item-title">高新技术企业认定时间: </p>
  85. <p>{theData.issuingDateFormattedDate}</p>
  86. </div>
  87. <div className="half-item">
  88. <p className="item-title">企业是否上市: </p>
  89. <p>{theData.listed == 0 ? "否" : "是"}</p>
  90. </div>
  91. <div className="half-item">
  92. <p className="item-title">上市时间: </p>
  93. <p>{theData.listedDateFormattedDate}</p>
  94. </div>
  95. <div className="half-item">
  96. <p className="item-title">上市类型: </p>
  97. <p>
  98. {(() => {
  99. switch (theData.listedType) {
  100. case 0:
  101. return "股票型上市公司";
  102. case 1:
  103. return "债券型上市公司";
  104. default:
  105. return "";
  106. }
  107. })()}
  108. </p>
  109. </div>
  110. <div className="half-item">
  111. <p className="item-title">股票代码: </p>
  112. <p>{theData.stockCode}</p>
  113. </div>
  114. <div className="half-item">
  115. <p className="item-title">企业联系人: </p>
  116. <p>{theData.contacts}</p>
  117. </div>
  118. </div>
  119. <div className="activityCost-title"><span>本年度获得的知识产权数: </span></div>
  120. <div className="clearfix annualReport-box">
  121. <div className="four-item">
  122. <p className="item-title">发明专利数: </p>
  123. <p>{theData.inventionPatent}</p>
  124. </div>
  125. <div className="four-item">
  126. <p className="item-title">国防专利数: </p>
  127. <p>{theData.defensePatent}</p>
  128. </div>
  129. <div className="four-item">
  130. <p className="item-title">国家级农作物品种数: </p>
  131. <p>{theData.nationalCrop}</p>
  132. </div>
  133. <div className="four-item">
  134. <p className="item-title">植物新品种数: </p>
  135. <p>{theData.newPlantCariety}</p>
  136. </div>
  137. <div className="four-item">
  138. <p className="item-title">国家新药数: </p>
  139. <p>{theData.nationalDrug}</p>
  140. </div>
  141. <div className="four-item">
  142. <p className="item-title">国家一级中药保护品种数: </p>
  143. <p>{theData.chineseMedicine}</p>
  144. </div>
  145. <div className="four-item">
  146. <p className="item-title">实用新型专利数: </p>
  147. <p>{theData.utilityPatent}</p>
  148. </div>
  149. <div className="four-item">
  150. <p className="item-title">集成电路布图设计专有权数: </p>
  151. <p>{theData.circuitDesign}</p>
  152. </div>
  153. <div className="four-item">
  154. <p className="item-title">外观设计专利数: </p>
  155. <p>{theData.exteriorPatent}</p>
  156. </div>
  157. <div className="four-item">
  158. <p className="item-title">软件著作权数: </p>
  159. <p>{theData.softwareWorks}</p>
  160. </div>
  161. </div>
  162. <div className="activityCost-title"><span>本年度人员情况(人): </span></div>
  163. <div className="clearfix annualReport-box">
  164. <div className="four-item">
  165. <p className="item-title">职工总人数: </p>
  166. <p>{theData.firmTotal}</p>
  167. </div>
  168. <div className="four-item">
  169. <p className="item-title">科技人员数: </p>
  170. <p>{theData.techTotal}</p>
  171. </div>
  172. <div className="four-item">
  173. <p className="item-title">新增就业人数: </p>
  174. <p>{theData.newEmployment}</p>
  175. </div>
  176. <div className="four-item">
  177. <p className="item-title">高校应届毕业生人数: </p>
  178. <p>{theData.graduateNumber}</p>
  179. </div>
  180. </div>
  181. <div className="activityCost-title"><span>企业本年度财务状况(万元): </span></div>
  182. <div className="clearfix annualReport-box">
  183. <div className="four-item">
  184. <p className="item-title">企业总收入: </p>
  185. <p>{theData.totalRevenue}</p>
  186. </div>
  187. <div className="four-item">
  188. <p className="item-title">销售收入: </p>
  189. <p>{theData.salesRevenue}</p>
  190. </div>
  191. <div className="four-item">
  192. <p className="item-title">所有者权益(净资产)合计: </p>
  193. <p>{theData.netAsset}</p>
  194. </div>
  195. <div className="four-item">
  196. <p className="item-title">高新技术产品(服务)收入:
  197. </p>
  198. <p>
  199. <span>{theData.lastYearRevenue} </span>
  200. {(() => {
  201. if ( theData.totalRevenue != 0 ) {
  202. let s = ( theData.lastYearRevenue / theData.totalRevenue * 100).toFixed(2);
  203. if (s < 60) {
  204. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于60%</span>
  205. } else {
  206. return <span> 占比总收入的{s}%</span>
  207. };
  208. } else {
  209. return <span style={{ color: '#ea0862' }}> 占比总收入的0%</span>
  210. }
  211. })()}
  212. </p>
  213. </div>
  214. <div className="four-item">
  215. <p className="item-title">利润总额: </p>
  216. <p>{theData.grossProfit}</p>
  217. </div>
  218. <div className="four-item">
  219. <p className="item-title">研发费用总额:
  220. </p>
  221. <p>
  222. <span>{theData.researchCost} </span>
  223. {(() => {
  224. if ( theData.salesRevenue != 0 ) {
  225. let s = (theData.researchCost / theData.salesRevenue * 100).toFixed(2);
  226. if (theData.salesRevenue < 5000) {
  227. if (s < 5) {
  228. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于5%</span>
  229. } else {
  230. return <span> 占比总收入的{s}%</span>
  231. };
  232. } else if (5000 < theData.salesRevenue < 20000) {
  233. if (s < 4) {
  234. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于4%</span>
  235. } else {
  236. return <span> 占比总收入的{s}%</span>
  237. };
  238. } else if (theData.salesRevenue >= 20000) {
  239. if (s < 3) {
  240. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于3%</span>
  241. } else {
  242. return <span> 占比总收入的{s}%</span>
  243. };
  244. }
  245. } else {
  246. return <span style={{ color: '#ea0862' }}> 占比总收入的0%</span>
  247. }
  248. })()}
  249. </p>
  250. </div>
  251. <div className="four-item" style={{ marginRight: '25%' }}>
  252. <p className="item-title">在中国境内研发费用: </p>
  253. <p>{theData.territory}</p>
  254. </div>
  255. <div className="four-item">
  256. <p className="item-title">纳税总额: </p>
  257. <FormItem
  258. {...formItemLayout}
  259. >
  260. {getFieldDecorator('totalTax', {
  261. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  262. initialValue: this.props.data.totalTax
  263. })(
  264. <InputNumber />
  265. )}
  266. </FormItem>
  267. </div>
  268. <div className="four-item">
  269. <p className="item-title">高企所得税减免额: </p>
  270. <FormItem
  271. {...formItemLayout}
  272. >
  273. {getFieldDecorator('incomeTaxRelief', {
  274. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  275. initialValue: this.props.data.incomeTaxRelief
  276. })(
  277. <InputNumber />
  278. )}
  279. </FormItem>
  280. </div>
  281. <div className="four-item">
  282. <p className="item-title">出口创汇总额(人民币): </p>
  283. <FormItem
  284. {...formItemLayout}
  285. >
  286. {getFieldDecorator('totalExportVolume', {
  287. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  288. initialValue: this.props.data.totalExportVolume
  289. })(
  290. <InputNumber />
  291. )}
  292. </FormItem>
  293. </div>
  294. <div className="four-item">
  295. <p className="item-title">基础研究投入费用: </p>
  296. <FormItem
  297. {...formItemLayout}
  298. >
  299. {getFieldDecorator('basicResearchCost', {
  300. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  301. initialValue: this.props.data.basicResearchCost
  302. })(
  303. <InputNumber />
  304. )}
  305. </FormItem>
  306. </div>
  307. </div>
  308. <FormItem style={{ marginTop: '20px' }}>
  309. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  310. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  311. </FormItem>
  312. </Form >
  313. );
  314. } else {
  315. return (
  316. <div></div>
  317. )
  318. }
  319. },
  320. }));
  321. const AnnualReportDesc = React.createClass({
  322. loadData(v) {
  323. this.setState({
  324. loading: true
  325. });
  326. $.ajax({
  327. method: "post",
  328. dataType: "json",
  329. crossDomain: false,
  330. url: globalConfig.context + "/api/admin/annualReportDetail",
  331. data: {
  332. year: this.props.data ? this.props.data.year : (new Date().getFullYear() - 1),
  333. uid: this.props.uid
  334. }
  335. }).done((data) => {
  336. if (!data.data) {
  337. if (data.error && data.error.length) {
  338. message.warning(data.error[0].message);
  339. }
  340. return;
  341. };
  342. let thisdata = data.data;
  343. this.state.detailData = {
  344. id: thisdata.id,
  345. uid: thisdata.uid,
  346. unitName: thisdata.unitName,
  347. orgCode: thisdata.orgCode,
  348. locationProvince: thisdata.locationProvince,
  349. locationCity: thisdata.locationCity,
  350. locationArea: thisdata.locationArea,
  351. location: thisdata.locationProvince + " / " + thisdata.locationCity + " / " + thisdata.locationArea,
  352. certificateNumber: thisdata.certificateNumber,
  353. issuingDate: thisdata.issuingDate,
  354. issuingDateFormattedDate: thisdata.issuingDateFormattedDate,
  355. listed: thisdata.listed,
  356. listedDate: thisdata.listedDate,
  357. listedDateFormattedDate: thisdata.listedDateFormattedDate,
  358. listedType: thisdata.listedType,
  359. stockCode: thisdata.stockCode,
  360. contacts: thisdata.contacts,
  361. inventionPatent: thisdata.inventionPatent,
  362. defensePatent: thisdata.defensePatent,
  363. nationalCrop: thisdata.nationalCrop,
  364. newPlantCariety: thisdata.newPlantCariety,
  365. nationalDrug: thisdata.nationalDrug,
  366. chineseMedicine: thisdata.chineseMedicine,
  367. utilityPatent: thisdata.utilityPatent,
  368. circuitDesign: thisdata.circuitDesign,
  369. exteriorPatent: thisdata.exteriorPatent,
  370. softwareWorks: thisdata.softwareWorks,
  371. firmTotal: thisdata.firmTotal,
  372. techTotal: thisdata.techTotal,
  373. newEmployment: thisdata.newEmployment,
  374. graduateNumber: thisdata.graduateNumber,
  375. totalRevenue: thisdata.totalRevenue,
  376. salesRevenue: thisdata.salesRevenue,
  377. netAsset: thisdata.netAsset,
  378. lastYearRevenue: thisdata.lastYearRevenue,
  379. grossProfit: thisdata.grossProfit,
  380. researchCost: thisdata.researchCost,
  381. territory: thisdata.territory
  382. };
  383. }).always(function () {
  384. this.setState({
  385. loading: false,
  386. visible: v
  387. });
  388. }.bind(this));
  389. },
  390. getInitialState() {
  391. return {
  392. visible: false,
  393. loading: false
  394. };
  395. },
  396. componentWillReceiveProps(nextProps) {
  397. if (nextProps.showDesc) {
  398. this.loadData(nextProps.showDesc);
  399. };
  400. },
  401. showModal() {
  402. this.setState({
  403. visible: true,
  404. });
  405. },
  406. handleOk() {
  407. this.setState({
  408. visible: false,
  409. });
  410. this.props.closeDesc(false, true);
  411. },
  412. handleCancel(e) {
  413. this.setState({
  414. visible: false,
  415. });
  416. this.props.closeDesc(false);
  417. },
  418. spinChange(e) {
  419. this.setState({
  420. loading: e
  421. });
  422. },
  423. render() {
  424. return (
  425. <div className="patent-addNew">
  426. <Spin spinning={this.state.loading} className='spin-box'>
  427. <Modal title="企业年报信息" visible={this.state.visible}
  428. onOk={this.handleOk} onCancel={this.handleCancel}
  429. width='1000px'
  430. footer=''
  431. >
  432. <AnnualReportDescFrom
  433. uid={this.props.uid}
  434. data={this.props.data}
  435. detailData={this.state.detailData}
  436. spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
  437. </Modal>
  438. </Spin>
  439. </div>
  440. );
  441. },
  442. });
  443. const AnnualReportAdd = React.createClass({
  444. getInitialState() {
  445. return {
  446. visible: false,
  447. loading: false,
  448. yearOption: []
  449. };
  450. },
  451. componentWillReceiveProps(nextProps) {
  452. this.state.visible = nextProps.showAdd
  453. },
  454. componentWillMount() {
  455. let d = new Date();
  456. let _me = this;
  457. d = d.getFullYear();
  458. for (let i = d; i > d - 20; i--) {
  459. _me.state.yearOption.push(
  460. <Select.Option value={i.toString()} key={i}>{i}</Select.Option>
  461. )
  462. };
  463. },
  464. showModal() {
  465. this.setState({
  466. visible: true,
  467. });
  468. },
  469. handleOk() {
  470. this.setState({
  471. loading: true
  472. });
  473. if (!this.state.year) {
  474. message.warning('请选择年份!');
  475. this.setState({
  476. loading: false
  477. });
  478. return;
  479. };
  480. $.ajax({
  481. method: "POST",
  482. dataType: "json",
  483. crossDomain: false,
  484. url: globalConfig.context + "/api/admin/disposeAnnualReport",
  485. data: {
  486. uid: this.props.uid,
  487. year: this.state.year,
  488. totalTax: this.state.totalTax,
  489. incomeTaxRelief: this.state.incomeTaxRelief,
  490. totalExportVolume: this.state.totalExportVolume,
  491. basicResearchCost: this.state.basicResearchCost,
  492. state: 0
  493. }
  494. }).done(function (data) {
  495. if (!data.error.length) {
  496. message.success('保存成功!');
  497. this.setState({
  498. visible: false
  499. });
  500. this.props.closeAdd(false, true);
  501. } else {
  502. message.warning(data.error[0].message);
  503. this.setState({
  504. loading: false
  505. });
  506. }
  507. }.bind(this));
  508. },
  509. handleCancel(e) {
  510. this.setState({
  511. visible: false,
  512. });
  513. this.props.closeAdd(false);
  514. },
  515. spinChange(e) {
  516. this.setState({
  517. loading: e
  518. });
  519. },
  520. render() {
  521. return (
  522. <div className="cognizance-add">
  523. <Modal title="年报申请" visible={this.state.visible}
  524. onOk={this.handleOk} onCancel={this.handleCancel}
  525. width='800px'
  526. footer={[
  527. <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>
  528. 提交
  529. </Button>,
  530. <Button key="back" onClick={this.handleCancel}>
  531. 返回
  532. </Button>,
  533. ]}
  534. >
  535. <div className="clearfix">
  536. <div className="half-item">
  537. <span>选择申请年份: </span>
  538. <Select placeholder="请选择年份" style={{ width: 200 }}
  539. onSelect={(e, n) => { this.state.year = e }}>
  540. {this.state.yearOption}
  541. </Select>
  542. </div>
  543. </div>
  544. <div className="clearfix">
  545. <div className="half-item">
  546. <span>纳税总额: </span>
  547. <InputNumber onChange={(e) => { this.state.totalTax = e; }} />
  548. <span>(万元)</span>
  549. </div>
  550. <div className="half-item">
  551. <span>高企所得税减免额: </span>
  552. <InputNumber onChange={(e) => { this.state.incomeTaxRelief = e; }} />
  553. <span>(万元)</span>
  554. </div>
  555. <div className="half-item">
  556. <span>出口创汇总额(人民币): </span>
  557. <InputNumber onChange={(e) => { this.state.totalExportVolume = e; }} />
  558. <span>(万元)</span>
  559. </div>
  560. <div className="half-item">
  561. <span>基础研究投入费用: </span>
  562. <InputNumber onChange={(e) => { this.state.basicResearchCost = e; }} />
  563. <span>(万元)</span>
  564. </div>
  565. </div>
  566. </Modal>
  567. </div>
  568. );
  569. }
  570. });
  571. const AnnualReport = React.createClass({
  572. loadData(pageNo) {
  573. this.state.data = [];
  574. this.setState({
  575. loading: true
  576. });
  577. $.ajax({
  578. method: "post",
  579. dataType: "json",
  580. crossDomain: false,
  581. url: globalConfig.context + "/api/admin/annualReport",
  582. data: {
  583. pageNo: pageNo || 1,
  584. pageSize: this.state.pagination.pageSize,
  585. uid: this.props.data.uid
  586. }
  587. }).done((data) => {
  588. if (!data.data || !data.data.list) {
  589. if (data.error.length) {
  590. message.warning(data.error[0].message);
  591. };
  592. return;
  593. };
  594. for (let i = 0; i < data.data.list.length; i++) {
  595. let thisdata = data.data.list[i];
  596. this.state.data.push({
  597. key: i,
  598. id: thisdata.id,
  599. uid: thisdata.uid,
  600. createTime: thisdata.createTime,
  601. lastUpdateTime: thisdata.lastUpdateTime,
  602. totalTax: thisdata.totalTax,
  603. incomeTaxRelief: thisdata.incomeTaxRelief,
  604. totalExportVolume: thisdata.totalExportVolume,
  605. year: thisdata.year,
  606. state: thisdata.state,
  607. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  608. lastUpdateTimeFormattedDate: thisdata.lastUpdateTimeFormattedDate,
  609. basicResearchCost: thisdata.basicResearchCost
  610. });
  611. };
  612. this.state.pagination.current = data.data.pageNo;
  613. this.state.pagination.total = data.data.totalCount;
  614. this.setState({
  615. dataSource: this.state.data,
  616. pagination: this.state.pagination
  617. });
  618. }).always(function () {
  619. this.setState({
  620. loading: false
  621. });
  622. }.bind(this));
  623. },
  624. getInitialState() {
  625. return {
  626. selectedRowKeys: [],
  627. selectedRows: [],
  628. loading: false,
  629. pagination: {
  630. defaultCurrent: 1,
  631. defaultPageSize: 10,
  632. showQuickJumper: true,
  633. pageSize: 10,
  634. onChange: function (page) {
  635. this.loadData(page);
  636. }.bind(this),
  637. showTotal: function (total) {
  638. return '共' + total + '条数据';
  639. }
  640. },
  641. columns: [
  642. {
  643. title: '年份',
  644. dataIndex: 'year',
  645. key: 'year'
  646. }, {
  647. title: '创建时间',
  648. dataIndex: 'createTimeFormattedDate',
  649. key: 'createTimeFormattedDate'
  650. }, {
  651. title: '最近更新时间',
  652. dataIndex: 'lastUpdateTimeFormattedDate',
  653. key: 'lastUpdateTimeFormattedDate'
  654. }, {
  655. title: '年报状态',
  656. dataIndex: 'state',
  657. key: 'state',
  658. render: (text) => {
  659. return getAnnualReportState(text)
  660. }
  661. }
  662. ],
  663. dataSource: []
  664. };
  665. },
  666. componentWillMount() {
  667. this.loadData();
  668. },
  669. tableRowClick(record, index) {
  670. this.state.RowData = record;
  671. this.setState({
  672. showDesc: true
  673. });
  674. },
  675. delectRow() {
  676. let deletedIds = [];
  677. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  678. let rowItem = this.state.selectedRows[idx];
  679. if (rowItem.id) {
  680. deletedIds.push(rowItem.id)
  681. }
  682. }
  683. this.setState({
  684. selectedRowKeys: [],
  685. loading: deletedIds.length > 0
  686. });
  687. $.ajax({
  688. method: "POST",
  689. dataType: "json",
  690. crossDomain: false,
  691. url: globalConfig.context + "/api/user/deleteAnnualReport",
  692. data: {
  693. ids: deletedIds
  694. }
  695. }).done(function (data) {
  696. if (!data.error.length) {
  697. message.success('删除成功!');
  698. this.setState({
  699. loading: false,
  700. });
  701. } else {
  702. message.warning(data.error[0].message);
  703. };
  704. this.loadData();
  705. }.bind(this));
  706. },
  707. closeDesc(e, s) {
  708. this.state.showDesc = e;
  709. if (s) {
  710. this.loadData();
  711. };
  712. },
  713. addClick() {
  714. this.setState({
  715. showAdd: true
  716. });
  717. },
  718. closeAdd(e, s) {
  719. this.state.showAdd = e;
  720. if (s) {
  721. this.loadData();
  722. };
  723. },
  724. // search() {
  725. // this.loadData();
  726. // },
  727. // reset() {
  728. // this.loadData();
  729. // },
  730. render() {
  731. const rowSelection = {
  732. selectedRowKeys: this.state.selectedRowKeys,
  733. onChange: (selectedRowKeys, selectedRows) => {
  734. this.setState({
  735. selectedRows: selectedRows,
  736. selectedRowKeys: selectedRowKeys
  737. });
  738. }
  739. };
  740. const hasSelected = this.state.selectedRowKeys.length > 0;
  741. return (
  742. <div className="user-content" >
  743. <div className="content-title">
  744. <span>企业年报</span>
  745. </div>
  746. <div className="user-search">
  747. <p>
  748. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  749. onClick={this.addClick}>添加<Icon type="plus" /></Button>
  750. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  751. disabled={!hasSelected}
  752. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  753. </p>
  754. </div>
  755. <div className="patent-table">
  756. <Spin spinning={this.state.loading}>
  757. <Table columns={this.state.columns}
  758. dataSource={this.state.dataSource}
  759. pagination={this.state.pagination}
  760. rowSelection={rowSelection}
  761. onRowClick={this.tableRowClick} />
  762. </Spin>
  763. </div>
  764. <AnnualReportDesc
  765. uid={this.props.data.uid}
  766. data={this.state.RowData}
  767. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  768. <AnnualReportAdd
  769. uid={this.props.data.uid}
  770. showAdd={this.state.showAdd}
  771. closeAdd={this.closeAdd} />
  772. </div >
  773. );
  774. }
  775. });
  776. export default AnnualReport;