Enable.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('compute.text_656')}}</div>
  4. <div slot="body">
  5. <a-alert class="mb-2" type="warning" :message="$t('compute.text_912')" />
  6. <dialog-selected-tips :count="params.data.length" :action="$t('compute.text_656')" :name="$t('compute.text_95')" />
  7. <dialog-table :data="params.data" :columns="columns" />
  8. </div>
  9. <div slot="footer">
  10. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  11. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  12. </div>
  13. </base-dialog>
  14. </template>
  15. <script>
  16. import DialogMixin from '@/mixins/dialog'
  17. import WindowsMixin from '@/mixins/windows'
  18. export default {
  19. name: 'ScalingGroupEnable',
  20. mixins: [DialogMixin, WindowsMixin],
  21. data () {
  22. return {
  23. loading: false,
  24. }
  25. },
  26. computed: {
  27. columns () {
  28. const fields = ['name', 'desire_instance_number', 'max_instance_number']
  29. return this.params.columns.filter(item => {
  30. const { field } = item
  31. return fields.indexOf(field) > -1
  32. })
  33. },
  34. },
  35. methods: {
  36. async handleConfirm () {
  37. this.loading = true
  38. try {
  39. await this.params.onManager('batchPerformAction', {
  40. id: this.params.data.map(item => item.id),
  41. managerArgs: {
  42. action: 'enable',
  43. },
  44. })
  45. this.cancelDialog()
  46. this.$message.success(this.$t('message.exec_success'))
  47. } catch (err) {
  48. throw err
  49. } finally {
  50. this.loading = false
  51. }
  52. },
  53. },
  54. }
  55. </script>