feat: 费用状态字段 + 表格排序 + 首页回款提醒 + 回款率着色

- 平台费用新增状态字段(计入费用/暂不计入),默认计入费用
- 费用表格月份列置首,所有表头点击正/倒序排序
- 首页新增回款提醒条(金色渐变,含确收/回款/未回款/回款率)
- 业务表格回款率着色:<30%红,30-80%黄,>=100%绿
- 版本号v1.0.0.5
This commit is contained in:
mac
2026-07-07 18:34:47 +08:00
parent a6acfb2012
commit f9fe32beed
7 changed files with 73 additions and 16 deletions

View File

@@ -105,6 +105,8 @@ def migrate_add_columns():
"ALTER TABLE expense_records ADD COLUMN expense_month VARCHAR(20) NOT NULL DEFAULT ''")
_add_column_if_missing(conn, "expense_records", "incurred_amount",
"ALTER TABLE expense_records ADD COLUMN incurred_amount DOUBLE NOT NULL DEFAULT 0")
_add_column_if_missing(conn, "expense_records", "status",
"ALTER TABLE expense_records ADD COLUMN status VARCHAR(50) NOT NULL DEFAULT '计入费用'")
# project_finances 费用明细 JSON 数据
_add_column_if_missing(conn, "project_finances", "expense_data",

View File

@@ -224,11 +224,12 @@ def seed_db():
incurred = int(amount * random.uniform(0.5, 1.0))
_exec(conn, """
INSERT INTO expense_records
(tenant, expense_type, expense_month, amount, incurred_amount, notes)
VALUES (?,?,?,?,?,?)
(tenant, expense_type, expense_month, amount, incurred_amount, notes, status)
VALUES (?,?,?,?,?,?,?)
""", (
tenant, et, month_str, amount, incurred,
f"{et} - {random.choice(['季度预算', '紧急支出', '常规费用', '项目费用'])}",
"计入费用",
))
print(f"[seed] {tenant}: {len(amounts)} 项目, {op_count} 运营项目, {expense_count} 费用记录")