List.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 { mapGetters } from 'vuex'
  11. import ColumnsMixin from '../mixins/columns'
  12. import SingleActionsMixin from '../mixins/singleActions'
  13. import WindowsMixin from '@/mixins/windows'
  14. import ListMixin from '@/mixins/list'
  15. import expectStatus from '@/constants/expectStatus'
  16. export default {
  17. name: 'PolicydefinitionList',
  18. mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
  19. props: {
  20. id: String,
  21. },
  22. data () {
  23. return {
  24. list: this.$list.createList(this, {
  25. id: this.id,
  26. resource: 'policy_definitions',
  27. getParams: { details: true },
  28. filterOptions: {
  29. name: {
  30. label: this.$t('cloudenv.text_95'),
  31. filter: true,
  32. formatter: val => {
  33. return `name.contains("${val}")`
  34. },
  35. },
  36. },
  37. }),
  38. exportDataOptions: {
  39. items: [
  40. { label: 'ID', key: 'id' },
  41. { label: this.$t('cloudenv.text_95'), key: 'name' },
  42. { label: this.$t('cloudenv.text_98'), key: 'status' },
  43. { label: this.$t('cloudenv.text_360'), key: 'category' },
  44. { label: this.$t('cloudenv.text_389'), key: 'parameters' },
  45. ],
  46. },
  47. groupActions: [
  48. {
  49. label: this.$t('cloudenv.text_354'),
  50. permission: 'policydefinition_perform_syncstatus',
  51. action: () => {
  52. this.list.batchPerformAction('syncstatus', {}, { status: Object.values(expectStatus.policydefinition).flat() })
  53. },
  54. meta: () => {
  55. return {
  56. validate: this.list.selectedItems && this.list.selectedItems.length > 0,
  57. tooltip: '',
  58. }
  59. },
  60. },
  61. ],
  62. }
  63. },
  64. computed: mapGetters(['isAdminMode']),
  65. created () {
  66. this.initSidePageTab('policydefinition-detail')
  67. this.list.fetchData()
  68. },
  69. methods: {
  70. handleOpenSidepage (row) {
  71. this.sidePageTriggerHandle(this, 'PolicydefinitionSidePage', {
  72. id: row.id,
  73. resource: 'policy_definitions',
  74. getParams: { details: true },
  75. }, {
  76. list: this.list,
  77. })
  78. },
  79. },
  80. }
  81. </script>