From 532cb23440d7aad3137cdc8b63879b16e507c439 Mon Sep 17 00:00:00 2001 From: shy Date: Mon, 9 Jun 2025 12:23:01 +0800 Subject: [PATCH] add some --- src/production/common.go | 35 ++++++++++++++++++++++++++++++++++- src/production/design.go | 11 ++++++++++- src/production/issue.go | 11 ++++++++++- src/production/meet.go | 1 + src/production/model/model.go | 11 ++++++++++- src/production/note.go | 22 ++++++++++++++++++++++ src/production/note.js | 8 ++++++++ src/production/plan.go | 6 ++++-- src/production/portal.json | 9 ++++++--- 9 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 src/production/note.go create mode 100644 src/production/note.js diff --git a/src/production/common.go b/src/production/common.go index ccc7138..1ea56c5 100644 --- a/src/production/common.go +++ b/src/production/common.go @@ -31,6 +31,7 @@ type Table struct { preview string `name:"preview" role:"worker"` program string `name:"program" role:"worker"` discuss string `name:"discuss meet_type* title* content meet_link* date* time*" role:"leader"` + addNote string `name:"addNote title content to_user_uid:select" help:"备注" role:"worker"` setScore string `name:"setScore score" help:"评分" role:"leader"` payfor string `name:"payfor price* title* content" role:"leader"` upload string `name:"upload" role:"worker"` @@ -42,6 +43,7 @@ type Table struct { designList string `name:"designList" role:"worker"` taskList string `name:"taskList" role:"worker"` caseList string `name:"caseList" role:"worker"` + noteList string `name:"noteList" role:"worker"` fileList string `name:"fileList" role:"worker"` meetList string `name:"meetList" role:"worker"` dealList string `name:"dealList" role:"worker"` @@ -69,6 +71,8 @@ func (s Table) Inputs(m *ice.Message, arg ...string) { s.InputsList(m, FileTypeList, arg...) case model.LEVEL: s.InputsList(m, LevelList, arg...) + case model.VERSION: + m.Push(arg[0], "v1", "v2", "v3", "v4", "v5") case nfs.PATH: m.Option(ice.MSG_USERROLE, aaa.TECH) m.Cmdy(web.SPACE, m.Option(web.SPACE), nfs.DIR, nfs.SRC, nfs.PATH) @@ -144,6 +148,9 @@ func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, arg ...ice.Any) { if isLeader { button = append(button, s.DateInsert) } + if isWorker { + button = append(button, s.AddNote) + } if isLeaderApproved { button = append(button, s.Approve) } @@ -175,6 +182,9 @@ func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, arg ...ice.Any) { if isWorker && value[model.LINK] != "" { button = append(button, s.Preview) } + if isWorker { + button = append(button, s.AddNote) + } if isWorker { button = append(button, s.FileCreate) } @@ -191,7 +201,7 @@ func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, arg ...ice.Any) { if isWorker && value[model.LINK] != "" { button = append(button, s.Preview) } - if isWorker && PlanStatus(kit.Int(value[model.PLAN_STATUS])) != PlanFinish { + if value[model.USER_UID] == m.Option(ice.MSG_USERUID) && PlanStatus(kit.Int(value[model.PLAN_STATUS])) != PlanFinish { button = append(button, s.FileCreate) } else if isLeader { button = append(button, s.FileCreate) @@ -271,9 +281,11 @@ func (s care) UserInfo(m *ice.Message, arg ...string) { } func (s Table) Reject(m *ice.Message, arg ...string) { s.changeStatus(m, IssueCreate, IssueRejected) + s.sendTemplate(m, "", "", "") } func (s Table) Approve(m *ice.Message, arg ...string) { s.changeStatus(m, IssueCreate, IssueApproved) + s.sendTemplate(m, "", "", "", arg...) } func (s Table) Process(m *ice.Message, arg ...string) { s.changeStatus(m, IssueApproved, IssueProcess) @@ -283,12 +295,19 @@ func (s Table) Submit(m *ice.Message, arg ...string) { } func (s Table) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, IssueSubmit, IssueFinish) + s.sendTemplate(m, "", "", "") } func (s Table) Reback(m *ice.Message, arg ...string) { s.ChangeStatus(m, int(IssueSubmit), int(IssueProcess)) + s.sendTemplate(m, "", "", "") +} +func (s Table) sendTemplate(m *ice.Message, from, to, title string, arg ...string) { + msg := s.Select(m.Spawn(), m.OptionSimple(model.UID)...) + s.SendTemplate(m, from, msg.Append(model.USER_UID), title, arg...) } func (s Table) Cancel(m *ice.Message, arg ...string) { s.ChangeStatus(m, int(IssueProcess), int(IssueCancel)) + s.sendTemplate(m, "", "", "") } func (s Table) Trash(m *ice.Message, arg ...string) { s.Delete(m, m.OptionSimple(model.UID, model.STORY_UID)...) @@ -313,6 +332,15 @@ func (s Table) Discuss(m *ice.Message, arg ...string) { func (s Issue) Discuss(m *ice.Message, arg ...string) { s.commonOtherCreate(m, Meet{}, arg...) } +func (s Table) AddNote(m *ice.Message, arg ...string) { + m.Cmd(Note{}, s.Create, arg) +} +func (s Issue) AddNote(m *ice.Message, arg ...string) { + m.Cmd(Note{}, s.Create, arg, model.ISSUE_UID, m.Option(model.UID), m.OptionSimple(model.PLAN_UID)) +} +func (s Design) AddNote(m *ice.Message, arg ...string) { + m.Cmd(Note{}, s.Create, arg, m.OptionSimple(model.ISSUE_UID), m.OptionSimple(model.PLAN_UID)) +} func (s Table) SetScore(m *ice.Message, arg ...string) { s.Update(m, arg, m.OptionSimple(model.UID, model.STORY_UID)...) } @@ -328,6 +356,8 @@ func (s Table) Upload(m *ice.Message, arg ...string) { } func (s Table) FileCreate(m *ice.Message, arg ...string) { s.issueOtherCreate(m, File{}, arg...) + msg := m.Cmd(Plan{}, s.Select, model.UID, m.Option(model.PLAN_UID)) + s.sendTemplate(m, "", msg.Append(model.USER_UID), "") } func (s Issue) FileCreate(m *ice.Message, arg ...string) { s.commonOtherCreate(m, File{}, arg...) @@ -395,6 +425,9 @@ func (s Table) CaseList(m *ice.Message, arg ...string) { s.commonOtherList(m, Case{}).RenameAppend(model.STATUS, model.CASE_STATUS) m.PushAction(s.Preview) } +func (s Table) NoteList(m *ice.Message, arg ...string) { + s.commonOtherList(m, Note{}) +} func (s Table) FileList(m *ice.Message, arg ...string) { if s.commonOtherList(m, File{}); s.IsLeader(m) { m.PushAction(s.Download) diff --git a/src/production/design.go b/src/production/design.go index 3b39424..38f0143 100644 --- a/src/production/design.go +++ b/src/production/design.go @@ -18,6 +18,8 @@ type Design struct { func (s Design) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.PRICE, "1000", model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("72h"))...)...) + msg := m.Cmd(Issue{}, s.Select, model.UID, m.Option(model.ISSUE_UID)) + s.SendTemplate(m.Options(model.UID, m.Result()), "", msg.Append(model.USER_UID), "") s.SendMessage(s.GetCommandUID(m), "", "") s.issueCount(m) } @@ -28,10 +30,17 @@ func (s Design) Remove(m *ice.Message, arg ...string) { func (s Design) Reject(m *ice.Message, arg ...string) { s.changeStatus(m, IssueCreate, IssueRejected) s.issueCount(m) + s.sendTemplate(m, "", "", "") } func (s Design) Cancel(m *ice.Message, arg ...string) { s.ChangeStatus(m, int(IssueProcess), int(IssueCancel)) s.issueCount(m) + s.sendTemplate(m, "", "", "") +} +func (s Design) Submit(m *ice.Message, arg ...string) { + s.ChangeStatus(m, int(IssueProcess), int(IssueSubmit), arg...) + msg := m.Cmd(Issue{}, s.Select, model.UID, m.Option(model.ISSUE_UID)) + s.sendTemplate(m, "", msg.Append(model.USER_UID), "") } func (s Design) List(m *ice.Message, arg ...string) { s.Orders(m, model.STATUS, s.Desc(model.UPDATED_AT)).Limit(m, 300) @@ -39,7 +48,7 @@ func (s Design) List(m *ice.Message, arg ...string) { s.SelectJoinPlan(m) m.Table(func(value ice.Maps) { s.PushIssueButton(m, value) }).Display("") kit.If(len(arg) == 1, func() { m.Sort("plan_status,status,updated_at", ice.STR, ice.STR, ice.STR_R) }) - s.OtherListCmd(m, s.IssueList, s.FileList, s.MeetList, s.DealList) + s.OtherListCmd(m, s.IssueList, s.NoteList, s.FileList, s.MeetList, s.DealList) } func init() { ice.TeamCtxCmd(Design{}) } diff --git a/src/production/issue.go b/src/production/issue.go index 795e00c..566579f 100644 --- a/src/production/issue.go +++ b/src/production/issue.go @@ -22,6 +22,8 @@ type Issue struct { 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) } @@ -32,10 +34,17 @@ func (s Issue) Remove(m *ice.Message, arg ...string) { 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)...) @@ -65,7 +74,7 @@ func (s Issue) List(m *ice.Message, arg ...string) { 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) }) - s.OtherListCmd(m, s.PlanList, s.DesignList, s.TaskList, s.CaseList, s.FileList, s.MeetList, s.DealList) + 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...) } diff --git a/src/production/meet.go b/src/production/meet.go index fa6a4c4..79f376d 100644 --- a/src/production/meet.go +++ b/src/production/meet.go @@ -27,6 +27,7 @@ func (s Meet) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, m.OptionSimple("issue_uid,from_user_uid,to_user_uid,title,content,meet_type,meet_link,begin_time,end_time,plan_uid,company_uid")...) s.SendMessage(s.GetCommandUID(m), m.Option(model.FROM_USER_UID), m.Option(model.TO_USER_UID)) s.SendMessage(s.GetCommandUID(m), m.Option(model.TO_USER_UID), m.Option(model.FROM_USER_UID)) + s.SendTemplate(m, "", "", "") } func (s Meet) List(m *ice.Message, arg ...string) { if s.ValueList(m, arg).Display(""); s.IsLeader(m) { diff --git a/src/production/model/model.go b/src/production/model/model.go index cf46454..8a25fd7 100644 --- a/src/production/model/model.go +++ b/src/production/model/model.go @@ -141,9 +141,18 @@ type File struct { Type uint8 `gorm:"default:0"` Size int `gorm:"default:0"` } +type Note struct { + db.ModelContent + CompanyUID string `gorm:"type:char(32);index"` + StoryUID string `gorm:"type:char(32);index"` + PlanUID string `gorm:"type:char(32);index"` + IssueUID string `gorm:"type:char(32);index"` + FromUserUID string `gorm:"type:char(32);index"` + ToUserUID string `gorm:"type:char(32);index"` +} func init() { - db.CmdModels("", &UserStory{}, &Story{}, &Plan{}, &Issue{}, &Design{}, &Task{}, &Case{}, &Meet{}, &Deal{}, &File{}) + db.CmdModels("", &UserStory{}, &Story{}, &Plan{}, &Issue{}, &Design{}, &Task{}, &Case{}, &Meet{}, &Deal{}, &File{}, &Note{}) } type Common struct { diff --git a/src/production/note.go b/src/production/note.go new file mode 100644 index 0000000..a1ad5dd --- /dev/null +++ b/src/production/note.go @@ -0,0 +1,22 @@ +package production + +import "shylinux.com/x/ice" + +type Note struct { + Table + fields string `data:"title,content,issue_uid,plan_uid,user_uid"` + create string `name:"create title content to_user_uid" role:"worker"` + remove string `name:"remove" role:"leader"` +} + +func (s Note) Create(m *ice.Message, arg ...string) { + s.ValueCreate(m, arg...) + s.SendTemplate(m, "", "", "") +} +func (s Note) List(m *ice.Message, arg ...string) { + s.ValueList(m, arg) + s.OtherListCmd(m, s.IssueList, s.DesignList) + // s.ValueList(m, arg).Display("") +} + +func init() { ice.TeamCtxCmd(Note{}) } diff --git a/src/production/note.js b/src/production/note.js new file mode 100644 index 0000000..731a375 --- /dev/null +++ b/src/production/note.js @@ -0,0 +1,8 @@ +Volcanos(chat.ONIMPORT, { + _init: function(can, msg) { + can.onimport.myView(can, msg, function(value) { return [ + {view: html.TITLE, list: [value.title||value.name||value.user_name, can.onimport.titleAction(can, value)]}, can.onimport.metaView(can, value), + {view: html.OUTPUT, list: [value.content||value.info]}, + ] }) + }, +}) \ No newline at end of file diff --git a/src/production/plan.go b/src/production/plan.go index fb54d21..143d273 100644 --- a/src/production/plan.go +++ b/src/production/plan.go @@ -11,8 +11,8 @@ type Plan struct { Table order string `data:"1"` fields string `data:"updated_at,title,content,version,plan_type,plan_status,issue_count,begin_time,end_time,process_time,finish_time,story_uid,user_uid"` - create string `name:"create title* content version begin_time:select@date end_time:select@date" role:"leader"` - modify string `name:"modify title* content version begin_time*:select@date end_time*:select@date" role:"leader"` + create string `name:"create title* content version:select begin_time:select@date end_time:select@date" role:"leader"` + modify string `name:"modify title* content version:select begin_time:select@date end_time:select@date" role:"leader"` remove string `name:"remove" role:"leader"` process string `name:"process" role:"leader"` setType string `name:"setType plan_type" role:"creator"` @@ -27,6 +27,8 @@ func (s Plan) Create(m *ice.Message, arg ...string) { } s.ValueCreate(m, arg...) }) + msg := m.Cmd(userStory{}, s.Select, m.OptionSimple(model.STORY_UID), model.ROLE, "1") + s.SendTemplate(m, "", msg.Append(model.USER_UID), "") s.SendMessage(m, "", "") } func (s Plan) List(m *ice.Message, arg ...string) { diff --git a/src/production/portal.json b/src/production/portal.json index 1496ebc..c12efb8 100644 --- a/src/production/portal.json +++ b/src/production/portal.json @@ -6,7 +6,10 @@ "issueCreate": "原型设计", "designCreate": "界面设计", "taskCreate": "开发任务", "caseCreate": "测试用例", "issueList": "原型设计", "designList": "界面设计", "taskList": "开发任务", "caseList": "测试用例", "program": "编程", "discuss": "约会", "payfor": "支付", "setType": "设置类型", "bindPlan": "绑定计划", - "planList": "迭代计划", "fileList": "附件列表", "meetList": "会议安排", "dealList": "支付记录", + "note": "备注", + "addNote": "备注", + "noteList": "备注列表", "fileList": "附件列表", "meetList": "会议安排", "dealList": "支付记录", + "planList": "迭代计划", "style": { "preview": "notice", "program": "notice", @@ -64,8 +67,8 @@ "file_link": "文件上传", "file_name": "文件名称", "file_size": "文件大小", - "from_user_uid": "付款人", - "to_user_uid": "收款人", + "from_user_uid": "发送人", + "to_user_uid": "接收人", "process_time": "开始时间", "finish_time": "完成时间", "date": "日期",