VpcList.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns" />
  5. </template>
  6. <script>
  7. import {
  8. getNameDescriptionTableColumn,
  9. getRegionTableColumn,
  10. getBrandTableColumn,
  11. getAccountTableColumn,
  12. } from '@/utils/common/tableColumn'
  13. export default {
  14. name: 'GloblaVpcSunVpcList',
  15. props: ['getParams'],
  16. data () {
  17. return {
  18. list: this.$list.createList(this, {
  19. id: 'GloblaVpcSunVpcListSidePage',
  20. resource: 'vpcs',
  21. steadyStatus: ['available', 'unavailable'],
  22. getParams: this.getParams,
  23. filterOptions: {
  24. name: {
  25. label: this.$t('network.text_21'),
  26. filter: true,
  27. formatter: val => {
  28. return `name.contains("${val}")`
  29. },
  30. },
  31. },
  32. }),
  33. columns: [
  34. getNameDescriptionTableColumn({
  35. vm: this,
  36. hideField: true,
  37. slotCallback: row => {
  38. return row.name
  39. },
  40. }),
  41. {
  42. field: 'cidr_block',
  43. title: this.$t('network.vpc.cidr_block.ipv4.label'),
  44. slots: {
  45. default: ({ row }) => {
  46. const ips = row.cidr_block
  47. return ips ? ips.split(',').map((ip) => <div>{ip}</div>) : null
  48. },
  49. },
  50. },
  51. getRegionTableColumn(),
  52. getBrandTableColumn(),
  53. getAccountTableColumn(),
  54. ],
  55. }
  56. },
  57. created () {
  58. this.list.fetchData()
  59. },
  60. }
  61. </script>