mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
code refactor
This commit is contained in:
@@ -81,21 +81,9 @@ import { mapStores } from 'pinia';
|
|||||||
import { useSettingsStore } from '@/stores/setting.js';
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
|
|
||||||
import colorConstants from '@/consts/color.js';
|
import colorConstants from '@/consts/color.js';
|
||||||
|
import statisticsConstants from '@/consts/statistics.js';
|
||||||
import { formatPercent } from '@/lib/common.js';
|
import { formatPercent } from '@/lib/common.js';
|
||||||
|
|
||||||
const defaultColors = [
|
|
||||||
'cc4a66',
|
|
||||||
'e3564a',
|
|
||||||
'fc892c',
|
|
||||||
'ffc349',
|
|
||||||
'4dd291',
|
|
||||||
'24ceb3',
|
|
||||||
'2ab4d0',
|
|
||||||
'065786',
|
|
||||||
'713670',
|
|
||||||
'8e1d51'
|
|
||||||
];
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
'skeleton',
|
'skeleton',
|
||||||
@@ -153,7 +141,7 @@ export default {
|
|||||||
percent: (item[this.percentField] > 0 || item[this.percentField] === 0 || item[this.percentField] === '0') ? item[this.percentField] : (item[this.valueField] / totalValidValue * 100),
|
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,
|
actualPercent: item[this.valueField] / totalValidValue,
|
||||||
currency: item[this.currencyField],
|
currency: item[this.currencyField],
|
||||||
color: item[this.colorField] ? item[this.colorField] : defaultColors[validItems.length % defaultColors.length],
|
color: item[this.colorField] ? item[this.colorField] : statisticsConstants.defaultChartColors[validItems.length % statisticsConstants.defaultChartColors.length],
|
||||||
sourceItem: item
|
sourceItem: item
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,20 +47,36 @@ const defaultChartDataType = allChartDataTypes.ExpenseByPrimaryCategory.type;
|
|||||||
const allSortingTypes = {
|
const allSortingTypes = {
|
||||||
Amount: {
|
Amount: {
|
||||||
type: 0,
|
type: 0,
|
||||||
name: 'Amount'
|
name: 'Amount',
|
||||||
|
fullName: 'Sort by Amount'
|
||||||
},
|
},
|
||||||
DisplayOrder: {
|
DisplayOrder: {
|
||||||
type: 1,
|
type: 1,
|
||||||
name: 'Display Order'
|
name: 'Display Order',
|
||||||
|
fullName: 'Sort by Display Order'
|
||||||
},
|
},
|
||||||
Name: {
|
Name: {
|
||||||
type: 2,
|
type: 2,
|
||||||
name: 'Name'
|
name: 'Name',
|
||||||
|
fullName: 'Sort by Name'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultSortingType = allSortingTypes.Amount.type;
|
const defaultSortingType = allSortingTypes.Amount.type;
|
||||||
|
|
||||||
|
const defaultChartColors = [
|
||||||
|
'cc4a66',
|
||||||
|
'e3564a',
|
||||||
|
'fc892c',
|
||||||
|
'ffc349',
|
||||||
|
'4dd291',
|
||||||
|
'24ceb3',
|
||||||
|
'2ab4d0',
|
||||||
|
'065786',
|
||||||
|
'713670',
|
||||||
|
'8e1d51'
|
||||||
|
];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
allChartTypes: allChartTypes,
|
allChartTypes: allChartTypes,
|
||||||
defaultChartType: defaultChartType,
|
defaultChartType: defaultChartType,
|
||||||
@@ -69,4 +85,5 @@ export default {
|
|||||||
defaultDataRangeType: datetime.allDateRanges.ThisMonth.type,
|
defaultDataRangeType: datetime.allDateRanges.ThisMonth.type,
|
||||||
allSortingTypes: allSortingTypes,
|
allSortingTypes: allSortingTypes,
|
||||||
defaultSortingType: defaultSortingType,
|
defaultSortingType: defaultSortingType,
|
||||||
|
defaultChartColors: defaultChartColors,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -975,6 +975,9 @@ export default {
|
|||||||
'Amount': 'Amount',
|
'Amount': 'Amount',
|
||||||
'Display Order': 'Display Order',
|
'Display Order': 'Display Order',
|
||||||
'Name': 'Name',
|
'Name': 'Name',
|
||||||
|
'Sort by Amount': 'Sort by Amount',
|
||||||
|
'Sort by Display Order': 'Sort by Display Order',
|
||||||
|
'Sort by Name': 'Sort by Name',
|
||||||
'Filter Accounts': 'Filter Accounts',
|
'Filter Accounts': 'Filter Accounts',
|
||||||
'Filter Transaction Categories': 'Filter Transaction Categories',
|
'Filter Transaction Categories': 'Filter Transaction Categories',
|
||||||
'User Settings': 'User Settings',
|
'User Settings': 'User Settings',
|
||||||
|
|||||||
@@ -975,6 +975,9 @@ export default {
|
|||||||
'Amount': '金额',
|
'Amount': '金额',
|
||||||
'Display Order': '显示顺序',
|
'Display Order': '显示顺序',
|
||||||
'Name': '名称',
|
'Name': '名称',
|
||||||
|
'Sort by Amount': '按金额排序',
|
||||||
|
'Sort by Display Order': '按显示顺序排序',
|
||||||
|
'Sort by Name': '按名称排序',
|
||||||
'Filter Accounts': '过滤账户',
|
'Filter Accounts': '过滤账户',
|
||||||
'Filter Transaction Categories': '过滤交易类型',
|
'Filter Transaction Categories': '过滤交易类型',
|
||||||
'User Settings': '用户设置',
|
'User Settings': '用户设置',
|
||||||
|
|||||||
Reference in New Issue
Block a user