CN-1449 fix: 实体搜索结果对命中字段高亮显示

This commit is contained in:
刘洪洪
2023-11-06 19:50:29 +08:00
parent 93be846064
commit 1c00f568fa
12 changed files with 148 additions and 31 deletions

View File

@@ -202,6 +202,7 @@ export default {
if (this.isCustomized(value)) { if (this.isCustomized(value)) {
meta.column.type = columnType.fullText meta.column.type = columnType.fullText
meta.column.label = value meta.column.label = value
meta.column.isFullText = true
meta.resetOperator() meta.resetOperator()
meta.resetValue() meta.resetValue()
} else { } else {
@@ -248,6 +249,7 @@ export default {
if (meta.column && meta.column.type === 'fullText') { if (meta.column && meta.column.type === 'fullText') {
meta.operator.value = '=' meta.operator.value = '='
meta.column.show = false meta.column.show = false
meta.column.isFullText = true
meta.operator.show = false meta.operator.show = false
const label = JSON.parse(JSON.stringify(meta.column.label)) const label = JSON.parse(JSON.stringify(meta.column.label))
meta.column.label = parser.getEntityTypeByValue(meta.column.label) meta.column.label = parser.getEntityTypeByValue(meta.column.label)
@@ -461,13 +463,21 @@ export default {
if (this.metaList.length > 0) { if (this.metaList.length > 0) {
const parser = new Parser(this.columnList) const parser = new Parser(this.columnList)
const errorList = parser.validateMeta(this.metaList) const errorList = parser.validateMeta(this.metaList)
const keywordList = []
this.metaList.forEach(item => {
if (item.column && item.column.isFullText) {
keywordList.push({ type: 'fullText', value: item.value.value })
} else if (item.column && !item.column.isFullText) {
keywordList.push({ type: item.column.type, value: item.value.value })
}
})
if (_.isEmpty(errorList)) { if (_.isEmpty(errorList)) {
const strObj = parser.handleMetaListToStr(this.metaList) const strObj = parser.handleMetaListToStr(this.metaList)
const str = strObj.str ? strObj.str : strObj const str = strObj.str ? strObj.str : strObj
const str2 = strObj.str2 ? strObj.str2 : strObj const str2 = strObj.str2 ? strObj.str2 : strObj
// str为将metaList转成字符串的值str2为地址栏展示的值 // str为将metaList转成字符串的值str2为地址栏展示的值
const key = parser.handleEntityTypeByStr(str) const key = parser.handleEntityTypeByStr(str)
this.$emit('search', { ...parser.parseStr(key), str: str2 }) this.$emit('search', { ...parser.parseStr(key), str: str2, keywordList: keywordList })
} else { } else {
this.$message.error(handleErrorTip(errorList[0])) this.$message.error(handleErrorTip(errorList[0]))
} }
@@ -653,6 +663,7 @@ export default {
if (item.column && item.column.type === 'fullText') { if (item.column && item.column.type === 'fullText') {
item.operator.value = '=' item.operator.value = '='
item.column.show = false item.column.show = false
item.column.isFullText = true
item.operator.show = false item.operator.show = false
const label = JSON.parse(JSON.stringify(item.column.label)) const label = JSON.parse(JSON.stringify(item.column.label))
item.column.label = parser.getEntityTypeByValue(item.column.label) item.column.label = parser.getEntityTypeByValue(item.column.label)

View File

@@ -97,10 +97,19 @@ export default {
if (str) { if (str) {
const parser = new Parser(this.columnList) const parser = new Parser(this.columnList)
const keyInfo = parser.comparedEntityKey(parser.handleEntityTypeByStr(str)) const keyInfo = parser.comparedEntityKey(parser.handleEntityTypeByStr(str))
const metaList = parser.parseStr(_.cloneDeep(str)).metaList
const keywordList = []
metaList.forEach(item => {
if (item.column && item.column.type === columnType.fullText) {
keywordList.push({ type: item.column.type, value: item.column.label })
} else if (item.column && item.column.type === columnType.string) {
keywordList.push({ type: item.column.type, value: item.value.value })
}
})
if (keyInfo.isKey) { if (keyInfo.isKey) {
const errorList = parser.validateStr(keyInfo.key) const errorList = parser.validateStr(keyInfo.key)
if (_.isEmpty(errorList)) { if (_.isEmpty(errorList)) {
this.$emit('search', { ...parser.parseStr(keyInfo.key), str: str }) this.$emit('search', { ...parser.parseStr(keyInfo.key), str: str, keywordList: keywordList })
} else { } else {
this.$message.error(handleErrorTip(errorList[0])) this.$message.error(handleErrorTip(errorList[0]))
} }

View File

@@ -7,7 +7,7 @@ import App from '@/App.vue'
import '@/utils/http.js' import '@/utils/http.js'
import { hasPermission } from '@/permission' import { hasPermission } from '@/permission'
import commonMixin from '@/mixins/common' import commonMixin from '@/mixins/common'
import { cancelWithChange, noData } from '@/utils/tools' import { cancelWithChange, noData, myHighLight } from '@/utils/tools'
import { ClickOutside } from 'element-plus/lib/directives' import { ClickOutside } from 'element-plus/lib/directives'
import i18n from '@/i18n' import i18n from '@/i18n'
// import '@/mock/index.js' // import '@/mock/index.js'
@@ -41,6 +41,7 @@ app.directive('has', hasPermission) // 注册指令
app.directive('ele-click-outside', ClickOutside) app.directive('ele-click-outside', ClickOutside)
app.directive('cancel', cancelWithChange) app.directive('cancel', cancelWithChange)
app.directive('no-data', noData) app.directive('no-data', noData)
app.directive('high-light', myHighLight)
app.config.globalProperties.$_ = _ app.config.globalProperties.$_ = _
app.mixin(commonMixin) app.mixin(commonMixin)

View File

@@ -7,6 +7,7 @@ import { format } from 'echarts'
import router from '@/router' import router from '@/router'
import store from '@/store' import store from '@/store'
import indexedDBUtils from '@/indexedDB' import indexedDBUtils from '@/indexedDB'
import { columnType } from '@/components/advancedSearch/meta/meta'
export const tableSort = { export const tableSort = {
// 是否需要排序 // 是否需要排序
@@ -1360,3 +1361,45 @@ export function getTagColor (color) {
return `color: ${color};border-color: ${color};background-color: ${backgroundColor};` return `color: ${color};border-color: ${color};background-color: ${backgroundColor};`
} }
} }
/**
* 字段高亮
* 用法: <span v-high-light=['搜索', '高亮']>搜索关键字高亮<span>
* @type {{updated(*, *): (*|undefined)}}
*/
export const myHighLight = {
updated (el, binding) {
if (el && binding.value) {
const { value } = binding
if (value && value.length > 0) {
const text = JSON.parse(JSON.stringify(el.innerHTML))
value.forEach(item => {
const regex = new RegExp(item.value, 'gi')
// 一旦高亮后就不再添加class不然会一直嵌套span
if (el.getElementsByClassName('highlight__text').length === 0) {
const newText = text.replace(regex, match => `<span class="highlight__text">${match}</span>`)
if (item.type === columnType.fullText) {
// el.innerHTML.toLowerCase().indexOf(item.value.toLowerCase()) > -1
}
if (newText && newText !== '-') {
el.innerHTML = newText
} else {
return newText
}
}
})
// const myValue = ['China', 'qq']
// const regex = new RegExp(myValue.join('|'), 'gi')
// // 一旦高亮后就不再添加class不然会一直嵌套span
// if (el.getElementsByClassName('highlight__text').length === 0) {
// const newText = text.replace(regex, match => `<span class="highlight__text">${match}</span>`)
// if (newText && newText !== '-') {
// el.innerHTML = newText
// } else {
// return newText
// }
// }
}
}
}
}

View File

@@ -46,6 +46,7 @@
style="width: 100%;" style="width: 100%;"
:list-data="listData" :list-data="listData"
:list-mode="listMode" :list-mode="listMode"
:keywordList="keywordList"
:pageObj="pageObj" :pageObj="pageObj"
:time-filter="timeFilter" :time-filter="timeFilter"
@pageSize="pageSize" @pageSize="pageSize"
@@ -174,6 +175,7 @@ import Parser from '@/components/advancedSearch/meta/parser'
import { handleErrorTip } from '@/components/advancedSearch/meta/error' import { handleErrorTip } from '@/components/advancedSearch/meta/error'
import { columnList } from '@/utils/static-data' import { columnList } from '@/utils/static-data'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { columnType } from '@/components/advancedSearch/meta/meta'
export default { export default {
name: 'entity-explorer', name: 'entity-explorer',
@@ -289,7 +291,8 @@ export default {
ipCount: 0, ipCount: 0,
appCount: 0 appCount: 0
}, },
loadingCount: false // 实体基数统计的loading loadingCount: false, // 实体基数统计的loading
keywordList: []
} }
}, },
methods: { methods: {
@@ -361,6 +364,7 @@ export default {
this.q = '' this.q = ''
this.metaList = [] this.metaList = []
} }
this.getKeyword(param.keywordList)
// 参数q避免切换页码时地址栏参数q为空 // 参数q避免切换页码时地址栏参数q为空
let urlQ = '' let urlQ = ''
@@ -581,7 +585,7 @@ export default {
this.summaryCount = { total: 0, domainCount: 0, ipCount: 0, appCount: 0 } this.summaryCount = { total: 0, domainCount: 0, ipCount: 0, appCount: 0 }
} }
}).catch(e => { }).catch(e => {
console.log(e) console.error(e)
this.summaryCount = { total: 0, domainCount: 0, ipCount: 0, appCount: 0 } this.summaryCount = { total: 0, domainCount: 0, ipCount: 0, appCount: 0 }
}).finally(() => { }).finally(() => {
this.loadingCount = false this.loadingCount = false
@@ -675,11 +679,20 @@ export default {
} }
} }
const parser = new Parser(columnList) const parser = new Parser(columnList)
const metaList = parser.parseStr(_.cloneDeep(str)).metaList
const keywordList = []
metaList.forEach(item => {
if (item.column && item.column.type === columnType.fullText) {
keywordList.push({ type: item.column.type, value: item.column.label })
} else if (item.column && item.column.type === columnType.string) {
keywordList.push({ type: item.column.type, value: item.value.value })
}
})
const keyInfo = parser.comparedEntityKey(parser.handleEntityTypeByStr(str)) const keyInfo = parser.comparedEntityKey(parser.handleEntityTypeByStr(str))
if (keyInfo.isKey) { if (keyInfo.isKey) {
const errorList = parser.validateStr(keyInfo.key) const errorList = parser.validateStr(keyInfo.key)
if (_.isEmpty(errorList)) { if (_.isEmpty(errorList)) {
this.search({ ...parser.parseStr(keyInfo.key), str: str }) this.search({ ...parser.parseStr(keyInfo.key), str: str, keywordList: keywordList })
} else { } else {
this.$message.error(handleErrorTip(errorList[0])) this.$message.error(handleErrorTip(errorList[0]))
} }
@@ -727,6 +740,31 @@ export default {
}).catch((e) => { }).catch((e) => {
}).finally(() => { }).finally(() => {
}) })
},
getKeyword (list) {
if (list) {
const metaList = JSON.parse(JSON.stringify(list))
const keyList = []
metaList.forEach(item => {
if (item.value) {
keyList.push({ type: item.type, value: this.getKeyValue(item.value) })
}
})
this.keywordList = keyList
}
},
getKeyValue (str) {
if (str[0] === "'" && str[str.length - 1] === "'") {
str = str.substring(1, str.length)
str = str.substring(0, str.length - 1)
}
if (str[0] === '%') {
str = str.substring(1, str.length)
}
if (str[str.length - 1] === '%') {
str = str.substring(0, str.length - 1)
}
return str
} }
}, },
mounted () { mounted () {

View File

@@ -11,6 +11,7 @@
v-for="(data, index) in listData" v-for="(data, index) in listData"
:entity="data" :entity="data"
:listMode="listMode" :listMode="listMode"
:keywordList="keywordList"
:timeFilter="timeFilter" :timeFilter="timeFilter"
:key="index" :key="index"
:ref="`entityRow${index}`" :ref="`entityRow${index}`"
@@ -65,7 +66,8 @@ export default {
pageObj: Object, pageObj: Object,
loading: Boolean, loading: Boolean,
timeFilter: Object, timeFilter: Object,
listMode: String listMode: String,
keywordList: Array
}, },
components: { components: {
'entity-card': Card, 'entity-card': Card,

View File

@@ -11,7 +11,7 @@
<div class="cn-entity__row"> <div class="cn-entity__row">
<!--标签--> <!--标签-->
<div class="cn-entity__header" style="display: flex;"> <div class="cn-entity__header" style="display: flex;">
<span class="cn-entity__header-title">{{ entityData.entityValue || 'Unknown' }}</span> <span class="cn-entity__header-title" v-high-light="keywordList">{{ entityData.entityValue || 'Unknown' }}</span>
<span class="entity-detail" style="display: flex;margin-left: 6px;margin-top: 1px;flex-wrap: wrap;margin-bottom: -10px;"> <span class="entity-detail" style="display: flex;margin-left: 6px;margin-top: 1px;flex-wrap: wrap;margin-bottom: -10px;">
<span v-for="(item, index) in levelTwoTags" <span v-for="(item, index) in levelTwoTags"
:key="index" :key="index"
@@ -30,29 +30,29 @@
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-country"></i> <i class="cn-icon cn-icon-country"></i>
<span class="row-item-label">{{ $t('overall.country') }}&nbsp;:&nbsp;&nbsp;</span> <span class="row-item-label">{{ $t('overall.country') }}&nbsp;:&nbsp;&nbsp;</span>
<span class="row-item-value">{{ $_.get(entityData, 'location.country', '-') || '-' }}</span> <span class="row-item-value" v-high-light="keywordList">{{ $_.get(entityData, 'location.country', '-') || '-' }}</span>
</div> </div>
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-position"></i> <i class="cn-icon cn-icon-position"></i>
<span class="row-item-label">{{ $t('overall.city') }}&nbsp;:&nbsp;&nbsp;</span> <span class="row-item-label">{{ $t('overall.city') }}&nbsp;:&nbsp;&nbsp;</span>
<span class="row-item-value">{{ entityData.location ? ipLocationRegion(entityData.location) : '-' }}</span> <span class="row-item-value" v-high-light="keywordList">{{ entityData.location ? ipLocationRegion(entityData.location) : '-' }}</span>
</div> </div>
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-cloud"></i> <i class="cn-icon cn-icon-cloud"></i>
<span class="row-item-label">{{ $t('entities.asn') }}&nbsp;:&nbsp;&nbsp;</span> <span class="row-item-label">{{ $t('entities.asn') }}&nbsp;:&nbsp;&nbsp;</span>
<span class="row-item-value">{{ $_.get(entityData, 'asn.asn', '-') || '-' }}</span> <span class="row-item-value" v-high-light="keywordList">{{ $_.get(entityData, 'asn.asn', '-') || '-' }}</span>
</div> </div>
</template> </template>
<template v-else-if="entityData.entityType === 'domain'"> <template v-else-if="entityData.entityType === 'domain'">
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-category-group"></i> <i class="cn-icon cn-icon-category-group"></i>
<span class="row-item-label">{{ $t('entities.category') }}&nbsp;:&nbsp;&nbsp;</span> <span class="row-item-label">{{ $t('entities.category') }}&nbsp;:&nbsp;&nbsp;</span>
<span class="row-item-value">{{ $_.get(entityData, 'category.categoryGroup', '-') || '-' }}</span> <span class="row-item-value" v-high-light="keywordList">{{ $_.get(entityData, 'category.categoryGroup', '-') || '-' }}</span>
</div> </div>
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-sub-category"></i> <i class="cn-icon cn-icon-sub-category"></i>
<span class="row-item-label">{{ $t('entities.subcategory') }}&nbsp;:&nbsp;&nbsp;</span> <span class="row-item-label">{{ $t('entities.subcategory') }}&nbsp;:&nbsp;&nbsp;</span>
<span class="row-item-value">{{ $_.get(entityData, 'category.categoryName', '-') || '-' }}</span> <span class="row-item-value" v-high-light="keywordList">{{ $_.get(entityData, 'category.categoryName', '-') || '-' }}</span>
</div> </div>
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-credit-rating"></i> <i class="cn-icon cn-icon-credit-rating"></i>
@@ -64,7 +64,7 @@
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-category2"></i> <i class="cn-icon cn-icon-category2"></i>
<span class="row-item-label">{{ $t('entities.category') }}&nbsp;:&nbsp;&nbsp;</span> <span class="row-item-label">{{ $t('entities.category') }}&nbsp;:&nbsp;&nbsp;</span>
<span class="row-item-value">{{ $_.get(entityData, 'category.appCategory', '-') || '-' }}</span> <span class="row-item-value" v-high-light="keywordList">{{ $_.get(entityData, 'category.appCategory', '-') || '-' }}</span>
</div> </div>
<div class="basic-info__item"> <div class="basic-info__item">
<i class="cn-icon cn-icon-sub-category"></i> <i class="cn-icon cn-icon-sub-category"></i>
@@ -176,7 +176,7 @@
<el-collapse-transition> <el-collapse-transition>
<div class="cn-entity__detail-overview" v-if="!isCollapse"> <div class="cn-entity__detail-overview" v-if="!isCollapse">
<el-divider></el-divider> <el-divider></el-divider>
<detail-overview :entity="entityData" :time-filter="timeFilter" @reloadEntity="getEntity" /> <detail-overview :entity="entityData" :time-filter="timeFilter" :key-word-list="keywordList" @reloadEntity="getEntity" />
</div> </div>
</el-collapse-transition> </el-collapse-transition>
</div> </div>
@@ -199,7 +199,8 @@ export default {
props: { props: {
index: Number, index: Number,
timeFilter: Object, timeFilter: Object,
listMode: String listMode: String,
keywordList: Array
}, },
components: { components: {
Loading, Loading,

View File

@@ -8,11 +8,11 @@
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.category')}}</div> <div class="row__label row__label--width130">{{$t('entities.category')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appCategory', '-') || '-'}}</div> <div class="row__content" v-high-light="keywordList">{{ $_.get(entity, 'category.appCategory', '-') || '-' }}</div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.subcategory')}}</div> <div class="row__label row__label--width130">{{$t('entities.subcategory')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appSubcategory', '-') || '-'}}</div> <div class="row__content" v-high-light="keywordList">{{ $_.get(entity, 'category.appSubcategory', '-') || '-' }}</div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.riskLevel')}}</div> <div class="row__label row__label--width130">{{$t('entities.riskLevel')}}</div>
@@ -20,7 +20,9 @@
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('overall.remark')}}</div> <div class="row__label row__label--width130">{{$t('overall.remark')}}</div>
<div class="row__content">{{$_.get(entity, 'category.appDescription', '-') || '-'}}</div> <div class="row__content">
<span v-high-light="keywordList">{{ $_.get(entity, 'category.appDescription', '-') || '-' }}</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -225,6 +227,9 @@ export default {
Chart, Chart,
Loading Loading
}, },
props: {
keywordList: Array
},
data () { data () {
return { return {
// entityData: {} // entityData: {}

View File

@@ -1,13 +1,13 @@
<template> <template>
<div class="entity-detail-overview"> <div class="entity-detail-overview">
<template v-if="entity.entityType === 'ip'"> <template v-if="entity.entityType === 'ip'">
<ip-overview :entity="entity" :time-filter="timeFilter" @reloadEntity="getEntity"></ip-overview> <ip-overview :entity="entity" :time-filter="timeFilter" :key-word-list="keywordList" @reloadEntity="getEntity"></ip-overview>
</template> </template>
<template v-else-if="entity.entityType === 'domain'"> <template v-else-if="entity.entityType === 'domain'">
<domain-overview :entity="entity" :time-filter="timeFilter" @reloadEntity="getEntity"></domain-overview> <domain-overview :entity="entity" :time-filter="timeFilter" :key-word-list="keywordList" @reloadEntity="getEntity"></domain-overview>
</template> </template>
<template v-else-if="entity.entityType === 'app'"> <template v-else-if="entity.entityType === 'app'">
<app-overview :entity="entity" :time-filter="timeFilter" @reloadEntity="getEntity"></app-overview> <app-overview :entity="entity" :time-filter="timeFilter" :key-word-list="keywordList" @reloadEntity="getEntity"></app-overview>
</template> </template>
</div> </div>
</template> </template>
@@ -22,7 +22,8 @@ export default {
name: 'DetailOverview', name: 'DetailOverview',
props: { props: {
entity: Object, entity: Object,
timeFilter: Object timeFilter: Object,
keywordList: Array
}, },
components: { components: {
'domain-overview': Domain, 'domain-overview': Domain,

View File

@@ -4,11 +4,11 @@
<div class="overview__content"> <div class="overview__content">
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.category')}}</div> <div class="row__label row__label--width130">{{$t('entities.category')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.categoryName', '-') || '-'}}</div> <div class="row__content" v-high-light="keywordList">{{ $_.get(entityData, 'category.categoryName', '-') || '-' }}</div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.domainDetail.categoryGroup')}}</div> <div class="row__label row__label--width130">{{$t('entities.domainDetail.categoryGroup')}}</div>
<div class="row__content">{{$_.get(entityData, 'category.categoryGroup', '-') || '-'}}</div> <div class="row__content" v-high-light="keywordList">{{ $_.get(entityData, 'category.categoryGroup', '-') || '-' }}</div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.reputationLevel')}}</div> <div class="row__label row__label--width130">{{$t('entities.reputationLevel')}}</div>
@@ -20,7 +20,7 @@
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.org')}}</div> <div class="row__label row__label--width130">{{$t('entities.org')}}</div>
<div class="row__content">{{$_.get(entityData, 'whois.registrantOrg', '-') || '-'}}</div> <div class="row__content" v-high-light="keywordList">{{ $_.get(entityData, 'whois.registrantOrg', '-') || '-' }}</div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.icpCompanyName')}}</div> <div class="row__label row__label--width130">{{$t('entities.icpCompanyName')}}</div>
@@ -229,6 +229,9 @@ export default {
Loading, Loading,
Chart Chart
}, },
props: {
keywordList: Array
},
mixins: [entityDetailMixin, relatedServer], mixins: [entityDetailMixin, relatedServer],
data () { data () {
return { return {

View File

@@ -10,18 +10,18 @@
<img v-if="entity.location.country===countryNameIdMapping.Unknown || !countryNameIdMapping[entity.location.country]" src="../../../../../public/images/flag/Unknown.svg" class="filter-country-flag"> <img v-if="entity.location.country===countryNameIdMapping.Unknown || !countryNameIdMapping[entity.location.country]" src="../../../../../public/images/flag/Unknown.svg" class="filter-country-flag">
<img v-else :src="require(`../../../../../public/images/flag/${countryNameIdMapping[entity.location.country]}.png`)" class="filter-country-flag" > <img v-else :src="require(`../../../../../public/images/flag/${countryNameIdMapping[entity.location.country]}.png`)" class="filter-country-flag" >
</div> </div>
{{ipLocationRegion(entity.location)}} <span v-high-light="keywordList">{{ ipLocationRegion(entity.location) }}</span>
</div> </div>
<div v-else>-</div> <div v-else>-</div>
</div> </div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">ASN</div> <div class="row__label row__label--width130">ASN</div>
<div class="row__content">{{$_.get(entity, 'asn.asn', '-') || '-'}}</div> <div class="row__content" v-high-light="keywordList">{{ $_.get(entity, 'asn.asn', '-') || '-' }}</div>
</div> </div>
<div class="overview__row"> <div class="overview__row">
<div class="row__label row__label--width130">{{$t('entities.openPort')}}</div> <div class="row__label row__label--width130">{{$t('entities.openPort')}}</div>
<div class="row__content" style="word-break: break-word;">{{ openPort }}</div> <div class="row__content" style="word-break: break-word;" v-high-light="keywordList">{{ openPort }}</div>
</div> </div>
</div> </div>
</div> </div>
@@ -262,6 +262,9 @@ export default {
Loading, Loading,
Chart Chart
}, },
props: {
keywordList: Array
},
data () { data () {
return { return {
entityType: 'ip', entityType: 'ip',

View File

@@ -90,7 +90,7 @@ export default {
} }
}, },
methods: { methods: {
search ({ str, q, metaList }) { search ({ str, q, metaList, keywordList }) {
if (str) { if (str) {
// 加入搜索记录将记录数量控制在30以内 // 加入搜索记录将记录数量控制在30以内
const oldHistory = localStorage.getItem(storageKey.entitySearchHistory) const oldHistory = localStorage.getItem(storageKey.entitySearchHistory)
@@ -113,7 +113,7 @@ export default {
} }
localStorage.setItem(storageKey.entitySearchHistory, JSON.stringify(arr)) localStorage.setItem(storageKey.entitySearchHistory, JSON.stringify(arr))
} }
this.$emit('search', { str, q, metaList }) this.$emit('search', { str, q, metaList, keywordList })
}, },
addParams (params) { addParams (params) {
this.$refs.search.addParams(params) this.$refs.search.addParams(params)