diff --git a/nezha-fronted/src/components/common/labelFilter/clickSearch.vue b/nezha-fronted/src/components/common/labelFilter/clickSearch.vue
index f26c7bc2b..6ebb9e013 100644
--- a/nezha-fronted/src/components/common/labelFilter/clickSearch.vue
+++ b/nezha-fronted/src/components/common/labelFilter/clickSearch.vue
@@ -6,7 +6,7 @@
- {{item.key || item.name || item.label}}
+ {{item.key || item.name || item.label}}
@@ -89,7 +89,7 @@ export default {
let top
switch (type) {
case 'checkBox': {
- top = 4
+ top = 8
break
}
case 'dropdownCheckBox': {
@@ -317,7 +317,7 @@ export default {
this.$set(item, 'isFocus', isFocus)
},
needMore (type, item, expand) {
- const contentWidth = this.$refs.searchContentBox[0].offsetWidth - 210
+ const contentWidth = this.$refs.searchContentBox[0].offsetWidth - 240
// 窗口尺寸没改变,则只重排当前type
if (type && contentWidth === this.contentWidth) {
this.titleSearchListCopy[type].width = 0
@@ -367,6 +367,7 @@ export default {
changShowMore (type) {
// this.changeMoreNum = 0
this.titleSearchListCopy[type].showMore = !this.titleSearchListCopy[type].showMore
+ // this.needMore()
// this.$nextTick(() => {
// this.changeMoreNum++
// })
diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue
index 93655a5c9..a26f891c9 100644
--- a/nezha-fronted/src/components/page/alert/alertMessage.vue
+++ b/nezha-fronted/src/components/page/alert/alertMessage.vue
@@ -8,7 +8,7 @@
:api="url"
:custom-table-title.sync="tools.customTableTitle"
:from="fromRoute.alertMessage"
- :layout="['searchInput', 'elementSet', 'pagination']"
+ :layout="['searchInput', 'elementSet', 'clickSearch', 'pagination']"
:search-msg="searchMsg"
@search="search"
v-loading="tools.loading"
@@ -24,6 +24,9 @@
+
+
+
{
+ this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false
if (response.code == 200) {
this.nowTime = this.utcTimeToTimezoneStr(response.time)
this.tableData = response.data.list
+ if (response.statistics && this.$route.path === '/alertMessage') {
+ this.setSearchData(response.statistics)
+ }
/* const axiosAll = []
this.$nextTick(() => {
this.tableData.forEach((item) => {
@@ -654,6 +758,64 @@ export default {
}
})
},
+ setSearchData (statistics) {
+ Object.keys(this.titleSearchList).forEach(key => {
+ const keys = key === 'assetLabel' ? 'meta' : key
+ this.titleSearchList[key].children = statistics[keys].map(d => { return { ...d, value: d.id } })
+ this.detailSearchList[key].children = statistics[keys].map(d => { return { ...d, value: d.id } })
+ if (this.titleSearchList[key].children.length === 0) {
+ // delete this.titleSearchList[key]
+ // delete this.detailSearchList[key]
+ } else {
+ this.titleSearchList[key].show = true
+ this.detailSearchList[key].show = true
+ }
+ this.titleSearchList[key].show = true
+ this.detailSearchList[key].show = true
+ })
+ },
+ reloadTable (obj) {
+ const params = JSON.parse(JSON.stringify(obj))
+ if (this.detailType === 'view') {
+ const obj = {}
+ params.modelIds = params.modelIdsDetail
+ params.fieldsDetail.forEach(item => {
+ const arr = item.split('-')
+ if (obj[arr[0]]) {
+ obj[arr[0]].push(arr[1])
+ } else {
+ obj[arr[0]] = [arr[1]]
+ }
+ })
+ params.fields = JSON.stringify(obj)
+ if (params.fields === '{}') {
+ params.fields = ''
+ }
+ delete params.modelIdsDetail
+ delete params.fieldsDetail
+ }
+ Object.keys(params).forEach(key => {
+ if (typeof params[key] === 'string') {
+ this.searchCheckBox[key] = params[key] ? params[key] : null
+ } else {
+ params[key] && params[key].length > 0 ? this.searchCheckBox[key] = params[key].join(',') : this.searchCheckBox[key] = null
+ }
+ })
+ if (!this.timer) {
+ this.timer = setTimeout(() => {
+ this.getTableData()
+ clearTimeout(this.timer)
+ this.timer = ''
+ }, 1000)
+ } else {
+ clearTimeout(this.timer)
+ this.timer = setTimeout(() => {
+ this.getTableData()
+ clearTimeout(this.timer)
+ this.timer = ''
+ }, 1000)
+ }
+ },
promQueryParamConvert (alert) {
const obj = { ...alert }
let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'') + ')'
@@ -834,4 +996,11 @@ export default {
cursor: default;
font-weight: bold;
}
+ .list-page /deep/ .main-container{
+ display: flex;
+ flex-direction: column;
+ /deep/ .nz-table2{
+ flex: 1;
+ }
+ }