This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-09-15 20:00:17 +08:00
parent 3a93591f39
commit a59ab08113
21 changed files with 92 additions and 74 deletions

View File

@ -9,12 +9,12 @@ import (
type client struct {
Table
fields string `data:"host,port,username,database"`
config string `name:"config host* port* username* password* database*" role:"leader"`
}
func (s client) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Fields(m, model.HOST, model.PORT, model.USERNAME, model.DATABASE)
s.SelectDetail(m, model.UID, arg[0])
if m.Append(model.USERNAME) == "" {
m.SetAppend().EchoInfoButton("", s.Config)

View File

@ -2,8 +2,6 @@ package dashboard
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/operation/src/dashboard/model"
@ -21,10 +19,6 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
s.InputsListRole(m, UserClientRoleList, arg...)
case model.CLIENT_TYPE:
s.InputsList(m, ClientTypeList, arg...)
case web.SPACE:
s.Hash.Inputs(m, arg...)
case ctx.INDEX:
s.Hash.Inputs(m, arg...)
default:
s.Table.Inputs(m, arg...)
}

View File

@ -27,6 +27,7 @@
}
},
"client_type": {
"place": "place",
"mysql": "MySQL",
"redis": "Redis",
"icons": {

View File

@ -24,9 +24,6 @@ type summary struct {
scan string `name:"scan" role:"leader"`
}
func (s summary) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
func (s summary) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s summary) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s summary) Scan(m *ice.Message, arg ...string) {
client_uid := kit.Select(m.Option(model.CLIENT_UID), arg, 0)
msg := m.Cmd(s.client, s.Select, model.UID, client_uid)

View File

@ -2,7 +2,9 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { var count = (parseInt(can.ConfWidth()/80)); if (msg.Length() < count) { count = msg.Length() }
var width = can.ConfWidth()/(count||1)
can.page.Append(can, can._output, msg.Table(function(value) {
return {view: html.ITEM, style: {width: width}, list: [{view: ["value", "", value.value]}, {view: ["title", "", value.title]}], oncontextmenu: function(event) {
return {view: html.ITEM, style: {width: width}, list: [
{view: [html.VALUE, "", value.value]}, {view: [html.TITLE, "", value.title]},
], oncontextmenu: function(event) {
can.user.carteItem(event, can, value)
}}
}))

View File

@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -31,31 +31,39 @@ func (s Case) Remove(m *ice.Message, arg ...string) {
s.taskCount(m, "-1")
s.planCount(m, "-1")
}
func (s Case) Modify(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
}
func (s Case) List(m *ice.Message, arg ...string) {
isLeader, user_uid := s.IsLeader(m), m.Option(model.USER_UID)
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
switch CaseStatus(kit.Int(value[model.CASE_STATUS])) {
case CaseCreate:
if value[model.PLAN_UID] == "" {
if isLeader && value[model.PLAN_UID] == "" {
button = append(button, s.PlanBind)
}
button = append(button, s.Process)
if isLeader || user_uid == value[model.USER_UID] {
button = append(button, s.Process)
}
case CaseProcess:
button = append(button, s.Finish)
if isLeader || user_uid == value[model.USER_UID] {
button = append(button, s.Finish)
}
case CaseFinish:
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
}
m.PushButton(button...)
}).Display("")
s.SelectJoinPlan(m)
s.SelectJoinUser(m)
}
func (s Case) Process(m *ice.Message, arg ...string) { s.changeStatus(m, CaseCreate, CaseProcess) }
func (s Case) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, CaseProcess, CaseFinish) }
func (s Case) PlanBind(m *ice.Message, arg ...string) { s.ValueModify(m, arg...); s.planCount(m, "1") }
func (s Case) Process(m *ice.Message, arg ...string) {
s.changeStatus(m, CaseCreate, CaseProcess)
}
func (s Case) Finish(m *ice.Message, arg ...string) {
s.changeStatus(m, CaseProcess, CaseFinish)
}
func (s Case) PlanBind(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
s.planCount(m, "1")
}
func init() { ice.TeamCtxCmd(Case{}) }

View File

@ -1,10 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title, value.case_status != "finish" && can.onimport.textView(can, value, "case_status"), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
value.plan_title && {view: html.STATUS, list: ["计划:", value.plan_title]},
{view: html.TITLE, list: [value.title, can.onimport.textView(can, value), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time), "计划:", value.plan_title]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -11,7 +11,7 @@ type issue struct {
Table
task task
order string `data:"2"`
fields string `data:"title,content,issue_type,level,issue_status,process_time,finish_time,task_count,plan_uid,user_uid"`
fields string `data:"title,content,issue_type,level,issue_status,task_count,process_time,finish_time,plan_uid,user_uid"`
create string `name:"create title* content* issue_type:select level:select" role:"leader,worker"`
modify string `name:"modify title* content* issue_type*:select level*:select" role:"leader,worker"`
remove string `name:"remove" role:"leader,worker"`
@ -35,29 +35,33 @@ func (s issue) Remove(m *ice.Message, arg ...string) {
s.DashboardUpdate(m)
s.planCount(m, "-1")
}
func (s issue) Modify(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
}
func (s issue) List(m *ice.Message, arg ...string) {
isLeader, user_uid := s.IsLeader(m), m.Option(model.USER_UID)
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
switch IssueStatus(kit.Int(value[model.ISSUE_STATUS])) {
case IssueCreate:
button = append(button, s.Reject, s.Approve)
if isLeader {
button = append(button, s.Reject, s.Approve)
}
case IssueApproved:
if value[model.PLAN_UID] == "" {
if isLeader && value[model.PLAN_UID] == "" {
button = append(button, s.PlanBind)
}
button = append(button, s.Process)
if isLeader || user_uid == value[model.USER_UID] {
button = append(button, s.Process)
}
case IssueProcess:
button = append(button, s.TaskCreate, s.Finish)
button = append(button, s.TaskCreate)
if isLeader || user_uid == value[model.USER_UID] {
button = append(button, s.Finish)
}
case IssueFinish:
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
}
m.PushButton(button...)
}).Display("")
s.SelectJoinPlan(m)
s.SelectJoinUser(m)
}
func (s issue) Reject(m *ice.Message, arg ...string) {
s.changeStatus(m, IssueCreate, IssueRejected)

View File

@ -4,12 +4,10 @@ Volcanos(chat.ONIMPORT, {
{view: html.TITLE, list: [value.title,
value.issue_type != "feature" && can.onimport.textView(can, value, "issue_type"),
value.level != "level-3" && can.onimport.textView(can, value, "level"),
value.issue_status != "finish" && can.onimport.textView(can, value, "issue_status"),
can.onimport.titleAction(can, value),
can.onimport.textView(can, value), can.onimport.titleAction(can, value),
]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
value.plan_title && {view: html.STATUS, list: ["计划:", value.plan_title, "任务:", value.task_count+" 个"]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time), "计划:", value.plan_title, "任务:", value.task_count+" 个"]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -12,6 +12,7 @@ const (
TITLE = "title"
CONTENT = "content"
USER_UID = "user_uid"
USER_ROLE = "user_role"
USER_STORY_ROLE = "user_story_role"
STORY_UID = "story_uid"
STORY_NAME = "story_name"
@ -46,13 +47,13 @@ type Plan struct {
db.ModelContent
StoryUID string `gorm:"type:char(32);index"`
Status uint8 `gorm:"default:0"`
IssueCount int `gorm:"default:0"`
TaskCount int `gorm:"default:0"`
CaseCount int `gorm:"default:0"`
BeginTime db.Time
EndTime db.Time
ProcessTime db.Time
FinishTime db.Time
IssueCount int `gorm:"default:0"`
TaskCount int `gorm:"default:0"`
CaseCount int `gorm:"default:0"`
}
type Issue struct {
Common
@ -63,9 +64,9 @@ type Issue struct {
type Task struct {
Common
IssueUID string `gorm:"type:char(32);index"`
CaseCount int `gorm:"default:0"`
BeginTime db.Time
EndTime db.Time
CaseCount int `gorm:"default:0"`
}
type Case struct {
Common

View File

@ -11,7 +11,7 @@ type plan struct {
Table
issue issue
order string `data:"1"`
fields string `data:"title,content,plan_status,begin_time,end_time,process_time,finish_time,issue_count,task_count,case_count"`
fields string `data:"title,content,plan_status,issue_count,task_count,case_count,begin_time,end_time,process_time,finish_time,user_uid"`
create string `name:"create title* content* begin_time:select@date end_time:select@date" role:"leader"`
modify string `name:"modify title* content* begin_time*:select@date end_time*:select@date" role:"leader"`
remove string `name:"remove" role:"leader"`
@ -24,24 +24,33 @@ func (s plan) Create(m *ice.Message, arg ...string) {
s.ValueCreate(m, kit.ArgDef(arg, kit.Simple(model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("720h"))...)...)
s.SendMessage(m, "", "")
}
func (s plan) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s plan) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s plan) List(m *ice.Message, arg ...string) {
isLeader := s.IsLeader(m)
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
switch PlanStatus(kit.Int(value[model.PLAN_STATUS])) {
case PlanCreate:
button = append(button, s.Modify, s.Process)
if isLeader {
button = append(button, s.Modify, s.Process)
}
case PlanProcess:
button = append(button, s.IssueCreate, s.Finish)
button = append(button, s.IssueCreate)
if isLeader {
button = append(button, s.Finish)
}
case PlanFinish:
kit.If(m.Option(model.MARKET_UID) == "", func() { button = append(button, s.MarketInsert) })
if isLeader && m.Option(model.MARKET_UID) == "" {
button = append(button, s.MarketInsert)
}
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
}
m.PushButton(button...)
}).Display("")
kit.If(!isLeader, func() { m.Action() })
}
func (s plan) Process(m *ice.Message, arg ...string) {
s.changeStatus(m, PlanCreate, PlanProcess)
}
func (s plan) Process(m *ice.Message, arg ...string) { s.changeStatus(m, PlanCreate, PlanProcess) }
func (s plan) Finish(m *ice.Message, arg ...string) {
count := m.Cmd(s.issue, s.Select, "plan_uid = ? AND status != ?", m.Option(model.UID), IssueFinish).Length()
if m.WarnNotValid(count > 0, kit.Format("还有 %v 个未完成的需求", count)) {

View File

@ -1,10 +1,10 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title, value.plan_status != "finish" && can.onimport.textView(can, value, "plan_status"), can.onimport.titleAction(can, value)]},
{view: html.TITLE, list: [value.title, can.onimport.textView(can, value), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.STATUS, list: [value.begin_time.split(" ")[0], "~", value.end_time.split(" ")[0]]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
{view: html.STATUS, list: ["需求:", value.issue_count+" 个", "任务:", value.task_count+" 个", "用例:", value.case_count+" 个"]},
{view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time), "需求:", value.issue_count+" 个", "任务:", value.task_count+" 个", "用例:", value.case_count+" 个"]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -19,6 +19,7 @@ func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {
s.DashboardInsert(m, "2", "需求待办", issue{}, "", "story_uid = ? AND status != ? AND status != ?", m.Option(model.STORY_UID), IssueRejected, IssueFinish)
s.DashboardInsert(m, "3", "任务总量", task{}, "", model.STORY_UID, m.Option(model.STORY_UID))
s.DashboardInsert(m, "4", "任务待办", task{}, "", "story_uid = ? AND status != ?", m.Option(model.STORY_UID), TaskFinish)
s.DashboardUpdate(m)
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userStory{}, story{})}) }

View File

@ -12,6 +12,7 @@
"caseCreate": "创建用例",
"style": {
"process": "notice",
"finish": "danger",
"issueCreate": "notice",
"taskCreate": "notice",
"caseCreate": "notice"

View File

@ -11,7 +11,7 @@ type task struct {
Table
Case Case
order string `data:"3"`
fields string `data:"title,content,task_status,begin_time,end_time,process_time,finish_time,case_count,issue_uid,plan_uid,user_uid"`
fields string `data:"title,content,task_status,case_count,begin_time,end_time,process_time,finish_time,issue_uid,plan_uid,user_uid"`
create string `name:"create title* content* begin_time:select@date end_time:select@date" role:"leader,worker"`
modify string `name:"modify title* content* begin_time*:select@date end_time*:select@date" role:"leader,worker"`
remove string `name:"remove" role:"leader,worker"`
@ -35,27 +35,29 @@ func (s task) Remove(m *ice.Message, arg ...string) {
s.issueCount(m, "-1")
s.planCount(m, "-1")
}
func (s task) Modify(m *ice.Message, arg ...string) {
s.ValueModify(m, arg...)
}
func (s task) List(m *ice.Message, arg ...string) {
isLeader, user_uid := s.IsLeader(m), m.Option(model.USER_UID)
s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{}
switch TaskStatus(kit.Int(value[model.TASK_STATUS])) {
case TaskCreate:
if value[model.PLAN_UID] == "" {
if isLeader && value[model.PLAN_UID] == "" {
button = append(button, s.PlanBind)
}
button = append(button, s.Process)
if isLeader || user_uid == value[model.USER_UID] {
button = append(button, s.Process)
}
case TaskProcess:
button = append(button, s.CaseCreate, s.Finish)
button = append(button, s.CaseCreate)
if isLeader || user_uid == value[model.USER_UID] {
button = append(button, s.Finish)
}
case TaskFinish:
kit.If(len(arg) == 2, func() { s.DoneMessage(m) })
}
m.PushButton(button...)
}).Display("")
s.SelectJoinPlan(m)
s.SelectJoinUser(m)
}
func (s task) Process(m *ice.Message, arg ...string) {
s.changeStatus(m, TaskCreate, TaskProcess)

View File

@ -1,10 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title, value.task_status != "finish" && can.onimport.textView(can, value, "task_status"), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
value.process_time && {view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time)]},
value.plan_title && {view: html.STATUS, list: ["计划:", value.plan_title, "用例:", value.case_count+" 个"]},
{view: html.TITLE, list: [value.title, can.onimport.textView(can, value), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.STATUS, list: [can.base.TimeTrim(value.process_time), "~", can.base.TimeTrim(value.finish_time), "计划:", value.plan_title, "用例:", value.case_count+" 个"]},
{view: html.OUTPUT, list: [value.content]},
] })
},

View File

@ -12,4 +12,8 @@ func init() { ice.TeamCtxCmd(userStory{}) }
type UserStoryRole = operation.UserCloudRole
var UserStoryCreator = operation.UserCloudCreator
var UserStoryLeader = operation.UserCloudLeader
var UserStoryRoleList = operation.UserCloudRoleList

View File

@ -4,13 +4,11 @@ import "shylinux.com/x/ice"
type {{.Option "name"}} struct {
Table
fields string `data:"title,content"`
fields string `data:"title,content,user_uid"`
create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s {{.Option "name"}}) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
func (s {{.Option "name"}}) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func init() { ice.TeamCtxCmd({{.Option "name"}}{}) }

View File

@ -1,9 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.name||value.title||value.user_name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at)]},
{view: html.OUTPUT, list: [value.info||value.content]},
{view: html.TITLE, list: [value.title||value.name||value.user_name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]},
] })
},
})