fix: 统一各页面账单分类来源
bills 和 review 页面改从 $lib/data/categories 导入分类列表, 删除本地重复硬编码的旧版 13 项分类。 BillDetailDrawer 的 categories prop 类型改为 readonly string[] 以兼容 as const 导出的元组类型。
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
interface Props {
|
interface Props {
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
record?: UIBill | null;
|
record?: UIBill | null;
|
||||||
categories?: string[];
|
categories?: readonly string[];
|
||||||
|
|
||||||
title?: string;
|
title?: string;
|
||||||
viewDescription?: string;
|
viewDescription?: string;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import ManualBillInput from '$lib/components/bills/ManualBillInput.svelte';
|
import ManualBillInput from '$lib/components/bills/ManualBillInput.svelte';
|
||||||
import BillDetailDrawer from '$lib/components/analysis/BillDetailDrawer.svelte';
|
import BillDetailDrawer from '$lib/components/analysis/BillDetailDrawer.svelte';
|
||||||
import { cleanedBillToUIBill, type UIBill } from '$lib/models/bill';
|
import { cleanedBillToUIBill, type UIBill } from '$lib/models/bill';
|
||||||
|
import { categories } from '$lib/data/categories';
|
||||||
import { formatLocalDate, formatDateTime } from '$lib/utils';
|
import { formatLocalDate, formatDateTime } from '$lib/utils';
|
||||||
import Loader2 from '@lucide/svelte/icons/loader-2';
|
import Loader2 from '@lucide/svelte/icons/loader-2';
|
||||||
import AlertCircle from '@lucide/svelte/icons/alert-circle';
|
import AlertCircle from '@lucide/svelte/icons/alert-circle';
|
||||||
@@ -89,12 +90,7 @@
|
|||||||
applyFilters();
|
applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分类列表(硬编码常用分类)
|
|
||||||
const categories = [
|
|
||||||
'餐饮美食', '交通出行', '生活服务', '日用百货',
|
|
||||||
'服饰美容', '医疗健康', '通讯话费', '住房缴费',
|
|
||||||
'文化娱乐', '金融理财', '教育培训', '人情往来', '其他'
|
|
||||||
];
|
|
||||||
|
|
||||||
async function loadBills() {
|
async function loadBills() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import BillDetailDrawer from '$lib/components/analysis/BillDetailDrawer.svelte';
|
import BillDetailDrawer from '$lib/components/analysis/BillDetailDrawer.svelte';
|
||||||
import { cleanedBillToUIBill, type UIBill } from '$lib/models/bill';
|
import { cleanedBillToUIBill, type UIBill } from '$lib/models/bill';
|
||||||
import { updateBill } from '$lib/api';
|
import { updateBill } from '$lib/api';
|
||||||
|
import { categories } from '$lib/data/categories';
|
||||||
import Loader2 from '@lucide/svelte/icons/loader-2';
|
import Loader2 from '@lucide/svelte/icons/loader-2';
|
||||||
import AlertCircle from '@lucide/svelte/icons/alert-circle';
|
import AlertCircle from '@lucide/svelte/icons/alert-circle';
|
||||||
import AlertTriangle from '@lucide/svelte/icons/alert-triangle';
|
import AlertTriangle from '@lucide/svelte/icons/alert-triangle';
|
||||||
@@ -80,12 +81,7 @@
|
|||||||
let drawerOpen = $state(false);
|
let drawerOpen = $state(false);
|
||||||
let selectedBill = $state<UIBill | null>(null);
|
let selectedBill = $state<UIBill | null>(null);
|
||||||
|
|
||||||
// 分类列表(用于编辑选择)
|
|
||||||
const categories = [
|
|
||||||
'餐饮美食', '交通出行', '生活服务', '日用百货',
|
|
||||||
'服饰美容', '医疗健康', '通讯话费', '住房缴费',
|
|
||||||
'文化娱乐', '金融理财', '教育培训', '人情往来', '其他'
|
|
||||||
];
|
|
||||||
|
|
||||||
// 点击行打开详情
|
// 点击行打开详情
|
||||||
function handleRowClick(record: CleanedBill) {
|
function handleRowClick(record: CleanedBill) {
|
||||||
|
|||||||
Reference in New Issue
Block a user