feat: 三项改进 — require_report + 拜访联动 + 解绑移到弹窗

1. 用户管理页 UX 优化:
   - 表格内「解绑」按钮移入编辑弹窗(clearable 输入框)
   - 新增「需要填写周报」el-switch 开关
   - 新增「填报」列显示是否计入统计

2. require_report 字段 (DB + API + 联动):
   - users 表新增 require_report BOOLEAN DEFAULT TRUE
   - 调度器/仪表盘进度/立即检查 均排除 require_report=false
   - UserOut schema + UpdateUserRoleRequest 同步更新

3. 拜访联动客户 last_visit:
   - customers 表新增 last_visit_date / last_visit_manager_id
   - 创建拜访记录时自动更新对应客户的最后拜访信息
   - 亮灯表可据此精确判断客户拜访状态

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-26 16:36:27 +08:00
parent 989c41da8c
commit a580eefd14
9 changed files with 54 additions and 26 deletions
+10
View File
@@ -38,6 +38,16 @@ async def lifespan(app: FastAPI):
await conn.run_sync(lambda c, t=tbl: c.exec_driver_sql(
f"ALTER TABLE {t} ADD COLUMN IF NOT EXISTS edit_log JSONB DEFAULT '[]'"
))
# New columns for v0.3
await conn.run_sync(lambda c: c.exec_driver_sql(
"ALTER TABLE users ADD COLUMN IF NOT EXISTS require_report BOOLEAN DEFAULT TRUE"
))
await conn.run_sync(lambda c: c.exec_driver_sql(
"ALTER TABLE customers ADD COLUMN IF NOT EXISTS last_visit_date DATE"
))
await conn.run_sync(lambda c: c.exec_driver_sql(
"ALTER TABLE customers ADD COLUMN IF NOT EXISTS last_visit_manager_id UUID"
))
# Start daily reporting scheduler (17:30 CST = 09:30 UTC)
_scheduler.add_job(_scheduled_check, "cron", hour=17, minute=30, id="daily_check")