index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('dictionary.secgrouprule')"
  5. icon="res-secgroup"
  6. :res-name="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. :res-id="data.id"
  17. :data="detailData"
  18. :getParams="getParams"
  19. res-type="secgrouprule"
  20. taskResource="compute-tasks" />
  21. </base-side-page>
  22. </template>
  23. <script>
  24. import SidePageMixin from '@/mixins/sidePage'
  25. import WindowsMixin from '@/mixins/windows'
  26. import Actions from '@/components/PageList/Actions'
  27. import SingleActionsMixin from '../mixins/singleActions'
  28. export default {
  29. name: 'SecgroupRuleSidePage',
  30. components: { Actions },
  31. mixins: [SidePageMixin, WindowsMixin, SingleActionsMixin],
  32. data () {
  33. const detailTabs = [
  34. { label: this.$t('table.title.task'), key: 'task-drawer' },
  35. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  36. ]
  37. return {
  38. detailTabs,
  39. t: null,
  40. }
  41. },
  42. computed: {
  43. getParams () {
  44. return {
  45. t: this.t,
  46. }
  47. },
  48. name () {
  49. return this.detailData.cidr ? `${this.detailData.cidr} (IP)` : '-'
  50. },
  51. },
  52. created () {
  53. if (this.params.tab) this.handleTabChange(this.params.tab)
  54. },
  55. methods: {
  56. refresh () {
  57. this.t = new Date().getTime()
  58. if (this.isList) return this.params.list.refresh(...arguments)
  59. return this.fetchData()
  60. },
  61. },
  62. }
  63. </script>