index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <a-form-item>
  3. <a-radio-group v-decorator="decorator">
  4. <a-radio-button :value="opt.value" v-for="opt in vgaOptions" :key="opt.value">{{ opt.text }}</a-radio-button>
  5. </a-radio-group>
  6. </a-form-item>
  7. </template>
  8. <script>
  9. export default {
  10. name: 'VGA',
  11. props: {
  12. decorator: {
  13. type: Array,
  14. required: true,
  15. },
  16. vdi: {
  17. type: String,
  18. },
  19. form: {
  20. type: Object,
  21. },
  22. showDefault: {
  23. type: Boolean,
  24. },
  25. },
  26. computed: {
  27. vgaOptions () {
  28. var options = []
  29. if (this.showDefault) {
  30. options.push({
  31. text: this.$t('compute.text_1'),
  32. value: '',
  33. })
  34. }
  35. if (this.vdi === 'vnc') {
  36. options.push({
  37. text: 'Standard',
  38. value: 'std',
  39. })
  40. }
  41. options.push(
  42. {
  43. text: 'QXL',
  44. value: 'qxl',
  45. },
  46. /* {
  47. text: 'Virtio-VGA',
  48. value: 'virtio',
  49. }, */
  50. )
  51. return options
  52. },
  53. },
  54. watch: {
  55. vdi: {
  56. handler: function (val) {
  57. const vga = this.form.fc.getFieldValue('vga')
  58. if (!this.vgaOptions.some(item => item.value === vga)) {
  59. this.form.fc.setFieldsValue({ vga: this.vgaOptions[0].value })
  60. }
  61. },
  62. },
  63. },
  64. }
  65. </script>