patentFees.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. let _this = this;
  120. this.setState({
  121. loading: true
  122. });
  123. $.ajax({
  124. method: "post",
  125. dataType: "json",
  126. crossDomain: false,
  127. url:globalConfig.context + '/api/admin/company/deletePatentPrice',
  128. data:{
  129. id: id
  130. },
  131. }).done(function (data) {
  132. _this.setState({
  133. loading: false
  134. });
  135. if (!data.error.length) {
  136. message.success('删除成功!');
  137. _this.loadData();
  138. } else {
  139. message.warning(data.error[0].message);
  140. }
  141. }.bind(this));
  142. }
  143. render() {
  144. return(
  145. <div className="user-content" >
  146. <div className="content-title">
  147. <div className="user-search" style={{display:'flex',flexFlow:'row',marginBottom:'10px'}}>
  148. <span style={{marginLeft: 'auto'}}>
  149. <Button type="primary" size={'middle'} onClick={()=>{
  150. this.setState({
  151. addSoftVisible : true
  152. })
  153. }}>
  154. 增加
  155. </Button>
  156. </span>
  157. </div>
  158. <div className="patent-table">
  159. <Spin spinning={this.state.loading}>
  160. <Table columns={this.state.columns}
  161. dataSource={this.state.dataSource}
  162. pagination={false}
  163. onRowClick={this.tableRowClick}/>
  164. </Spin>
  165. </div>
  166. </div>
  167. {this.state.addSoftVisible ? <AddPatentPrice
  168. infor={this.state.infor}
  169. visible={this.state.addSoftVisible}
  170. onCancel={()=>{
  171. this.setState({
  172. addSoftVisible : false,
  173. infor: {},
  174. })
  175. }}
  176. successFn={()=>{
  177. this.loadData();
  178. this.setState({
  179. addSoftVisible : false,
  180. infor: {}
  181. })
  182. }}/> : <div/>}
  183. </div>
  184. )
  185. }
  186. }
  187. export default PatentFees