index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import React from 'react'
  2. import { FilterTable } from 'wptpc-design'
  3. import { Link } from 'dva/router'
  4. import { thanos } from '@/conf/config'
  5. import { Button } from 'antd'
  6. import { Divider, message, Popconfirm } from 'antd'
  7. const apiUrl = `${thanos}/thanos-admin/api/v1/group/list`
  8. class GroupList extends React.PureComponent {
  9. state = {
  10. showModal: false,
  11. params: {}
  12. }
  13. filterSetting = {
  14. rfBtnsJsx: <Link
  15. to={{
  16. pathname: './group/add'
  17. }}
  18. ><Button>新增分组</Button></Link>,
  19. isClearSearch: true,
  20. formFields: [
  21. {
  22. label: '描述:',
  23. type: 'input',
  24. key: 'queryName',
  25. placeholder: '分组名称'
  26. }
  27. ]
  28. // 在接口请求前,可以修改给接口的入参
  29. // beforeSearchFunc: params => {
  30. // params.pageNum = params.pageNum
  31. // }
  32. }
  33. // filtertable的列表配置
  34. tableSetting = {
  35. pagination: {
  36. pageSize: 10
  37. },
  38. columnConfig: [
  39. {
  40. title: 'ID',
  41. dataIndex: 'id'
  42. },
  43. {
  44. title: '分组名称',
  45. dataIndex: 'name'
  46. },
  47. {
  48. title: '描述',
  49. dataIndex: 'description'
  50. },
  51. {
  52. title: '前置函数',
  53. dataIndex: 'preScript'
  54. },
  55. {
  56. title: '后置函数',
  57. dataIndex: 'postScript'
  58. },
  59. {
  60. title: '创建人',
  61. dataIndex: 'createUser'
  62. },
  63. {
  64. title: '修改人',
  65. dataIndex: 'updateUser'
  66. },
  67. {
  68. title: '操作',
  69. dataIndex: 'actions',
  70. // 所有需要弹窗操作的都可以用编辑的逻辑;所有不需要弹窗的操作,比如上架、发布等,都可以用”删除“的逻辑
  71. render: (text, record) => (
  72. <span>
  73. <Link
  74. to={{
  75. pathname: './edit/' + record.name,
  76. state: record
  77. }}
  78. >编辑</Link>
  79. <Divider type="vertical"/>
  80. <Popconfirm
  81. title="确定删除"
  82. onConfirm={() => this.delItem(record)}>
  83. <a>删除</a>
  84. </Popconfirm>
  85. </span>)
  86. }
  87. ],
  88. getRefresh: refresh => {
  89. this.refresh = refresh
  90. }
  91. }
  92. render () {
  93. return (
  94. <div>
  95. <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
  96. />
  97. </div>
  98. )
  99. }
  100. }
  101. export default GroupList