index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div>
  3. <item-filters
  4. :getParams="getParams"
  5. :disableds="disableds"
  6. :decorators="decorators" />
  7. <sku-list
  8. :filterSkuCallback="filterSkuCallback"
  9. ref="SKU_LIST" />
  10. </div>
  11. </template>
  12. <script>
  13. import SkuList from './components/List'
  14. import { SKU_PARAMS } from '@Network/views/nats/constants'
  15. export default {
  16. name: 'NatCreateSku',
  17. components: {
  18. SkuList,
  19. },
  20. inject: ['form'],
  21. props: {
  22. decorators: {
  23. type: Object,
  24. },
  25. filterSkuCallback: {
  26. type: Function,
  27. },
  28. disableds: {
  29. type: Object,
  30. },
  31. },
  32. methods: {
  33. getParams (keys) {
  34. const values = this.form.getFieldsValue(keys)
  35. const params = {
  36. ...values,
  37. scope: 'domain',
  38. }
  39. if (this.form.getFieldValue('billing_type') === 'postpaid') {
  40. params.postpaid_status = 'available'
  41. } else {
  42. params.prepaid_status = 'available'
  43. }
  44. return params
  45. },
  46. getZone () {
  47. return this.$refs.SKU_LIST.getZone()
  48. },
  49. getCloudregionId () {
  50. return this.$refs.SKU_LIST.getCloudregionId()
  51. },
  52. async fetchSkus () {
  53. const { fetchSkus } = this.$refs.SKU_LIST
  54. const values = this.getParams(SKU_PARAMS)
  55. try {
  56. await fetchSkus(values)
  57. } catch (err) {
  58. throw err
  59. }
  60. },
  61. },
  62. }
  63. </script>