perf: 优化资产、网关列表页面显示 labels 信息不全的问题

This commit is contained in:
Bai 2023-05-15 19:01:23 +08:00 committed by Jiangjie.Bai
parent c4ad25bfe3
commit 1fdcf9ff75
3 changed files with 23 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<el-tag <el-tag
v-for="tag of cellValue" v-for="tag of iTags"
:key="tag" :key="tag"
:type="getTagType(tag)" :type="getTagType(tag)"
class="tag-formatter" class="tag-formatter"
@ -24,6 +24,9 @@ export default {
return { return {
getTagType(tag) { getTagType(tag) {
return 'primary' return 'primary'
},
getTags(cellValue) {
return cellValue
} }
} }
} }
@ -34,6 +37,11 @@ export default {
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs) formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs)
} }
}, },
computed: {
iTags() {
return this.formatterArgs.getTags(this.cellValue)
}
},
methods: { methods: {
getTagType(tag) { getTagType(tag) {
return this.formatterArgs.getTagType(tag) return this.formatterArgs.getTagType(tag)

View File

@ -164,8 +164,13 @@ export default {
} }
}, },
connectivity: connectivityMeta, connectivity: connectivityMeta,
labels_display: { labels: {
formatter: TagsFormatter formatter: TagsFormatter,
formatterArgs: {
getTags(cellValue) {
return cellValue.map(item => `${item.name}:${item.value}`)
}
}
}, },
actions: { actions: {
formatter: ActionsFormatter, formatter: ActionsFormatter,

View File

@ -78,8 +78,13 @@ export default {
nodes_display: { nodes_display: {
formatter: ArrayFormatter formatter: ArrayFormatter
}, },
labels_display: { labels: {
formatter: TagsFormatter formatter: TagsFormatter,
formatterArgs: {
getTags(cellValue) {
return cellValue.map(item => `${item.name}:${item.value}`)
}
}
}, },
connectivity: connectivityMeta, connectivity: connectivityMeta,
actions: { actions: {