mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 07:57:33 +08:00
code refactor
This commit is contained in:
@@ -10,7 +10,6 @@ import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
import { formatPercent } from '@/lib/common.js';
|
||||
|
||||
export default {
|
||||
@@ -88,7 +87,7 @@ export default {
|
||||
actualPercent: item[this.valueField] / totalValidValue,
|
||||
currency: item[this.currencyField],
|
||||
itemStyle: {
|
||||
color: this.getColor(item[this.colorField] ? item[this.colorField] : statisticsConstants.defaultChartColors[validItems.length % statisticsConstants.defaultChartColors.length]),
|
||||
color: this.getColor(item[this.colorField] ? item[this.colorField] : colorConstants.defaultChartColors[validItems.length % colorConstants.defaultChartColors.length]),
|
||||
},
|
||||
selected: true,
|
||||
sourceItem: item
|
||||
|
||||
@@ -81,7 +81,6 @@ import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
import { formatPercent } from '@/lib/common.js';
|
||||
|
||||
export default {
|
||||
@@ -141,7 +140,7 @@ export default {
|
||||
percent: (item[this.percentField] > 0 || item[this.percentField] === 0 || item[this.percentField] === '0') ? item[this.percentField] : (item[this.valueField] / totalValidValue * 100),
|
||||
actualPercent: item[this.valueField] / totalValidValue,
|
||||
currency: item[this.currencyField],
|
||||
color: item[this.colorField] ? item[this.colorField] : statisticsConstants.defaultChartColors[validItems.length % statisticsConstants.defaultChartColors.length],
|
||||
color: item[this.colorField] ? item[this.colorField] : colorConstants.defaultChartColors[validItems.length % colorConstants.defaultChartColors.length],
|
||||
sourceItem: item
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user