StartBackup.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('compute.start_buckup')}}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="$t('compute.start_buckup')" />
  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 { mapGetters } from 'vuex'
  16. import DialogMixin from '@/mixins/dialog'
  17. import WindowsMixin from '@/mixins/windows'
  18. export default {
  19. name: 'VmStartBackupDialog',
  20. mixins: [DialogMixin, WindowsMixin],
  21. data () {
  22. return {
  23. loading: false,
  24. formItemLayout: {
  25. wrapperCol: {
  26. span: 18,
  27. },
  28. labelCol: {
  29. span: 6,
  30. },
  31. },
  32. }
  33. },
  34. computed: {
  35. ...mapGetters(['isAdminMode', 'isDomainMode', 'scope']),
  36. firstData () {
  37. return this.params.data[0]
  38. },
  39. },
  40. created () {
  41. },
  42. methods: {
  43. async handleConfirm () {
  44. this.loading = true
  45. try {
  46. const ids = this.params.data.map(item => item.id)
  47. await this.params.onManager('batchPerformAction', {
  48. id: ids,
  49. steadyStatus: ['running', 'ready'],
  50. managerArgs: {
  51. action: 'start-backup',
  52. },
  53. })
  54. this.cancelDialog()
  55. } finally {
  56. this.loading = false
  57. }
  58. },
  59. },
  60. }
  61. </script>