2025-05-02 01:36:35 +08:00

50 lines
1.7 KiB
Go

package production
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/operation/src/production/model"
)
type Case struct {
Table
order string `data:"5"`
fields string `data:"title,content,status,space,index,begin_time,end_time,process_time,finish_time,task_uid,plan_uid,user_uid"`
create string `name:"create task_uid* title* content* space index begin_time:select@date end_time:select@date" role:"worker"`
modify string `name:"modify title* content* space index begin_time*:select@date end_time*:select@date" role:"worker"`
finish string `name:"finish" role:"worker"`
}
func (s Case) Create(m *ice.Message, arg ...string) {
s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("72h"))...)...)
s.SendMessage(s.GetCommandUID(m), "", "")
s.taskCount(m)
}
func (s Case) Remove(m *ice.Message, arg ...string) {
s.ValueRemove(m, arg...)
s.taskCount(m)
}
func (s Case) List(m *ice.Message, arg ...string) {
user_uid := m.Option(model.USER_UID)
s.Orders(m, model.STATUS, s.Desc(model.CREATED_AT))
s.ValueList(m, arg)
s.SelectJoinPlan(m)
s.StatusCount(m, arg...)
m.Table(func(value ice.Maps) { s.PushTaskButton(m, value, user_uid, s.Preview) }).Display("")
m.RenameAppend(model.STATUS, model.CASE_STATUS)
}
func (s Case) Preview(m *ice.Message, arg ...string) {
m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX)))
}
func (s Case) Process(m *ice.Message, arg ...string) {
s.changeStatus(m, IssueCreate, IssueProcess)
}
func (s Case) Finish(m *ice.Message, arg ...string) {
s.changeStatus(m, IssueProcess, IssueFinish)
}
func init() { ice.TeamCtxCmd(Case{}) }