Merge pull request #3471 from dataease/pr@dev@feat_percent

feat(视图): 快速计算支持占比
This commit is contained in:
xuwei-fit2cloud 2022-10-27 09:28:22 +08:00 committed by GitHub
commit 3b89bd84d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 5 deletions

View File

@ -3218,3 +3218,5 @@ export function getRemark(chart) {
}
return remark
}
export const quotaViews = ['label', 'richTextView', 'text', 'gauge', 'liquid']

View File

@ -175,7 +175,10 @@
:disabled="disableEditCompare"
:command="beforeQuickCalc('setting')"
>{{ $t('chart.yoy_label') }}...</el-dropdown-item>
<el-dropdown-item :command="beforeQuickCalc('percent')">{{ $t('chart.percent') }}</el-dropdown-item>
<el-dropdown-item
:disabled="quotaViews.indexOf(chart.type) > -1"
:command="beforeQuickCalc('percent')"
>{{ $t('chart.percent') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
@ -242,6 +245,7 @@ import { getItemType, getOriginFieldName } from '@/views/chart/components/drag-i
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
import { formatterItem } from '@/views/chart/chart/formatter'
import { quotaViews } from '@/views/chart/chart/util'
export default {
name: 'QuotaExtItem',
@ -277,7 +281,8 @@ export default {
compareItem: compareItem,
disableEditCompare: false,
tagType: 'success',
formatterItem: formatterItem
formatterItem: formatterItem,
quotaViews: quotaViews
}
},
watch: {

View File

@ -175,7 +175,10 @@
:disabled="disableEditCompare"
:command="beforeQuickCalc('setting')"
>{{ $t('chart.yoy_label') }}...</el-dropdown-item>
<el-dropdown-item :command="beforeQuickCalc('percent')">{{ $t('chart.percent') }}</el-dropdown-item>
<el-dropdown-item
:disabled="quotaViews.indexOf(chart.type) > -1"
:command="beforeQuickCalc('percent')"
>{{ $t('chart.percent') }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown-item>
@ -242,6 +245,7 @@ import { getItemType, getOriginFieldName } from '@/views/chart/components/drag-i
import FieldErrorTips from '@/views/chart/components/drag-item/components/FieldErrorTips'
import bus from '@/utils/bus'
import { formatterItem } from '@/views/chart/chart/formatter'
import { quotaViews } from '@/views/chart/chart/util'
export default {
name: 'QuotaItem',
@ -277,7 +281,8 @@ export default {
compareItem: compareItem,
disableEditCompare: false,
tagType: 'success',
formatterItem: formatterItem
formatterItem: formatterItem,
quotaViews: quotaViews
}
},
watch: {

View File

@ -1589,6 +1589,7 @@ import ScrollCfg from '@/views/chart/components/senior/ScrollCfg'
import ChartFieldEdit from '@/views/chart/view/ChartFieldEdit'
import CalcChartFieldEdit from '@/views/chart/view/CalcChartFieldEdit'
import { equalsAny } from '@/utils/StringUtils'
import { quotaViews } from '@/views/chart/chart/util'
export default {
name: 'ChartEdit',
@ -1748,7 +1749,6 @@ export default {
tabActive: 'data',
currentAreaCode: '',
showStackCustomSort: false
}
},
computed: {
@ -2094,6 +2094,10 @@ export default {
if (!ele.compareCalc) {
ele.compareCalc = compareItem
}
if (quotaViews.indexOf(view.type) > -1) {
ele.compareCalc = compareItem
ele.formatterCfg.type = 'auto'
}
})
if (view.type === 'chart-mix') {
view.yaxisExt.forEach(function(ele) {
@ -2121,6 +2125,10 @@ export default {
if (!ele.compareCalc) {
ele.compareCalc = compareItem
}
if (quotaViews.indexOf(view.type) > -1) {
ele.compareCalc = compareItem
ele.formatterCfg.type = 'auto'
}
})
}
view.extStack.forEach(function(ele) {