singleActions.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { mapGetters } from 'vuex'
  2. import i18n from '@/locales'
  3. export default {
  4. created () {
  5. this.singleActions = [
  6. {
  7. label: i18n.t('network.ssh-proxy-match.unlink'),
  8. permission: 'sshproxy_match_unlink',
  9. action: obj => {
  10. this.createDialog('DeleteResDialog', {
  11. vm: this,
  12. data: [obj],
  13. columns: this.columns,
  14. title: i18n.t('network.ssh-proxy-match.unlink'),
  15. name: this.$t('network.ssh-proxy.match'),
  16. onManager: this.onManager,
  17. })
  18. },
  19. meta: obj => {
  20. if (!this.isPower(obj)) {
  21. return {
  22. validate: false,
  23. tooltip: i18n.t('network.text_627'),
  24. }
  25. }
  26. if (!this.$getDeleteResult(obj).validate) {
  27. return {
  28. validate: false,
  29. tooltip: this.$getDeleteResult(obj).tooltip,
  30. }
  31. }
  32. return {
  33. validate: true,
  34. tooltip: '',
  35. }
  36. },
  37. }]
  38. },
  39. computed: {
  40. ...mapGetters(['isAdminMode', 'isDomainMode', 'userInfo']),
  41. },
  42. methods: {
  43. isPower (obj) {
  44. if (this.isAdminMode) return true
  45. if (this.isDomainMode) return obj.domain_id === this.userInfo.projectDomainId
  46. return obj.tenant_id === this.userInfo.projectId
  47. },
  48. },
  49. }