annualReport.jsx 32 KB

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