This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-09-14 11:48:29 +08:00
parent f6fb2e1416
commit a3cf46f398
12 changed files with 192 additions and 68 deletions

View File

@ -33,9 +33,8 @@ func (s summary) Scan(m *ice.Message, arg ...string) {
switch ClientType(kit.Int(msg.Append(model.TYPE))) {
case ClientPlace:
s.List(m, client_uid).Table(func(value ice.Maps) {
msg := m.Cmd(web.SPACE, value[web.SPACE], value[ctx.INDEX], mdb.SELECT, kit.Simple(kit.UnMarshal(value[model.QUERY])), kit.Dict(
mdb.SELECT, kit.Select("count(*)", value[mdb.FIELD]),
ice.MSG_USERROLE, aaa.TECH,
msg := s.SpaceCmd(m, value[web.SPACE], value[ctx.INDEX], mdb.SELECT, kit.Simple(kit.UnMarshal(value[model.QUERY])), kit.Dict(
mdb.SELECT, kit.Select("count(*)", value[mdb.FIELD]), ice.MSG_USERROLE, aaa.TECH,
))
s.Update(m, kit.Dict(model.VALUE, msg.Append(msg.Append(ice.MSG_APPEND))), model.UID, value[model.UID])
})

View File

@ -10,9 +10,9 @@ import (
type Case struct {
Table
order string `data:"3"`
fields string `data:"title,content,case_status,plan_uid,user_uid"`
fields string `data:"title,content,case_status,process_time,finish_time,plan_uid,user_uid"`
create string `name:"create title* content*" role:"leader,worker"`
modify string `name:"create title* content*" role:"leader,worker"`
modify string `name:"modify title* content*" role:"leader,worker"`
remove string `name:"remove" role:"leader,worker"`
process string `name:"process" role:"leader,worker"`
finish string `name:"finish" role:"leader,worker"`
@ -20,11 +20,20 @@ type Case struct {
}
func (s Case) Create(m *ice.Message, arg ...string) {
s.GetCommandUID(m)
s.ValueCreate(m, arg...)
s.SendMessage(m, "", "")
s.taskCount(m, "1")
s.planCount(m, "1")
}
func (s Case) Remove(m *ice.Message, arg ...string) {
s.ValueRemove(m, arg...)
s.taskCount(m, "-1")
s.planCount(m, "-1")
}
func (s Case) Modify(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
}
func (s Case) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s Case) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s Case) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
@ -44,14 +53,28 @@ func (s Case) List(m *ice.Message, arg ...string) {
s.SelectJoinPlan(m)
s.SelectJoinUser(m)
}
func (s Case) Process(m *ice.Message, arg ...string) { s.changeStatus(m, CaseCreate, CaseProcess) }
func (s Case) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, CaseProcess, CaseFinish) }
func (s Case) PlanBind(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s Case) Process(m *ice.Message, arg ...string) { s.changeStatus(m, CaseCreate, CaseProcess) }
func (s Case) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, CaseProcess, CaseFinish) }
func (s Case) PlanBind(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
s.planCount(m, "1")
}
func init() { ice.TeamCtxCmd(Case{}) }
func (s Case) changeStatus(m *ice.Message, from, to CaseStatus, arg ...string) {
s.ChangeStatus(m, int(from), int(to))
func (s Case) changeStatus(m *ice.Message, from, to CaseStatus) {
s.ChangeStatus(m, int(from), int(to), m.ActionKey()+"_time", m.Time())
}
func (s Case) planCount(m *ice.Message, value string) {
s.Table.planCount(m, model.CASE_COUNT, value)
}
func (s Case) taskCount(m *ice.Message, value string) {
if m.IsErr() {
return
}
if m.Option(model.TASK_UID) != "" {
m.Cmd(task{}, s.AddCount, model.CASE_COUNT, value, m.Option(model.TASK_UID))
}
}
type CaseStatus int

View File

@ -6,7 +6,8 @@ Volcanos(chat.ONIMPORT, {
can.onimport.titleAction(can, value),
]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.OUTPUT, list: [value.plan_title]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
value.plan_title && {view: html.STATUS, list: ["计划:", value.plan_title]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -62,6 +62,14 @@ func (s Table) ChangeStatus(m *ice.Message, from, to int, arg ...string) {
s.Table.ChangeStatus(m, m.Option(model.STORY_UID), m.Option(model.UID), from, to, arg...)
s.DashboardUpdate(m)
}
func (s Table) planCount(m *ice.Message, key, value string) {
if m.IsErr() {
return
}
if m.Option(model.PLAN_UID) != "" {
m.Cmd(plan{}, s.AddCount, key, value, m.Option(model.PLAN_UID))
}
}
type Tables struct{ Table }

View File

@ -11,24 +11,33 @@ type issue struct {
Table
task task
order string `data:"2"`
fields string `data:"title,content,issue_type,level,issue_status,plan_uid,user_uid"`
create string `name:"create title* content* issue_type*:select level*:select" role:"leader,worker"`
fields string `data:"title,content,issue_type,level,issue_status,process_time,finish_time,task_count,plan_uid,user_uid"`
create string `name:"create title* content* issue_type:select level:select" role:"leader,worker"`
modify string `name:"modify title* content* issue_type*:select level*:select" role:"leader,worker"`
remove string `name:"remove" role:"leader,worker"`
reject string `name:"reject" role:"leader"`
approve string `name:"approve" role:"leader"`
process string `name:"process" role:"leader,worker"`
finish string `name:"finish" role:"leader,worker"`
planBind string `name:"planBind plan_uid*" role:"leader"`
taskCreate string `name:"taskCreate title* content* begin_time*:select@date end_time*:select@date" role:"leader,worker"`
taskCreate string `name:"taskCreate title* content* begin_time:select@date end_time:select@date" role:"leader,worker"`
}
func (s issue) Create(m *ice.Message, arg ...string) {
s.ValueCreate(m, arg...)
s.GetCommandUID(m)
s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.ISSUE_TYPE, IssueFeature, model.LEVEL, Level3)...)...)
s.SendMessage(m, "", "")
s.DashboardUpdate(m)
s.planCount(m, "1")
}
func (s issue) Remove(m *ice.Message, arg ...string) {
s.ValueRemove(m, arg...)
s.DashboardUpdate(m)
s.planCount(m, "-1")
}
func (s issue) Modify(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
}
func (s issue) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...); s.DashboardUpdate(m) }
func (s issue) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s issue) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
@ -39,6 +48,8 @@ func (s issue) List(m *ice.Message, arg ...string) {
if value[model.PLAN_UID] == "" {
button = append(button, s.PlanBind)
}
button = append(button, s.Process)
case IssueProcess:
button = append(button, s.TaskCreate, s.Finish)
case IssueFinish:
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
@ -48,19 +59,38 @@ func (s issue) List(m *ice.Message, arg ...string) {
s.SelectJoinPlan(m)
s.SelectJoinUser(m)
}
func (s issue) Reject(m *ice.Message, arg ...string) { s.changeStatus(m, IssueCreate, IssueRejected) }
func (s issue) Approve(m *ice.Message, arg ...string) { s.changeStatus(m, IssueCreate, IssueApproved) }
func (s issue) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, IssueApproved, IssueFinish) }
func (s issue) PlanBind(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s issue) Reject(m *ice.Message, arg ...string) {
s.changeStatus(m, IssueCreate, IssueRejected)
}
func (s issue) Approve(m *ice.Message, arg ...string) {
s.changeStatus(m, IssueCreate, IssueApproved)
}
func (s issue) Process(m *ice.Message, arg ...string) {
s.changeStatus(m, IssueApproved, IssueProcess)
}
func (s issue) Finish(m *ice.Message, arg ...string) {
count := m.Cmd(s.task, s.Select, "issue_uid = ? AND status != ?", m.Option(model.UID), TaskFinish).Length()
if m.WarnNotValid(count > 0, kit.Format("还有%v个未完成的任务", count)) {
return
}
s.changeStatus(m, IssueProcess, IssueFinish)
s.DashboardUpdate(m)
}
func (s issue) PlanBind(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
s.planCount(m, "1")
}
func (s issue) TaskCreate(m *ice.Message, arg ...string) {
m.Cmd(s.task, s.Create, arg, model.ISSUE_UID, m.Option(model.UID), m.OptionSimple(model.PLAN_UID))
}
func init() { ice.TeamCtxCmd(issue{}) }
func (s issue) changeStatus(m *ice.Message, from, to IssueStatus, arg ...string) {
s.ChangeStatus(m, int(from), int(to))
s.DashboardUpdate(m)
func (s issue) changeStatus(m *ice.Message, from, to IssueStatus) {
s.ChangeStatus(m, int(from), int(to), m.ActionKey()+"_time", m.Time())
}
func (s issue) planCount(m *ice.Message, value string) {
s.Table.planCount(m, model.ISSUE_COUNT, value)
}
type IssueType int

View File

@ -8,7 +8,8 @@ Volcanos(chat.ONIMPORT, {
can.onimport.titleAction(can, value),
]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.OUTPUT, list: [value.plan_title]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
value.plan_title && {view: html.STATUS, list: ["计划:", value.plan_title, "任务:", value.task_count+" 个"]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -18,6 +18,9 @@ const (
STORY_TYPE = "story_type"
PLAN_UID = "plan_uid"
PLAN_STATUS = "plan_status"
ISSUE_COUNT = "issue_count"
TASK_COUNT = "task_count"
CASE_COUNT = "case_count"
ISSUE_UID = "issue_uid"
ISSUE_TYPE = "issue_type"
ISSUE_STATUS = "issue_status"
@ -27,6 +30,8 @@ const (
COMPANY_UID = "company_uid"
CITY_UID = "city_uid"
MARKET_UID = "market_uid"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
)
type UserStory struct {
@ -37,34 +42,45 @@ type Story struct {
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
}
type Plan struct {
db.ModelContent
StoryUID string `gorm:"type:char(32);index"`
Status uint8 `gorm:"default:0"`
BeginTime db.Time
EndTime db.Time
ProcessTime db.Time
FinishTime db.Time
IssueCount int `gorm:"default:0"`
TaskCount int `gorm:"default:0"`
CaseCount int `gorm:"default:0"`
}
type Issue struct {
Common
TaskCount int `gorm:"default:0"`
RejectTime db.Time
ApproveTime db.Time
}
type Task struct {
Common
IssueUID string `gorm:"type:char(32);index"`
BeginTime db.Time
EndTime db.Time
CaseCount int `gorm:"default:0"`
}
type Case struct {
Common
TaskUID string `gorm:"type:char(32);index"`
}
type Plan struct {
db.ModelContent
StoryUID string `gorm:"type:char(32);index"`
Status uint8 `gorm:"default:0"`
BeginTime db.Time
EndTime db.Time
}
func init() { db.CmdModels("", &UserStory{}, &Story{}, &Plan{}, &Issue{}, &Task{}, &Case{}) }
type Common struct {
db.ModelContent
StoryUID string `gorm:"type:char(32);index:idx_story"`
PlanUID string `gorm:"type:char(32);index:idx_story"`
Type uint8 `gorm:"default:0"`
Level uint8 `gorm:"default:0"`
Status uint8 `gorm:"default:0"`
StoryUID string `gorm:"type:char(32);index:idx_story"`
PlanUID string `gorm:"type:char(32);index:idx_story"`
Type uint8 `gorm:"default:0"`
Level uint8 `gorm:"default:2"`
Status uint8 `gorm:"default:0"`
ProcessTime db.Time
FinishTime db.Time
}

View File

@ -11,16 +11,19 @@ type plan struct {
Table
issue issue
order string `data:"1"`
fields string `data:"title,content,plan_status,begin_time,end_time"`
create string `name:"create title* content* begin_time*:select@date end_time*:select@date" role:"leader"`
fields string `data:"title,content,plan_status,begin_time,end_time,process_time,finish_time,issue_count,task_count,case_count"`
create string `name:"create title* content* begin_time:select@date end_time:select@date" role:"leader"`
modify string `name:"modify title* content* begin_time*:select@date end_time*:select@date" role:"leader"`
remove string `name:"remove" role:"leader"`
process string `name:"process" role:"leader"`
finish string `name:"finish" role:"leader"`
issueCreate string `name:"issueCreate issue_title* issue_content* issue_type*:select level*:select" role:"leader,worker"`
issueCreate string `name:"issueCreate title* content* issue_type:select level:select" role:"leader,worker"`
}
func (s plan) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
func (s plan) Create(m *ice.Message, arg ...string) {
s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("720h"))...)...)
s.SendMessage(m, "", "")
}
func (s plan) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s plan) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s plan) List(m *ice.Message, arg ...string) {
@ -30,25 +33,30 @@ func (s plan) List(m *ice.Message, arg ...string) {
case PlanCreate:
button = append(button, s.Modify, s.Process)
case PlanProcess:
button = append(button, s.IssueCreate, s.Modify, s.Finish)
default:
if m.Option(model.MARKET_UID) == "" {
button = append(button, s.MarketInsert)
}
button = append(button, s.IssueCreate, s.Finish)
case PlanFinish:
kit.If(m.Option(model.MARKET_UID) == "", func() { button = append(button, s.MarketInsert) })
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
}
m.PushButton(button...)
}).Display("")
}
func (s plan) Process(m *ice.Message, arg ...string) { s.changeStatus(m, PlanCreate, PlanProcess) }
func (s plan) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, PlanProcess, PlanFinish) }
func (s plan) Finish(m *ice.Message, arg ...string) {
count := m.Cmd(s.issue, s.Select, "plan_uid = ? AND status != ?", m.Option(model.UID), IssueFinish).Length()
if m.WarnNotValid(count > 0, kit.Format("还有%v个未完成的需求", count)) {
return
}
s.changeStatus(m, PlanProcess, PlanFinish)
}
func (s plan) IssueCreate(m *ice.Message, arg ...string) {
m.Cmd(s.issue, s.Create, arg, model.PLAN_UID, m.Option(model.UID))
}
func init() { ice.TeamCtxCmd(plan{}) }
func (s plan) changeStatus(m *ice.Message, from, to PlanStatus, arg ...string) {
s.ChangeStatus(m, int(from), int(to))
func (s plan) changeStatus(m *ice.Message, from, to PlanStatus) {
s.ChangeStatus(m, int(from), int(to), m.ActionKey()+"_time", m.Time())
}
type PlanStatus int

View File

@ -6,6 +6,8 @@ Volcanos(chat.ONIMPORT, {
can.onimport.titleAction(can, value)
]},
{view: html.STATUS, list: [value.begin_time.split(" ")[0], "~", value.end_time.split(" ")[0]]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
{view: html.STATUS, list: ["需求:", value.issue_count+" 个", "任务:", value.task_count+" 个", "用例:", value.case_count+" 个"]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -34,6 +34,10 @@
"issue_status": "需求状态",
"task_status": "任务状态",
"case_status": "用例状态",
"case_count": "用例数量",
"issue_count": "需求数量",
"task_count": "任务数量",
"process_time": "开始时间",
"level": "优先级"
},
"value": {
@ -68,7 +72,7 @@
"issue_status": {
"create": "待评审",
"rejected": "已驳回",
"approved": "已通过",
"approved": "待开发",
"process": "开发中",
"finish": "已完成",
"style": {
@ -81,8 +85,8 @@
"finish": "已完成"
},
"case_status": {
"create": "待开发",
"process": "开发中",
"create": "待测试",
"process": "测试中",
"finish": "已完成"
},
"level": {

View File

@ -11,8 +11,8 @@ type task struct {
Table
Case Case
order string `data:"3"`
fields string `data:"title,content,begin_time,end_time,task_status,issue_uid,plan_uid,user_uid"`
create string `name:"create title* content* begin_time*:select@date end_time*:select@date" role:"leader,worker"`
fields string `data:"title,content,task_status,begin_time,end_time,process_time,finish_time,case_count,issue_uid,plan_uid,user_uid"`
create string `name:"create title* content* begin_time:select@date end_time:select@date" role:"leader,worker"`
modify string `name:"modify title* content* begin_time*:select@date end_time*:select@date" role:"leader,worker"`
remove string `name:"remove" role:"leader,worker"`
process string `name:"process" role:"leader,worker"`
@ -22,12 +22,22 @@ type task struct {
}
func (s task) Create(m *ice.Message, arg ...string) {
s.ValueCreate(m, arg...)
s.GetCommandUID(m)
s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("72h"))...)...)
s.SendMessage(m, "", "")
s.DashboardUpdate(m)
s.issueCount(m, "1")
s.planCount(m, "1")
}
func (s task) Remove(m *ice.Message, arg ...string) {
s.ValueRemove(m, arg...)
s.DashboardUpdate(m)
s.issueCount(m, "-1")
s.planCount(m, "-1")
}
func (s task) Modify(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
}
func (s task) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...); s.DashboardUpdate(m) }
func (s task) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s task) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
@ -38,8 +48,7 @@ func (s task) List(m *ice.Message, arg ...string) {
}
button = append(button, s.Process)
case TaskProcess:
button = append(button, s.CaseCreate)
button = append(button, s.Finish)
button = append(button, s.CaseCreate, s.Finish)
case TaskFinish:
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
}
@ -48,18 +57,40 @@ func (s task) List(m *ice.Message, arg ...string) {
s.SelectJoinPlan(m)
s.SelectJoinUser(m)
}
func (s task) Process(m *ice.Message, arg ...string) { s.changeStatus(m, TaskCreate, TaskProcess) }
func (s task) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, TaskProcess, TaskFinish) }
func (s task) PlanBind(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s task) Process(m *ice.Message, arg ...string) {
s.changeStatus(m, TaskCreate, TaskProcess)
}
func (s task) Finish(m *ice.Message, arg ...string) {
count := m.Cmd(s.Case, s.Select, "task_uid = ? AND status != ?", m.Option(model.UID), CaseFinish).Length()
if m.WarnNotValid(count > 0, kit.Format("还有%v个未完成的用例", count)) {
return
}
s.changeStatus(m, TaskProcess, TaskFinish)
s.DashboardUpdate(m)
}
func (s task) PlanBind(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
s.DashboardUpdate(m)
}
func (s task) CaseCreate(m *ice.Message, arg ...string) {
m.Cmd(s.Case, s.Create, arg, model.TASK_UID, m.Option(model.UID), m.OptionSimple(model.PLAN_UID))
}
func init() { ice.TeamCtxCmd(task{}) }
func (s task) changeStatus(m *ice.Message, from, to TaskStatus, arg ...string) {
s.ChangeStatus(m, int(from), int(to))
s.DashboardUpdate(m)
func (s task) changeStatus(m *ice.Message, from, to TaskStatus) {
s.ChangeStatus(m, int(from), int(to), m.ActionKey()+"_time", m.Time())
}
func (s task) planCount(m *ice.Message, value string) {
s.Table.planCount(m, model.TASK_COUNT, value)
}
func (s task) issueCount(m *ice.Message, value string) {
if m.IsErr() {
return
}
if m.Option(model.ISSUE_UID) != "" {
m.Cmd(issue{}, s.AddCount, model.TASK_COUNT, value, m.Option(model.ISSUE_UID))
}
}
type TaskStatus int

View File

@ -6,7 +6,8 @@ Volcanos(chat.ONIMPORT, {
can.onimport.titleAction(can, value),
]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.OUTPUT, list: [value.plan_title]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
value.plan_title && {view: html.STATUS, list: ["计划:", value.plan_title, "用例:", value.case_count+" 个"]},
{view: html.OUTPUT, list: [value.content]},
] })
},