index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('dictionary.domain')"
  5. icon="res-domain"
  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
  13. :options="singleActions"
  14. :row="detailData"
  15. button-type="link"
  16. button-size="small" />
  17. </template>
  18. <component
  19. :is="params.windowData.currentTab"
  20. :res-id="data.id"
  21. :id="listId"
  22. :data="detailData"
  23. :resource="resource"
  24. :getParams="getParams"
  25. :on-manager="onManager"
  26. :is-allow-create="isAllowCreate"
  27. :columns="columns"
  28. @refresh="refresh"
  29. @tab-change="handleTabChange" />
  30. </base-side-page>
  31. </template>
  32. <script>
  33. import * as R from 'ramda'
  34. import { mapGetters } from 'vuex'
  35. import ProjectList from '@IAM/views/projects/components/List'
  36. import UserList from '@IAM/views/user/components/List'
  37. import SidePageMixin from '@/mixins/sidePage'
  38. import WindowsMixin from '@/mixins/windows'
  39. import Actions from '@/components/PageList/Actions'
  40. import SingleActionsMixin from '../mixins/singleActions'
  41. import ColumnsMixin from '../mixins/columns'
  42. import Detail from './Detail'
  43. import RoleList from './Role'
  44. import CloudaccountList from './Cloudaccount'
  45. export default {
  46. name: 'DomainSidePage',
  47. components: {
  48. Detail,
  49. Actions,
  50. RoleList,
  51. CloudaccountList,
  52. ProjectList,
  53. UserList,
  54. },
  55. mixins: [SidePageMixin, WindowsMixin, SingleActionsMixin, ColumnsMixin],
  56. data () {
  57. return {
  58. detailTabs: [
  59. { label: this.$t('system.text_159'), key: 'detail' },
  60. { label: this.$t('system.text_6'), key: 'user-list' },
  61. { label: this.$t('system.text_9'), key: 'project-list' },
  62. { label: this.$t('system.text_10'), key: 'role-list' },
  63. { label: this.$t('system.text_50'), key: 'cloudaccount-list' },
  64. { label: this.$t('system.text_17'), key: 'event-drawer' },
  65. ],
  66. }
  67. },
  68. computed: {
  69. ...mapGetters(['l3PermissionEnable', 'globalConfig']),
  70. getParams () {
  71. const obj = {}
  72. if (this.params.windowData.currentTab === 'role-list') {
  73. obj.filter = `domain_id.equals("${this.data.id}")`
  74. }
  75. if (['project-list', 'cloudaccount-list', 'user-list'].indexOf(this.params.windowData.currentTab) > -1) {
  76. obj.project_domains = [this.data.id]
  77. }
  78. return obj
  79. },
  80. isAllowCreate () {
  81. if (this.params.windowData.currentTab === 'role-list') {
  82. return true
  83. }
  84. return false
  85. },
  86. listId () {
  87. switch (this.params.windowData.currentTab) {
  88. case 'event-drawer':
  89. return 'EventListForDomainSidePage'
  90. case 'user-list':
  91. return 'UserListForDomainSidePage'
  92. case 'project-list':
  93. return 'ProjectListForDomainSidePage'
  94. case 'role-list':
  95. return 'RoleListForDomainSidePage'
  96. case 'cloudaccount-list':
  97. return 'CloudaccountListForDomainSidePage'
  98. default:
  99. return ''
  100. }
  101. },
  102. },
  103. created () {
  104. if (this.params.tab) {
  105. this.handleTabChange(this.params.tab)
  106. } else {
  107. if (R.isNil(R.find(R.propEq('key', this.params.windowData.currentTab))(this.detailTabs))) {
  108. this.handleTabChange(this.detailTabs[0].key)
  109. }
  110. }
  111. },
  112. }
  113. </script>