mirror of
https://shylinux.com/x/operation
synced 2025-07-03 14:01:20 +08:00
147 lines
4.8 KiB
Go
147 lines
4.8 KiB
Go
package production
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/operation/src/production/model"
|
|
)
|
|
|
|
type Issue struct {
|
|
Table
|
|
order string `data:"2"`
|
|
portal string `data:"true"`
|
|
fields string `data:"updated_at,title,issue_content,issue_type,level,status,price,score,link,design_count AS design_count,task_count AS task_count,begin_time,end_time,process_time,finish_time,plan_uid,story_uid,user_uid"`
|
|
create string `name:"create plan_uid*:select title* issue_content* price=1000 begin_time:select@date end_time:select@date" role:"worker"`
|
|
modify string `name:"modify title* issue_content* price*" role:"worker"`
|
|
designCreate string `name:"designCreate title* design_content* price=1000 begin_time:select@date end_time:select@date" role:"worker"`
|
|
taskCreate string `name:"taskCreate title* content* space:select path:select begin_time:select@date end_time:select@date" role:"leader"`
|
|
bindPlan string `name:"bindPlan plan_uid*:select"`
|
|
}
|
|
|
|
func (s Issue) Create(m *ice.Message, arg ...string) {
|
|
s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.ISSUE_TYPE, IssueFeature, model.LEVEL, Level3,
|
|
model.PRICE, "1000", model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("72h"))...)...)
|
|
msg := m.Cmd(Plan{}, s.Select, model.UID, m.Option(model.PLAN_UID))
|
|
s.SendTemplate(m.Options(model.UID, m.Result()), "", msg.Append(model.USER_UID), "")
|
|
s.SendMessage(s.GetCommandUID(m), "", "")
|
|
s.planCount(m).DashboardUpdate(m)
|
|
}
|
|
func (s Issue) Remove(m *ice.Message, arg ...string) {
|
|
s.ValueRemove(m, arg...)
|
|
s.planCount(m).DashboardUpdate(m)
|
|
}
|
|
func (s Issue) Reject(m *ice.Message, arg ...string) {
|
|
s.changeStatus(m, IssueCreate, IssueRejected)
|
|
s.planCount(m).DashboardUpdate(m)
|
|
s.sendTemplate(m, "", "", "")
|
|
}
|
|
func (s Issue) Cancel(m *ice.Message, arg ...string) {
|
|
s.ChangeStatus(m, int(IssueProcess), int(IssueCancel))
|
|
s.planCount(m).DashboardUpdate(m)
|
|
s.sendTemplate(m, "", "", "")
|
|
}
|
|
func (s Issue) Submit(m *ice.Message, arg ...string) {
|
|
s.ChangeStatus(m, int(IssueProcess), int(IssueSubmit), arg...)
|
|
msg := m.Cmd(Plan{}, s.Select, model.UID, m.Option(model.PLAN_UID))
|
|
s.SendTemplate(m, "", msg.Append(model.USER_UID), "")
|
|
}
|
|
func (s Table) BindPlan(m *ice.Message, arg ...string) {
|
|
s.Update(m, arg, m.OptionSimple(model.UID, model.STORY_UID)...)
|
|
}
|
|
func (s Issue) List(m *ice.Message, arg ...string) {
|
|
if !s.IsWorker(m) {
|
|
s.ApplyCheck(m, arg...)
|
|
return
|
|
}
|
|
isCreator, isWorker := s.IsCreator(m), s.IsWorker(m)
|
|
defer kit.If(!s.IsLeader(m), func() { m.Action() })
|
|
msg := m.Cmd(Design{}, s.Select, model.STORY_UID, arg[0], m.OptionSimple(model.USER_UID), model.STATUS, IssueCreate)
|
|
// s.Orders(m, model.STATUS, model.DESIGN_COUNT, model.TASK_COUNT, s.Desc(model.UPDATED_AT)).Limit(m, 300)
|
|
s.Orders(m, model.STATUS, model.DESIGN_COUNT, s.Desc(model.UPDATED_AT)).Limit(m, 300)
|
|
s.ValueList(m, arg)
|
|
s.SelectJoinPlan(m)
|
|
s.SettingSelect(m)
|
|
m.Table(func(value ice.Maps) {
|
|
button := []ice.Any{}
|
|
if isWorker && kit.Int(value[model.DESIGN_COUNT]) == 0 {
|
|
if PlanStatus(kit.Int(value[model.PLAN_STATUS])) != PlanFinish && msg.Length() < 2 {
|
|
button = append(button, s.DesignCreate)
|
|
}
|
|
}
|
|
if isCreator {
|
|
button = append(button, s.TaskCreate)
|
|
}
|
|
s.PushIssueButton(m, value, button...)
|
|
}).Display("").DisplayCSS("")
|
|
kit.If(len(arg) == 1, func() {
|
|
// m.Sort("plan_status,status,design_count,task_count,updated_at", ice.STR, ice.STR, ice.STR, ice.STR, ice.STR_R)
|
|
m.Sort("plan_status,status,design_count,updated_at", ice.STR, ice.STR, ice.STR, ice.STR_R)
|
|
})
|
|
s.OtherListCmd(m, s.PlanList, s.DesignList, s.TaskList, s.CaseList, s.NoteList, s.FileList, s.MeetList, s.DealList)
|
|
}
|
|
func (s Issue) DesignCreate(m *ice.Message, arg ...string) { s.commonOtherCreate(m, Design{}, arg...) }
|
|
func (s Issue) TaskCreate(m *ice.Message, arg ...string) { s.commonOtherCreate(m, Task{}, arg...) }
|
|
|
|
func init() { ice.TeamCtxCmd(Issue{}) }
|
|
|
|
type IssueType int
|
|
|
|
const (
|
|
IssueFeature IssueType = iota
|
|
IssueBugfix
|
|
)
|
|
|
|
var IssueTypeList = map[IssueType]string{
|
|
IssueFeature: "feature",
|
|
IssueBugfix: "bugfix",
|
|
}
|
|
|
|
func (s IssueType) String() string { return IssueTypeList[s] }
|
|
|
|
type Level int
|
|
|
|
const (
|
|
Level1 Level = iota
|
|
Level2
|
|
Level3
|
|
Level4
|
|
Level5
|
|
)
|
|
|
|
var LevelList = map[Level]string{
|
|
Level1: "level-1",
|
|
Level2: "level-2",
|
|
Level3: "level-3",
|
|
Level4: "level-4",
|
|
Level5: "level-5",
|
|
}
|
|
|
|
func (s Level) String() string { return LevelList[s] }
|
|
|
|
type IssueStatus int
|
|
|
|
const (
|
|
IssueCreate IssueStatus = iota
|
|
IssueRejected
|
|
IssueApproved
|
|
IssueProcess
|
|
IssueSubmit
|
|
IssueReback
|
|
IssueFinish
|
|
IssueCancel
|
|
)
|
|
|
|
var IssueStatusList = map[IssueStatus]string{
|
|
IssueCreate: "create",
|
|
IssueRejected: "rejected",
|
|
IssueApproved: "approved",
|
|
IssueProcess: "process",
|
|
IssueSubmit: "submit",
|
|
IssueReback: "reback",
|
|
IssueFinish: "finish",
|
|
IssueCancel: "cancel",
|
|
}
|
|
|
|
func (s IssueStatus) String() string { return IssueStatusList[s] }
|