CertificateList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :single-actions="singleActions"
  6. :group-actions="groupActions"
  7. :export-data-options="exportDataOptions"
  8. :hiddenExportKeys="['description']"
  9. :showPage="false" />
  10. </template>
  11. <script>
  12. import WindowsMixin from '@/mixins/windows'
  13. import ListMixin from '@/mixins/list'
  14. // import { getNameFilter } from '@/utils/common/tableFilter'
  15. import { getNameDescriptionTableColumn, getCopyWithContentTableColumn } from '@/utils/common/tableColumn'
  16. export default {
  17. name: 'CertificateListForWebAppSidepage',
  18. mixins: [WindowsMixin, ListMixin],
  19. props: {
  20. resId: String,
  21. data: {
  22. type: Object,
  23. required: true,
  24. },
  25. },
  26. data () {
  27. return {
  28. list: this.$list.createList(this, {
  29. id: 'WebAppCertificateList',
  30. resource: `webapps/${this.data.id}/certificates`,
  31. getParams: {
  32. },
  33. // filterOptions: {
  34. // name: getNameFilter(),
  35. // },
  36. }),
  37. columns: [
  38. getNameDescriptionTableColumn({
  39. onManager: this.onManager,
  40. hideField: true,
  41. title: this.$t('table.title.name'),
  42. showDesc: false,
  43. slotCallback: row => {
  44. return (
  45. <span>{ row.name }</span>
  46. )
  47. },
  48. }),
  49. {
  50. field: 'status',
  51. title: this.$t('compute.text_268'),
  52. slots: {
  53. default: ({ row }) => {
  54. const { expire_time } = row
  55. if (expire_time) {
  56. const time = new Date(expire_time).getTime() - new Date('2024-03-27 08:00:00')
  57. return time > 0 ? [<status specifyStatus={{ class: 'status-success', text: this.$t('compute.status_normal') }} />] : [<status specifyStatus={{ class: 'status-danger', text: this.$t('compute.status_expired') }} />]
  58. }
  59. return '-'
  60. },
  61. },
  62. formatter: ({ row }) => {
  63. const { expire_time } = row
  64. if (expire_time) {
  65. const time = new Date(expire_time).getTime() - new Date('2024-03-27 08:00:00')
  66. return time > 0 ? this.$t('compute.status_normal') : this.$t('compute.status_expired')
  67. }
  68. return '-'
  69. },
  70. },
  71. getCopyWithContentTableColumn({
  72. field: 'subject_name',
  73. title: this.$t('network.certificate_domain'),
  74. hiddenField: true,
  75. message: (row) => {
  76. return row.subject_name || '-'
  77. },
  78. slotCallback: (row) => {
  79. return row.subject_name || '-'
  80. },
  81. }),
  82. getCopyWithContentTableColumn({
  83. field: 'thumbprint',
  84. title: this.$t('network.thumbprint'),
  85. hiddenField: true,
  86. message: (row) => {
  87. return row.thumbprint || '-'
  88. },
  89. slotCallback: (row) => {
  90. return row.thumbprint || '-'
  91. },
  92. }),
  93. {
  94. field: 'expire_time',
  95. title: this.$t('network.expire_time'),
  96. formatter: ({ row }) => {
  97. if (row.expire_time) {
  98. return this.$moment(row.expire_time).format('YYYY-MM-DD')
  99. }
  100. return '-'
  101. },
  102. },
  103. ],
  104. singleActions: [],
  105. groupActions: [],
  106. }
  107. },
  108. computed: {
  109. exportDataOptions () {
  110. return {
  111. downloadType: 'local',
  112. title: this.$t('network.text_143'),
  113. items: [
  114. { field: 'id', label: 'ID' },
  115. ...this.columns,
  116. ],
  117. hiddenFields: ['status'],
  118. }
  119. },
  120. },
  121. created () {
  122. this.list.fetchData()
  123. },
  124. methods: {
  125. },
  126. }
  127. </script>