List.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <page-list
  3. :columns="columns"
  4. :group-actions="groupActions"
  5. :list="list"
  6. :single-actions="singleActions" />
  7. </template>
  8. <script>
  9. import SingleActionsMixin from '../mixins/singleActions'
  10. import ColumnsMixin from '../mixins/columns'
  11. import WindowsMixin from '@/mixins/windows'
  12. import ListMixin from '@/mixins/list'
  13. import expectStatus from '@/constants/expectStatus'
  14. import { getNameFilter, getStatusFilter } from '@/utils/common/tableFilter'
  15. import { HYPERVISORS_MAP } from '@/constants'
  16. export default {
  17. name: 'RDSAccountList',
  18. mixins: [WindowsMixin, ColumnsMixin, SingleActionsMixin, ListMixin],
  19. props: {
  20. params: {
  21. type: Object,
  22. },
  23. data: {
  24. type: Object,
  25. },
  26. id: {
  27. type: String,
  28. },
  29. },
  30. data () {
  31. return {
  32. list: this.$list.createList(this, {
  33. id: this.id,
  34. resource: 'dbinstanceaccounts',
  35. getParams: this.params,
  36. steadyStatus: Object.values(expectStatus.rdsAccount).flat(),
  37. filterOptions: {
  38. name: getNameFilter(),
  39. status: getStatusFilter('rdsAccount'),
  40. },
  41. }),
  42. groupActions: [
  43. {
  44. label: this.$t('db.text_41'),
  45. permission: 'rds_dbinstanceaccounts_create',
  46. action: () => {
  47. this.createDialog('RDSAccountCreateDialog', {
  48. list: this.list,
  49. title: this.$t('db.text_197'),
  50. rdsItem: this.data,
  51. })
  52. },
  53. meta: () => {
  54. const { engine, provider, brand } = this.data
  55. const { isRunning } = this.commonMeta
  56. const _meta = () => {
  57. if (!isRunning) {
  58. return {
  59. validate: false,
  60. tooltip: this.$t('db.text_198'),
  61. }
  62. }
  63. if (engine === 'SQLServer' && provider === 'Huawei') {
  64. return {
  65. validate: false,
  66. tooltip: this.$t('db.text_199'),
  67. }
  68. }
  69. if (engine === 'PostgreSQL' && provider === 'Huawei') {
  70. return {
  71. validate: false,
  72. tooltip: this.$t('db.text_200'),
  73. }
  74. }
  75. if (brand === HYPERVISORS_MAP.aws.brand || brand === HYPERVISORS_MAP.azure.brand) {
  76. return {
  77. validate: false,
  78. tooltip: this.$t('db.text_384', [brand]),
  79. }
  80. }
  81. return {
  82. validate: true,
  83. tooltip: '',
  84. }
  85. }
  86. return {
  87. buttonType: 'primary',
  88. ..._meta(),
  89. }
  90. },
  91. },
  92. ],
  93. }
  94. },
  95. created () {
  96. this.list.fetchData()
  97. this.initSidePageTab('detail')
  98. },
  99. methods: {
  100. handleOpenSidepage (row) {
  101. this.sidePageTriggerHandle(this, 'RDSAccountSidePage', {
  102. id: row.id,
  103. resource: 'dbinstanceaccounts',
  104. }, {
  105. list: this.list,
  106. rdsItem: this.data,
  107. })
  108. },
  109. },
  110. }
  111. </script>