Rule.vue 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <div>
  3. <access-group-rule-list :type="getParams.type" :id="getParams.id" :isRead="isRead" />
  4. </div>
  5. </template>
  6. <script>
  7. import { mapGetters } from 'vuex'
  8. import AccessGroupRuleList from '../components/AccessGroupRule'
  9. import WindowsMixin from '@/mixins/windows'
  10. export default {
  11. name: 'AccessGroupRule',
  12. components: {
  13. AccessGroupRuleList,
  14. },
  15. mixins: [WindowsMixin],
  16. props: {
  17. getParams: {
  18. type: Object,
  19. required: true,
  20. },
  21. resId: String,
  22. data: {
  23. type: Object,
  24. required: true,
  25. },
  26. },
  27. computed: {
  28. ...mapGetters(['isAdminMode', 'isDomainMode', 'isProjectMode', 'userInfo']),
  29. isRead () {
  30. return !this.isPower
  31. },
  32. isPower (obj) {
  33. if (!obj.domain_id && obj.data.domain_id) {
  34. obj = obj.data
  35. }
  36. if (this.isAdminMode) return true
  37. if (this.isDomainMode) return obj.domain_id === this.userInfo.projectDomainId
  38. return false
  39. },
  40. },
  41. }
  42. </script>