mirror of https://github.com/veops/cmdb.git
fix(ui): dashboard chart config
This commit is contained in:
parent
95506e6f4e
commit
41d7cdf4d2
|
@ -362,6 +362,7 @@ export default {
|
||||||
commonAttributes: [],
|
commonAttributes: [],
|
||||||
level2children: {},
|
level2children: {},
|
||||||
isShadow: false,
|
isShadow: false,
|
||||||
|
changeCITypeRequestValue: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -425,6 +426,14 @@ export default {
|
||||||
this.fontColor = fontColor
|
this.fontColor = fontColor
|
||||||
this.bgColor = bgColor
|
this.bgColor = bgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type_ids?.length || type_id) {
|
||||||
|
const requireTypeIds = type_id ? [type_id] : type_ids
|
||||||
|
await getCITypeAttributesByTypeIds({ type_ids: requireTypeIds.join(',') }).then((res) => {
|
||||||
|
this.attributes = res.attributes
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (type_ids && type_ids.length) {
|
if (type_ids && type_ids.length) {
|
||||||
await getCITypeAttributesByTypeIds({ type_ids: type_ids.join(',') }).then((res) => {
|
await getCITypeAttributesByTypeIds({ type_ids: type_ids.join(',') }).then((res) => {
|
||||||
this.attributes = res.attributes
|
this.attributes = res.attributes
|
||||||
|
@ -483,19 +492,26 @@ export default {
|
||||||
changeCIType(value) {
|
changeCIType(value) {
|
||||||
this.form.attr_ids = []
|
this.form.attr_ids = []
|
||||||
this.commonAttributes = []
|
this.commonAttributes = []
|
||||||
|
this.changeCITypeRequestValue = value
|
||||||
if ((Array.isArray(value) && value.length) || (!Array.isArray(value) && value)) {
|
if ((Array.isArray(value) && value.length) || (!Array.isArray(value) && value)) {
|
||||||
getCITypeAttributesByTypeIds({ type_ids: Array.isArray(value) ? value.join(',') : value }).then((res) => {
|
getCITypeAttributesByTypeIds({ type_ids: Array.isArray(value) ? value.join(',') : value }).then((res) => {
|
||||||
this.attributes = res.attributes
|
if (this.changeCITypeRequestValue === value) {
|
||||||
|
this.attributes = res.attributes
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (!Array.isArray(value) && value) {
|
if (!Array.isArray(value) && value) {
|
||||||
getRecursive_level2children(value).then((res) => {
|
getRecursive_level2children(value).then((res) => {
|
||||||
this.level2children = res
|
if (this.changeCITypeRequestValue === value) {
|
||||||
|
this.level2children = res
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if ((['bar', 'line', 'pie'].includes(this.chartType) && this.form.category === 1) || this.chartType === 'table') {
|
if ((['bar', 'line', 'pie'].includes(this.chartType) && this.form.category === 1) || this.chartType === 'table') {
|
||||||
getCITypeCommonAttributesByTypeIds({ type_ids: Array.isArray(value) ? value.join(',') : value }).then((res) => {
|
getCITypeCommonAttributesByTypeIds({ type_ids: Array.isArray(value) ? value.join(',') : value }).then((res) => {
|
||||||
this.commonAttributes = res.attributes
|
if (this.changeCITypeRequestValue === value) {
|
||||||
|
this.commonAttributes = res.attributes
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue