annualReport.jsx 34 KB

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