mirror of
https://shylinux.com/x/operation
synced 2025-07-01 21:21:19 +08:00
135 lines
3.9 KiB
Go
135 lines
3.9 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"`
|
|
fields string `data:"title,content,issue_type,level,status,price,link,design_count,task_count,begin_time,end_time,process_time,finish_time,plan_uid,user_uid"`
|
|
create string `name:"create plan_uid* title* content* issue_type:select level:select price=1000 begin_time:select@date end_time:select@date" role:"worker"`
|
|
modify string `name:"modify title* content* price* link begin_time:select@date end_time:select@date" role:"worker"`
|
|
designCreate string `name:"designCreate title* content* price=1000 begin_time:select@date end_time:select@date" role:"worker"`
|
|
taskCreate string `name:"taskCreate title* content* space path begin_time:select@date end_time:select@date" role:"worker"`
|
|
}
|
|
|
|
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"))...)...)
|
|
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)
|
|
}
|
|
func (s Issue) Cancel(m *ice.Message, arg ...string) {
|
|
s.ChangeStatus(m, int(IssueSubmit), int(IssueCancel))
|
|
s.planCount(m).DashboardUpdate(m)
|
|
}
|
|
func (s Issue) List(m *ice.Message, arg ...string) {
|
|
if !s.IsWorker(m) {
|
|
s.ApplyCheck(m, arg...)
|
|
return
|
|
}
|
|
user_uid, isCreator, isWorker := m.Option(model.USER_UID), s.IsCreator(m), s.IsWorker(m)
|
|
s.Orders(m, model.STATUS, model.DESIGN_COUNT, model.TASK_COUNT, s.Desc(model.CREATED_AT))
|
|
s.ValueList(m, arg)
|
|
s.SelectJoinPlan(m)
|
|
s.StatusCount(m, arg...)
|
|
m.Table(func(value ice.Maps) {
|
|
button := []ice.Any{}
|
|
if PlanStatus(kit.Int(value[model.PLAN_STATUS])) != PlanFinish {
|
|
if isWorker && kit.Int(value[model.DESIGN_COUNT]) == 0 {
|
|
button = append(button, s.DesignCreate)
|
|
}
|
|
}
|
|
if isCreator {
|
|
button = append(button, s.TaskCreate)
|
|
}
|
|
s.PushIssueButton(m, value, user_uid, button...)
|
|
}).Display("").Option("otherList", "designList,taskList,caseList,meetList,dealList")
|
|
kit.If(len(arg) == 1, func() { m.Sort("plan_status,status,design_count,task_count,created_at") })
|
|
}
|
|
func (s Issue) Finish(m *ice.Message, arg ...string) {
|
|
if s.finishCheck(m, Design{}, "设计") {
|
|
return
|
|
}
|
|
if s.finishCheck(m, Task{}, "任务") {
|
|
return
|
|
}
|
|
s.changeStatus(m, IssueSubmit, IssueFinish)
|
|
}
|
|
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] }
|