Update.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('cloudenv.text_383')}}</div>
  4. <div slot="body">
  5. <schedpolicy-form ref="formRef" :update-value="params.data[0]" />
  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: 'UpdateSchedpolicyDialog',
  19. components: {
  20. SchedpolicyForm,
  21. },
  22. mixins: [DialogMixin, WindowsMixin],
  23. data () {
  24. return {
  25. loading: false,
  26. }
  27. },
  28. methods: {
  29. doCreate (data) {
  30. this.params.onManager('update', {
  31. id: this.params.data[0].id,
  32. managerArgs: {
  33. data,
  34. },
  35. })
  36. },
  37. async handleConfirm () {
  38. this.loading = true
  39. try {
  40. const values = await this.$refs.formRef.validateForm()
  41. this.loading = true
  42. await this.doCreate(values)
  43. this.loading = false
  44. this.cancelDialog()
  45. this.$message.success(this.$t('cloudenv.text_381'))
  46. } catch (error) {
  47. this.loading = false
  48. throw error
  49. }
  50. },
  51. },
  52. }
  53. </script>