officialFees.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. import React,{Component} from 'react';
  2. import {Button, Input, message, Select, Spin, Table, Modal, Popconfirm, Tabs} from "antd";
  3. import AddOfficialFeePrice from './addOfficialFeePrice'
  4. import $ from "jquery/src/ajax";
  5. import '../content.less';
  6. import {ChooseList} from "../../order/orderNew/chooseList";
  7. const TabPane = Tabs.TabPane;
  8. class OfficialFees extends Component{
  9. constructor(props) {
  10. super(props);
  11. this.state={
  12. type:'',
  13. dataSource: [],
  14. columns: [
  15. {
  16. title: '项目类型',
  17. dataIndex: 'type',
  18. key: 'type',
  19. render: (text) => {
  20. return text === 0 ? '实用新型' : text === 1 ? '外观专利' : '发明专利'
  21. }
  22. },
  23. {
  24. title: '专利类型',
  25. dataIndex: 'typePatentName',
  26. key: 'typePatentName',
  27. },
  28. {
  29. title: '全额(万元)',
  30. dataIndex: 'amount',
  31. key: 'amount',
  32. },
  33. {
  34. title: '减缴85%',
  35. dataIndex: 'proportion85',
  36. key: 'proportion85',
  37. },
  38. {
  39. title: '备注',
  40. dataIndex: 'remarks',
  41. key: 'remarks',
  42. },
  43. {
  44. title: '操作',
  45. dataIndex: 'id',
  46. key: 'id',
  47. render: (text) => {
  48. return <div>
  49. <Popconfirm
  50. title="是否删除?"
  51. onConfirm={() => {
  52. this.deleteOfficialFeePrice(text);
  53. }}
  54. okText="删除"
  55. cancelText="不删除"
  56. >
  57. <Button type="danger" onClick={(e) => {
  58. e.stopPropagation()
  59. }}>
  60. 删除
  61. </Button>
  62. </Popconfirm>
  63. </div>
  64. }
  65. },
  66. ],
  67. addSoftVisible: false,
  68. infor: {},
  69. pagination: {
  70. defaultCurrent: 1,
  71. defaultPageSize: 10,
  72. showQuickJumper: true,
  73. pageSize: 10,
  74. onChange: function (page) {
  75. this.loadData(page);
  76. }.bind(this),
  77. showTotal: function (total) {
  78. return "共" + total + "条数据";
  79. },
  80. }
  81. }
  82. this.loadData = this.loadData.bind(this);
  83. this.tableRowClick = this.tableRowClick.bind(this);
  84. this.reset = this.reset.bind(this);
  85. this.changeList = this.changeList.bind(this);
  86. }
  87. componentDidMount() {
  88. this.loadData();
  89. }
  90. //搜索功能和初始列表加载
  91. loadData(pageNo) {
  92. this.setState({
  93. loading: true,
  94. });
  95. $.ajax({
  96. method: "get",
  97. dataType: "json",
  98. crossDomain: false,
  99. url: globalConfig.context + '/api/admin/company/listOfficialFeePrice',
  100. data: {
  101. pageNo: pageNo || 1,
  102. pageSize: this.state.pagination.pageSize,
  103. },
  104. success: function (data) {
  105. if (!data.data || !data.data) {
  106. if (data.error && data.error.length) {
  107. message.warning(data.error[0].message);
  108. };
  109. } else {
  110. data.data.list.map((v,i)=>{v.key = i})
  111. this.state.pagination.current = data.data.pageNo;
  112. this.state.pagination.total = data.data.totalCount;
  113. if (data.data && data.data.list && !data.data.list.length) {
  114. this.state.pagination.current = 0;
  115. this.state.pagination.total = 0;
  116. }
  117. this.setState({
  118. dataSource: data.data.list,
  119. page: data.data.pageNo,
  120. pagination: this.state.pagination,
  121. });
  122. };
  123. }.bind(this),
  124. }).always(function () {
  125. this.setState({
  126. loading: false
  127. });
  128. }.bind(this));
  129. }
  130. tableRowClick(infor) {
  131. this.setState({
  132. addSoftVisible : true,
  133. infor: infor
  134. })
  135. }
  136. reset(){
  137. this.setState({
  138. type:'', //名称
  139. },()=>{
  140. this.loadData();
  141. })
  142. }
  143. //删除
  144. deleteOfficialFeePrice(id) {
  145. let _this = this;
  146. this.setState({
  147. loading: true
  148. });
  149. $.ajax({
  150. method: "post",
  151. dataType: "json",
  152. crossDomain: false,
  153. url:globalConfig.context + '/api/admin/company/deleteOfficialFeePrice',
  154. data:{
  155. id: id
  156. },
  157. }).done(function (data) {
  158. _this.setState({
  159. loading: false
  160. });
  161. if (!data.error.length) {
  162. message.success('删除成功!');
  163. _this.loadData();
  164. } else {
  165. message.warning(data.error[0].message);
  166. }
  167. }.bind(this));
  168. }
  169. changeList(arr) {
  170. const newArr = [];
  171. this.state.columns.forEach(item => {
  172. arr.forEach(val => {
  173. if (val === item.title) {
  174. newArr.push(item);
  175. }
  176. });
  177. });
  178. this.setState({
  179. changeList: newArr
  180. });
  181. }
  182. render() {
  183. return(
  184. <div className="user-content" >
  185. <div className="content-title">
  186. <Tabs defaultActiveKey="1" className="test">
  187. <TabPane tab="操作" key="1">
  188. <div className="user-search" style={{display:'flex',flexFlow:'row',marginBottom:'10px'}}>
  189. <span>
  190. <Button type="primary" size={'middle'} onClick={()=>{
  191. this.setState({
  192. addSoftVisible : true
  193. })
  194. }}>
  195. 增加
  196. </Button>
  197. </span>
  198. </div>
  199. </TabPane>
  200. <TabPane tab="更改表格显示数据" key="2">
  201. <div style={{ marginLeft: 10 }}>
  202. <ChooseList
  203. columns={this.state.columns}
  204. changeFn={this.changeList}
  205. changeList={this.state.changeList}
  206. top={55}
  207. margin={11}
  208. />
  209. </div>
  210. </TabPane>
  211. </Tabs>
  212. <div className="patent-table">
  213. <Spin spinning={this.state.loading}>
  214. <Table size="middle" columns={
  215. this.state.changeList
  216. ? this.state.changeList
  217. : this.state.columns
  218. }
  219. pagination={this.state.pagination}
  220. dataSource={this.state.dataSource}
  221. style={{
  222. cursor: 'pointer',
  223. }}
  224. onRowClick={this.tableRowClick}/>
  225. </Spin>
  226. </div>
  227. </div>
  228. {this.state.addSoftVisible ? <AddOfficialFeePrice
  229. infor={this.state.infor}
  230. visible={this.state.addSoftVisible}
  231. onCancel={()=>{
  232. this.setState({
  233. addSoftVisible : false,
  234. infor: {},
  235. })
  236. }}
  237. successFn={()=>{
  238. this.loadData(this.state.page);
  239. this.setState({
  240. addSoftVisible : false,
  241. infor: {}
  242. })
  243. }}/> : <div/>}
  244. </div>
  245. )
  246. }
  247. }
  248. export default OfficialFees