mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
feat(图表): 同环比计算公式提示优化
This commit is contained in:
parent
76f529aaad
commit
45f49eeadc
@ -1588,15 +1588,25 @@ export default {
|
||||
data_sub: 'Comparison difference',
|
||||
data_percent: 'Difference percentage',
|
||||
compare_calc_expression: 'Calculation formula',
|
||||
compare_calc_day_pre: 'Previous Day Data',
|
||||
compare_calc_day_sub: "Today's Data - Previous Day Data",
|
||||
compare_calc_day_percent: "(Today's Data / Previous Day Data - 1) * 100%",
|
||||
compare_calc_month_pre: 'Same Day Last Month Data',
|
||||
compare_calc_month_sub: "Today's Data - Same Day Last Month Data",
|
||||
compare_calc_month_percent: "(Today's Data / Same Day Last Month Data - 1) * 100%",
|
||||
compare_calc_year_pre: 'Same Day Last Year Data',
|
||||
compare_calc_year_sub: "Today's Data - Same Day Last Year Data",
|
||||
compare_calc_year_percent: "(Today's Data / Same Day Last Year Data - 1) * 100%",
|
||||
compare_calc_day_pre: "Yesterday's Data",
|
||||
compare_calc_day_sub: "Today's Data - Yesterday's Data",
|
||||
compare_calc_day_percent: "(Today's Data / Yesterday's Data - 1) * 100%",
|
||||
compare_calc_month_pre: "Same Day Last Month's Data",
|
||||
compare_calc_month_pre_m: "Last Month's Data",
|
||||
compare_calc_month_sub: "Today's Data - Same Day Last Month's Data",
|
||||
compare_calc_month_sub_m: "Current Month's Data - Last Month's Data",
|
||||
compare_calc_month_percent: "(Today's Data / Same Day Last Month's Data - 1) * 100%",
|
||||
compare_calc_month_percent_m: "(Current Month's Data / Last Month's Data - 1) * 100%",
|
||||
compare_calc_year_pre: "Same Day Last Year's Data",
|
||||
compare_calc_year_pre_m: "Same Month Last Year's Data",
|
||||
compare_calc_year_pre_y: "Last Year's Data",
|
||||
compare_calc_year_sub: "Today's Data - Same Day Last Year's Data",
|
||||
compare_calc_year_sub_m: "Current Year's Monthly Data - Same Month Last Year's Data",
|
||||
compare_calc_year_sub_y: "Current Year's Data - Last Year's Data",
|
||||
compare_calc_year_percent: "(Today's Data / Same Day Last Year's Data - 1) * 100%",
|
||||
compare_calc_year_percent_m:
|
||||
"(Current Year's Monthly Data / Same Month Last Year's Data - 1) * 100%",
|
||||
compare_calc_year_percent_y: "(Current Year's Data / Last Year's Data - 1) * 100%",
|
||||
compare_calc_tip:
|
||||
'When filtering is required for comparison dates, please use the filter component to apply the filter; using chart filters, dashboard drilling, and linking functions may lead to inconsistent results.',
|
||||
and: 'And',
|
||||
|
@ -1562,11 +1562,20 @@ export default {
|
||||
compare_calc_day_sub: '當天數據 - 昨日數據',
|
||||
compare_calc_day_percent: '(當天數據 / 昨日數據 - 1)* 100%',
|
||||
compare_calc_month_pre: '上月同日數據',
|
||||
compare_calc_month_pre_m: '上月數據',
|
||||
compare_calc_month_sub: '當天數據 - 上月同日數據',
|
||||
compare_calc_month_sub_m: '當月數據 - 上月數據',
|
||||
compare_calc_month_percent: '(當天數據 / 上月同日數據 - 1)* 100%',
|
||||
compare_calc_month_percent_m: '(當月數據 / 上月數據 - 1)* 100%',
|
||||
compare_calc_year_pre: '去年同月同日數據',
|
||||
compare_calc_year_pre_m: '去年同月數據',
|
||||
compare_calc_year_pre_y: '去年數據',
|
||||
compare_calc_year_sub: '當天數據 - 去年同月同日數據',
|
||||
compare_calc_year_sub_m: '當月數據 - 去年同月數據',
|
||||
compare_calc_year_sub_y: '當年數據 - 去年數據',
|
||||
compare_calc_year_percent: '(當天數據 / 去年同月同日數據 - 1)* 100%',
|
||||
compare_calc_year_percent_m: '(當月數據 / 去年同月數據 - 1)* 100%',
|
||||
compare_calc_year_percent_y: '(當年數據 / 去年數據 - 1)* 100%',
|
||||
compare_calc_tip:
|
||||
'當對比日期需要過濾時,請使用過濾組件實現過濾;使用圖表過濾器,儀表板下鑽和聯動等功能,會導致結果不一致',
|
||||
and: '與',
|
||||
|
@ -1564,11 +1564,20 @@ export default {
|
||||
compare_calc_day_sub: '当天数据 - 昨日数据',
|
||||
compare_calc_day_percent: '(当天数据 / 昨日数据 - 1)* 100%',
|
||||
compare_calc_month_pre: '上月同日数据',
|
||||
compare_calc_month_pre_m: '上月数据',
|
||||
compare_calc_month_sub: '当天数据 - 上月同日数据',
|
||||
compare_calc_month_sub_m: '当月数据 - 上月数据',
|
||||
compare_calc_month_percent: '(当天数据 / 上月同日数据 - 1)* 100%',
|
||||
compare_calc_month_percent_m: '(当月数据 / 上月数据 - 1)* 100%',
|
||||
compare_calc_year_pre: '去年同月同日数据',
|
||||
compare_calc_year_pre_m: '去年同月数据',
|
||||
compare_calc_year_pre_y: '去年数据',
|
||||
compare_calc_year_sub: '当天数据 - 去年同月同日数据',
|
||||
compare_calc_year_sub_m: '当月数据 - 去年同月数据',
|
||||
compare_calc_year_sub_y: '当年数据 - 去年数据',
|
||||
compare_calc_year_percent: '(当天数据 / 去年同月同日数据 - 1)* 100%',
|
||||
compare_calc_year_percent_m: '(当月数据 / 去年同月数据 - 1)* 100%',
|
||||
compare_calc_year_percent_y: '(当年数据 / 去年数据 - 1)* 100%',
|
||||
compare_calc_tip:
|
||||
'当对比日期需要过滤时,请使用过滤组件实现过滤;使用图表过滤器,仪表板下钻和联动等功能,会导致结果不一致',
|
||||
and: '与',
|
||||
|
@ -62,6 +62,94 @@ const initDateFormatter = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const hintStr = computed<string>(() => {
|
||||
let dataFormatter = state.dateFormatter
|
||||
const checkedField = state.fieldList.filter(ele => ele.id === compareItem.value.compareCalc.field)
|
||||
if (checkedField && checkedField.length > 0) {
|
||||
dataFormatter = checkedField[0].dateStyle
|
||||
}
|
||||
switch (dataFormatter) {
|
||||
case 'y_M_d':
|
||||
switch (compareItem.value.compareCalc.type) {
|
||||
case 'day_mom':
|
||||
switch (compareItem.value.compareCalc.resultData) {
|
||||
case 'pre':
|
||||
return t('chart.compare_calc_day_pre')
|
||||
case 'sub':
|
||||
return t('chart.compare_calc_day_sub')
|
||||
case 'percent':
|
||||
return t('chart.compare_calc_day_percent')
|
||||
}
|
||||
break
|
||||
case 'month_yoy':
|
||||
case 'month_mom':
|
||||
switch (compareItem.value.compareCalc.resultData) {
|
||||
case 'pre':
|
||||
return t('chart.compare_calc_month_pre')
|
||||
case 'sub':
|
||||
return t('chart.compare_calc_month_sub')
|
||||
case 'percent':
|
||||
return t('chart.compare_calc_month_percent')
|
||||
}
|
||||
break
|
||||
case 'year_yoy':
|
||||
case 'year_mom':
|
||||
switch (compareItem.value.compareCalc.resultData) {
|
||||
case 'pre':
|
||||
return t('chart.compare_calc_year_pre')
|
||||
case 'sub':
|
||||
return t('chart.compare_calc_year_sub')
|
||||
case 'percent':
|
||||
return t('chart.compare_calc_year_percent')
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
case 'y_M':
|
||||
switch (compareItem.value.compareCalc.type) {
|
||||
case 'month_yoy':
|
||||
case 'month_mom':
|
||||
switch (compareItem.value.compareCalc.resultData) {
|
||||
case 'pre':
|
||||
return t('chart.compare_calc_month_pre_m')
|
||||
case 'sub':
|
||||
return t('chart.compare_calc_month_sub_m')
|
||||
case 'percent':
|
||||
return t('chart.compare_calc_month_percent_m')
|
||||
}
|
||||
break
|
||||
case 'year_yoy':
|
||||
case 'year_mom':
|
||||
switch (compareItem.value.compareCalc.resultData) {
|
||||
case 'pre':
|
||||
return t('chart.compare_calc_year_pre_m')
|
||||
case 'sub':
|
||||
return t('chart.compare_calc_year_sub_m')
|
||||
case 'percent':
|
||||
return t('chart.compare_calc_year_percent_m')
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
case 'y':
|
||||
switch (compareItem.value.compareCalc.type) {
|
||||
case 'year_yoy':
|
||||
case 'year_mom':
|
||||
switch (compareItem.value.compareCalc.resultData) {
|
||||
case 'pre':
|
||||
return t('chart.compare_calc_year_pre_y')
|
||||
case 'sub':
|
||||
return t('chart.compare_calc_year_sub_y')
|
||||
case 'percent':
|
||||
return t('chart.compare_calc_year_percent_y')
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.chart,
|
||||
() => {
|
||||
@ -208,49 +296,9 @@ initDateFormatter()
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="t('chart.compare_calc_expression')">
|
||||
<template v-if="compareItem.compareCalc.type === 'day_mom'">
|
||||
<span v-if="compareItem.compareCalc.resultData === 'pre'" class="exp-style">
|
||||
{{ t('chart.compare_calc_day_pre') }}
|
||||
<span class="exp-style">
|
||||
{{ hintStr }}
|
||||
</span>
|
||||
<span v-if="compareItem.compareCalc.resultData === 'sub'" class="exp-style">
|
||||
{{ t('chart.compare_calc_day_sub') }}
|
||||
</span>
|
||||
<span v-else-if="compareItem.compareCalc.resultData === 'percent'" class="exp-style">
|
||||
{{ t('chart.compare_calc_day_percent') }}
|
||||
</span>
|
||||
</template>
|
||||
<template
|
||||
v-if="
|
||||
compareItem.compareCalc.type === 'month_yoy' ||
|
||||
compareItem.compareCalc.type === 'month_mom'
|
||||
"
|
||||
>
|
||||
<span v-if="compareItem.compareCalc.resultData === 'pre'" class="exp-style">
|
||||
{{ t('chart.compare_calc_month_pre') }}
|
||||
</span>
|
||||
<span v-if="compareItem.compareCalc.resultData === 'sub'" class="exp-style">
|
||||
{{ t('chart.compare_calc_month_sub') }}
|
||||
</span>
|
||||
<span v-else-if="compareItem.compareCalc.resultData === 'percent'" class="exp-style">
|
||||
{{ t('chart.compare_calc_month_percent') }}
|
||||
</span>
|
||||
</template>
|
||||
<template
|
||||
v-if="
|
||||
compareItem.compareCalc.type === 'year_yoy' ||
|
||||
compareItem.compareCalc.type === 'year_mom'
|
||||
"
|
||||
>
|
||||
<span v-if="compareItem.compareCalc.resultData === 'pre'" class="exp-style">
|
||||
{{ t('chart.compare_calc_year_pre') }}
|
||||
</span>
|
||||
<span v-if="compareItem.compareCalc.resultData === 'sub'" class="exp-style">
|
||||
{{ t('chart.compare_calc_year_sub') }}
|
||||
</span>
|
||||
<span v-else-if="compareItem.compareCalc.resultData === 'percent'" class="exp-style">
|
||||
{{ t('chart.compare_calc_year_percent') }}
|
||||
</span>
|
||||
</template>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="t('chart.tip')">
|
||||
|
Loading…
Reference in New Issue
Block a user