fix(ui): dashboard chart config

This commit is contained in:
songlh 2024-08-07 14:41:22 +08:00
parent e7cbd0caa9
commit b73d796891
1 changed files with 19 additions and 3 deletions

View File

@ -362,6 +362,7 @@ export default {
commonAttributes: [],
level2children: {},
isShadow: false,
changeCITypeRequestValue: null,
}
},
computed: {
@ -425,6 +426,14 @@ export default {
this.fontColor = fontColor
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) {
await getCITypeAttributesByTypeIds({ type_ids: type_ids.join(',') }).then((res) => {
this.attributes = res.attributes
@ -483,19 +492,26 @@ export default {
changeCIType(value) {
this.form.attr_ids = []
this.commonAttributes = []
this.changeCITypeRequestValue = value
if ((Array.isArray(value) && value.length) || (!Array.isArray(value) && value)) {
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) {
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') {
getCITypeCommonAttributesByTypeIds({ type_ids: Array.isArray(value) ? value.join(',') : value }).then((res) => {
this.commonAttributes = res.attributes
if (this.changeCITypeRequestValue === value) {
this.commonAttributes = res.attributes
}
})
}
},