officialFees.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. import React,{Component} from 'react';
  2. import {Button, Input, message, Select, Spin, Table, Modal, Popconfirm} from "antd";
  3. import AddOfficialFeePrice from './addOfficialFeePrice'
  4. import $ from "jquery/src/ajax";
  5. import '../content.less';
  6. class OfficialFees extends Component{
  7. constructor(props) {
  8. super(props);
  9. this.state={
  10. type:'',
  11. dataSource: [],
  12. columns: [
  13. {
  14. title: '专利类型',
  15. dataIndex: 'type',
  16. key: 'type',
  17. render: (text) => {
  18. return text === 0 ? '实用新型' : text === 1 ? '外观专利' : '发明专利'
  19. }
  20. },
  21. {
  22. title: '全额(万元)',
  23. dataIndex: 'amount',
  24. key: 'amount',
  25. },
  26. {
  27. title: '减缴85%',
  28. dataIndex: 'proportion85',
  29. key: 'proportion85',
  30. },
  31. {
  32. title: '备注',
  33. dataIndex: 'remarks',
  34. key: 'remarks',
  35. },
  36. {
  37. title: '操作',
  38. dataIndex: 'id',
  39. key: 'id',
  40. render: (text) => {
  41. return <div>
  42. <Popconfirm
  43. title="是否删除?"
  44. onConfirm={() => {
  45. this.deleteOfficialFeePrice(text);
  46. }}
  47. okText="删除"
  48. cancelText="不删除"
  49. >
  50. <Button type="danger" onClick={(e) => {
  51. e.stopPropagation()
  52. }}>
  53. 删除
  54. </Button>
  55. </Popconfirm>
  56. </div>
  57. }
  58. },
  59. ],
  60. addSoftVisible: false,
  61. infor: {},
  62. }
  63. this.loadData = this.loadData.bind(this);
  64. this.tableRowClick = this.tableRowClick.bind(this);
  65. this.reset = this.reset.bind(this);
  66. }
  67. componentDidMount() {
  68. this.loadData();
  69. }
  70. //搜索功能和初始列表加载
  71. loadData() {
  72. this.setState({
  73. loading: true,
  74. });
  75. $.ajax({
  76. method: "get",
  77. dataType: "json",
  78. crossDomain: false,
  79. url: globalConfig.context + '/api/admin/company/listOfficialFeePrice',
  80. data: {
  81. type:this.state.type, //名称
  82. },
  83. success: function (data) {
  84. if (!data.data || !data.data) {
  85. if (data.error && data.error.length) {
  86. message.warning(data.error[0].message);
  87. };
  88. } else {
  89. data.data.map((v,i)=>{v.key = i})
  90. this.setState({
  91. dataSource: data.data,
  92. });
  93. };
  94. }.bind(this),
  95. }).always(function () {
  96. this.setState({
  97. loading: false
  98. });
  99. }.bind(this));
  100. }
  101. tableRowClick(infor) {
  102. this.setState({
  103. addSoftVisible : true,
  104. infor: infor
  105. })
  106. }
  107. reset(){
  108. this.setState({
  109. type:'', //名称
  110. },()=>{
  111. this.loadData();
  112. })
  113. }
  114. //删除
  115. deleteOfficialFeePrice(id) {
  116. let _this = this;
  117. this.setState({
  118. loading: true
  119. });
  120. $.ajax({
  121. method: "post",
  122. dataType: "json",
  123. crossDomain: false,
  124. url:globalConfig.context + '/api/admin/company/deleteOfficialFeePrice',
  125. data:{
  126. id: id
  127. },
  128. }).done(function (data) {
  129. _this.setState({
  130. loading: false
  131. });
  132. if (!data.error.length) {
  133. message.success('删除成功!');
  134. _this.loadData();
  135. } else {
  136. message.warning(data.error[0].message);
  137. }
  138. }.bind(this));
  139. }
  140. render() {
  141. return(
  142. <div className="user-content" >
  143. <div className="content-title">
  144. <div className="user-search" style={{display:'flex',flexFlow:'row',marginBottom:'10px'}}>
  145. <span style={{marginLeft: 'auto'}}>
  146. <Button type="primary" size={'middle'} onClick={()=>{
  147. this.setState({
  148. addSoftVisible : true
  149. })
  150. }}>
  151. 增加
  152. </Button>
  153. </span>
  154. </div>
  155. <div className="patent-table">
  156. <Spin spinning={this.state.loading}>
  157. <Table columns={this.state.columns}
  158. dataSource={this.state.dataSource}
  159. pagination={false}
  160. onRowClick={this.tableRowClick}/>
  161. </Spin>
  162. </div>
  163. </div>
  164. {this.state.addSoftVisible ? <AddOfficialFeePrice
  165. infor={this.state.infor}
  166. visible={this.state.addSoftVisible}
  167. onCancel={()=>{
  168. this.setState({
  169. addSoftVisible : false,
  170. infor: {},
  171. })
  172. }}
  173. successFn={()=>{
  174. this.loadData();
  175. this.setState({
  176. addSoftVisible : false,
  177. infor: {}
  178. })
  179. }}/> : <div/>}
  180. </div>
  181. )
  182. }
  183. }
  184. export default OfficialFees