singleActions.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import { mapGetters } from 'vuex'
  2. import i18n from '@/locales'
  3. import {
  4. getSetPublicAction,
  5. } from '@/utils/common/tableActions'
  6. export default {
  7. computed: mapGetters(['isAdminMode', 'l3PermissionEnable']),
  8. created () {
  9. this.singleActions = [
  10. {
  11. label: i18n.t('role.action.set_policies'),
  12. action: obj => {
  13. this.sidePageTriggerHandle(this, 'RoleSidePage', {
  14. id: obj.id,
  15. resource: 'roles',
  16. apiVersion: 'v1',
  17. }, { tab: 'policies-list-for-role-sidepage', list: this.list })
  18. },
  19. },
  20. {
  21. label: i18n.t('common.more'),
  22. actions: obj => {
  23. return [
  24. // {
  25. // label: i18n.t('system.text_435'),
  26. // action: () => {
  27. // this.onManager('performAction', {
  28. // id: obj.id,
  29. // managerArgs: {
  30. // action: 'public',
  31. // },
  32. // })
  33. // },
  34. // meta: () => {
  35. // const ret = {
  36. // validate: false,
  37. // }
  38. // if (!this.isAdminMode || !this.l3PermissionEnable) return ret
  39. // if (obj.is_public) return ret
  40. // ret.validate = true
  41. // return ret
  42. // },
  43. // },
  44. // {
  45. // label: i18n.t('system.text_436'),
  46. // action: () => {
  47. // this.onManager('performAction', {
  48. // id: obj.id,
  49. // managerArgs: {
  50. // action: 'private',
  51. // },
  52. // })
  53. // },
  54. // meta: () => {
  55. // const ret = {
  56. // validate: false,
  57. // }
  58. // if (!this.isAdminMode || !this.l3PermissionEnable) return ret
  59. // if (!obj.is_public) return ret
  60. // ret.validate = true
  61. // return ret
  62. // },
  63. // },
  64. getSetPublicAction(this, {
  65. name: this.$t('dictionary.role'),
  66. scope: 'domain',
  67. resource: 'roles',
  68. apiVersion: 'v1',
  69. noCandidateDomains: true,
  70. }, {
  71. permission: 'roles_perform_public',
  72. }),
  73. {
  74. label: i18n.t('system.text_129'),
  75. permission: 'roles_delete',
  76. action: () => {
  77. this.createDialog('DeleteResDialog', {
  78. vm: this,
  79. data: [obj],
  80. columns: this.columns,
  81. title: i18n.t('system.text_129'),
  82. onManager: this.onManager,
  83. name: this.$t('dictionary.role'),
  84. })
  85. },
  86. meta: () => this.$getDeleteResult(obj),
  87. },
  88. ]
  89. },
  90. },
  91. ]
  92. },
  93. }