unis_manager/.workbuddy/memory/2026-09-18.md

3.9 KiB
Raw Permalink Blame History

2026-09-18

定开项目明细:4 项调整(更新时间 / 统计实时 / 搜索回车 / 季度口径)

用户提了 4 条:

1) 保存后「更新时间」= 提交时间

  • 昨天把 PATCH 改成 update_date = sign_date;今天改回提交时间。
  • app/routers/custom.py:from datetime import date, datetime, timedelta;
    • PATCH:if changed: cp.update_date = datetime.now().strftime("%Y-%m-%d %H:%M")
    • CREATE:data["update_date"] = datetime.now().strftime("%Y-%m-%d %H:%M")
  • 实测:PATCH 项目 1(原 2024-04-30)→ 2026-09-18 11:21(含时分),已在库中还原为 2024-04-30。
  • 口径小结:导入/初始 = 下单时间;界面改/新建后 = 提交时间(String(16) 正好放「YYYY-MM-DD HH:MM」)。

2) 统计随修改实时更新

  • 保存走 afterWrite() → refresh() → renderCustom(),统计条本就重算;用户观感「项目状态改了统计没变」的根因是旧口径(验收看 accept_date_real)与项目状态无关。
  • 改为验收口径 = 「项目状态 == 已验收」,季度/年度按 accept_date_real 归属(无验收日期的计入本年)→ 改状态即可反映到「本季度/本年验收」。

3) 项目名称搜索改为「回车」触发

  • web/app.js 的 bindKeyword(id, opts) 增加 opts.enter:为真时只在 Enter(或 type=search 的清除 ×)才查询,否则维持 320ms 防抖。
  • 启用:bindKeyword("cKeyword", { enter: true })(定开)、bindKeyword("pKeyword", { enter: true })(项目)。fKeyword/stKeyword 维持实时。

4) 统计维度:本月 → 本季度

  • renderCustomList 统计条:本月新增下单 → 本季度下单(Y年Qn)、本月验收项目 → 本季度验收(Y年Qn);本年两项保留。
  • 季季度按 1-3/4-6/7-9/10-12 划分;ymOf() 只认 ^\d{4}-\d{2} 的日期(「2024年3月前」这类文本不参与)。
  • 核对(2026 Q3):本季度下单 12 / 本年下单 31 / 本季度验收 17 / 本年验收 62。

其他

  • 后端改了 custom.py → 重启 uvicorn(新 PID 26784,旧 27492 已杀);前端 static 无需重启。
  • node --check web/app.js、ast.parse(custom.py) 通过。
  • 临时脚本 scripts/_tmp_verify.py 已删除。

定开明细:只留「项目明细」+ 统计全局化 + 导出对齐

用户提了 3 条:去掉其它几个板块;筛选/统计只按项目明细;本季度统计要覆盖全部项目且不随搜索变化,并优化样式。

  1. 只保留「项目明细」:删掉「交付流水线 / 阶段看板 / 财务跟踪」三个 tab,以及 renderCustomBoard / renderCustomPipeline / renderCustomFinance 三个函数(共删 235 行,脚本 _tmp_rmviews.py 完成)。state.customTab 固定为 "list"。
  2. 筛选/统计只基于项目明细:
    • renderCustom 改为一次取全部(/custom/projects?archived=X,不再带 keyword/region);
    • 列表在客户端按 关键字 + 区域 + 状态 过滤(state.keyword/customRegion/customStatus);
    • 统计条基于 allRows(全部项目),不受搜索/筛选影响(加 .stat-note 说明文字)。
  3. 导出 Excel 对齐「项目明细」:export_custom 去掉 stage 参数、新增 status 参数;列改为 15 列(= 明细表列);改 _sort_by_update 排序;前端导出带 archived/region/status/keyword。实测 status=已验收 → 64 行、表头 15 列正确(64 个已验收,其中 62 个有本年验收日期)。
  4. 统计样式优化:.stat 左侧 3px 色条 + 金额重点色(--c);分色:总量=--primary、下单=--violet、验收=--amber。
  5. 清理:删除未用的 customQuery、state.customBoard/customStats;归档确认文案去掉「阶段看板」措辞。
  6. 重启 uvicorn(PID 38440);node --check / ast.parse / health 均通过。前端 static 无需重启。