mirror of
https://github.com/dataease/dataease.git
synced 2025-02-28 15:12:52 +08:00

* fix: 执行 eslint 命令, 修复代码 * fix(frontend): justify-content 不支持的值 start, end 改为 flex-start, flex-end * Update format-utils.js 去掉注释 * fix(frontend): 修复 css 中不再支持的样式深度选择符号 >>> 导致命令行报错的问题, 替换为 ::v-deep * Update DateFormat.vue * Update FrameLinks.vue * Update Hyperlinks.vue * Update HyperlinksDialog.vue * Update LinkageField.vue * Update VideoLinks.vue * Update DeNumberRange.vue * Update DeSelectGrid.vue * Update index.scss * Update index.vue * Update BackgroundColorSelector.vue * Update LegendSelector.vue * Update LegendSelectorAntV.vue * Update SplitSelector.vue * Update SplitSelectorAntV.vue * Update TitleSelector.vue * Update TitleSelectorAntV.vue * Update XAxisSelector.vue * Update XAxisSelectorAntV.vue * Update YAxisExtSelector.vue * Update YAxisExtSelectorAntV.vue * Update YAxisSelector.vue * Update YAxisSelectorAntV.vue * Update QuotaFilterEditor.vue * Update ResultFilterEditor.vue * Update LabelNormal.vue * Update LabelNormalText.vue * Update AssistLine.vue * Update FunctionCfg.vue * Update ScrollCfg.vue * Update Threshold.vue * Update ColorSelector.vue * Update LabelSelector.vue * Update SizeSelector.vue * Update TooltipSelector.vue * Update TooltipSelectorAntV.vue * Update TotalCfg.vue * Update TableNormal.vue * Update ChartStyle.vue * Update AddCustom.vue * Update AddExcel.vue * Update DatasetChartDetail.vue * Update DatasetGroupSelector.vue * Update DatasetGroupSelectorTree.vue * Update CalcFieldEdit.vue * Update FieldEdit.vue * Update TabDataPreview.vue * Update UnionView.vue * Update UpdateInfo.vue * Update Group.vue * Update all.vue * Update readed.vue * Update unread.vue * Update index.vue * Update index.vue * Update index.vue * Update PanelBackgroundColorSelector.vue * Update PanelColorSelector.vue * Update ViewAttribute.vue * Update SubjectTemplateItem.vue * Update multiplexing.vue * Update filterDialog.vue * Update PanelList.vue * Update PanelMain.vue * Update PanelDetailInfo.vue * Update MapSettingLeft.vue * Update index.vue * Update DatasetTaskList.vue * Update TaskRecord.vue * Update dataset.vue * Update personPwd.vue * Update privateForm.vue Co-authored-by: 王嘉豪 <42510293+ziyujiahao@users.noreply.github.com>
194 lines
7.2 KiB
Vue
194 lines
7.2 KiB
Vue
<template>
|
|
<div style="width: 100%">
|
|
<el-col>
|
|
<el-form ref="totalForm" :model="totalForm" label-width="80px" size="mini">
|
|
<el-divider v-if="showProperty('row')" content-position="center" class="divider-style">{{ $t('chart.row_cfg') }}</el-divider>
|
|
<el-form-item v-show="showProperty('row')" :label="$t('chart.total_show')" class="form-item">
|
|
<el-checkbox v-model="totalForm.row.showGrandTotals" @change="changeTotalCfg('row')">{{ $t('chart.show') }}</el-checkbox>
|
|
</el-form-item>
|
|
<div v-show="showProperty('row') && totalForm.row.showGrandTotals">
|
|
<el-form-item :label="$t('chart.total_position')" class="form-item">
|
|
<el-radio-group v-model="totalForm.row.reverseLayout" @change="changeTotalCfg('row')">
|
|
<el-radio :label="true">{{ $t('chart.total_pos_top') }}</el-radio>
|
|
<el-radio :label="false">{{ $t('chart.total_pos_bottom') }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<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>
|
|
</div>
|
|
|
|
<el-form-item v-show="showProperty('row')" :label="$t('chart.sub_total_show')" class="form-item">
|
|
<el-checkbox v-model="totalForm.row.showSubTotals" :disabled="rowNum < 2" @change="changeTotalCfg('row')">{{ $t('chart.show') }}</el-checkbox>
|
|
</el-form-item>
|
|
<div v-show="showProperty('row') && totalForm.row.showSubTotals">
|
|
<el-form-item :label="$t('chart.total_position')" class="form-item">
|
|
<el-radio-group v-model="totalForm.row.reverseSubLayout" :disabled="rowNum < 2" @change="changeTotalCfg('row')">
|
|
<el-radio :label="true">{{ $t('chart.total_pos_top') }}</el-radio>
|
|
<el-radio :label="false">{{ $t('chart.total_pos_bottom') }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<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>
|
|
</div>
|
|
|
|
<el-divider v-if="showProperty('col')" content-position="center" class="divider-style">{{ $t('chart.col_cfg') }}</el-divider>
|
|
<el-form-item v-show="showProperty('col')" :label="$t('chart.total_show')" class="form-item">
|
|
<el-checkbox v-model="totalForm.col.showGrandTotals" @change="changeTotalCfg('col')">{{ $t('chart.show') }}</el-checkbox>
|
|
</el-form-item>
|
|
<div v-show="showProperty('col') && totalForm.col.showGrandTotals">
|
|
<el-form-item :label="$t('chart.total_position')" class="form-item">
|
|
<el-radio-group v-model="totalForm.col.reverseLayout" @change="changeTotalCfg('col')">
|
|
<el-radio :label="true">{{ $t('chart.total_pos_left') }}</el-radio>
|
|
<el-radio :label="false">{{ $t('chart.total_pos_right') }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<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>
|
|
</div>
|
|
|
|
<el-form-item v-show="showProperty('col')" :label="$t('chart.sub_total_show')" class="form-item">
|
|
<el-checkbox v-model="totalForm.col.showSubTotals" :disabled="colNum < 2" @change="changeTotalCfg('col')">{{ $t('chart.show') }}</el-checkbox>
|
|
</el-form-item>
|
|
<div v-show="showProperty('col') && totalForm.col.showSubTotals">
|
|
<el-form-item :label="$t('chart.total_position')" class="form-item">
|
|
<el-radio-group v-model="totalForm.col.reverseSubLayout" :disabled="colNum < 2" @change="changeTotalCfg('col')">
|
|
<el-radio :label="true">{{ $t('chart.total_pos_left') }}</el-radio>
|
|
<el-radio :label="false">{{ $t('chart.total_pos_right') }}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<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>
|
|
</div>
|
|
</el-form>
|
|
</el-col>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { DEFAULT_TOTAL } from '@/views/chart/chart/chart'
|
|
|
|
export default {
|
|
name: 'TotalCfg',
|
|
props: {
|
|
chart: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
propertyInner: {
|
|
type: Array,
|
|
required: false,
|
|
default: function() {
|
|
return []
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
totalForm: JSON.parse(JSON.stringify(DEFAULT_TOTAL))
|
|
}
|
|
},
|
|
computed: {
|
|
rowNum() {
|
|
const chart = JSON.parse(JSON.stringify(this.chart))
|
|
if (chart.xaxisExt) {
|
|
let arr = null
|
|
if (Object.prototype.toString.call(chart.xaxisExt) === '[object Array]') {
|
|
arr = JSON.parse(JSON.stringify(chart.xaxisExt))
|
|
} else {
|
|
arr = JSON.parse(chart.xaxisExt)
|
|
}
|
|
return arr.length
|
|
}
|
|
return 0
|
|
},
|
|
colNum() {
|
|
const chart = JSON.parse(JSON.stringify(this.chart))
|
|
if (chart.xaxis) {
|
|
let arr = null
|
|
if (Object.prototype.toString.call(chart.xaxis) === '[object Array]') {
|
|
arr = JSON.parse(JSON.stringify(chart.xaxis))
|
|
} else {
|
|
arr = JSON.parse(chart.xaxis)
|
|
}
|
|
return arr.length
|
|
}
|
|
return 0
|
|
}
|
|
},
|
|
watch: {
|
|
'chart': {
|
|
handler: function() {
|
|
this.initData()
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
this.initData()
|
|
},
|
|
methods: {
|
|
initData() {
|
|
const chart = JSON.parse(JSON.stringify(this.chart))
|
|
if (chart.customAttr) {
|
|
let customAttr = null
|
|
if (Object.prototype.toString.call(chart.customAttr) === '[object Object]') {
|
|
customAttr = JSON.parse(JSON.stringify(chart.customAttr))
|
|
} else {
|
|
customAttr = JSON.parse(chart.customAttr)
|
|
}
|
|
if (customAttr.totalCfg) {
|
|
this.totalForm = customAttr.totalCfg
|
|
} else {
|
|
this.totalForm = JSON.parse(JSON.stringify(DEFAULT_TOTAL))
|
|
}
|
|
}
|
|
},
|
|
changeTotalCfg(modifyName) {
|
|
this.totalForm['modifyName'] = modifyName
|
|
this.$emit('onTotalCfgChange', this.totalForm)
|
|
},
|
|
showProperty(property) {
|
|
return this.propertyInner.includes(property)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.shape-item{
|
|
padding: 6px;
|
|
border: none;
|
|
width: 100%;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
.form-item-slider ::v-deep .el-form-item__label{
|
|
font-size: 12px;
|
|
line-height: 38px;
|
|
}
|
|
.form-item ::v-deep .el-form-item__label{
|
|
font-size: 12px;
|
|
}
|
|
.el-select-dropdown__item{
|
|
padding: 0 20px;
|
|
}
|
|
span{font-size: 12px}
|
|
|
|
.el-form-item{
|
|
margin-bottom: 6px;
|
|
}
|
|
.el-divider--horizontal {
|
|
margin: 10px 0
|
|
}
|
|
.divider-style ::v-deep .el-divider__text{
|
|
color: #606266;
|
|
font-size: 12px;
|
|
font-weight: 400;
|
|
padding: 0 10px;
|
|
}
|
|
</style>
|