annualReport.jsx 33 KB

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