Create.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('cloudenv.text_416')}}</div>
  4. <div slot="body">
  5. <schedpolicy-form ref="formRef" />
  6. </div>
  7. <div slot="footer">
  8. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  9. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  10. </div>
  11. </base-dialog>
  12. </template>
  13. <script>
  14. import SchedpolicyForm from '../components/Form'
  15. import DialogMixin from '@/mixins/dialog'
  16. import WindowsMixin from '@/mixins/windows'
  17. export default {
  18. name: 'CreateSchedpolicyDialog',
  19. components: {
  20. SchedpolicyForm,
  21. },
  22. mixins: [DialogMixin, WindowsMixin],
  23. data () {
  24. return {
  25. loading: false,
  26. }
  27. },
  28. methods: {
  29. doCreate (data) {
  30. return this.params.onManager('create', {
  31. managerArgs: {
  32. data,
  33. },
  34. })
  35. },
  36. async handleConfirm () {
  37. this.loading = true
  38. try {
  39. const values = await this.$refs.formRef.validateForm()
  40. this.loading = true
  41. await this.doCreate(values)
  42. this.loading = false
  43. this.cancelDialog()
  44. this.$message.success(this.$t('cloudenv.text_381'))
  45. } catch (error) {
  46. this.loading = false
  47. }
  48. },
  49. },
  50. }
  51. </script>