index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import validateForm from '@/utils/validate'
  2. import i18n from '@/locales'
  3. export const BILL_TYPES_MAP = {
  4. postpaid: {
  5. label: i18n.t('network.text_256'),
  6. key: 'postpaid',
  7. },
  8. prepaid: {
  9. label: i18n.t('network.text_257'),
  10. key: 'prepaid',
  11. },
  12. }
  13. export const DECORATORS = {
  14. eip: {
  15. type: [
  16. 'type',
  17. {
  18. initialValue: 'none',
  19. },
  20. ],
  21. charge_type: [
  22. 'charge_type',
  23. {
  24. initialValue: 'traffic',
  25. },
  26. ],
  27. bgp_type: [
  28. 'bgp_type',
  29. {
  30. initialValue: '',
  31. },
  32. ],
  33. bandwidth: [
  34. 'bandwidth',
  35. {
  36. initialValue: 30,
  37. validateFirst: true,
  38. },
  39. ],
  40. eip: [
  41. 'eip',
  42. {
  43. rules: [
  44. { required: true, message: i18n.t('compute.text_145'), trigger: 'change' },
  45. ],
  46. },
  47. ],
  48. },
  49. billing_type: [
  50. 'billing_type',
  51. {
  52. initialValue: 'postpaid',
  53. },
  54. ],
  55. duration: {
  56. durationStandard: [
  57. 'durationStandard',
  58. {
  59. initialValue: 'none',
  60. },
  61. ],
  62. duration: [
  63. 'duration',
  64. {
  65. initialValue: '1h',
  66. },
  67. ],
  68. },
  69. project_domain: [
  70. 'project_domain',
  71. {
  72. initialValue: undefined,
  73. },
  74. ],
  75. name: [
  76. 'name',
  77. {
  78. validateFirst: true,
  79. rules: [
  80. { required: true, message: i18n.t('network.text_218') },
  81. { validator: validateForm('serverName') },
  82. ],
  83. },
  84. ],
  85. description: ['description'],
  86. __meta__: [
  87. '__meta__',
  88. {
  89. rules: [
  90. { validator: validateForm('tagName') },
  91. ],
  92. },
  93. ],
  94. }
  95. // capbilit接口所需要的参数
  96. export const CAPABILIT_PARAMS = ['city', 'provider', 'cloudregion']
  97. export const SKU_PARAMS = [...CAPABILIT_PARAMS]