index.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('compute.text_461')"
  5. icon="res-kuaizhaocelue"
  6. :res-name="detailData.name"
  7. :current-tab="params.windowData.currentTab"
  8. :tabs="detailTabs"
  9. :loaded="loaded"
  10. @tab-change="handleTabChange">
  11. <template v-slot:actions>
  12. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  13. </template>
  14. <component
  15. :is="params.windowData.currentTab"
  16. :data="detailData"
  17. :on-manager="onManager"
  18. :res-id="data.id"
  19. :id="listId"
  20. taskResource="compute-tasks"
  21. @tab-change="handleTabChange" />
  22. </base-side-page>
  23. </template>
  24. <script>
  25. import SidePageMixin from '@/mixins/sidePage'
  26. import WindowsMixin from '@/mixins/windows'
  27. import Actions from '@/components/PageList/Actions'
  28. import SingleActionsMixin from '../mixins/singleActions'
  29. import ColumnsMixin from '../mixins/columns'
  30. import Detail from './Detail'
  31. import SnapshotPolicyDisk from './Disk'
  32. import SnapshotPolicyServer from './Server'
  33. export default {
  34. name: 'SnapshotPolicySidePage',
  35. components: {
  36. Detail,
  37. SnapshotPolicyDisk,
  38. SnapshotPolicyServer,
  39. Actions,
  40. },
  41. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  42. data () {
  43. return {
  44. }
  45. },
  46. computed: {
  47. listId () {
  48. switch (this.params.windowData.currentTab) {
  49. case 'event-drawer':
  50. return 'EventListForSnapshotPolicySidePage'
  51. default:
  52. return ''
  53. }
  54. },
  55. detailTabs () {
  56. const list = [
  57. { label: this.$t('compute.text_238'), key: 'detail' },
  58. { label: this.$t('compute.text_1084'), key: 'snapshot-policy-disk' },
  59. { label: this.$t('compute.bind_server'), key: 'snapshot-policy-server' },
  60. { label: this.$t('table.title.task'), key: 'task-drawer' },
  61. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  62. ]
  63. if (this.detailData.type === 'server') {
  64. return list.filter(item => item.key !== 'snapshot-policy-disk')
  65. }
  66. if (this.detailData.type === 'disk') {
  67. return list.filter(item => item.key !== 'snapshot-policy-server')
  68. }
  69. return list
  70. },
  71. },
  72. }
  73. </script>