annualReport.jsx 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  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. let s = (theData.lastYearRevenue / theData.totalRevenue * 100).toFixed(2);
  202. if (s < 50) {
  203. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于60%</span>
  204. } else {
  205. return <span> 占比总收入的{s}%</span>
  206. };
  207. })()}
  208. </p>
  209. </div>
  210. <div className="four-item">
  211. <p className="item-title">利润总额: </p>
  212. <p>{theData.grossProfit}</p>
  213. </div>
  214. <div className="four-item">
  215. <p className="item-title">研发费用总额:
  216. </p>
  217. <p>
  218. <span>{theData.researchCost} </span>
  219. {(() => {
  220. let s = (theData.researchCost / theData.salesRevenue * 100).toFixed(2);
  221. if (theData.salesRevenue < 5000) {
  222. if (s < 5) {
  223. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于60%</span>
  224. } else {
  225. return <span> 占比总收入的{s}%</span>
  226. };
  227. } else if (5000 < theData.salesRevenue < 20000) {
  228. if (s < 4) {
  229. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于60%</span>
  230. } else {
  231. return <span> 占比总收入的{s}%</span>
  232. };
  233. } else if (theData.salesRevenue >= 20000) {
  234. if (s < 3) {
  235. return <span style={{ color: '#ea0862' }}> 占比总收入的{s}%,小于60%</span>
  236. } else {
  237. return <span> 占比总收入的{s}%</span>
  238. };
  239. }
  240. })()}
  241. </p>
  242. </div>
  243. <div className="four-item" style={{ marginRight: '25%' }}>
  244. <p className="item-title">在中国境内研发费用: </p>
  245. <p>{theData.territory}</p>
  246. </div>
  247. <div className="four-item">
  248. <p className="item-title">纳税总额: </p>
  249. <FormItem
  250. {...formItemLayout}
  251. >
  252. {getFieldDecorator('totalTax', {
  253. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  254. initialValue: this.props.data.totalTax
  255. })(
  256. <InputNumber />
  257. )}
  258. </FormItem>
  259. </div>
  260. <div className="four-item">
  261. <p className="item-title">高企所得税减免额: </p>
  262. <FormItem
  263. {...formItemLayout}
  264. >
  265. {getFieldDecorator('incomeTaxRelief', {
  266. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  267. initialValue: this.props.data.incomeTaxRelief
  268. })(
  269. <InputNumber />
  270. )}
  271. </FormItem>
  272. </div>
  273. <div className="four-item">
  274. <p className="item-title">出口创汇总额(人民币): </p>
  275. <FormItem
  276. {...formItemLayout}
  277. >
  278. {getFieldDecorator('totalExportVolume', {
  279. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  280. initialValue: this.props.data.totalExportVolume
  281. })(
  282. <InputNumber />
  283. )}
  284. </FormItem>
  285. </div>
  286. <div className="four-item">
  287. <p className="item-title">基础研究投入费用: </p>
  288. <FormItem
  289. {...formItemLayout}
  290. >
  291. {getFieldDecorator('basicResearchCost', {
  292. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  293. initialValue: this.props.data.basicResearchCost
  294. })(
  295. <InputNumber />
  296. )}
  297. </FormItem>
  298. </div>
  299. </div>
  300. <FormItem style={{ marginTop: '20px' }}>
  301. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  302. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  303. </FormItem>
  304. </Form >
  305. );
  306. } else {
  307. return (
  308. <div></div>
  309. )
  310. }
  311. },
  312. }));
  313. const AnnualReportDesc = React.createClass({
  314. loadData(v) {
  315. this.setState({
  316. loading: true
  317. });
  318. $.ajax({
  319. method: "post",
  320. dataType: "json",
  321. crossDomain: false,
  322. url: globalConfig.context + "/api/admin/annualReportDetail",
  323. data: {
  324. year: this.props.data ? this.props.data.year : (new Date().getFullYear() - 1),
  325. uid: this.props.uid
  326. }
  327. }).done((data) => {
  328. if (!data.data) {
  329. if (data.error && data.error.length) {
  330. message.warning(data.error[0].message);
  331. }
  332. return;
  333. };
  334. let thisdata = data.data;
  335. this.state.detailData = {
  336. id: thisdata.id,
  337. uid: thisdata.uid,
  338. unitName: thisdata.unitName,
  339. orgCode: thisdata.orgCode,
  340. locationProvince: thisdata.locationProvince,
  341. locationCity: thisdata.locationCity,
  342. locationArea: thisdata.locationArea,
  343. location: thisdata.locationProvince + " / " + thisdata.locationCity + " / " + thisdata.locationArea,
  344. certificateNumber: thisdata.certificateNumber,
  345. issuingDate: thisdata.issuingDate,
  346. issuingDateFormattedDate: thisdata.issuingDateFormattedDate,
  347. listed: thisdata.listed,
  348. listedDate: thisdata.listedDate,
  349. listedDateFormattedDate: thisdata.listedDateFormattedDate,
  350. listedType: thisdata.listedType,
  351. stockCode: thisdata.stockCode,
  352. contacts: thisdata.contacts,
  353. inventionPatent: thisdata.inventionPatent,
  354. defensePatent: thisdata.defensePatent,
  355. nationalCrop: thisdata.nationalCrop,
  356. newPlantCariety: thisdata.newPlantCariety,
  357. nationalDrug: thisdata.nationalDrug,
  358. chineseMedicine: thisdata.chineseMedicine,
  359. utilityPatent: thisdata.utilityPatent,
  360. circuitDesign: thisdata.circuitDesign,
  361. exteriorPatent: thisdata.exteriorPatent,
  362. softwareWorks: thisdata.softwareWorks,
  363. firmTotal: thisdata.firmTotal,
  364. techTotal: thisdata.techTotal,
  365. newEmployment: thisdata.newEmployment,
  366. graduateNumber: thisdata.graduateNumber,
  367. totalRevenue: thisdata.totalRevenue,
  368. salesRevenue: thisdata.salesRevenue,
  369. netAsset: thisdata.netAsset,
  370. lastYearRevenue: thisdata.lastYearRevenue,
  371. grossProfit: thisdata.grossProfit,
  372. researchCost: thisdata.researchCost,
  373. territory: thisdata.territory
  374. };
  375. }).always(function () {
  376. this.setState({
  377. loading: false,
  378. visible: v
  379. });
  380. }.bind(this));
  381. },
  382. getInitialState() {
  383. return {
  384. visible: false,
  385. loading: false
  386. };
  387. },
  388. componentWillReceiveProps(nextProps) {
  389. if (nextProps.showDesc) {
  390. this.loadData(nextProps.showDesc);
  391. };
  392. },
  393. showModal() {
  394. this.setState({
  395. visible: true,
  396. });
  397. },
  398. handleOk() {
  399. this.setState({
  400. visible: false,
  401. });
  402. this.props.closeDesc(false, true);
  403. },
  404. handleCancel(e) {
  405. this.setState({
  406. visible: false,
  407. });
  408. this.props.closeDesc(false);
  409. },
  410. spinChange(e) {
  411. this.setState({
  412. loading: e
  413. });
  414. },
  415. render() {
  416. return (
  417. <div className="patent-addNew">
  418. <Spin spinning={this.state.loading} className='spin-box'>
  419. <Modal title="财务报表信息" visible={this.state.visible}
  420. onOk={this.handleOk} onCancel={this.handleCancel}
  421. width='1000px'
  422. footer=''
  423. >
  424. <AnnualReportDescFrom
  425. uid={this.props.uid}
  426. data={this.props.data}
  427. detailData={this.state.detailData}
  428. spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
  429. </Modal>
  430. </Spin>
  431. </div>
  432. );
  433. },
  434. });
  435. const AnnualReportAdd = React.createClass({
  436. getInitialState() {
  437. return {
  438. visible: false,
  439. loading: false,
  440. yearOption: []
  441. };
  442. },
  443. componentWillReceiveProps(nextProps) {
  444. this.state.visible = nextProps.showAdd
  445. },
  446. componentWillMount() {
  447. let d = new Date();
  448. let _me = this;
  449. d = d.getFullYear();
  450. for (let i = d; i > d - 20; i--) {
  451. _me.state.yearOption.push(
  452. <Select.Option value={i.toString()} key={i}>{i}</Select.Option>
  453. )
  454. };
  455. },
  456. showModal() {
  457. this.setState({
  458. visible: true,
  459. });
  460. },
  461. handleOk() {
  462. this.setState({
  463. loading: true
  464. });
  465. if (!this.state.year) {
  466. message.warning('请选择年份!');
  467. this.setState({
  468. loading: false
  469. });
  470. return;
  471. };
  472. $.ajax({
  473. method: "POST",
  474. dataType: "json",
  475. crossDomain: false,
  476. url: globalConfig.context + "/api/admin/disposeAnnualReport",
  477. data: {
  478. uid: this.props.uid,
  479. year: this.state.year,
  480. totalTax: this.state.totalTax,
  481. incomeTaxRelief: this.state.incomeTaxRelief,
  482. totalExportVolume: this.state.totalExportVolume,
  483. basicResearchCost: this.state.basicResearchCost,
  484. state: 0
  485. }
  486. }).done(function (data) {
  487. if (!data.error.length) {
  488. message.success('保存成功!');
  489. this.setState({
  490. visible: false
  491. });
  492. this.props.closeAdd(false, true);
  493. } else {
  494. message.warning(data.error[0].message);
  495. this.setState({
  496. loading: false
  497. });
  498. }
  499. }.bind(this));
  500. },
  501. handleCancel(e) {
  502. this.setState({
  503. visible: false,
  504. });
  505. this.props.closeAdd(false);
  506. },
  507. spinChange(e) {
  508. this.setState({
  509. loading: e
  510. });
  511. },
  512. render() {
  513. return (
  514. <div className="cognizance-add">
  515. <Modal title="年报申请" visible={this.state.visible}
  516. onOk={this.handleOk} onCancel={this.handleCancel}
  517. width='800px'
  518. footer={[
  519. <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>
  520. 提交
  521. </Button>,
  522. <Button key="back" onClick={this.handleCancel}>
  523. 返回
  524. </Button>,
  525. ]}
  526. >
  527. <div className="clearfix">
  528. <div className="half-item">
  529. <span>选择申请年份: </span>
  530. <Select placeholder="请选择年份" style={{ width: 200 }}
  531. onSelect={(e, n) => { this.state.year = e }}>
  532. {this.state.yearOption}
  533. </Select>
  534. </div>
  535. </div>
  536. <div className="clearfix">
  537. <div className="half-item">
  538. <span>纳税总额: </span>
  539. <InputNumber onChange={(e) => { this.state.totalTax = e; }} />
  540. <span>(万元)</span>
  541. </div>
  542. <div className="half-item">
  543. <span>高企所得税减免额: </span>
  544. <InputNumber onChange={(e) => { this.state.incomeTaxRelief = e; }} />
  545. <span>(万元)</span>
  546. </div>
  547. <div className="half-item">
  548. <span>出口创汇总额(人民币): </span>
  549. <InputNumber onChange={(e) => { this.state.totalExportVolume = e; }} />
  550. <span>(万元)</span>
  551. </div>
  552. <div className="half-item">
  553. <span>基础研究投入费用: </span>
  554. <InputNumber onChange={(e) => { this.state.basicResearchCost = e; }} />
  555. <span>(万元)</span>
  556. </div>
  557. </div>
  558. </Modal>
  559. </div>
  560. );
  561. }
  562. });
  563. const AnnualReport = React.createClass({
  564. loadData(pageNo) {
  565. this.state.data = [];
  566. this.setState({
  567. loading: true
  568. });
  569. $.ajax({
  570. method: "post",
  571. dataType: "json",
  572. crossDomain: false,
  573. url: globalConfig.context + "/api/admin/annualReport",
  574. data: {
  575. pageNo: pageNo || 1,
  576. pageSize: this.state.pagination.pageSize,
  577. uid: this.props.data.uid
  578. }
  579. }).done((data) => {
  580. if (!data.data || !data.data.list) {
  581. if (data.error.length) {
  582. message.warning(data.error[0].message);
  583. };
  584. return;
  585. };
  586. for (let i = 0; i < data.data.list.length; i++) {
  587. let thisdata = data.data.list[i];
  588. this.state.data.push({
  589. key: i,
  590. id: thisdata.id,
  591. uid: thisdata.uid,
  592. createTime: thisdata.createTime,
  593. lastUpdateTime: thisdata.lastUpdateTime,
  594. totalTax: thisdata.totalTax,
  595. incomeTaxRelief: thisdata.incomeTaxRelief,
  596. totalExportVolume: thisdata.totalExportVolume,
  597. year: thisdata.year,
  598. state: thisdata.state,
  599. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  600. lastUpdateTimeFormattedDate: thisdata.lastUpdateTimeFormattedDate,
  601. basicResearchCost: thisdata.basicResearchCost
  602. });
  603. };
  604. this.state.pagination.current = data.data.pageNo;
  605. this.state.pagination.total = data.data.totalCount;
  606. this.setState({
  607. dataSource: this.state.data,
  608. pagination: this.state.pagination
  609. });
  610. }).always(function () {
  611. this.setState({
  612. loading: false
  613. });
  614. }.bind(this));
  615. },
  616. getInitialState() {
  617. return {
  618. selectedRowKeys: [],
  619. selectedRows: [],
  620. loading: false,
  621. pagination: {
  622. defaultCurrent: 1,
  623. defaultPageSize: 10,
  624. showQuickJumper: true,
  625. pageSize: 10,
  626. onChange: function (page) {
  627. this.loadData(page);
  628. }.bind(this),
  629. showTotal: function (total) {
  630. return '共' + total + '条数据';
  631. }
  632. },
  633. columns: [
  634. {
  635. title: '年份',
  636. dataIndex: 'year',
  637. key: 'year'
  638. }, {
  639. title: '创建时间',
  640. dataIndex: 'createTimeFormattedDate',
  641. key: 'createTimeFormattedDate'
  642. }, {
  643. title: '最近更新时间',
  644. dataIndex: 'lastUpdateTimeFormattedDate',
  645. key: 'lastUpdateTimeFormattedDate'
  646. }, {
  647. title: '年报状态',
  648. dataIndex: 'state',
  649. key: 'state',
  650. render: (text) => {
  651. return getAnnualReportState(text)
  652. }
  653. }
  654. ],
  655. dataSource: []
  656. };
  657. },
  658. componentWillMount() {
  659. this.loadData();
  660. },
  661. tableRowClick(record, index) {
  662. this.state.RowData = record;
  663. this.setState({
  664. showDesc: true
  665. });
  666. },
  667. delectRow() {
  668. let deletedIds = [];
  669. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  670. let rowItem = this.state.selectedRows[idx];
  671. if (rowItem.id) {
  672. deletedIds.push(rowItem.id)
  673. }
  674. }
  675. this.setState({
  676. selectedRowKeys: [],
  677. loading: deletedIds.length > 0
  678. });
  679. $.ajax({
  680. method: "POST",
  681. dataType: "json",
  682. crossDomain: false,
  683. url: globalConfig.context + "/api/user/cognizance/deleteAnnualReport",
  684. data: {
  685. ids: deletedIds
  686. }
  687. }).done(function (data) {
  688. if (!data.error.length) {
  689. message.success('保存成功!');
  690. this.setState({
  691. loading: false,
  692. });
  693. } else {
  694. message.warning(data.error[0].message);
  695. };
  696. this.loadData();
  697. }.bind(this));
  698. },
  699. closeDesc(e, s) {
  700. this.state.showDesc = e;
  701. if (s) {
  702. this.loadData();
  703. };
  704. },
  705. addClick() {
  706. this.setState({
  707. showAdd: true
  708. });
  709. },
  710. closeAdd(e, s) {
  711. this.state.showAdd = e;
  712. if (s) {
  713. this.loadData();
  714. };
  715. },
  716. // search() {
  717. // this.loadData();
  718. // },
  719. // reset() {
  720. // this.loadData();
  721. // },
  722. render() {
  723. const rowSelection = {
  724. selectedRowKeys: this.state.selectedRowKeys,
  725. onChange: (selectedRowKeys, selectedRows) => {
  726. this.setState({
  727. selectedRows: selectedRows,
  728. selectedRowKeys: selectedRowKeys
  729. });
  730. }
  731. };
  732. const hasSelected = this.state.selectedRowKeys.length > 0;
  733. return (
  734. <div className="user-content" >
  735. <div className="content-title">
  736. <span>企业年报</span>
  737. </div>
  738. <div className="user-search">
  739. <p>
  740. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  741. onClick={this.addClick}>添加<Icon type="plus" /></Button>
  742. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  743. disabled={!hasSelected}
  744. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  745. </p>
  746. </div>
  747. <div className="patent-table">
  748. <Spin spinning={this.state.loading}>
  749. <Table columns={this.state.columns}
  750. dataSource={this.state.dataSource}
  751. pagination={this.state.pagination}
  752. rowSelection={rowSelection}
  753. onRowClick={this.tableRowClick} />
  754. </Spin>
  755. </div>
  756. <AnnualReportDesc
  757. uid={this.props.data.uid}
  758. data={this.state.RowData}
  759. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  760. <AnnualReportAdd
  761. uid={this.props.data.uid}
  762. showAdd={this.state.showAdd}
  763. closeAdd={this.closeAdd} />
  764. </div >
  765. );
  766. }
  767. });
  768. export default AnnualReport;