UnAssociatedHost.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!-- 宿主机列表-取消关联宿主机 -->
  2. <template>
  3. <base-dialog @cancel="cancelDialog">
  4. <div slot="header">{{this.params.title}}</div>
  5. <div slot="body">
  6. <dialog-selected-tips :count="params.data.length" :action="this.params.title" :name="$t('storage.text_50')" />
  7. <dialog-table :data="params.data" :columns="params.columns.slice(0, 3)" />
  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: 'UnAssociatedHostDialog',
  20. mixins: [DialogMixin, WindowsMixin],
  21. data () {
  22. return {
  23. loading: false,
  24. }
  25. },
  26. methods: {
  27. async handleConfirm () {
  28. this.loading = true
  29. try {
  30. await this.params.list.onManager('batchDelete', {
  31. id: this.params.data.map(({ id }) => id),
  32. managerArgs: {
  33. ctx: [['storages', this.params.resId]],
  34. },
  35. })
  36. this.$bus.$emit('BlockStorageListSingleUpdate', [this.params.resId])
  37. this.cancelDialog()
  38. this.loading = false
  39. } catch (error) {
  40. this.loading = false
  41. throw error
  42. }
  43. },
  44. },
  45. }
  46. </script>