columns.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import {
  2. getBrandTableColumn,
  3. getStatusTableColumn,
  4. getEnabledTableColumn,
  5. getCopyWithContentTableColumn,
  6. getNameDescriptionTableColumn,
  7. getProjectDomainTableColumn,
  8. getTimeTableColumn,
  9. getTagTableColumn,
  10. } from '@/utils/common/tableColumn'
  11. import i18n from '@/locales'
  12. import {
  13. getAccessUrlTableColumn,
  14. getBalanceTableColumn,
  15. getGuestCountTableColumn,
  16. getHostCountTableColumn,
  17. getPublicScopeTableColumn,
  18. getResourceMatchProjectTableColumn,
  19. getLastSyncCostTableColumn,
  20. } from '../utils/columns'
  21. export default {
  22. created () {
  23. this.columns = [
  24. getNameDescriptionTableColumn({
  25. onManager: this.onManager,
  26. hideField: true,
  27. formRules: [
  28. { required: true, message: this.$t('common.text00042') },
  29. ],
  30. slotCallback: row => {
  31. return (
  32. <side-page-trigger onTrigger={() => this.handleOpenSidepage(row)}>{ row.name }</side-page-trigger>
  33. )
  34. },
  35. }),
  36. getAccessUrlTableColumn(),
  37. getStatusTableColumn({ vm: this, statusModule: 'cloudaccount' }),
  38. getEnabledTableColumn(),
  39. getStatusTableColumn({ statusModule: 'cloudaccountHealthStatus', title: i18n.t('cloudenv.text_93'), field: 'health_status', minWidth: 90 }),
  40. getTagTableColumn({
  41. onManager: this.onManager,
  42. resource: 'cloudaccounts',
  43. columns: () => this.columns,
  44. tipName: this.$t('cloudenv.text_12'),
  45. }),
  46. getBalanceTableColumn(),
  47. getBrandTableColumn(),
  48. getCopyWithContentTableColumn({ field: 'account', title: i18n.t('cloudenv.text_94') }),
  49. getHostCountTableColumn(),
  50. getGuestCountTableColumn(),
  51. getLastSyncCostTableColumn(),
  52. // getEnabledTableColumn({ field: 'enable_auto_sync', title: i18n.t('cloudenv.text_83'), minWidth: 90 }),
  53. {
  54. field: 'last_sync',
  55. title: i18n.t('cloudenv.text_103'),
  56. minWidth: 70,
  57. showOverflow: 'ellipsis',
  58. slots: {
  59. default: ({ row }) => {
  60. if (row.sync_status !== 'idle') { // 表示正在同步中
  61. return [
  62. <status status={ row.sync_status } statusModule='cloudaccountSyncStatus' />,
  63. ]
  64. } else {
  65. const time = this.$moment(row.last_sync)
  66. if (time) {
  67. return time.fromNow()
  68. } else {
  69. return '-'
  70. }
  71. }
  72. },
  73. },
  74. formatter: ({ row }) => {
  75. if (row.sync_status !== 'idle') { // 表示正在同步中
  76. return ''
  77. } else {
  78. const time = this.$moment(row.last_sync)
  79. if (time) {
  80. return time.fromNow()
  81. } else {
  82. return '-'
  83. }
  84. }
  85. },
  86. },
  87. {
  88. field: 'probe_at',
  89. title: i18n.t('cloudenv.text_309'),
  90. minWidth: 100,
  91. slots: {
  92. default: ({ row }) => {
  93. const time = this.$moment(row.probe_at)
  94. if (time) {
  95. return time.fromNow()
  96. } else {
  97. return '-'
  98. }
  99. },
  100. },
  101. },
  102. getPublicScopeTableColumn({ vm: this, resource: 'cloudaccounts' }),
  103. getProjectDomainTableColumn(),
  104. getResourceMatchProjectTableColumn(),
  105. getTimeTableColumn(),
  106. ]
  107. },
  108. }