index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div>
  3. <page-header :title="title" :current-tab.sync="createCloudEnv" :tabs="cloudEnvOptions" />
  4. <component :is="createCloudEnv" :cloudEnv="createCloudEnv" :initFormData="initFormData" :isInitForm="isInitForm" />
  5. </div>
  6. </template>
  7. <script>
  8. import workflowMixin from '@/mixins/workflow'
  9. import WindowsMixin from '@/mixins/windows'
  10. import { getCloudEnvOptions } from '@/utils/common/hypervisor'
  11. import Onpremise from './IDC'
  12. import Private from './Private'
  13. export default {
  14. name: 'BaremetalCreateIndex',
  15. components: {
  16. Onpremise,
  17. Private,
  18. },
  19. mixins: [WindowsMixin, workflowMixin],
  20. props: {
  21. cloudEnv: {
  22. type: String,
  23. default: 'onpremise',
  24. },
  25. },
  26. data () {
  27. const paramsData = this.$route.params?.data || {}
  28. return {
  29. createCloudEnv: this.$route.query.cloud_env || this.$route.query.type || 'onpremise',
  30. initFormData: paramsData,
  31. }
  32. },
  33. computed: {
  34. cloudEnvOptions: () => {
  35. return getCloudEnvOptions('compute_engine_brands').filter(val => ['onpremise', 'private'].includes(val.key))
  36. },
  37. isInitForm () {
  38. return !!this.initFormData?.extraData?.formType && this.$route.query.workflow
  39. },
  40. title () {
  41. return this.isInstallOperationSystem ? this.$t('compute.text_298') : (this.isInitForm ? this.$t('compute.text_299') + `(${this.$t('common.modify_workflow')})` : this.$t('compute.text_299'))
  42. },
  43. },
  44. watch: {
  45. cloudEnv (val) {
  46. if (!val) {
  47. this.createCloudEnv = 'onpremise'
  48. } else {
  49. this.createCloudEnv = val
  50. }
  51. },
  52. },
  53. created () {
  54. },
  55. methods: {
  56. },
  57. }
  58. </script>