feat(v1.3): 管理员(打手)颜色,客户归属打手,日历/待办按颜色标识
1) 管理员颜色 - users 表新增 color;设置 → 管理员 每行一个颜色选择器,保存即生效 - 新建管理员自动从 8 色调色板分配,尽量不重复;支持 #RRGGBB 校验,非法值拒绝 2) 客户归属打手 - customers 表新增 assignee_id(可空,指向 users) - 新建/编辑客户时可选择「归属打手」,客户详情页也能直接改派 - 语义:一个客户一个打手,该客户之后的所有单子都归这个打手 - 停用的账户不出现在打手候选里;未指派显示灰色「未指派」 3) 日历 - 每个日期格左侧新增 5px 竖条,按当天涉及的打手颜色等分显示(几种颜色几段) - 竖条按“当天全部任务”去重计算,不受格内色签 3 条上限影响 - 未指派的任务用中性灰段落 4) 待办与大屏 - 「当日待完成」每条任务左侧 3px 打手色条 + 圆点色标 + 打手名字,未指派灰字 - 大屏:今日待打列表、热力格竖条、悬停浮层(新增 who / who_color 字段)统一使用同一套颜色 - 加急样式改为红底,避免与打手色左边框冲突 数据库兼容性: - 只做加法:users.color、customers.assignee_id 两列;老库打开时自动 ALTER,可重复迁移 - 原有表结构、字段、页面接口不变;未指派的存量数据照常工作 测试: - 新增单测:颜色自动分配/规范化/非法值拒绝、客户指派与取消、订阅联表带出打手、停用账户不进候选 - 旧库迁移测试扩展:老 users / customers 表自动补列并可写 - 功能验证 16 项(颜色保存、指派、详情展示、日历多色竖条分段、大屏列表与浮层接口)全部通过 - 原有 119 项验收回归全绿;go vet / go test ./... 通过;版本号 1.3.0
This commit is contained in:
@@ -18,6 +18,8 @@ type screenDay struct {
|
||||
Count int
|
||||
Urgent int
|
||||
Heat int
|
||||
// Strip 打手色竖条(去重)
|
||||
Strip []string
|
||||
}
|
||||
|
||||
type screenTask struct {
|
||||
@@ -124,6 +126,8 @@ func (s *Server) handleScreen(w http.ResponseWriter, r *http.Request) {
|
||||
d := domain.AddDays(gridStart, wi*7+di)
|
||||
ds := domain.Date(d)
|
||||
count, urgentN := 0, 0
|
||||
strip := []string{}
|
||||
seenColor := map[string]bool{}
|
||||
for _, cs := range list {
|
||||
if heatMode == "due" {
|
||||
if cs.sub.EndDate == ds {
|
||||
@@ -142,6 +146,14 @@ func (s *Server) handleScreen(w http.ResponseWriter, r *http.Request) {
|
||||
if urgent[cs.sub.ID][ds] {
|
||||
urgentN++
|
||||
}
|
||||
color := cs.sub.AssigneeColor
|
||||
if color == "" {
|
||||
color = "#8A8F98"
|
||||
}
|
||||
if !seenColor[color] {
|
||||
seenColor[color] = true
|
||||
strip = append(strip, color)
|
||||
}
|
||||
}
|
||||
if d.Month() == today.Month() {
|
||||
data.HeatTotal += count
|
||||
@@ -155,6 +167,7 @@ func (s *Server) handleScreen(w http.ResponseWriter, r *http.Request) {
|
||||
Count: count,
|
||||
Urgent: urgentN,
|
||||
Heat: heatLevel(count),
|
||||
Strip: strip,
|
||||
})
|
||||
}
|
||||
data.Weeks = append(data.Weeks, week)
|
||||
@@ -225,6 +238,8 @@ func (s *Server) handleScreenDay(w http.ResponseWriter, r *http.Request) {
|
||||
Remain string `json:"remain"`
|
||||
Urgent bool `json:"urgent"`
|
||||
Done bool `json:"done"`
|
||||
Who string `json:"who"`
|
||||
WhoCol string `json:"who_color"`
|
||||
}
|
||||
out := struct {
|
||||
Date string `json:"date"`
|
||||
@@ -256,6 +271,8 @@ func (s *Server) handleScreenDay(w http.ResponseWriter, r *http.Request) {
|
||||
Remain: row.RemainText,
|
||||
Urgent: row.Urgent,
|
||||
Done: row.Done || row.Skipped,
|
||||
Who: row.AssigneeLabel(),
|
||||
WhoCol: row.AssigneeHex(),
|
||||
})
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
|
||||
Reference in New Issue
Block a user