refactor: 彻底删除计划模块status字段+新增蓝色tip
- 数据库: DROP plan_finances.status 列(幂等迁移) - 后端: routes.py TABLES移除status, migrate用显式列名 - 前端: plan.js移除表单/表格/过滤/汇总所有status引用 - planFilter值从待签约改为projects - 计划页面顶部新增蓝色tip提醒条 - 版本号 v1.0.0.22
This commit is contained in:
@@ -114,5 +114,14 @@ def migrate_add_columns():
|
||||
|
||||
conn.commit()
|
||||
print("[migrate] 加列迁移完成")
|
||||
|
||||
# 删除 plan_finances.status 列(计划模块不再需要状态字段)
|
||||
cur = conn.cursor()
|
||||
cur.execute("SHOW COLUMNS FROM plan_finances LIKE 'status'")
|
||||
if cur.fetchone():
|
||||
cur.execute("ALTER TABLE plan_finances DROP COLUMN status")
|
||||
conn.commit()
|
||||
print("[migrate] plan_finances.status 列已删除")
|
||||
cur.close()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
@@ -121,11 +121,16 @@ def migrate_move_pending_to_plan():
|
||||
conn = db()
|
||||
try:
|
||||
cur = conn.cursor()
|
||||
# 获取 plan_finances 的列名(排除 status,因计划模块已删除该列)
|
||||
cur.execute("SHOW COLUMNS FROM plan_finances")
|
||||
plan_cols = [row[0] for row in cur.fetchall()]
|
||||
col_list = ", ".join(plan_cols)
|
||||
|
||||
# 仅迁移 id 不存在于计划表的待签约项目
|
||||
cur.execute(
|
||||
"INSERT INTO plan_finances "
|
||||
"SELECT * FROM project_finances WHERE status='待签约' "
|
||||
"AND id NOT IN (SELECT id FROM plan_finances)"
|
||||
f"INSERT INTO plan_finances ({col_list}) "
|
||||
f"SELECT {col_list} FROM project_finances WHERE status='待签约' "
|
||||
f"AND id NOT IN (SELECT id FROM plan_finances)"
|
||||
)
|
||||
moved = cur.rowcount
|
||||
if moved:
|
||||
|
||||
@@ -25,7 +25,7 @@ TABLES = {
|
||||
"tasks": ("project_tasks", ["project_id", "phase", "milestone", "task", "owner", "due_date", "blockers", "notes", "status", "sort_order", "priority", "tenant"]),
|
||||
"projectFinances": ("project_finances", ["project_id", "tenant", "business_type", "customer_name", "sign_amount", "sign_month", "status", "sales_person", "owner", "total_rev", "total_gross", "total_payment", "total_cost", "total_paid", "budget_data", "expense_data", "start_date", "end_date", "task_type", "task_count", "service_fee_standard", "project_manager", "task_data", "project_code", "contact_name", "contact_phone", "other_info"]),
|
||||
"expense": ("expense_records", ["expense_type", "expense_month", "amount", "incurred_amount", "notes", "status", "tenant"]),
|
||||
"planFinances": ("plan_finances", ["project_id", "tenant", "business_type", "customer_name", "sign_amount", "sign_month", "status", "sales_person", "owner", "total_rev", "total_gross", "total_payment", "total_cost", "total_paid", "budget_data", "expense_data", "start_date", "end_date", "task_type", "task_count", "service_fee_standard", "project_manager", "task_data", "project_code", "contact_name", "contact_phone", "other_info"]),
|
||||
"planFinances": ("plan_finances", ["project_id", "tenant", "business_type", "customer_name", "sign_amount", "sign_month", "sales_person", "owner", "total_rev", "total_gross", "total_payment", "total_cost", "total_paid", "budget_data", "expense_data", "start_date", "end_date", "task_type", "task_count", "service_fee_standard", "project_manager", "task_data", "project_code", "contact_name", "contact_phone", "other_info"]),
|
||||
"planExpense": ("plan_expense_records", ["expense_type", "expense_month", "amount", "incurred_amount", "notes", "status", "tenant"]),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user