delete.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('monitor.dashboard.dialog.delete')}}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="$t('monitor.dashboard.title')" :count="params.data.length" :action="$t('compute.perform_delete')" />
  6. <dialog-table :data="params.data" :columns="params.columns" />
  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: 'DeleteMonitorDashboard',
  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. this.loading = true
  30. await new this.$Manager('alertdashboards', 'v1').delete({ id: this.params.data[0].id })
  31. this.loading = false
  32. this.cancelDialog()
  33. this.params.refresh()
  34. } catch (error) {
  35. this.loading = false
  36. throw error
  37. }
  38. },
  39. },
  40. }
  41. </script>
  42. <style scoped>
  43. </style>