refactor: 视图样式配置项调整

This commit is contained in:
junjie 2022-01-12 11:01:14 +08:00
parent 3f028ce0b0
commit 76523b5787

View File

@ -196,9 +196,9 @@
:options="chartGroupTreeAvailable"
:normalizer="normalizer"
:placeholder="$t('chart.select_group')"
:noChildrenText="$t('commons.treeselect.no_children_text')"
:noOptionsText="$t('commons.treeselect.no_options_text')"
:noResultsText="$t('commons.treeselect.no_results_text')"
:no-children-text="$t('commons.treeselect.no_children_text')"
:no-options-text="$t('commons.treeselect.no_options_text')"
:no-results-text="$t('commons.treeselect.no_results_text')"
/>
</el-form-item>
</el-col>
@ -773,6 +773,7 @@ export default {
view.customFilter = JSON.stringify([])
view.drillFields = JSON.stringify([])
view.extBubble = JSON.stringify([])
this.setChartDefaultOptions(view)
const _this = this
post('/chart/view/save', view).then(response => {
this.closeCreateChart()
@ -788,6 +789,33 @@ export default {
})
},
setChartDefaultOptions(view) {
const type = view.type
const attr = JSON.parse(view.customAttr)
if (type.includes('pie')) {
if (view.render === 'echarts') {
attr.label.position = 'inside'
} else {
attr.label.position = 'inner'
}
} else if (type.includes('line')) {
attr.label.position = 'top'
} else if (type.includes('treemap')) {
if (view.render === 'echarts') {
attr.label.position = 'inside'
} else {
attr.label.position = 'middle'
}
} else {
if (view.render === 'echarts') {
attr.label.position = 'inside'
} else {
attr.label.position = 'middle'
}
}
view.customAttr = JSON.stringify(attr)
},
getTable(table) {
this.table = JSON.parse(JSON.stringify(table))
},