feat(视图): 透视表合计小计支持多种聚合方式

This commit is contained in:
junjun 2022-09-07 16:09:59 +08:00
parent a30c66a752
commit ad07ea00a1
5 changed files with 41 additions and 5 deletions

View File

@ -1326,7 +1326,9 @@ export default {
dynamic: 'Dynamic',
gauge_size_field_delete: 'Dynamic field changedplease edit again',
chart_group: 'Sub Type',
chart_bar_group: 'Bar Group'
chart_bar_group: 'Bar Group',
field_dynamic: 'Dynamic',
aggregation: 'Aggregation'
},
dataset: {
parse_filed: 'Parse Field',

View File

@ -1326,7 +1326,9 @@ export default {
dynamic: '動態值',
gauge_size_field_delete: '動態值中字段發生變更,請重新編輯',
chart_group: '子類別',
chart_bar_group: '分組柱狀圖'
chart_bar_group: '分組柱狀圖',
field_dynamic: '動態值',
aggregation: '聚合方式'
},
dataset: {
parse_filed: '解析字段',

View File

@ -1326,7 +1326,9 @@ export default {
dynamic: '动态值',
gauge_size_field_delete: '动态值中字段发生变更,请重新编辑',
chart_group: '子类别',
chart_bar_group: '分组柱状图'
chart_bar_group: '分组柱状图',
field_dynamic: '动态值',
aggregation: '聚合方式'
},
dataset: {
parse_filed: '解析字段',

View File

@ -16,6 +16,11 @@
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.row.label" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg('row')" />
</el-form-item>
<el-form-item :label="$t('chart.aggregation')" class="form-item">
<el-select v-model="totalForm.row.calcTotals.aggregation" class="form-item-select" :placeholder="$t('chart.aggregation')" size="mini" @change="changeTotalCfg('row')">
<el-option v-for="option in aggregations" :key="option.value" :label="option.name" :value="option.value" />
</el-select>
</el-form-item>
</div>
<el-form-item v-show="showProperty('row')" :label="$t('chart.sub_total_show')" class="form-item">
@ -31,6 +36,11 @@
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.row.subLabel" :disabled="rowNum < 2" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg" />
</el-form-item>
<el-form-item :label="$t('chart.aggregation')" class="form-item">
<el-select v-model="totalForm.row.calcSubTotals.aggregation" :disabled="rowNum < 2" class="form-item-select" :placeholder="$t('chart.aggregation')" size="mini" @change="changeTotalCfg('row')">
<el-option v-for="option in aggregations" :key="option.value" :label="option.name" :value="option.value" />
</el-select>
</el-form-item>
</div>
<el-divider v-if="showProperty('col')" content-position="center" class="divider-style">{{ $t('chart.col_cfg') }}</el-divider>
@ -47,6 +57,11 @@
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.col.label" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg('col')" />
</el-form-item>
<el-form-item :label="$t('chart.aggregation')" class="form-item">
<el-select v-model="totalForm.col.calcTotals.aggregation" class="form-item-select" :placeholder="$t('chart.aggregation')" size="mini" @change="changeTotalCfg('col')">
<el-option v-for="option in aggregations" :key="option.value" :label="option.name" :value="option.value" />
</el-select>
</el-form-item>
</div>
<el-form-item v-show="showProperty('col')" :label="$t('chart.sub_total_show')" class="form-item">
@ -62,6 +77,11 @@
<el-form-item :label="$t('chart.total_label')" class="form-item">
<el-input v-model="totalForm.col.subLabel" :disabled="colNum < 2" style="width: 160px;" :placeholder="$t('chart.total_label')" size="mini" clearable @change="changeTotalCfg('col')" />
</el-form-item>
<el-form-item :label="$t('chart.aggregation')" class="form-item">
<el-select v-model="totalForm.col.calcSubTotals.aggregation" :disabled="colNum < 2" class="form-item-select" :placeholder="$t('chart.aggregation')" size="mini" @change="changeTotalCfg('col')">
<el-option v-for="option in aggregations" :key="option.value" :label="option.name" :value="option.value" />
</el-select>
</el-form-item>
</div>
</el-form>
</el-col>
@ -88,7 +108,13 @@ export default {
},
data() {
return {
totalForm: JSON.parse(JSON.stringify(DEFAULT_TOTAL))
totalForm: JSON.parse(JSON.stringify(DEFAULT_TOTAL)),
aggregations: [
{ name: this.$t('chart.sum'), value: 'SUM' },
{ name: this.$t('chart.avg'), value: 'AVG' },
{ name: this.$t('chart.max'), value: 'MAX' },
{ name: this.$t('chart.min'), value: 'MIN' }
]
}
},
computed: {
@ -190,4 +216,8 @@ span{font-size: 12px}
font-weight: 400;
padding: 0 10px;
}
.form-item-select{
width:160px!important;
}
</style>