AllProjects.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :group-actions="groupActions"
  6. :single-actions="singleActions" />
  7. </template>
  8. <script>
  9. import {
  10. getCopyWithContentTableColumn,
  11. } from '@/utils/common/tableColumn'
  12. import WindowsMixin from '@/mixins/windows'
  13. import RoleColumn from '../components/RoleColumn'
  14. export default {
  15. name: 'UserSidepageAllProjects',
  16. mixins: [WindowsMixin],
  17. props: {
  18. data: {
  19. type: Object,
  20. required: true,
  21. },
  22. },
  23. data () {
  24. return {
  25. list: this.$list.createList(this, {
  26. id: this.id,
  27. resource: this.getList,
  28. apiVersion: 'v1',
  29. getParams: { effective: true, resource: 'user' },
  30. }),
  31. columns: [
  32. getCopyWithContentTableColumn({
  33. title: this.$t('system.text_560'),
  34. field: 'name',
  35. }),
  36. {
  37. title: this.$t('dictionary.role'),
  38. field: 'role',
  39. slots: {
  40. default: ({ row }) => {
  41. return row.roles.map(item => item.name).join(', ')
  42. },
  43. },
  44. },
  45. {
  46. title: this.$t('dictionary.policy'),
  47. field: 'role',
  48. slots: {
  49. default: ({ row }) => {
  50. return [<RoleColumn vm={this} roles={row.roles || []} />]
  51. },
  52. },
  53. },
  54. ],
  55. groupActions: [
  56. ],
  57. singleActions: [
  58. ],
  59. }
  60. },
  61. created () {
  62. this.list.fetchData()
  63. this.$bus.$on('UserSidepageAllProjectsListRefresh', () => {
  64. this.list.refresh()
  65. }, this)
  66. },
  67. methods: {
  68. getList (params) {
  69. return new this.$Manager('role_assignments', 'v1').objectRpc({
  70. methodname: 'GetProjectRole',
  71. objId: this.data.id,
  72. params,
  73. })
  74. },
  75. },
  76. }
  77. </script>