List.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <notification-base-list :extra-list-params="ExtraListParams" :extra-columns="ExtraColumns" :extra-filter-options="ExtraFilterOptions" :id="id" />
  3. </template>
  4. <script>
  5. import WindowsMixin from '@/mixins/windows'
  6. import NotificationBaseList from '@IAM/sections/NotificationBaseList'
  7. import { getTimeRangeFilter } from '@/utils/common/tableFilter'
  8. import { getTimeTableColumn } from '@/utils/common/tableColumn'
  9. import { NOTIFY_TOPIC_TYPES_MAP } from '@IAM/constants'
  10. export default {
  11. name: 'NotificationList',
  12. components: {
  13. NotificationBaseList,
  14. },
  15. mixins: [WindowsMixin],
  16. props: {
  17. id: String,
  18. },
  19. data () {
  20. return {
  21. ExtraListParams: { contact_type: 'webconsole' },
  22. ExtraColumns: [
  23. {
  24. title: this.$t('system.notify.topic.type'),
  25. field: 'topic_type',
  26. sortable: true,
  27. minWidth: 100,
  28. showOverflow: 'title',
  29. formatter: ({ row }) => {
  30. return NOTIFY_TOPIC_TYPES_MAP[row.topic_type] ? NOTIFY_TOPIC_TYPES_MAP[row.topic_type].label : '-'
  31. },
  32. },
  33. getTimeTableColumn({
  34. field: 'received_at',
  35. title: this.$t('system.text_316'),
  36. }),
  37. {
  38. title: this.$t('system.text_308'),
  39. field: 'content',
  40. slots: {
  41. default: ({ row }) => {
  42. return [<a-button type="link" onClick={() => this.handleContentView(row)} style="padding-left:0">{this.$t('cloudenv.text_463')}</a-button>]
  43. },
  44. },
  45. },
  46. ],
  47. ExtraFilterOptions: {
  48. // topic_type: {
  49. // label: this.$t('system.text_48'),
  50. // filter: true,
  51. // dropdown: true,
  52. // distinctField: {
  53. // type: 'field',
  54. // key: 'topic_type',
  55. // getParams: this.getParam,
  56. // },
  57. // formatter: val => {
  58. // return `topic_type.contains("${val}")`
  59. // },
  60. // mapper: list => {
  61. // return list.map(({ key, label }) => {
  62. // return {
  63. // key,
  64. // label: NOTIFY_TOPIC_TYPES_MAP[key] ? NOTIFY_TOPIC_TYPES_MAP[key].label : label,
  65. // }
  66. // })
  67. // },
  68. // },
  69. received_at: getTimeRangeFilter({ label: this.$t('system.text_316'), field: 'received_at' }),
  70. },
  71. }
  72. },
  73. methods: {
  74. handleContentView (row) {
  75. this.createDialog('NotificationViewInfoDialog', {
  76. data: [row],
  77. })
  78. },
  79. },
  80. }
  81. </script>