patentFees.js 6.2 KB

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