List.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :group-actions="groupActions"
  6. :single-actions="singleActions"
  7. :export-data-options="exportDataOptions" />
  8. </template>
  9. <script>
  10. import ColumnsMixin from '../mixins/columns'
  11. import SingleActionsMixin from '../mixins/singleActions'
  12. import { STRATEGY_OPT } from '@Cloudenv/constants/sched'
  13. import ListMixin from '@/mixins/list'
  14. import WindowsMixin from '@/mixins/windows'
  15. import { getNameFilter, getEnabledFilter, getFilter, getDescriptionFilter, getCreatedAtFilter } from '@/utils/common/tableFilter'
  16. const getParams = { details: true }
  17. export default {
  18. name: 'SchedpolicyList',
  19. mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
  20. props: {
  21. id: String,
  22. },
  23. data () {
  24. return {
  25. list: this.$list.createList(this, {
  26. id: this.id,
  27. resource: 'schedpolicies',
  28. getParams,
  29. filterOptions: {
  30. name: getNameFilter(),
  31. description: getDescriptionFilter(),
  32. enabled: getEnabledFilter(),
  33. strategy: {
  34. label: this.$t('cloudenv.text_413'),
  35. dropdown: true,
  36. multiple: true,
  37. items: STRATEGY_OPT,
  38. },
  39. schedtag: getFilter({
  40. field: 'schedtag',
  41. title: this.$t('cloudenv.text_18'),
  42. }),
  43. created_at: getCreatedAtFilter(),
  44. },
  45. hiddenColumns: ['created_at'],
  46. }),
  47. exportDataOptions: {
  48. items: [
  49. { label: 'ID', key: 'id' },
  50. { label: this.$t('cloudenv.text_95'), key: 'name' },
  51. { label: this.$t('cloudenv.text_97'), key: 'enabled' },
  52. { label: this.$t('cloudenv.text_413'), key: 'strategy' },
  53. { label: this.$t('cloudenv.text_18'), key: 'schedtag' },
  54. { label: this.$t('cloudenv.text_22'), key: 'condition' },
  55. { label: this.$t('common.createdAt'), key: 'created_at' },
  56. ],
  57. },
  58. groupActions: [
  59. {
  60. label: this.$t('cloudenv.text_104'),
  61. permission: 'schedpolicies_create',
  62. action: () => {
  63. this.createDialog('CreateSchedpolicyDialog', {
  64. title: this.$t('cloudenv.text_414'),
  65. onManager: this.onManager,
  66. })
  67. },
  68. meta: () => {
  69. return {
  70. buttonType: 'primary',
  71. }
  72. },
  73. },
  74. {
  75. label: this.$t('cloudenv.text_108'),
  76. permission: 'schedpolicies_delete',
  77. action: () => {
  78. this.createDialog('DeleteResDialog', {
  79. vm: this,
  80. data: this.list.selectedItems,
  81. columns: this.columns,
  82. title: this.$t('cloudenv.text_415'),
  83. name: this.$t('dictionary.schedpolicie'),
  84. onManager: this.onManager,
  85. })
  86. },
  87. meta: () => {
  88. return {
  89. validate: this.list.allowDelete(),
  90. }
  91. },
  92. },
  93. ],
  94. }
  95. },
  96. created () {
  97. this.initSidePageTab('schedpolicy-detail')
  98. this.list.fetchData()
  99. },
  100. methods: {
  101. handleOpenSidepage (row) {
  102. this.sidePageTriggerHandle(this, 'SchedpolicySidePage', {
  103. id: row.id,
  104. resource: 'schedpolicies',
  105. getParams,
  106. }, {
  107. list: this.list,
  108. })
  109. },
  110. },
  111. }
  112. </script>