index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('network.text_720')"
  5. icon="res-dns-zone"
  6. :res-name="detailData.name"
  7. :actions="params.actions"
  8. :current-tab="params.windowData.currentTab"
  9. :tabs="detailTabs"
  10. :loaded="loaded"
  11. @tab-change="handleTabChange">
  12. <template v-slot:actions>
  13. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  14. </template>
  15. <component
  16. :is="params.windowData.currentTab"
  17. :id="listId"
  18. :res-id="detailData.id"
  19. :data="detailData"
  20. :getParams="getParams"
  21. :on-manager="onManager"
  22. taskResource="compute-tasks"
  23. @side-page-trigger-handle="sidePageTriggerHandle"
  24. @init-side-page-tab="initSidePageTab"
  25. @refresh="refresh"
  26. @single-refresh="singleRefresh"
  27. @tab-change="handleTabChange" />
  28. </base-side-page>
  29. </template>
  30. <script>
  31. import * as R from 'ramda'
  32. import SidePageMixin from '@/mixins/sidePage'
  33. import WindowsMixin from '@/mixins/windows'
  34. import Actions from '@/components/PageList/Actions'
  35. import DnsRecordsetListForDnsZoneSidepage from '@Network/views/dns-recordset/components/List'
  36. import SingleActionsMixin from '../mixins/singleActions'
  37. import ColumnsMixin from '../mixins/columns'
  38. import DnsZoneDetail from './Detail'
  39. import DnsAssociateVpcList from './DnsAssociateVpcList'
  40. export default {
  41. name: 'DnsZoneSidePage',
  42. components: {
  43. DnsZoneDetail,
  44. Actions,
  45. DnsRecordsetListForDnsZoneSidepage,
  46. DnsAssociateVpcList,
  47. },
  48. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  49. data () {
  50. return {}
  51. },
  52. computed: {
  53. detailTabs () {
  54. const data = this.detailData
  55. const detailTabs = [
  56. { label: this.$t('network.text_67'), key: 'dns-zone-detail' },
  57. { label: this.$t('common_663'), key: 'dns-recordset-list-for-dns-zone-sidepage' },
  58. { label: this.$t('table.title.task'), key: 'task-drawer' },
  59. { label: this.$t('network.text_150'), key: 'event-drawer' },
  60. ]
  61. if (data.cloud_env === 'public' && data.zone_type === 'PrivateZone') {
  62. detailTabs.splice(1, 0, { label: this.$t('network.text_719'), key: 'dns-associate-vpc-list' })
  63. }
  64. return detailTabs
  65. },
  66. getParams () {
  67. if (this.params.windowData.currentTab === 'dns-recordset-list-for-dns-zone-sidepage') {
  68. return {
  69. detail: true,
  70. dns_zone_id: this.detailData.id,
  71. }
  72. } else if (this.params.windowData.currentTab === 'dns-associate-vpc-list') {
  73. return {
  74. detail: true,
  75. dns_zone_id: this.detailData.id,
  76. }
  77. }
  78. return null
  79. },
  80. listId () {
  81. switch (this.params.windowData.currentTab) {
  82. case 'event-drawer':
  83. return 'EventListForDnsZoneSidePage'
  84. case 'dns-recordset-list-for-dns-zone-sidepage':
  85. return 'DnsRecordsetListForDnsZoneSidePage'
  86. case 'dns-associate-vpc-list':
  87. return 'DnsAssociateListForDnsZoneSidePage'
  88. default:
  89. return ''
  90. }
  91. },
  92. },
  93. created () {
  94. if (R.isNil(R.find(R.propEq('key', this.params.windowData.currentTab))(this.detailTabs))) {
  95. this.handleTabChange(this.detailTabs[0].key)
  96. }
  97. },
  98. }
  99. </script>