SetDisabled.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{params.title}}</div>
  4. <div slot="body">
  5. <a-alert :message="$t('system.text_171')" banner />
  6. <dialog-selected-tips :name="$t('dictionary.domain')" class="mt-3" :count="params.data.length" :action="params.title" />
  7. <dialog-table v-if="params.columns && params.columns.length" :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: 'DomainSetDisabledDialog',
  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. const ids = this.params.data.map(item => item.id)
  31. await this.params.onManager('batchUpdate', {
  32. id: ids,
  33. managerArgs: {
  34. data: {
  35. enabled: false,
  36. },
  37. },
  38. })
  39. this.cancelDialog()
  40. } catch (error) {
  41. throw error
  42. } finally {
  43. this.loading = false
  44. }
  45. },
  46. },
  47. }
  48. </script>