This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-06-11 19:42:05 +08:00
parent ff74f7cbc6
commit 2dd86622f0
8 changed files with 35 additions and 16 deletions

View File

@ -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) }) kit.If(s.check(m), func() { m.Cmdy(code.VIMER, m.ActionKey(), arg) })
} }
func (s coder) check(m *ice.Message, arg ...string) bool { 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))) 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)) 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" { if s.SettingIsOn(m, CREATOR_PROGRAM) && msg.Append(model.ROLE) == "1" {
return true return true
} else if s.SettingIsOn(m, LEADER_PROGRAM) && msg.Append(model.ROLE) == "2" { } else if s.SettingIsOn(m, LEADER_PROGRAM) && msg.Append(model.ROLE) == "2" {
return true return true
} else { } else {
m.WarnNotRight(true) m.WarnNotRight(true, kit.Format("%v", msg.Append(model.ROLE)))
return false return false
} }
} }

View File

@ -2,6 +2,7 @@ package production
import ( import (
"path" "path"
"strconv"
"strings" "strings"
"shylinux.com/x/ice" "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 { func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string { m.RewriteAppend(func(value, key string, index int) string {
if _, e := strconv.ParseInt(value, 10, 64); e != nil {
return value
}
switch key { switch key {
case model.USER_STORY_ROLE: case model.USER_STORY_ROLE:
value = UserStoryRole(kit.Int(value)).String() value = UserStoryRole(kit.Int(value)).String()
@ -382,7 +386,9 @@ func (s Table) commonOtherList(m *ice.Message, target ice.Any, arg ...string) *i
} else { } else {
s.OtherList(m, target, model.ISSUE_UID, m.Option(model.ISSUE_UID)) s.OtherList(m, target, model.ISSUE_UID, m.Option(model.ISSUE_UID))
} }
if kit.IndexOf(m.Appendv(ice.MSG_APPEND), model.USER_UID) == -1 {
m.RenameAppend(model.TO_USER_UID, model.USER_UID) m.RenameAppend(model.TO_USER_UID, model.USER_UID)
}
return m return m
} }
func (s Table) otherListButton(m *ice.Message, arg ...string) { func (s Table) otherListButton(m *ice.Message, arg ...string) {

View File

@ -55,6 +55,7 @@ func (s Issue) List(m *ice.Message, arg ...string) {
return return
} }
isCreator, isWorker := s.IsCreator(m), s.IsWorker(m) 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.Orders(m, model.STATUS, model.DESIGN_COUNT, model.TASK_COUNT, s.Desc(model.UPDATED_AT)).Limit(m, 300)
s.ValueList(m, arg) s.ValueList(m, arg)
s.SelectJoinPlan(m) s.SelectJoinPlan(m)
@ -62,7 +63,7 @@ func (s Issue) List(m *ice.Message, arg ...string) {
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
button := []ice.Any{} button := []ice.Any{}
if isWorker && kit.Int(value[model.DESIGN_COUNT]) == 0 { 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) button = append(button, s.DesignCreate)
} }
} }

View File

@ -15,6 +15,7 @@ const (
PRICE = "price" PRICE = "price"
SCORE = "score" SCORE = "score"
COUNT = "count" COUNT = "count"
AVATAR = "avatar"
TITLE = "title" TITLE = "title"
CONTENT = "content" CONTENT = "content"
VERSION = "version" VERSION = "version"

View File

@ -1,10 +1,12 @@
package production package production
import "shylinux.com/x/ice" import (
"shylinux.com/x/ice"
)
type Note struct { type Note struct {
Table 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"` create string `name:"create title content to_user_uid" role:"worker"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"leader"`
} }

View File

@ -3,6 +3,7 @@ Volcanos(chat.ONIMPORT, {
can.onimport.myView(can, msg, function(value) { return [ 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.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.OUTPUT, list: [value.content||value.info]},
// {view: html.STATUS, list: [{img: value.to_user_avatar}, value.to_user_name]},
] }) ] })
}, },
}) })

View File

@ -39,6 +39,9 @@ func (s Plan) List(m *ice.Message, arg ...string) {
m.SetResult("请等待「管理员」创建迭代计划") 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.Orders(m, model.STATUS, model.ISSUE_COUNT, s.Desc(model.UPDATED_AT)).Limit(m, 300)
s.ValueList(m, arg).Table(func(value ice.Maps) { s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{} 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) button = append(button, s.Process, s.Handover, s.Modify, s.Remove)
} }
case PlanProcess: 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) button = append(button, s.IssueCreate)
} }
if isLeader && m.Option(model.MARKET_UID) == "" { if isLeader && m.Option(model.MARKET_UID) == "" {

View File

@ -16,11 +16,13 @@ type Portal struct {
func (s Plan) AfterMigrate(m *ice.Message, arg ...string) { func (s Plan) AfterMigrate(m *ice.Message, arg ...string) {
s.Table.AfterMigrate(m, arg...) s.Table.AfterMigrate(m, arg...)
s.SettingCreate(m, LEADER_APPROVED, "", "允许管理人员审批项目", api.CREATOR, "100") s.SettingCreate(m, "auth", "title", "项目权限", "", "999")
s.SettingCreate(m, LEADER_FINISH, "", "允许管理人员验收项目", api.CREATOR, "101") s.SettingCreate(m, LEADER_APPROVED, "", "允许管理人员审批项目", api.CREATOR, "1000")
s.SettingCreate(m, LEADER_PAYFOR, "", "允许管理人员支付项目", api.CREATOR, "102") s.SettingCreate(m, LEADER_FINISH, "", "允许管理人员验收项目", api.CREATOR, "1001")
s.SettingCreate(m, LEADER_PROGRAM, "", "允许管理人员本地开发", api.TECH, "103") s.SettingCreate(m, LEADER_PAYFOR, "", "允许管理人员支付项目", api.CREATOR, "1002")
s.SettingCreate(m, CREATOR_PROGRAM, "", "允许创建人本地开发", api.TECH, "104") 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) { func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {
if m.PrefixKey() != ice.GetTypeKey(s) { if m.PrefixKey() != ice.GetTypeKey(s) {
@ -41,4 +43,5 @@ const (
LEADER_PAYFOR = "leader_payfor" LEADER_PAYFOR = "leader_payfor"
LEADER_PROGRAM = "leader_program" LEADER_PROGRAM = "leader_program"
CREATOR_PROGRAM = "creator_program" CREATOR_PROGRAM = "creator_program"
ISSUE_MAX_CREATE = "issue_max_create"
) )