2022-03-28 16:44:40 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2022-03-30 18:58:47 +08:00
|
|
|
<el-tabs v-model="activeName" type="card" v-if="!nodata">
|
|
|
|
|
<el-tab-pane v-for="item in cardNames" :label="item.label" :name="item.key" :key="item.key">
|
2022-03-31 13:31:23 +08:00
|
|
|
<div v-if="item.key === 'detail' && activeName === 'detail'">
|
2022-03-31 09:52:13 +08:00
|
|
|
<alert-message-info-detail :info-data="infoData"/>
|
|
|
|
|
</div>
|
2023-04-24 16:31:50 +08:00
|
|
|
<div v-else-if="item.key === 'dashboard' && activeName === 'dashboard'" class="alert-message-info-dashboard">
|
|
|
|
|
<dashboard :temp-id="infoData.alertRule.dashboardId" :showImport="false" :showName="false" :url-type="'dashboard'" :time="timeRange" :from="fromRoute.dashboard"></dashboard>
|
|
|
|
|
</div>
|
2022-03-31 19:07:46 +08:00
|
|
|
<div v-else-if="(activeName === item.key) && infoData[item.key]" class="no-position-alert-label">
|
2022-03-31 13:31:23 +08:00
|
|
|
<!-- <searchItemInfo :obj="findData(item.key)" :severityData="severityData" :fa-loading="false"></searchItemInfo>-->
|
|
|
|
|
<alertLabel
|
2022-04-20 17:16:07 +08:00
|
|
|
class="alert"
|
2022-03-31 13:31:23 +08:00
|
|
|
v-if="item.key !=='alertRule'"
|
|
|
|
|
:id="infoData[item.key].id"
|
|
|
|
|
:that="findData2(item.key)"
|
2022-04-01 15:43:14 +08:00
|
|
|
:alertTableDialog="true"
|
2022-03-31 13:31:23 +08:00
|
|
|
:type="item.key"/>
|
|
|
|
|
<alertRuleInfo
|
2022-04-20 17:16:07 +08:00
|
|
|
class="alert"
|
2022-03-31 13:31:23 +08:00
|
|
|
v-else
|
|
|
|
|
:id="infoData[item.key].id"
|
|
|
|
|
:severity-data="severityData"
|
|
|
|
|
:that="findData2(item.key)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else-if="item.key === 'trbShot' && activeName === 'trbShot'">
|
2022-07-21 18:57:15 +08:00
|
|
|
<div v-html="infoData.alertRule.trbShot" v-if="infoData.alertRule.trbShot">
|
2022-03-31 13:31:23 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-03-30 18:58:47 +08:00
|
|
|
</el-tab-pane>
|
2022-03-28 16:44:40 +08:00
|
|
|
</el-tabs>
|
2022-03-30 15:55:38 +08:00
|
|
|
<div v-else class="table-no-data">
|
|
|
|
|
<svg class="icon" aria-hidden="true">
|
|
|
|
|
<use xlink:href="#nz-icon-no-data-list"></use>
|
|
|
|
|
</svg>
|
|
|
|
|
<div class="table-no-data__title">No results found</div>
|
|
|
|
|
</div>
|
2022-03-28 16:44:40 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-03-31 09:52:13 +08:00
|
|
|
import alertMessageInfoDetail from '@/components/common/alert/alertMessageInfoDetail'
|
2022-03-31 13:31:23 +08:00
|
|
|
import searchItemInfo from '@/components/common/globalSearch/searchItemInfo'
|
2022-04-26 11:26:31 +08:00
|
|
|
import alertLabel from '@/components/common/alert/alertLabel3'
|
|
|
|
|
import alertRuleInfo from '@/components/common/alert/alertRuleInfo2'
|
2023-04-24 16:31:50 +08:00
|
|
|
import dashboard from '@/components/page/integration/integration-tabs/dashboard'
|
|
|
|
|
import { fromRoute } from '@/components/common/js/constants'
|
2022-03-31 13:31:23 +08:00
|
|
|
// import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
|
2022-03-28 16:44:40 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'alertMessageInfoTab',
|
2022-03-31 09:52:13 +08:00
|
|
|
components: {
|
2022-03-31 13:31:23 +08:00
|
|
|
alertMessageInfoDetail,
|
|
|
|
|
searchItemInfo,
|
|
|
|
|
alertLabel,
|
2023-04-24 16:31:50 +08:00
|
|
|
alertRuleInfo,
|
|
|
|
|
dashboard
|
2022-03-31 09:52:13 +08:00
|
|
|
},
|
2022-03-31 13:31:23 +08:00
|
|
|
// mixins: [alertLabelMixin],
|
2022-03-30 15:55:38 +08:00
|
|
|
props: {
|
2022-03-30 18:58:47 +08:00
|
|
|
infoData: {
|
|
|
|
|
type: Object
|
2022-03-31 19:07:46 +08:00
|
|
|
},
|
|
|
|
|
nodata: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
2023-04-24 16:31:50 +08:00
|
|
|
},
|
|
|
|
|
time: {}
|
2022-03-30 15:55:38 +08:00
|
|
|
},
|
2022-03-31 13:31:23 +08:00
|
|
|
computed: {
|
|
|
|
|
severityData () {
|
|
|
|
|
return this.$store.getters.severityData
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-03-28 16:44:40 +08:00
|
|
|
data () {
|
|
|
|
|
return {
|
2023-04-24 16:31:50 +08:00
|
|
|
fromRoute,
|
2022-03-30 18:58:47 +08:00
|
|
|
activeName: 'detail',
|
2022-03-30 15:55:38 +08:00
|
|
|
cardNames: [{
|
|
|
|
|
key: 'detail',
|
|
|
|
|
label: this.$t('overall.detail')
|
2022-03-30 18:58:47 +08:00
|
|
|
}],
|
|
|
|
|
sysArr: [{
|
2022-03-31 13:31:23 +08:00
|
|
|
key: 'alertRule',
|
2022-07-05 17:57:15 +08:00
|
|
|
label: this.$t('alert.rule')
|
2022-03-31 13:31:23 +08:00
|
|
|
}, {
|
2022-03-30 18:58:47 +08:00
|
|
|
key: 'dc',
|
|
|
|
|
label: this.$t('overall.dc')
|
|
|
|
|
}, {
|
|
|
|
|
key: 'asset',
|
2022-07-05 17:57:15 +08:00
|
|
|
label: this.$t('asset.asset')
|
2022-03-30 18:58:47 +08:00
|
|
|
}, {
|
|
|
|
|
key: 'endpoint',
|
2022-06-21 18:14:21 +08:00
|
|
|
label: this.$t('asset.endpoint')
|
2022-03-30 18:58:47 +08:00
|
|
|
}, {
|
|
|
|
|
key: 'module',
|
|
|
|
|
label: this.$t('overall.module')
|
|
|
|
|
}, {
|
|
|
|
|
key: 'project',
|
2022-07-05 17:57:15 +08:00
|
|
|
label: this.$t('project.project.projectName')
|
2023-04-24 16:31:50 +08:00
|
|
|
}],
|
|
|
|
|
timeRange: []
|
2022-03-30 15:55:38 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-03-30 18:58:47 +08:00
|
|
|
watch: {
|
|
|
|
|
infoData: {
|
|
|
|
|
immediate: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
if (n) {
|
|
|
|
|
this.cardNames = [{
|
|
|
|
|
key: 'detail',
|
|
|
|
|
label: this.$t('overall.detail')
|
|
|
|
|
}]
|
|
|
|
|
this.sysArr.forEach(item => {
|
|
|
|
|
if (n[item.key]) {
|
|
|
|
|
this.cardNames.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-04-24 16:31:50 +08:00
|
|
|
// && n.alertRule.dashboardId
|
2023-04-26 13:41:04 +08:00
|
|
|
n.alertRule && (n.alertRule.dashboardId = 102224)
|
2023-04-25 15:09:33 +08:00
|
|
|
if (n.alertRule && n.alertRule.dashboardId) {
|
2023-04-26 13:41:04 +08:00
|
|
|
//
|
2023-04-24 16:31:50 +08:00
|
|
|
this.cardNames.push({
|
|
|
|
|
key: 'dashboard',
|
2023-04-25 15:09:33 +08:00
|
|
|
label: this.$t('overall.dashboard')
|
2023-04-24 16:31:50 +08:00
|
|
|
})
|
|
|
|
|
}
|
2022-07-21 18:57:15 +08:00
|
|
|
if (n.alertRule && n.alertRule.trbShot && n.alertRule.trbShot != '<div class="editor-core ql-container ql-snow"><div class="ql-editor"><p><br></p></div></div>') {
|
2022-03-31 13:31:23 +08:00
|
|
|
this.cardNames.push({
|
|
|
|
|
key: 'trbShot',
|
|
|
|
|
label: this.$t('alert.config.trbShot')
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-03-30 18:58:47 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-04-24 16:31:50 +08:00
|
|
|
},
|
|
|
|
|
time: {
|
|
|
|
|
immediate: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
if (n && n.length) {
|
|
|
|
|
this.timeRange = [n[0] * 1000, n[1] * 1000]
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-30 18:58:47 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-03-30 15:55:38 +08:00
|
|
|
mounted () {
|
2022-03-30 18:58:47 +08:00
|
|
|
|
2022-03-30 15:55:38 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2022-03-31 13:31:23 +08:00
|
|
|
findData (key) {
|
|
|
|
|
if (key) {
|
|
|
|
|
const obj = {
|
|
|
|
|
...this.$loadsh.cloneDeep(this.infoData[key]),
|
|
|
|
|
type: key
|
|
|
|
|
}
|
|
|
|
|
if (key === 'dc') {
|
|
|
|
|
obj.type = 'datacenter'
|
|
|
|
|
} else if (key === 'alertRule') {
|
|
|
|
|
obj.type = 'alertrule'
|
|
|
|
|
}
|
|
|
|
|
return { ...obj }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
findData2 (key) {
|
|
|
|
|
if (key) {
|
|
|
|
|
const obj = {
|
|
|
|
|
...this.$loadsh.cloneDeep(this.infoData[key]),
|
|
|
|
|
type: key,
|
|
|
|
|
position: {
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return { ...obj }
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-28 16:44:40 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|