Unconvert.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('compute.text_508')}}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="$t('dictionary.host')" :count="params.data.length" :action="$t('compute.text_508')" />
  6. <dialog-table :data="params.data" :columns="params.columns.slice(0, 2)" />
  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: 'HostUnconvertDialog',
  19. mixins: [DialogMixin, WindowsMixin],
  20. data () {
  21. return {
  22. loading: false,
  23. scope: this.$store.getters.scope,
  24. }
  25. },
  26. methods: {
  27. doUnconver () {
  28. return this.params.onManager('batchPerformAction', {
  29. id: this.params.data.map(item => item.id),
  30. managerArgs: {
  31. action: 'undo-convert',
  32. },
  33. })
  34. },
  35. async handleConfirm () {
  36. this.loading = true
  37. try {
  38. await this.doUnconver()
  39. this.loading = false
  40. this.cancelDialog()
  41. this.params.refresh()
  42. } catch (error) {
  43. this.loading = false
  44. }
  45. },
  46. },
  47. }
  48. </script>