RemoveVpcDialog.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('cloudenv.text_452')}}</div>
  4. <div slot="body">
  5. <dialog-selected-tips name="VPC" :count="params.data.length" :action="$t('cloudenv.text_452')" />
  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: 'RemoveVpcDialog',
  19. mixins: [DialogMixin, WindowsMixin],
  20. data () {
  21. return {
  22. loading: false,
  23. }
  24. },
  25. methods: {
  26. async handleConfirm () {
  27. this.loading = true
  28. try {
  29. const ids = this.params.data.map(item => item.id)
  30. const vpcManager = new this.$Manager('dns_zones')
  31. await vpcManager.batchPerformAction({
  32. ids: this.params.resData.id,
  33. action: 'remove-vpcs',
  34. data: {
  35. vpc_ids: ids,
  36. },
  37. })
  38. this.params.refresh && this.params.refresh()
  39. this.$bus.$emit('DnsZoneListSingleRefresh', [this.params.resData.id])
  40. this.cancelDialog()
  41. } finally {
  42. this.loading = false
  43. }
  44. },
  45. },
  46. }
  47. </script>