| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <template>
- <base-dialog @cancel="cancelDialog">
- <div slot="header">{{$t('compute.text_366')}}</div>
- <div slot="body">
- <dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="$t('compute.text_366')" />
- <dialog-table :data="params.data" :columns="params.columns.slice(0, 3)" />
- <a-form :form="form.fc" hideRequiredMark>
- <a-form-item :label="$t('compute.text_1218')" v-bind="formItemLayout">
- <base-select
- class="w-100"
- remote
- filterable
- version="v1"
- v-decorator="decorators.image_id"
- resource="images"
- :params="imageParams"
- :select-props="{ placeholder: $t('compute.text_1219') }" />
- </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 { mapGetters } from 'vuex'
- import DialogMixin from '@/mixins/dialog'
- import WindowsMixin from '@/mixins/windows'
- export default {
- name: 'VmMountIsoDialog',
- mixins: [DialogMixin, WindowsMixin],
- data () {
- return {
- loading: false,
- form: {
- fc: this.$form.createForm(this),
- },
- decorators: {
- image_id: [
- 'image_id',
- {
- rules: [
- { required: true, message: this.$t('compute.text_1219') },
- ],
- },
- ],
- },
- formItemLayout: {
- wrapperCol: {
- span: 21,
- },
- labelCol: {
- span: 3,
- },
- },
- }
- },
- computed: {
- ...mapGetters(['scope']),
- imageParams () {
- return { disk_formats: 'iso', scope: this.scope }
- },
- },
- methods: {
- async handleConfirm () {
- this.loading = true
- try {
- const values = await this.form.fc.validateFields()
- const ids = this.params.data.map(item => item.id)
- await this.params.onManager('batchPerformAction', {
- id: ids,
- managerArgs: {
- action: 'insertiso',
- data: values,
- },
- })
- this.params.refresh()
- this.cancelDialog()
- } finally {
- this.loading = false
- }
- },
- },
- }
- </script>
|