| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <base-dialog @cancel="cancelDialog">
- <div slot="header">{{this.params.name}}</div>
- <div slot="body">
- <dialog-selected-tips :name="$t('dictionary.host')" :count="params.data.length" :action="$t('compute.text_547')" />
- <dialog-table :data="params.data" :columns="params.columns.slice(0, 3)" />
- <a-form
- :form="form.fc">
- <a-form-item :label="$t('compute.text_548')" v-bind="formItemLayout" :extra="$t('compute.text_549')">
- <a-switch v-decorator="decorators.enable" :checkedChildren="$t('compute.text_115')" :unCheckedChildren="$t('compute.text_116')" />
- </a-form-item>
- </a-form>
- </div>
- <div slot="footer">
- <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
- <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
- </div>
- </base-dialog>
- </template>
- <script>
- import DialogMixin from '@/mixins/dialog'
- import WindowsMixin from '@/mixins/windows'
- export default {
- name: 'DowntimeMigrateDialog',
- mixins: [DialogMixin, WindowsMixin],
- data () {
- return {
- loading: false,
- scope: this.$store.getters.scope,
- form: {
- fc: this.$form.createForm(this),
- },
- decorators: {
- enable: [
- 'enable',
- {
- initialValue: this.params.data[0].auto_migrate_on_host_down,
- valuePropName: 'checked',
- },
- ],
- },
- formItemLayout: {
- wrapperCol: {
- span: 20,
- },
- labelCol: {
- span: 4,
- },
- },
- }
- },
- methods: {
- doMigrate (data) {
- data = {
- auto_migrate_on_host_down: data.enable ? 'enable' : 'disable',
- }
- return this.params.onManager('performAction', {
- id: this.params.data[0].id,
- managerArgs: {
- action: 'auto-migrate-on-host-down',
- data,
- },
- })
- },
- async handleConfirm () {
- this.loading = true
- try {
- const values = await this.form.fc.validateFields()
- await this.doMigrate(values)
- this.loading = false
- this.cancelDialog()
- } catch (error) {
- this.loading = false
- }
- },
- },
- }
- </script>
|