fix: 1、修复detection和entity搜索时,时间不是最新的问题
This commit is contained in:
@@ -209,3 +209,15 @@ export function getDurationsTimeByType (number, type) {
|
||||
}
|
||||
return `P${T}${number}${switchValueByDateType(type)}`
|
||||
}
|
||||
|
||||
export function getNowDate (timeFilter) {
|
||||
if (timeFilter?.dateRangeValue > -1) {
|
||||
return {
|
||||
startTime: (new Date()).getTime() - (timeFilter.dateRangeValue * 60 * 1000),
|
||||
endTime: (new Date()).getTime(),
|
||||
dateRangeValue: { value: timeFilter.dateRangeValue }
|
||||
}
|
||||
} else {
|
||||
return timeFilter
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ import DetectionFilter from '@/views/detections/DetectionFilter'
|
||||
import DetectionList from '@/views/detections/DetectionList'
|
||||
import Pagination from '@/components/common/Pagination'
|
||||
import { defaultPageSize, detectionPageType, detectionEventType } from '@/utils/constants'
|
||||
import { getNowTime, getSecond, getMillisecond } from '@/utils/date-util'
|
||||
import { getNowTime, getSecond, getMillisecond, getNowDate } from '@/utils/date-util'
|
||||
import { ref, shallowRef } from 'vue'
|
||||
import * as echarts from 'echarts'
|
||||
import {
|
||||
@@ -569,6 +569,12 @@ export default {
|
||||
this.timeFilter = { startTime: s, endTime: e, dateRangeValue: v.value }
|
||||
},
|
||||
search (param) {
|
||||
// 如果不是最新时间,则获取当前时间
|
||||
if (!param.isNowDate) {
|
||||
const myTimeFilter = getNowDate(this.$_.cloneDeep(this.timeFilter))
|
||||
this.reload(myTimeFilter.startTime, myTimeFilter.endTime, myTimeFilter.dateRangeValue)
|
||||
return true
|
||||
}
|
||||
let q
|
||||
let metaList
|
||||
if (param) {
|
||||
@@ -857,7 +863,7 @@ export default {
|
||||
}
|
||||
},
|
||||
timeFilter () {
|
||||
this.search({ metaList: this.metaList, q: this.q })
|
||||
this.search({ metaList: this.metaList, q: this.q, isNowDate: true })
|
||||
}
|
||||
},
|
||||
beforeUnmount () {
|
||||
|
||||
@@ -207,7 +207,7 @@ import EntityList from '@/views/entityExplorer/entityList/EntityList'
|
||||
import { defaultPageSize, riskLevelMapping } from '@/utils/constants'
|
||||
import axios from 'axios'
|
||||
import { api } from '@/utils/api'
|
||||
import { getNowTime, getSecond } from '@/utils/date-util'
|
||||
import { getNowDate, getNowTime, getSecond } from '@/utils/date-util'
|
||||
import { ref } from 'vue'
|
||||
import _ from 'lodash'
|
||||
import Loading from '@/components/common/Loading'
|
||||
@@ -413,9 +413,10 @@ export default {
|
||||
return result
|
||||
},
|
||||
search (param) {
|
||||
// todo 下版本08版本删除 ---- start
|
||||
if (param && param.q.indexOf("QUERY('") > -1) {
|
||||
this.$message.error(this.$t('overall.versionNotSupportThisFormat'))
|
||||
// 如果不是最新时间,则获取当前时间
|
||||
if (!param.isNowDate) {
|
||||
const myTimeFilter = getNowDate(this.$_.cloneDeep(this.timeFilter))
|
||||
this.reload(myTimeFilter.startTime, myTimeFilter.endTime, myTimeFilter.dateRangeValue)
|
||||
return true
|
||||
}
|
||||
// 下版本08版本删除 ---- end
|
||||
@@ -936,7 +937,7 @@ export default {
|
||||
watch: {
|
||||
timeFilter () {
|
||||
const keywordList = this.getKeywordListByMetaList(this.metaList)
|
||||
this.search({ metaList: this.metaList, q: this.q, str: this.str, keywordList: keywordList })
|
||||
this.search({ metaList: this.metaList, q: this.q, str: this.str, keywordList: keywordList, isNowDate: true })
|
||||
}
|
||||
},
|
||||
setup () {
|
||||
|
||||
Reference in New Issue
Block a user