UnbindSecgroup.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{ action }}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="params.resourceName || $t('dictionary.server')" :count="params.data.length" :action="action" />
  6. <dialog-table :data="params.data" :columns="params.columns.slice(0, 3)" />
  7. </div>
  8. <div slot="footer">
  9. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  10. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  11. </div>
  12. </base-dialog>
  13. </template>
  14. <script>
  15. import DialogMixin from '@/mixins/dialog'
  16. import WindowsMixin from '@/mixins/windows'
  17. export default {
  18. name: 'UnbindSecgroupDialog',
  19. mixins: [DialogMixin, WindowsMixin],
  20. data () {
  21. return {
  22. action: this.$t('compute.text_1024', [this.$t('dictionary.secgroup')]),
  23. loading: false,
  24. form: {
  25. fc: this.$form.createForm(this),
  26. },
  27. }
  28. },
  29. methods: {
  30. async handleConfirm () {
  31. this.loading = true
  32. try {
  33. const ids = this.params.data.map(item => item.id)
  34. await this.params.onManager('batchPerformAction', {
  35. id: ids,
  36. managerArgs: {
  37. action: 'revoke-secgroup',
  38. data: {
  39. secgroup_ids: [this.params.detailData.id],
  40. },
  41. },
  42. })
  43. this.params.refresh && this.params.refresh()
  44. this.cancelDialog()
  45. } finally {
  46. this.loading = false
  47. }
  48. },
  49. },
  50. }
  51. </script>