LeaveUser.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{ $t('system.text_197', [$t('dictionary.group')]) }}</div>
  4. <div slot="body">
  5. <a-alert :message="$t('iam.operation_object.alter_tips')" class="mb-2" />
  6. <dialog-selected-tips :count="params.data.length" :action="$t('system.text_196', [$t('dictionary.group')])" :name="$t('dictionary.user')" />
  7. <dialog-table v-if="params.columns && params.columns.length" :data="params.data" :columns="params.columns.slice(0, 3)" />
  8. </div>
  9. <div slot="footer">
  10. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t("dialog.ok") }}</a-button>
  11. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  12. </div>
  13. </base-dialog>
  14. </template>
  15. <script>
  16. import DialogMixin from '@/mixins/dialog'
  17. import WindowsMixin from '@/mixins/windows'
  18. export default {
  19. name: 'GroupLeaveUserDialog',
  20. mixins: [DialogMixin, WindowsMixin],
  21. data () {
  22. return {
  23. loading: false,
  24. }
  25. },
  26. destroyed () {
  27. this.manager = null
  28. },
  29. created () {
  30. this.manager = new this.$Manager('groups', 'v1')
  31. },
  32. methods: {
  33. async handleConfirm () {
  34. this.loading = true
  35. try {
  36. const userIds = []
  37. this.params.data.forEach(item => {
  38. userIds.push(item.id)
  39. })
  40. const values = {
  41. user: userIds,
  42. }
  43. await this.manager.performAction({
  44. id: this.params.resItem.id,
  45. action: 'remove-users',
  46. data: values,
  47. })
  48. this.loading = false
  49. this.params.success()
  50. this.cancelDialog()
  51. } catch (error) {
  52. this.loading = false
  53. throw error
  54. }
  55. },
  56. },
  57. }
  58. </script>