index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('cloudenv.text_11')"
  5. icon="res-zone"
  6. :res-name="detailData.name"
  7. :actions="params.actions"
  8. :current-tab="params.windowData.currentTab"
  9. :loaded="loaded"
  10. :tabs="detailTabs"
  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. :res-id="data.id"
  18. :id="listId"
  19. :data="detailData"
  20. :on-manager="onManager"
  21. :getParams="getParams"
  22. @side-page-trigger-handle="sidePageTriggerHandle"
  23. @init-side-page-tab="initSidePageTab"
  24. @single-refresh="singleRefresh" />
  25. </base-side-page>
  26. </template>
  27. <script>
  28. import SingleActionsMixin from '../mixins/singleActions'
  29. import ColumnsMixin from '../mixins/columns'
  30. import ZoneDetail from './Detail'
  31. import Dashboard from './Dashboard'
  32. import HostList from './Host'
  33. import SidePageMixin from '@/mixins/sidePage'
  34. import WindowsMixin from '@/mixins/windows'
  35. import Actions from '@/components/PageList/Actions'
  36. export default {
  37. name: 'ZoneSidePage',
  38. components: {
  39. Actions,
  40. ZoneDetail,
  41. HostList,
  42. Dashboard,
  43. },
  44. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  45. data () {
  46. return {}
  47. },
  48. computed: {
  49. getParams () {
  50. if (this.params.windowData.currentTab === 'host-list') {
  51. return () => {
  52. return {
  53. zone: this.data.id,
  54. details: true,
  55. }
  56. }
  57. }
  58. return null
  59. },
  60. listId () {
  61. switch (this.params.windowData.currentTab) {
  62. case 'event-drawer':
  63. return 'EventListForZoneSidePage'
  64. case 'host-list':
  65. return 'HostListForZoneSidePage'
  66. default:
  67. return ''
  68. }
  69. },
  70. hiddenActions () {
  71. return this.params.hiddenActions || []
  72. },
  73. detailTabs () {
  74. const detailTabs = [
  75. { label: this.$t('cloudenv.text_237'), key: 'zone-detail' },
  76. { label: this.$t('cloudenv.text_15'), key: 'event-drawer' },
  77. ]
  78. if (!['public'].includes(this.detailData.cloud_env)) {
  79. detailTabs.splice(1, 0, { label: this.$t('cloudenv.text_319'), key: 'dashboard' })
  80. detailTabs.splice(1, 0, { label: this.$t('cloudenv.text_101'), key: 'host-list' })
  81. }
  82. return detailTabs
  83. },
  84. },
  85. }
  86. </script>