feat: 添加alertMessageInfo

This commit is contained in:
zhangyu
2022-03-31 13:31:23 +08:00
parent 0c662135b4
commit 5e067891ff
5 changed files with 83 additions and 16 deletions

View File

@@ -57,6 +57,10 @@
overflow-y: auto;
}
}
.alert-label.alert-label__border{
border: none !important;
position: unset;
}
}
}
.info-box-right{

View File

@@ -2,10 +2,27 @@
<div>
<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">
{{item.key}}
<div v-if="item.key === 'detail'">
<div v-if="item.key === 'detail' && activeName === 'detail'">
<alert-message-info-detail :info-data="infoData"/>
</div>
<div v-else-if="(activeName === 'alertRule' || activeName === 'dc' || activeName === 'asset' || activeName === 'project' || activeName === 'module' || activeName === 'endpoint') && infoData[item.key]">
<!-- <searchItemInfo :obj="findData(item.key)" :severityData="severityData" :fa-loading="false"></searchItemInfo>-->
<alertLabel
v-if="item.key !=='alertRule'"
:id="infoData[item.key].id"
:that="findData2(item.key)"
:type="item.key"/>
<alertRuleInfo
v-else
:id="infoData[item.key].id"
:severity-data="severityData"
:that="findData2(item.key)"
/>
</div>
<div v-else-if="item.key === 'trbShot' && activeName === 'trbShot'">
<div v-html="infoData.alertRule.trbShot">
</div>
</div>
</el-tab-pane>
</el-tabs>
<div v-else class="table-no-data">
@@ -19,16 +36,29 @@
<script>
import alertMessageInfoDetail from '@/components/common/alert/alertMessageInfoDetail'
import searchItemInfo from '@/components/common/globalSearch/searchItemInfo'
import alertLabel from '@/components/common/alert/alertLabel'
import alertRuleInfo from '@/components/common/alert/alertRuleInfo'
// import alertLabelMixin from '@/components/common/mixin/alertLabelMixin'
export default {
name: 'alertMessageInfoTab',
components: {
alertMessageInfoDetail
alertMessageInfoDetail,
searchItemInfo,
alertLabel,
alertRuleInfo
},
// mixins: [alertLabelMixin],
props: {
infoData: {
type: Object
}
},
computed: {
severityData () {
return this.$store.getters.severityData
}
},
data () {
return {
activeName: 'detail',
@@ -38,14 +68,14 @@ export default {
label: this.$t('overall.detail')
}],
sysArr: [{
key: 'alertRule',
label: this.$t('alert.alertRule')
}, {
key: 'dc',
label: this.$t('overall.dc')
}, {
key: 'asset',
label: this.$t('overall.asset')
}, {
key: 'alertRule',
label: this.$t('alert.alertRule')
}, {
key: 'endpoint',
label: this.$t('overall.endpoint')
@@ -72,6 +102,12 @@ export default {
this.cardNames.push(item)
}
})
if (n.alertRule && n.alertRule.trbShot) {
this.cardNames.push({
key: 'trbShot',
label: this.$t('alert.config.trbShot')
})
}
}
}
}
@@ -80,7 +116,33 @@ export default {
},
methods: {
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 }
}
}
}
}
</script>

View File

@@ -167,14 +167,6 @@ export default {
this.$i18n.locale = this.lang
this.theme = res.data.user.theme
this.userInfo = res.data.user
// 获取可选语言
get('/sys/dict/all?type=lang').then(response => {
if (response.code === 200) {
const langList = response.data.map(lang => ({ name: lang.name, value: lang.value }))
this.$store.commit('setLangList', langList)
localStorage.setItem('nz-language-list', JSON.stringify(langList))
}
})
localStorage.setItem('nz-token', res.data.authToken)
if (res.data.authFlag === 1) {
if (res.data.authBind === 0) {

View File

@@ -14,7 +14,7 @@ import router from './router'
import VueResource from 'vue-resource'
import axios from 'axios'
import { hasPermission, hasButton } from './permission'
import loadsh from 'lodash'
import plTable from 'pl-table'
import 'pl-table/themes/index.css'
@@ -62,6 +62,7 @@ Vue.prototype.$post = post
Vue.prototype.$get = get
Vue.prototype.$put = put
Vue.prototype.$delete = del
Vue.prototype.$loadsh = loadsh
Vue.prototype.$CONSTANTS = constants
Vue.prototype.$TOOLS = tools
Vue.prototype.$bottomBoxWindow = bottomBoxWindow // 底部上滑框控制

View File

@@ -102,6 +102,14 @@ const user = {
localStorage.setItem('nz-mfa-enable', Number(res.data.mfaAuthEnable) ? 1 : 0)
store.commit('setLanguage', res.data.user.lang || defaultAppearance.language)
store.commit('setTimeFormatMain', localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss')
// 获取可选语言
get('/sys/dict/all?type=lang').then(response => {
if (response.code === 200) {
const langList = response.data.map(lang => ({ name: lang.name, value: lang.value }))
store.commit('setLangList', langList)
localStorage.setItem('nz-language-list', JSON.stringify(langList))
}
})
post('/sys/user/permissions', { token: res.data.token }).then(res => {
const menuList = sortByOrderNum(res.data.menus)
// localStorage.setItem('nz-user-permissions', JSON.stringify(res.data.buttons))