CN-1540 fix: 实体智能学习类型的Tag展示逻辑更改

This commit is contained in:
刘洪洪
2024-01-03 17:45:52 +08:00
parent a9215469fb
commit 8b81181ae2
3 changed files with 54 additions and 18 deletions

View File

@@ -153,12 +153,24 @@ export default {
if (tagData.status === 200) {
Object.keys(res.data).forEach(k => {
if (k !== 'userDefinedTags' && res.data[k]) {
Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(res.data[k][k2]), type: find.type })
}
})
// 此处是vpnLearningDomain/Ip/App的tag
if (_.isArray(res.data[k])) {
res.data[k].forEach(k3 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k3.pluginName)
if (find) {
this.levelTwoTags.push({ key: 'pluginName', value: this.tagValueHandler(k3.pluginName), type: find.type })
} else {
this.levelTwoTags.push({ key: 'pluginName', value: this.tagValueHandler(k3.pluginName), color: k3.knowledgeBase ? (k3.knowledgeBase.color || entityDefaultColor) : entityDefaultColor })
}
})
} else {
Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(res.data[k][k2]), type: find.type })
}
})
}
}
})
if (_.isArray(res.data.userDefinedTags)) {

View File

@@ -82,12 +82,24 @@ export default class Node {
let _tags = []
Object.keys(tags).forEach(k => {
if (k !== 'userDefinedTags' && tags[k]) {
Object.keys(tags[k]).forEach(k2 => {
const find = entityDetailTags[entityType].find(t => t.name === k2)
if (find) {
_tags.push({ key: k2, value: this.tagValueHandler(k, k2, tags[k][k2]), type: find.type })
}
})
// 此处是vpnLearningDomain/Ip/App的tag
if (_.isArray(tags[k])) {
tags[k].forEach(k3 => {
const find = entityDetailTags[entityType].find(t => t.name === k3.pluginName)
if (find) {
_tags.push({ key: 'pluginName', value: this.tagValueHandler('', '', k3.pluginName), type: find.type })
} else {
_tags.push({ key: 'pluginName', value: this.tagValueHandler('', '', k3.pluginName), color: k3.knowledgeBase ? (k3.knowledgeBase.color || entityDefaultColor) : entityDefaultColor })
}
})
} else {
Object.keys(tags[k]).forEach(k2 => {
const find = entityDetailTags[entityType].find(t => t.name === k2)
if (find) {
_tags.push({ key: k2, value: this.tagValueHandler(k, k2, tags[k][k2]), type: find.type })
}
})
}
}
})
if (_.isArray(tags.userDefinedTags)) {

View File

@@ -305,12 +305,24 @@ export default {
if (responese.status === 200) {
Object.keys(res.data).forEach(k => {
if (k !== 'userDefinedTags' && res.data[k]) {
Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(res.data[k][k2]), type: find.type })
}
})
// 此处是vpnLearningDomain/Ip/App的tag
if (_.isArray(res.data[k])) {
res.data[k].forEach(k3 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k3.pluginName)
if (find) {
this.levelTwoTags.push({ key: 'pluginName', value: this.tagValueHandler(k3.pluginName), type: find.type })
} else {
this.levelTwoTags.push({ key: 'pluginName', value: this.tagValueHandler(k3.pluginName), color: k3.knowledgeBase ? (k3.knowledgeBase.color || entityDefaultColor) : entityDefaultColor })
}
})
} else {
Object.keys(res.data[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
this.levelTwoTags.push({ key: k2, value: this.tagValueHandler(res.data[k][k2]), type: find.type })
}
})
}
}
})
if (_.isArray(res.data.userDefinedTags)) {