columns.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import {
  2. getNameDescriptionTableColumn,
  3. getBrandTableColumn,
  4. getTimeTableColumn,
  5. getPublicScopeTableColumn,
  6. getStatusTableColumn,
  7. getProjectTableColumn,
  8. getRegionTableColumn,
  9. getAccountTableColumn,
  10. } from '@/utils/common/tableColumn'
  11. import i18n from '@/locales'
  12. export default {
  13. created () {
  14. this.columns = [
  15. getNameDescriptionTableColumn({
  16. onManager: this.onManager,
  17. hideField: true,
  18. title: i18n.t('network.text_291'),
  19. slotCallback: row => {
  20. return (
  21. <side-page-trigger onTrigger={ () => this.handleOpenSidepage(row) }>{ row.name }</side-page-trigger>
  22. )
  23. },
  24. }),
  25. {
  26. field: 'acl_entries',
  27. title: i18n.t('network.text_312'),
  28. width: 150,
  29. slots: {
  30. default: ({ row }, h) => {
  31. const arr = []
  32. if (row.acl_entries && row.acl_entries.length > 0) {
  33. row.acl_entries.forEach(obj => {
  34. let text = obj.cidr
  35. if (obj.comment) {
  36. text += ` | ${obj.comment}`
  37. }
  38. arr.push({
  39. value: text,
  40. })
  41. })
  42. }
  43. if (arr.length <= 0) {
  44. return [
  45. <div class='text-color-help'>{ this.$t('network.text_729') }</div>,
  46. ]
  47. }
  48. const list = arr.map(item => <a-tag class='mb-2 mr-1'>{ item.value }</a-tag>)
  49. return [<list-body-cell-popover text={i18n.t('common_323', [arr.length])} max-width="400px">
  50. <div style="display: inline-flex; flex-wrap: wrap; max-width: 40vw;">
  51. {...list}
  52. </div>
  53. </list-body-cell-popover>]
  54. },
  55. },
  56. },
  57. {
  58. field: 'lb_listener_count',
  59. title: this.$t('network.text_750'),
  60. },
  61. getStatusTableColumn({ statusModule: 'lbacl', vm: this }),
  62. getBrandTableColumn(),
  63. getAccountTableColumn(),
  64. getTimeTableColumn(),
  65. {
  66. field: 'updated_at',
  67. title: i18n.t('network.text_314'),
  68. width: 180,
  69. formatter: ({ cellValue }) => {
  70. return this.$moment(cellValue).format()
  71. },
  72. },
  73. getPublicScopeTableColumn({ vm: this, resource: 'loadbalanceracls' }),
  74. getRegionTableColumn(),
  75. getProjectTableColumn(),
  76. ]
  77. },
  78. }