This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-05-08 11:58:53 +08:00
parent af83ed031e
commit 6d885edd69
7 changed files with 60 additions and 37 deletions

View File

@ -1,7 +1,7 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [ can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title, can.onimport.textView(can, value, "status")]}, {view: html.TITLE, list: [value.title, can.onimport.textView(can, value, "case_status")]},
{view: html.STATUS, list: [ {view: html.STATUS, list: [
// can.onimport.beginTime(can, value), // can.onimport.beginTime(can, value),
(value.process_time||value.begin_time).split(" ")[0], (value.process_time||value.begin_time).split(" ")[0],

View File

@ -26,9 +26,11 @@ type Table struct {
finish string `name:"finish" role:"leader"` finish string `name:"finish" role:"leader"`
reback string `name:"reback" role:"leader"` reback string `name:"reback" role:"leader"`
cancel string `name:"cancel" role:"leader"` cancel string `name:"cancel" role:"leader"`
trash string `name:"trash" role:"leader"`
payfor string `name:"payfor price* title* content" role:"leader"` payfor string `name:"payfor price* title* content" role:"leader"`
discuss string `name:"discuss meet_type* title* content link* date* time*" role:"leader"` discuss string `name:"discuss meet_type* title* content link* date* time*" role:"leader"`
list string `name:"list story_uid uid auto" role:"void"` list string `name:"list story_uid uid auto" role:"void"`
issueList string `name:"issueList" role:"worker"`
designList string `name:"designList" role:"worker"` designList string `name:"designList" role:"worker"`
taskList string `name:"taskList" role:"worker"` taskList string `name:"taskList" role:"worker"`
caseList string `name:"caseList" role:"worker"` caseList string `name:"caseList" role:"worker"`
@ -110,14 +112,10 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, user_uid string, arg ...ice.Any) { func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, user_uid string, arg ...ice.Any) {
button := []ice.Any{} button := []ice.Any{}
defer func() { m.PushButton(button...) }() defer func() { m.PushButton(button...) }()
if PlanStatus(kit.Int(value[model.PLAN_STATUS])) == PlanFinish {
kit.If(m.FieldsIsDetail(), func() { s.DoneMessage(m) })
return
}
isCreator, isLeader, isWorker := s.IsCreator(m), s.IsLeader(m), s.IsWorker(m) isCreator, isLeader, isWorker := s.IsCreator(m), s.IsLeader(m), s.IsWorker(m)
switch IssueStatus(kit.Int(value[model.STATUS])) { switch IssueStatus(kit.Int(value[model.STATUS])) {
case IssueCreate: case IssueCreate:
if isLeader { if isCreator {
button = append(button, s.Discuss, s.Payfor) button = append(button, s.Discuss, s.Payfor)
} }
if isCreator { if isCreator {
@ -126,22 +124,27 @@ func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, user_uid string,
if user_uid == value[model.USER_UID] { if user_uid == value[model.USER_UID] {
button = append(button, s.Modify, s.Remove) button = append(button, s.Modify, s.Remove)
} }
case IssueRejected:
if isLeader {
button = append(button, s.Trash)
}
case IssueApproved: case IssueApproved:
if user_uid == value[model.USER_UID] { if user_uid == value[model.USER_UID] {
button = append(button, s.Process) button = append(button, s.Process)
} }
case IssueProcess: case IssueProcess:
if isLeader { if isCreator {
button = append(button, s.Discuss, s.Payfor) button = append(button, s.Discuss, s.Payfor)
} }
if user_uid == value[model.USER_UID] { if user_uid == value[model.USER_UID] {
button = append(button, s.Submit) button = append(button, s.Submit)
} }
// button = append(button, s.Remove)
case IssueSubmit: case IssueSubmit:
if isWorker { if isWorker {
button = append(button, s.Preview) button = append(button, s.Preview)
} }
if isLeader { if isCreator {
button = append(button, s.Discuss, s.Payfor) button = append(button, s.Discuss, s.Payfor)
} }
if isCreator { if isCreator {
@ -151,18 +154,26 @@ func (s Table) PushIssueButton(m *ice.Message, value ice.Maps, user_uid string,
if isWorker { if isWorker {
button = append(button, s.Preview) button = append(button, s.Preview)
} }
if isLeader { if PlanStatus(kit.Int(value[model.PLAN_STATUS])) != PlanFinish {
if isCreator {
button = append(button, s.Discuss, s.Payfor) button = append(button, s.Discuss, s.Payfor)
} }
}
if isWorker { if isWorker {
button = append(button, arg...) button = append(button, arg...)
} }
kit.If(m.FieldsIsDetail(), func() { s.DoneMessage(m) }) kit.If(m.FieldsIsDetail(), func() { s.DoneMessage(m) })
case IssueCancel:
if isLeader {
button = append(button, s.Trash)
}
} }
} }
func (s Table) PushTaskButton(m *ice.Message, value ice.Maps, user_uid string, arg ...ice.Any) { func (s Table) PushTaskButton(m *ice.Message, value ice.Maps, user_uid string, arg ...ice.Any) {
button := []ice.Any{} button := []ice.Any{}
isWorker := s.IsWorker(m) isWorker := s.IsWorker(m)
// isCreator, isLeader, isWorker := s.IsCreator(m), s.IsLeader(m), s.IsWorker(m)
// _ = isLeader
switch IssueStatus(kit.Int(value[model.STATUS])) { switch IssueStatus(kit.Int(value[model.STATUS])) {
case IssueCreate: case IssueCreate:
if user_uid == value[model.USER_UID] { if user_uid == value[model.USER_UID] {
@ -231,6 +242,11 @@ func (s Table) Reback(m *ice.Message, arg ...string) {
func (s Table) Cancel(m *ice.Message, arg ...string) { func (s Table) Cancel(m *ice.Message, arg ...string) {
s.ChangeStatus(m, int(IssueSubmit), int(IssueCancel)) s.ChangeStatus(m, int(IssueSubmit), int(IssueCancel))
} }
func (s Table) Trash(m *ice.Message, arg ...string) {
if s.IsLeader(m) {
s.Delete(m, m.OptionSimple(model.UID, model.STORY_UID)...)
}
}
func (s Table) Program(m *ice.Message, arg ...string) { func (s Table) Program(m *ice.Message, arg ...string) {
p := path.Base(m.Option(nfs.PATH)) p := path.Base(m.Option(nfs.PATH))
m.ProcessOpen(kit.MergeURL(web.S(m.Option(web.SPACE))+web.C(web.VIMER), nfs.PATH, nfs.SRC, nfs.FILE, path.Join(p, "portal.go"))) m.ProcessOpen(kit.MergeURL(web.S(m.Option(web.SPACE))+web.C(web.VIMER), nfs.PATH, nfs.SRC, nfs.FILE, path.Join(p, "portal.go")))
@ -281,7 +297,11 @@ func (s Table) otherListButton(m *ice.Message, arg ...string) {
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
switch IssueStatus(kit.Int(value[model.STATUS])) { switch IssueStatus(kit.Int(value[model.STATUS])) {
case IssueSubmit, IssueFinish: case IssueSubmit, IssueFinish:
if value[web.LINK] != "" {
m.PushButton(s.Preview) m.PushButton(s.Preview)
break
}
fallthrough
default: default:
m.PushButton() m.PushButton()
} }
@ -297,11 +317,13 @@ func (s Table) DesignList(m *ice.Message, arg ...string) {
} }
func (s Table) TaskList(m *ice.Message, arg ...string) { func (s Table) TaskList(m *ice.Message, arg ...string) {
s.OtherList(m, Task{}).Display("task.js") s.OtherList(m, Task{}).Display("task.js")
s.otherListButton(m) m.RenameAppend(model.STATUS, model.TASK_STATUS)
m.PushAction(s.Program)
} }
func (s Table) CaseList(m *ice.Message, arg ...string) { func (s Table) CaseList(m *ice.Message, arg ...string) {
s.OtherList(m, Case{}).Display("case.js") s.OtherList(m, Case{}).Display("case.js")
s.otherListButton(m) m.RenameAppend(model.STATUS, model.CASE_STATUS)
m.PushAction(s.Preview)
} }
func (s Table) MeetList(m *ice.Message, arg ...string) { func (s Table) MeetList(m *ice.Message, arg ...string) {
s.OtherList(m, meet{}).Display("meet.js") s.OtherList(m, meet{}).Display("meet.js")
@ -312,8 +334,7 @@ func (s Table) DealList(m *ice.Message, arg ...string) {
} }
func (s Table) finishCheck(m *ice.Message, target ice.Any, name string, arg ...string) bool { func (s Table) finishCheck(m *ice.Message, target ice.Any, name string, arg ...string) bool {
count := m.Cmd(target, s.Select, m.CommandKey()+"_uid = ? AND status != ? AND status != ? AND status != ?", count := m.Cmd(target, s.Select, m.CommandKey()+"_uid = ? AND status != ? AND status != ? AND status != ?", m.Option(model.UID), IssueRejected, IssueFinish, IssueCancel).Length()
m.Option(model.UID), IssueRejected, IssueFinish, IssueCancel).Length()
if m.WarnNotValid(count > 0, kit.Format("还有 %v 个未完成的%s", count, name)) { if m.WarnNotValid(count > 0, kit.Format("还有 %v 个未完成的%s", count, name)) {
return true return true
} }

View File

@ -12,7 +12,7 @@ type Design struct {
order string `data:"3"` order string `data:"3"`
fields string `data:"title,content,status,price,link,begin_time,end_time,process_time,finish_time,issue_uid,plan_uid,user_uid"` fields string `data:"title,content,status,price,link,begin_time,end_time,process_time,finish_time,issue_uid,plan_uid,user_uid"`
create string `name:"create issue_uid* title* content* price*=1000 begin_time:select@date end_time:select@date" role:"worker"` create string `name:"create issue_uid* title* content* price*=1000 begin_time:select@date end_time:select@date" role:"worker"`
modify string `name:"modify title* content* price* 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"`
} }
func (s Design) Create(m *ice.Message, arg ...string) { func (s Design) Create(m *ice.Message, arg ...string) {

View File

@ -12,10 +12,9 @@ type Issue struct {
order string `data:"2"` 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"` 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"` 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* 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"` 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"` taskCreate string `name:"taskCreate title* content* space path begin_time:select@date end_time:select@date" role:"worker"`
applyCreate string `name:"applyCreate" role:"void"`
} }
func (s Issue) Create(m *ice.Message, arg ...string) { func (s Issue) Create(m *ice.Message, arg ...string) {
@ -41,13 +40,22 @@ func (s Issue) List(m *ice.Message, arg ...string) {
s.ApplyCheck(m, arg...) s.ApplyCheck(m, arg...)
return return
} }
user_uid := m.Option(model.USER_UID) 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.Orders(m, model.STATUS, model.DESIGN_COUNT, model.TASK_COUNT, s.Desc(model.CREATED_AT))
s.ValueList(m, arg) s.ValueList(m, arg)
s.SelectJoinPlan(m) s.SelectJoinPlan(m)
s.StatusCount(m, arg...) s.StatusCount(m, arg...)
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
s.PushIssueButton(m, value, user_uid, s.DesignCreate, s.TaskCreate) 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") }).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") }) kit.If(len(arg) == 1, func() { m.Sort("plan_status,status,design_count,task_count,created_at") })
} }

View File

@ -16,7 +16,6 @@ type Plan struct {
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"leader"`
process string `name:"process" role:"leader"` process string `name:"process" role:"leader"`
issueCreate string `name:"issueCreate title* content* price=1000 begin_time:select@date end_time:select@date" role:"worker"` issueCreate string `name:"issueCreate title* content* price=1000 begin_time:select@date end_time:select@date" role:"worker"`
issueList string `name:"issueList" role:"worker"`
} }
func (s Plan) Create(m *ice.Message, arg ...string) { func (s Plan) Create(m *ice.Message, arg ...string) {
@ -27,40 +26,36 @@ func (s Plan) List(m *ice.Message, arg ...string) {
isLeader, isWorker := s.IsLeader(m), s.IsWorker(m) isLeader, isWorker := s.IsLeader(m), s.IsWorker(m)
defer kit.If(!isLeader, func() { defer kit.If(!isLeader, func() {
if m.Action(); m.Length() == 0 { if m.Action(); m.Length() == 0 {
m.SetResult("请等待管理员创建迭代计划") m.SetResult("请等待管理员创建迭代计划")
} }
}) })
s.Orders(m, model.STATUS, model.ISSUE_COUNT, s.Desc(model.CREATED_AT)) s.Orders(m, model.STATUS, model.ISSUE_COUNT, s.Desc(model.CREATED_AT))
s.ValueList(m, arg).Table(func(value ice.Maps) { s.ValueList(m, arg).Table(func(value ice.Maps) {
button := []ice.Any{} button := []ice.Any{}
defer func() { m.PushButton(button...) }()
switch PlanStatus(kit.Int(value[model.PLAN_STATUS])) { switch PlanStatus(kit.Int(value[model.PLAN_STATUS])) {
case PlanCreate: case PlanCreate:
if isLeader { if isLeader {
button = append(button, s.Process, s.Modify, s.Remove) button = append(button, s.Process, s.Modify, s.Remove)
} }
case PlanProcess: case PlanProcess:
if isWorker { if isWorker && kit.Int(value[model.ISSUE_COUNT]) == 0 {
if kit.Int(value[model.ISSUE_COUNT]) == 0 {
button = append(button, s.IssueCreate) button = append(button, s.IssueCreate)
} }
}
if isLeader && kit.Int(value[model.ISSUE_COUNT]) > 0 {
button = append(button, s.Finish)
}
if isLeader && m.Option(model.MARKET_UID) == "" { if isLeader && m.Option(model.MARKET_UID) == "" {
button = append(button, s.MarketInsert) button = append(button, s.MarketInsert)
} }
if isLeader && kit.Int(value[model.ISSUE_COUNT]) > 0 {
button = append(button, s.Finish)
}
if isLeader && kit.Int(value[model.ISSUE_COUNT]) == 0 { if isLeader && kit.Int(value[model.ISSUE_COUNT]) == 0 {
button = append(button, s.Remove) button = append(button, s.Remove)
} }
case PlanFinish: case PlanFinish:
if isLeader && m.Option(model.MARKET_UID) == "" { kit.If(m.FieldsIsDetail(), func() { s.DoneMessage(m) })
// button = append(button, s.MarketInsert)
} }
kit.If(len(arg) == 2, func() { s.DoneMessage(m) }) }).Display("").DisplayCSS("")
} m.Option("otherList", "issueList,designList,taskList,caseList,meetList,dealList")
m.PushButton(button...)
}).Display("").DisplayCSS("").Option("otherList", "issueList,designList,taskList,caseList,meetList,dealList")
s.StatusCount(m, arg...) s.StatusCount(m, arg...)
} }
func (s Plan) Process(m *ice.Message, arg ...string) { func (s Plan) Process(m *ice.Message, arg ...string) {

View File

@ -15,7 +15,6 @@ type Task struct {
modify string `name:"modify title* content* space path begin_time*:select@date end_time*:select@date" role:"worker"` modify string `name:"modify title* content* space path begin_time*:select@date end_time*:select@date" role:"worker"`
finish string `name:"finish" role:"worker"` finish string `name:"finish" role:"worker"`
caseCreate string `name:"caseCreate title* content* space index" role:"worker"` caseCreate string `name:"caseCreate title* content* space index" role:"worker"`
caseList string `name:"caseList" role:"worker"`
} }
func (s Task) Create(m *ice.Message, arg ...string) { func (s Task) Create(m *ice.Message, arg ...string) {

View File

@ -1,7 +1,7 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [ can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title, can.onimport.textView(can, value, "status")]}, {view: html.TITLE, list: [value.title, can.onimport.textView(can, value, "task_status")]},
{view: html.STATUS, list: [ {view: html.STATUS, list: [
// can.onimport.beginTime(can, value), // can.onimport.beginTime(can, value),
(value.process_time||value.begin_time).split(" ")[0], (value.process_time||value.begin_time).split(" ")[0],