List.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :group-actions="groupActions"
  6. :single-actions="singleActions" />
  7. </template>
  8. <script>
  9. import ColumnsMixin from '../mixins/columns'
  10. import SingleActionsMixin from '../mixins/singleActions'
  11. import { getNameFilter } from '@/utils/common/tableFilter'
  12. import WindowsMixin from '@/mixins/windows'
  13. import ListMixin from '@/mixins/list'
  14. export default {
  15. name: 'K8SFederatednamespaceList',
  16. mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
  17. props: {
  18. id: String,
  19. getParams: {
  20. type: Object,
  21. default: () => ({}),
  22. },
  23. },
  24. data () {
  25. return {
  26. list: this.$list.createList(this, {
  27. id: this.id,
  28. resource: 'federatednamespaces',
  29. apiVersion: 'v1',
  30. getParams: this.getParams,
  31. filterOptions: {
  32. name: getNameFilter(),
  33. },
  34. }),
  35. groupActions: [
  36. {
  37. label: this.$t('k8s.create'),
  38. permission: 'k8s_federatednamespaces_create',
  39. action: () => {
  40. this.$router.push({ path: '/k8s-federatednamespace/create' })
  41. },
  42. meta: () => ({
  43. buttonType: 'primary',
  44. }),
  45. },
  46. {
  47. label: this.$t('k8s.text_201'),
  48. permission: 'k8s_federatednamespaces_delete',
  49. action: () => {
  50. this.createDialog('DeleteResDialog', {
  51. vm: this,
  52. data: this.list.selectedItems,
  53. columns: this.columns,
  54. title: this.$t('k8s.text_284'),
  55. name: this.$t('k8s.text_23'),
  56. onManager: this.onManager,
  57. requestParams: {
  58. id: this.list.selectedItems.map(item => item.id),
  59. },
  60. })
  61. },
  62. meta: () => this.$getDeleteResult(this.list.selectedItems),
  63. },
  64. ],
  65. }
  66. },
  67. created () {
  68. this.fetchData()
  69. },
  70. methods: {
  71. fetchData () {
  72. this.list.fetchData()
  73. },
  74. handleOpenSidepage (row) {
  75. this.sidePageTriggerHandle(this, 'K8SFederatednamespaceSidePage', {
  76. id: row.id,
  77. resource: 'federatednamespaces',
  78. apiVersion: 'v1',
  79. getParams: this.list.getParams,
  80. }, {
  81. list: this.list,
  82. })
  83. },
  84. },
  85. }
  86. </script>