annualReport.jsx 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  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 key={i.toString()} >{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. <Modal maskClosable={false} title="企业年报详情" visible={this.state.visible}
  426. onOk={this.handleOk} onCancel={this.handleCancel}
  427. width='1000px'
  428. footer='' >
  429. <Spin spinning={this.state.loading} className='spin-box'>
  430. <AnnualReportDescFrom
  431. data={this.props.data}
  432. detailData={this.state.detailData}
  433. spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
  434. </Spin>
  435. </Modal>
  436. </div>
  437. );
  438. },
  439. });
  440. const AnnualReportAdd = React.createClass({
  441. getInitialState() {
  442. return {
  443. visible: false,
  444. loading: false,
  445. yearOption: []
  446. };
  447. },
  448. componentWillReceiveProps(nextProps) {
  449. this.state.visible = nextProps.showAdd
  450. },
  451. componentWillMount() {
  452. let d = new Date();
  453. let _me = this;
  454. d = d.getFullYear();
  455. for (let i = d; i > d - 20; i--) {
  456. _me.state.yearOption.push(
  457. <Select.Option key={i.toString()} >{i}</Select.Option>
  458. )
  459. };
  460. },
  461. showModal() {
  462. this.setState({
  463. visible: true,
  464. });
  465. },
  466. handleOk() {
  467. this.setState({
  468. loading: true
  469. });
  470. if (!this.state.year) {
  471. message.warning('请选择年份!');
  472. this.setState({
  473. loading: false
  474. });
  475. return;
  476. };
  477. $.ajax({
  478. method: "POST",
  479. dataType: "json",
  480. crossDomain: false,
  481. url: globalConfig.context + "/api/user/cognizance/disposeAnnualReport",
  482. data: {
  483. year: this.state.year,
  484. totalTax: this.state.totalTax,
  485. incomeTaxRelief: this.state.incomeTaxRelief,
  486. totalExportVolume: this.state.totalExportVolume,
  487. basicResearchCost: this.state.basicResearchCost,
  488. state: 0
  489. }
  490. }).done(function (data) {
  491. this.setState({
  492. loading: false
  493. });
  494. if (!data.error.length) {
  495. message.success('保存成功!');
  496. this.setState({
  497. visible: false
  498. });
  499. this.props.closeAdd(false, true);
  500. } else {
  501. message.warning(data.error[0].message);
  502. }
  503. }.bind(this));
  504. },
  505. handleCancel(e) {
  506. this.setState({
  507. visible: false,
  508. });
  509. this.props.closeAdd(false);
  510. },
  511. spinChange(e) {
  512. this.setState({
  513. loading: e
  514. });
  515. },
  516. render() {
  517. return (
  518. <div className="cognizance-add">
  519. <Modal maskClosable={false} title="年报申请" visible={this.state.visible}
  520. onOk={this.handleOk} onCancel={this.handleCancel}
  521. width='800px'
  522. footer={[
  523. <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>
  524. 提交
  525. </Button>,
  526. <Button key="back" onClick={this.handleCancel}>
  527. 返回
  528. </Button>,
  529. ]}
  530. >
  531. <Spin spinning={this.state.loading} className='spin-box'>
  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. </Spin>
  564. </Modal>
  565. </div>
  566. );
  567. }
  568. });
  569. const AnnualReport = React.createClass({
  570. loadData(pageNo) {
  571. this.state.data = [];
  572. this.setState({
  573. loading: true
  574. });
  575. $.ajax({
  576. method: "post",
  577. dataType: "json",
  578. crossDomain: false,
  579. url: globalConfig.context + "/api/user/cognizance/annualReport",
  580. data: {
  581. pageNo: pageNo || 1,
  582. pageSize: this.state.pagination.pageSize,
  583. }
  584. }).done((data) => {
  585. if (!data.data || !data.data.list) {
  586. if (data.error.length) {
  587. message.warning(data.error[0].message);
  588. this.state.ButtonDisabled = true;
  589. };
  590. return;
  591. };
  592. for (let i = 0; i < data.data.list.length; i++) {
  593. let thisdata = data.data.list[i];
  594. this.state.data.push({
  595. key: i,
  596. id: thisdata.id,
  597. uid: thisdata.uid,
  598. createTime: thisdata.createTime,
  599. lastUpdateTime: thisdata.lastUpdateTime,
  600. totalTax: thisdata.totalTax,
  601. incomeTaxRelief: thisdata.incomeTaxRelief,
  602. totalExportVolume: thisdata.totalExportVolume,
  603. year: thisdata.year,
  604. state: thisdata.state,
  605. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  606. lastUpdateTimeFormattedDate: thisdata.lastUpdateTimeFormattedDate,
  607. basicResearchCost: thisdata.basicResearchCost
  608. });
  609. };
  610. this.state.pagination.current = data.data.pageNo;
  611. this.state.pagination.total = data.data.totalCount;
  612. this.setState({
  613. dataSource: this.state.data,
  614. pagination: this.state.pagination
  615. });
  616. }).always(function () {
  617. this.setState({
  618. loading: false
  619. });
  620. }.bind(this));
  621. },
  622. getInitialState() {
  623. return {
  624. selectedRowKeys: [],
  625. selectedRows: [],
  626. loading: false,
  627. pagination: {
  628. defaultCurrent: 1,
  629. defaultPageSize: 10,
  630. showQuickJumper: true,
  631. pageSize: 10,
  632. onChange: function (page) {
  633. this.loadData(page);
  634. }.bind(this),
  635. showTotal: function (total) {
  636. return '共' + total + '条数据';
  637. }
  638. },
  639. columns: [
  640. {
  641. title: '年份',
  642. dataIndex: 'year',
  643. key: 'year'
  644. }, {
  645. title: '创建时间',
  646. dataIndex: 'createTimeFormattedDate',
  647. key: 'createTimeFormattedDate'
  648. }, {
  649. title: '最近更新时间',
  650. dataIndex: 'lastUpdateTimeFormattedDate',
  651. key: 'lastUpdateTimeFormattedDate'
  652. }, {
  653. title: '年报状态',
  654. dataIndex: 'state',
  655. key: 'state',
  656. render: (text) => {
  657. return getAnnualReportState(text)
  658. }
  659. }
  660. ],
  661. dataSource: []
  662. };
  663. },
  664. componentWillMount() {
  665. this.loadData();
  666. },
  667. tableRowClick(record, index) {
  668. this.state.RowData = record;
  669. this.setState({
  670. showDesc: true
  671. });
  672. },
  673. // delectRow() {
  674. // let deletedIds = [];
  675. // for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  676. // let rowItem = this.state.selectedRows[idx];
  677. // if (rowItem.id) {
  678. // deletedIds.push(rowItem.id)
  679. // }
  680. // }
  681. // this.setState({
  682. // selectedRowKeys: [],
  683. // loading: deletedIds.length > 0
  684. // });
  685. // $.ajax({
  686. // method: "POST",
  687. // dataType: "json",
  688. // crossDomain: false,
  689. // url: globalConfig.context + "/api/user/cognizance/deleteAnnualReport",
  690. // data: {
  691. // ids: deletedIds
  692. // }
  693. // }).done(function (data) {
  694. // if (!data.error.length) {
  695. // message.success('保存成功!');
  696. // this.setState({
  697. // loading: false,
  698. // });
  699. // } else {
  700. // message.warning(data.error[0].message);
  701. // };
  702. // this.loadData();
  703. // }.bind(this));
  704. // },
  705. closeDesc(e, s) {
  706. this.state.showDesc = e;
  707. if (s) {
  708. this.loadData();
  709. };
  710. },
  711. addClick() {
  712. this.setState({
  713. showAdd: true
  714. });
  715. },
  716. closeAdd(e, s) {
  717. this.state.showAdd = e;
  718. if (s) {
  719. this.loadData();
  720. };
  721. },
  722. // search() {
  723. // this.loadData();
  724. // },
  725. // reset() {
  726. // this.loadData();
  727. // },
  728. render() {
  729. const rowSelection = {
  730. selectedRowKeys: this.state.selectedRowKeys,
  731. onChange: (selectedRowKeys, selectedRows) => {
  732. this.setState({
  733. selectedRows: selectedRows,
  734. selectedRowKeys: selectedRowKeys
  735. });
  736. }
  737. };
  738. const hasSelected = this.state.selectedRowKeys.length > 0;
  739. return (
  740. <div className="user-content" >
  741. <div className="content-title">
  742. <span>企业年报</span>
  743. </div>
  744. <div className="user-search">
  745. <p>
  746. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  747. disabled={this.state.ButtonDisabled}
  748. onClick={this.addClick}>添加<Icon type="plus" /></Button>
  749. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff", display: 'none' }}
  750. disabled={!hasSelected}
  751. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  752. </p>
  753. </div>
  754. <div className="patent-table">
  755. <Spin spinning={this.state.loading}>
  756. <Table columns={this.state.columns}
  757. dataSource={this.state.dataSource}
  758. pagination={this.state.pagination}
  759. //rowSelection={rowSelection}
  760. onRowClick={this.tableRowClick} />
  761. </Spin>
  762. </div>
  763. <AnnualReportDesc
  764. data={this.state.RowData}
  765. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  766. <AnnualReportAdd
  767. showAdd={this.state.showAdd}
  768. closeAdd={this.closeAdd} />
  769. </div >
  770. );
  771. }
  772. });
  773. export default AnnualReport;