RevokeSecgroup.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <base-dialog @cancel="cancelDialog" width="480px">
  3. <div slot="header">{{ action }}</div>
  4. <div slot="body">{{$t('compute.text_1020')}}</div>
  5. <div slot="footer">
  6. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  7. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  8. </div>
  9. </base-dialog>
  10. </template>
  11. <script>
  12. import DialogMixin from '@/mixins/dialog'
  13. import WindowsMixin from '@/mixins/windows'
  14. export default {
  15. name: 'RevokeSecgroupDialog',
  16. mixins: [DialogMixin, WindowsMixin],
  17. data () {
  18. return {
  19. action: this.$t('compute.text_950'),
  20. loading: false,
  21. }
  22. },
  23. methods: {
  24. async handleConfirm () {
  25. this.loading = true
  26. try {
  27. const ids = this.params.data.map(item => item.id)
  28. await new this.$Manager('servers').batchPerformAction({
  29. ids: ids,
  30. action: 'revoke-secgroup',
  31. data: {
  32. secgroup_ids: [this.params.secgrpId],
  33. },
  34. })
  35. this.params.refresh && this.params.refresh()
  36. this.cancelDialog()
  37. this.$message.success(this.$t('compute.text_1021'))
  38. } finally {
  39. this.loading = false
  40. }
  41. },
  42. },
  43. }
  44. </script>