index.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('dictionary.commonalert')"
  5. icon="res-commonalerts"
  6. :res-name="detailData.name"
  7. :current-tab="params.windowData.currentTab"
  8. :tabs="detailTabs"
  9. :loaded="loaded"
  10. @tab-change="handleTabChange">
  11. <template v-slot:actions>
  12. <actions
  13. :options="singleActions"
  14. :row="detailData"
  15. button-type="link"
  16. button-size="small" />
  17. </template>
  18. <component
  19. :is="params.windowData.currentTab"
  20. :listId="listId"
  21. :id="listId"
  22. :resId="data.id"
  23. :alertId="data.id"
  24. :data="detailData"
  25. :resource="resource"
  26. :on-manager="onManager"
  27. :getParams="getParams" />
  28. </base-side-page>
  29. </template>
  30. <script>
  31. import AlertrecortList from '@Monitor/views/alertrecord/components/List'
  32. import SidePageMixin from '@/mixins/sidePage'
  33. import WindowsMixin from '@/mixins/windows'
  34. import Actions from '@/components/PageList/Actions'
  35. import SingleActionsMixin from '../mixins/singleActions'
  36. import ColumnsMixin from '../mixins/columns'
  37. import CommonalertDetail from './Detail'
  38. export default {
  39. name: 'CommonalertsSidePage',
  40. components: {
  41. CommonalertDetail,
  42. Actions,
  43. AlertrecortList,
  44. },
  45. mixins: [SidePageMixin, WindowsMixin, SingleActionsMixin, ColumnsMixin],
  46. computed: {
  47. listId () {
  48. switch (this.params.windowData.currentTab) {
  49. case 'event-drawer':
  50. return 'EventListForHostSidePage'
  51. case 'commonalert-detail':
  52. return 'CommonalertDetailSidePage'
  53. case 'AlertrecortList':
  54. return 'AlertrecortListSidePage'
  55. default:
  56. return ''
  57. }
  58. },
  59. detailTabs () {
  60. const tabs = [
  61. { label: this.$t('sidepage.tab.label.detail'), key: 'commonalert-detail' },
  62. { label: this.$t('dictionary.actions'), key: 'event-drawer' },
  63. ]
  64. // if (this.$store.getters.isAdminMode) {
  65. // tabs.splice(1, 0, { label: this.$t('monitor.text_10'), key: 'AlertrecortList' })
  66. // }
  67. if (this.data.id) {
  68. tabs.splice(1, 0, { label: this.$t('monitor.text_10'), key: 'AlertrecortList' })
  69. }
  70. return tabs
  71. },
  72. getParams () {
  73. const param = {
  74. alert_id: this.data.id,
  75. }
  76. const { getParams = {} } = this.data
  77. const { used_by } = getParams
  78. if (used_by) {
  79. // 其他模块使用告警记录时,添加此参数进行区分
  80. param.used_by = used_by
  81. }
  82. return param
  83. },
  84. },
  85. }
  86. </script>