diff --git a/src/assets/css/common/table-common.scss b/src/assets/css/common/table-common.scss index 094c6656..e4ceaf16 100644 --- a/src/assets/css/common/table-common.scss +++ b/src/assets/css/common/table-common.scss @@ -230,6 +230,10 @@ margin-bottom: 10px; } +.margin-l-16 { + margin-left: 16px; +} + .padding-r-20 { padding-right: 20px; } diff --git a/src/views/detections/DetectionRow.vue b/src/views/detections/DetectionRow.vue index 449ceea7..cfcdda93 100644 --- a/src/views/detections/DetectionRow.vue +++ b/src/views/detections/DetectionRow.vue @@ -11,7 +11,7 @@
- {{ detection.eventName || '-' }} + {{ detection.eventName || '-' }}
{{item.key}} ({{ item.type }}) @@ -22,7 +22,7 @@
-
+
{{$t('detections.eventType')}} :   {{detection.eventType || '-'}} diff --git a/src/views/detections/Index.vue b/src/views/detections/Index.vue index 436e5581..f3c08991 100644 --- a/src/views/detections/Index.vue +++ b/src/views/detections/Index.vue @@ -701,10 +701,24 @@ export default { this.$refs.search.changeParams([params]) } else if (topColumn === 'keyFields') { const nameList = name.split(',') + + // 多个keyField、keyValues时进行拆分匹配 + const mid = Math.ceil(nameList.length / 2) + const fieldsList = nameList.slice(0, mid) + const valuesList = nameList.slice(mid) + const columnList = this.filterData[2].topColumn.split(',') - nameList.forEach((item, index) => { + fieldsList.forEach(item => { const params = { - column: columnList[index], + column: columnList[0], + operator: '=', + value: item + } + this.$refs.search.changeParams([params]) + }) + valuesList.forEach(item => { + const params = { + column: columnList[1], operator: '=', value: item } diff --git a/src/views/detections/overview/detectionDetailMixin.js b/src/views/detections/overview/detectionDetailMixin.js index d3f95d31..6b82a313 100644 --- a/src/views/detections/overview/detectionDetailMixin.js +++ b/src/views/detections/overview/detectionDetailMixin.js @@ -110,29 +110,35 @@ export default { if (res.status === 200) { // 类型为Threshold时处理折线图 if (this.detection.ruleType === detectionRuleType.threshold.key) { - const seriesData = [] - res.data.data.result.forEach(item => { - seriesData.push([getMillisecond(JSON.parse(item.statTime)), item.recordsNums]) - }) - this.lineOption.series[0].data = seriesData - this.lineOption.series[0].color = getSeverityNumberColor(res.data.data.result[0].severity) || '#ff9a79' + const data = res.data.data.result + if (data && data.length > 0) { + const seriesData = [] + data.forEach(item => { + seriesData.push([getMillisecond(JSON.parse(item.statTime)), item.recordsNums]) + }) + this.lineOption.series[0].data = seriesData + this.lineOption.series[0].color = getSeverityNumberColor(res.data.data.result[0].severity) || '#ff9a79' - this.seriesDataNum = seriesData.length - if (this.seriesDataNum <= 1) { - this.lineOption.series[0].symbol = 'circle' - this.lineOption.series[0].symbolSize = 9 - } else { - this.lineOption.series[0].symbol = 'none' + this.seriesDataNum = seriesData.length + if (this.seriesDataNum <= 1) { + this.lineOption.series[0].symbol = 'circle' + this.lineOption.series[0].symbolSize = 9 + } else { + this.lineOption.series[0].symbol = 'none' + } + + this.myChart = markRaw(echarts.init(document.getElementById('myChart' + this.detection.eventId))) + this.myChart.setOption(this.lineOption) } - - this.myChart = markRaw(echarts.init(document.getElementById('myChart' + this.detection.eventId))) - this.myChart.setOption(this.lineOption) } else { - const detailData = res.data.data.result.pop() - if (detailData?.eventInfo) { - detailData.eventInfoList = JSON.parse(detailData.eventInfo) + const data = res.data.data.result + if (data && data.length > 0) { + const detailData = res.data.data.result.pop() + if (detailData?.eventInfo) { + detailData.eventInfoList = JSON.parse(detailData.eventInfo) + } + this.myDetection = { ...detailData, ...this.detection } } - this.myDetection = { ...detailData, ...this.detection } } } }).catch(e => { @@ -150,11 +156,14 @@ export default { } axios.get(api.detection.event.detail, { params }).then(res => { if (res.status === 200) { - const detailData = res.data.data.result[0] - if (detailData.eventInfo) { - detailData.eventInfoList = JSON.parse(detailData.eventInfo) + const data = res.data.data.result + if (data && data.length > 0) { + const detailData = data[0] + if (detailData.eventInfo) { + detailData.eventInfoList = JSON.parse(detailData.eventInfo) + } + this.myDetection = { ...this.myDetection, ...detailData } } - this.myDetection = { ...this.myDetection, ...detailData } } }).catch(e => { this.$message.error(this.errorMsgHandler(e))