WhiteListDelete.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{ params.title }}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="$t('dictionary.elasticcaches')" :count="params.data.length" :action="this.params.title" />
  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 DialogMixin from '@/mixins/dialog'
  16. import WindowsMixin from '@/mixins/windows'
  17. export default {
  18. name: 'RedisWhiteListDeleteDialog',
  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 = false
  30. if (this.params.ok) {
  31. await this.params.ok()
  32. } else {
  33. const ids = this.params.data.map(item => item.id)
  34. await this.params.list.onManager('batchDelete', {
  35. id: ids,
  36. })
  37. }
  38. this.cancelDialog()
  39. this.$message.success(this.$t('db.text_149'))
  40. } catch (error) {
  41. this.loading = false
  42. }
  43. },
  44. },
  45. }
  46. </script>