CN-1384 1.把0的数据去掉,列表和图里都不展示;2.进入实体详情页时,查一次接口,确认非0数据的个数,个数显示在tab上;3.进入tab时,查更新tab顶部数值;4.数据全是0显示No Data;
This commit is contained in:
@@ -178,7 +178,8 @@ export default {
|
|||||||
if (this.entity.entityType === 'ip') {
|
if (this.entity.entityType === 'ip') {
|
||||||
const appsOfIp = axios.get(api.entity.domainNameResolutionAboutAppsOfIp, { params: params })
|
const appsOfIp = axios.get(api.entity.domainNameResolutionAboutAppsOfIp, { params: params })
|
||||||
const domainsOfIp = axios.get(api.entity.domainNameResolutionAboutDomainsOfIp, { params: params })
|
const domainsOfIp = axios.get(api.entity.domainNameResolutionAboutDomainsOfIp, { params: params })
|
||||||
this.promiseData(appsOfIp, domainsOfIp)
|
const behaviorPattern = axios.get(api.entity.behaviorPattern, { params: params })
|
||||||
|
this.promiseData(appsOfIp, domainsOfIp, behaviorPattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entity.entityType === 'domain') {
|
if (this.entity.entityType === 'domain') {
|
||||||
@@ -198,6 +199,18 @@ export default {
|
|||||||
const len1 = res[0].status === 200 ? res0.data.result.length : 0
|
const len1 = res[0].status === 200 ? res0.data.result.length : 0
|
||||||
const len2 = res[1].status === 200 ? res1.data.result.length : 0
|
const len2 = res[1].status === 200 ? res1.data.result.length : 0
|
||||||
this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2)
|
this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2)
|
||||||
|
const behaviorPatternData = res[2].status === 200 ? res[2].data.data.result : 0
|
||||||
|
let behaviorPatternLen = 0
|
||||||
|
if (behaviorPatternData && behaviorPatternData[0]) {
|
||||||
|
const dataObject = behaviorPatternData[0]
|
||||||
|
Object.keys(dataObject).forEach(key => {
|
||||||
|
const value = Number(dataObject[key]) ? Number(dataObject[key]) : 0
|
||||||
|
if (value !== 0) {
|
||||||
|
behaviorPatternLen++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.initSetTag(entityDetailTabsName.behaviorPattern, behaviorPatternLen)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'domain': {
|
case 'domain': {
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted () {
|
||||||
this.$emit('checkTag', entityDetailTabsName.behaviorPattern, 0)
|
|
||||||
await this.initData()
|
await this.initData()
|
||||||
this.toggleLoading(true)
|
this.toggleLoading(true)
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
@@ -80,13 +79,32 @@ export default {
|
|||||||
this.chartOption.angleAxis.data.push(item.name)
|
this.chartOption.angleAxis.data.push(item.name)
|
||||||
this.chartOption.series[0].data.push(item.value)
|
this.chartOption.series[0].data.push(item.value)
|
||||||
})
|
})
|
||||||
const len = this.tableData.length - 1
|
const len = this.tableData.length
|
||||||
|
const endIndex = len - 1
|
||||||
this.tableData.forEach((item, i) => {
|
this.tableData.forEach((item, i) => {
|
||||||
if (i !== len) {
|
if (i !== endIndex) {
|
||||||
this.chartOption.angleAxis.data.push(item.name + '2')
|
this.chartOption.angleAxis.data.push(item.name + '2')
|
||||||
this.chartOption.series[0].data.push(0)
|
this.chartOption.series[0].data.push(0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const axisLabel = this.chartOption.angleAxis.axisLabel
|
||||||
|
this.chartOption.angleAxis.axisLabel = {
|
||||||
|
...axisLabel,
|
||||||
|
formatter: function (params, index) {
|
||||||
|
if (len > 15) {
|
||||||
|
if (index === 7) {
|
||||||
|
return params + '\n'
|
||||||
|
} else if (index === 8) {
|
||||||
|
return '\n' + params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index === endIndex) {
|
||||||
|
return params + '\n'
|
||||||
|
} else {
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const self = this
|
const self = this
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -122,7 +140,7 @@ export default {
|
|||||||
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.isNoData = res.data.result.length === 0
|
this.isNoData = res.data.result.length === 0
|
||||||
this.$emit('checkTag', entityDetailTabsName.behaviorPattern, res.data.result.length)
|
|
||||||
this.showError = false
|
this.showError = false
|
||||||
if (!this.isNoData) {
|
if (!this.isNoData) {
|
||||||
const data = res.data.result
|
const data = res.data.result
|
||||||
@@ -132,16 +150,22 @@ export default {
|
|||||||
const dataObject = data[0]
|
const dataObject = data[0]
|
||||||
Object.keys(dataObject).forEach(key => {
|
Object.keys(dataObject).forEach(key => {
|
||||||
const value = Number(dataObject[key]) ? Number(dataObject[key]) : 0
|
const value = Number(dataObject[key]) ? Number(dataObject[key]) : 0
|
||||||
sum = sum + value
|
if (value !== 0) {
|
||||||
this.tableData.push({
|
sum = sum + value
|
||||||
name: key,
|
this.tableData.push({
|
||||||
value: value
|
name: key,
|
||||||
})
|
value: value
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.tableData.forEach(item => {
|
this.tableData.forEach(item => {
|
||||||
item.percent = item.value / sum
|
item.percent = item.value / sum
|
||||||
})
|
})
|
||||||
this.tableData = this.tableData.sort(reverseSortBy('value'))
|
this.tableData = this.tableData.sort(reverseSortBy('value'))
|
||||||
|
this.$emit('checkTag', entityDetailTabsName.behaviorPattern, this.tableData.length)
|
||||||
|
if (this.tableData.length === 0) {
|
||||||
|
this.isNoData = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user