List.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 WindowsMixin from '@/mixins/windows'
  12. import ListMixin from '@/mixins/list'
  13. import { getCreatedAtFilter } from '@/utils/common/tableFilter'
  14. export default {
  15. name: 'NotifyConfigList',
  16. mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
  17. props: {
  18. id: String,
  19. getParams: {
  20. type: Object,
  21. },
  22. },
  23. data () {
  24. return {
  25. list: this.$list.createList(this, {
  26. id: this.id,
  27. resource: 'notifyconfigs',
  28. apiVersion: 'v1',
  29. getParams: this.getParam,
  30. filterOptions: {
  31. name: {
  32. label: this.$t('system.text_101'),
  33. filter: true,
  34. formatter: val => {
  35. return `name.contains("${val}")`
  36. },
  37. },
  38. created_at: getCreatedAtFilter(),
  39. },
  40. hiddenColumns: ['created_at'],
  41. }),
  42. groupActions: [{
  43. label: this.$t('system.text_128'),
  44. permission: 'notifyconfigs_create',
  45. action: () => {
  46. this.$router.push({
  47. path: '/notifyconfig/create',
  48. })
  49. },
  50. meta: () => {
  51. return {
  52. buttonType: 'primary',
  53. }
  54. },
  55. }, {
  56. label: this.$t('system.text_129'),
  57. permission: 'notifyconfigs_delete',
  58. action: (row) => {
  59. this.createDialog('DeleteResDialog', {
  60. vm: this,
  61. data: this.list.selectedItems,
  62. columns: this.columns,
  63. title: this.$t('system.text_129'),
  64. name: this.$t('system.notify_channels'),
  65. onManager: this.onManager,
  66. })
  67. },
  68. meta: () => this.$getDeleteResult(this.list.selectedItems),
  69. }],
  70. }
  71. },
  72. created () {
  73. this.initSidePageTab('detail')
  74. this.list.fetchData()
  75. },
  76. methods: {
  77. getParam () {
  78. const ret = {
  79. ...this.getParams,
  80. details: true,
  81. }
  82. return ret
  83. },
  84. handleOpenSidepage (row) {
  85. this.sidePageTriggerHandle(this, 'NotifyConfigSidePage', {
  86. id: row.id,
  87. resource: 'notifyconfigs',
  88. apiVersion: 'v1',
  89. getParams: this.getParam,
  90. }, {
  91. list: this.list,
  92. })
  93. },
  94. },
  95. }
  96. </script>