diff --git a/src/production/coder.go b/src/production/coder.go index d046682..6beaf55 100644 --- a/src/production/coder.go +++ b/src/production/coder.go @@ -29,14 +29,16 @@ func (s coder) cmd(m *ice.Message, arg ...string) { kit.If(s.check(m), func() { m.Cmdy(code.VIMER, m.ActionKey(), arg) }) } func (s coder) check(m *ice.Message, arg ...string) bool { + m.OptionDefault(model.USER_UID, m.Option(ice.MSG_USERUID)) s.SettingSelect(m.Options(model.PLACE_UID, m.Option(model.STORY_UID))) msg := m.Cmd(userStory{}, s.Select, m.OptionSimple(model.STORY_UID, model.USER_UID)) + m.Info("what %v", msg.FormatChain()) if s.SettingIsOn(m, CREATOR_PROGRAM) && msg.Append(model.ROLE) == "1" { return true } else if s.SettingIsOn(m, LEADER_PROGRAM) && msg.Append(model.ROLE) == "2" { return true } else { - m.WarnNotRight(true) + m.WarnNotRight(true, kit.Format("%v", msg.Append(model.ROLE))) return false } } diff --git a/src/production/common.go b/src/production/common.go index d4c266c..f466c37 100644 --- a/src/production/common.go +++ b/src/production/common.go @@ -2,6 +2,7 @@ package production import ( "path" + "strconv" "strings" "shylinux.com/x/ice" @@ -105,6 +106,9 @@ func (s Table) Inputs(m *ice.Message, arg ...string) { } func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { m.RewriteAppend(func(value, key string, index int) string { + if _, e := strconv.ParseInt(value, 10, 64); e != nil { + return value + } switch key { case model.USER_STORY_ROLE: value = UserStoryRole(kit.Int(value)).String() @@ -382,7 +386,9 @@ func (s Table) commonOtherList(m *ice.Message, target ice.Any, arg ...string) *i } else { s.OtherList(m, target, model.ISSUE_UID, m.Option(model.ISSUE_UID)) } - m.RenameAppend(model.TO_USER_UID, model.USER_UID) + if kit.IndexOf(m.Appendv(ice.MSG_APPEND), model.USER_UID) == -1 { + m.RenameAppend(model.TO_USER_UID, model.USER_UID) + } return m } func (s Table) otherListButton(m *ice.Message, arg ...string) { diff --git a/src/production/issue.go b/src/production/issue.go index 566579f..e9e103a 100644 --- a/src/production/issue.go +++ b/src/production/issue.go @@ -55,6 +55,7 @@ func (s Issue) List(m *ice.Message, arg ...string) { return } isCreator, isWorker := s.IsCreator(m), s.IsWorker(m) + 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.ValueList(m, arg) s.SelectJoinPlan(m) @@ -62,7 +63,7 @@ func (s Issue) List(m *ice.Message, arg ...string) { 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 { + if PlanStatus(kit.Int(value[model.PLAN_STATUS])) != PlanFinish && msg.Length() < 2 { button = append(button, s.DesignCreate) } } diff --git a/src/production/model/model.go b/src/production/model/model.go index 908e7cb..9285f00 100644 --- a/src/production/model/model.go +++ b/src/production/model/model.go @@ -15,6 +15,7 @@ const ( PRICE = "price" SCORE = "score" COUNT = "count" + AVATAR = "avatar" TITLE = "title" CONTENT = "content" VERSION = "version" diff --git a/src/production/note.go b/src/production/note.go index af54b33..15881a2 100644 --- a/src/production/note.go +++ b/src/production/note.go @@ -1,10 +1,12 @@ package production -import "shylinux.com/x/ice" +import ( + "shylinux.com/x/ice" +) type Note struct { Table - fields string `data:"title,content,issue_uid,plan_uid,user_uid"` + fields string `data:"to_user_uid,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"` } diff --git a/src/production/note.js b/src/production/note.js index 731a375..b91cd52 100644 --- a/src/production/note.js +++ b/src/production/note.js @@ -3,6 +3,7 @@ Volcanos(chat.ONIMPORT, { 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]}, + // {view: html.STATUS, list: [{img: value.to_user_avatar}, value.to_user_name]}, ] }) }, }) \ No newline at end of file diff --git a/src/production/plan.go b/src/production/plan.go index 43a3705..3c17a6b 100644 --- a/src/production/plan.go +++ b/src/production/plan.go @@ -39,6 +39,9 @@ func (s Plan) List(m *ice.Message, arg ...string) { m.SetResult("请等待「管理员」创建迭代计划") } }) + s.SettingSelect(m) + issue_max_create := kit.Int(m.Option(ISSUE_MAX_CREATE)) + msg := m.Cmd(Issue{}, s.Select, model.STORY_UID, arg[0], m.OptionSimple(model.USER_UID), model.STATUS, IssueCreate) s.Orders(m, model.STATUS, model.ISSUE_COUNT, s.Desc(model.UPDATED_AT)).Limit(m, 300) s.ValueList(m, arg).Table(func(value ice.Maps) { button := []ice.Any{} @@ -49,7 +52,7 @@ func (s Plan) List(m *ice.Message, arg ...string) { button = append(button, s.Process, s.Handover, s.Modify, s.Remove) } case PlanProcess: - if isWorker && kit.Int(value[model.ISSUE_COUNT]) == 0 { + if isWorker && kit.Int(value[model.ISSUE_COUNT]) == 0 && msg.Length() < issue_max_create { button = append(button, s.IssueCreate) } if isLeader && m.Option(model.MARKET_UID) == "" { diff --git a/src/production/portal.go b/src/production/portal.go index 7878b08..c4db471 100644 --- a/src/production/portal.go +++ b/src/production/portal.go @@ -16,11 +16,13 @@ type Portal struct { func (s Plan) AfterMigrate(m *ice.Message, arg ...string) { s.Table.AfterMigrate(m, arg...) - s.SettingCreate(m, LEADER_APPROVED, "", "允许管理人员审批项目", api.CREATOR, "100") - s.SettingCreate(m, LEADER_FINISH, "", "允许管理人员验收项目", api.CREATOR, "101") - s.SettingCreate(m, LEADER_PAYFOR, "", "允许管理人员支付项目", api.CREATOR, "102") - s.SettingCreate(m, LEADER_PROGRAM, "", "允许管理人员本地开发", api.TECH, "103") - s.SettingCreate(m, CREATOR_PROGRAM, "", "允许创建人本地开发", api.TECH, "104") + s.SettingCreate(m, "auth", "title", "项目权限", "", "999") + s.SettingCreate(m, LEADER_APPROVED, "", "允许管理人员审批项目", api.CREATOR, "1000") + s.SettingCreate(m, LEADER_FINISH, "", "允许管理人员验收项目", api.CREATOR, "1001") + s.SettingCreate(m, LEADER_PAYFOR, "", "允许管理人员支付项目", api.CREATOR, "1002") + s.SettingCreate(m, LEADER_PROGRAM, "", "允许管理人员本地开发", api.TECH, "1003") + s.SettingCreate(m, CREATOR_PROGRAM, "", "允许创建人本地开发", api.TECH, "1004") + s.SettingCreate(m, ISSUE_MAX_CREATE, "input", "每个人最多有多少个项目待审批", api.LEADER, "1005", "2") } func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) { if m.PrefixKey() != ice.GetTypeKey(s) { @@ -36,9 +38,10 @@ func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) { func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStory{}, story{})}) } const ( - LEADER_APPROVED = "leader_approved" - LEADER_FINISH = "leader_finish" - LEADER_PAYFOR = "leader_payfor" - LEADER_PROGRAM = "leader_program" - CREATOR_PROGRAM = "creator_program" + LEADER_APPROVED = "leader_approved" + LEADER_FINISH = "leader_finish" + LEADER_PAYFOR = "leader_payfor" + LEADER_PROGRAM = "leader_program" + CREATOR_PROGRAM = "creator_program" + ISSUE_MAX_CREATE = "issue_max_create" )