patentFees.js 7.8 KB

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