feat: 计划模块 + 待签约迁移 + 表格排序 + 已签约→项目
- 新增计划模块(plan_finances/plan_expense_records, 侧边栏计划tab) - 待签约项目自动迁移到计划模块(data_fixes 幂等) - 已签约tab改名为项目(业务+计划两个模块) - 业务模块表格点击列头排序(月度/季度/总视图) - 计划与业务侧边栏位置对调 - plan模块CSS修复(使用finance-tab类) - 版本号 v1.0.0.17
This commit is contained in:
@@ -17,7 +17,7 @@ def run_migrations():
|
||||
"""
|
||||
from migrations.tables import migrate_create_tables
|
||||
from migrations.columns import migrate_add_columns
|
||||
from migrations.data_fixes import migrate_fix_task_status, migrate_rename_tenant, migrate_drop_product_fields, migrate_fix_service_fee_standard, migrate_fix_expense_status
|
||||
from migrations.data_fixes import migrate_fix_task_status, migrate_rename_tenant, migrate_drop_product_fields, migrate_fix_service_fee_standard, migrate_fix_expense_status, migrate_move_pending_to_plan
|
||||
from migrations.data_split import migrate_data_split
|
||||
from migrations.seed import migrate_seed_users, migrate_seed_demo_data
|
||||
|
||||
@@ -28,6 +28,7 @@ def run_migrations():
|
||||
migrate_drop_product_fields()
|
||||
migrate_fix_service_fee_standard()
|
||||
migrate_fix_expense_status()
|
||||
migrate_move_pending_to_plan()
|
||||
migrate_data_split()
|
||||
migrate_seed_users()
|
||||
migrate_seed_demo_data()
|
||||
|
||||
@@ -112,3 +112,31 @@ def migrate_fix_expense_status():
|
||||
print(f"[migrate] expense_records: {affected} 条记录 status 修正为 '计入费用'")
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def migrate_move_pending_to_plan():
|
||||
"""迁移业务待签约项目到计划模块(幂等)"""
|
||||
from db import db
|
||||
|
||||
conn = db()
|
||||
try:
|
||||
cur = conn.cursor()
|
||||
# 仅迁移 id 不存在于计划表的待签约项目
|
||||
cur.execute(
|
||||
"INSERT INTO plan_finances "
|
||||
"SELECT * FROM project_finances WHERE status='待签约' "
|
||||
"AND id NOT IN (SELECT id FROM plan_finances)"
|
||||
)
|
||||
moved = cur.rowcount
|
||||
if moved:
|
||||
# 删除已迁移的原记录
|
||||
cur.execute(
|
||||
"DELETE FROM project_finances WHERE status='待签约' "
|
||||
"AND id IN (SELECT id FROM plan_finances)"
|
||||
)
|
||||
deleted = cur.rowcount
|
||||
conn.commit()
|
||||
print(f"[migrate] 待签约项目迁移到计划: {moved} 条 (已删除 {deleted} 条)")
|
||||
cur.close()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
@@ -158,6 +158,8 @@ def migrate_create_tables():
|
||||
created_at VARCHAR(30) NOT NULL DEFAULT '',
|
||||
updated_at VARCHAR(30) NOT NULL DEFAULT ''
|
||||
)""",
|
||||
"""CREATE TABLE IF NOT EXISTS plan_finances LIKE project_finances""",
|
||||
"""CREATE TABLE IF NOT EXISTS plan_expense_records LIKE expense_records""",
|
||||
]
|
||||
|
||||
for ddl in tables:
|
||||
|
||||
Reference in New Issue
Block a user