index.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div>
  3. <item-filters
  4. :getParams="getParams"
  5. :disableds="disableds"
  6. :decorators="decorators" />
  7. <sku-list
  8. @update:options="skuChanged"
  9. :filterSkuCallback="filterSkuCallback"
  10. ref="SKU_LIST" />
  11. </div>
  12. </template>
  13. <script>
  14. import SkuList from './components/List'
  15. export default {
  16. name: 'FileSystemSku',
  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. skuChanged (options) {
  34. this.$emit('update:options', options)
  35. },
  36. getParams (keys) {
  37. const values = this.form.fc.getFieldsValue(keys)
  38. const params = {
  39. ...values,
  40. scope: 'domain',
  41. }
  42. if (this.form.fc.getFieldValue('billing_type') === 'postpaid') {
  43. params.postpaid_status = 'available'
  44. } else {
  45. params.prepaid_status = 'available'
  46. }
  47. return params
  48. },
  49. async fetchSkus (extraParams) {
  50. const { fetchSkus } = this.$refs.SKU_LIST
  51. const values = this.getParams(extraParams || ['cloudregion_id'])
  52. try {
  53. await fetchSkus(values)
  54. } catch (err) {
  55. throw err
  56. }
  57. },
  58. },
  59. }
  60. </script>