mirror of
https://shylinux.com/x/community
synced 2025-04-25 17:48:06 +08:00
add some
This commit is contained in:
parent
bf9fb9afcd
commit
958719c479
@ -1,2 +0,0 @@
|
||||
$output>div.item.card.cancel div.title span { border:none; color:gray; text-decoration:line-through; }
|
||||
$output>div.item.card.rejected div.title span.status { border:var(--box-danger); color:var(--danger-bg-color); }
|
@ -7,44 +7,40 @@ import (
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type Apply struct {
|
||||
type apply struct {
|
||||
Table
|
||||
user user
|
||||
event event
|
||||
portal string `data:"true"`
|
||||
domain string `data:"gonganxitong"`
|
||||
create string `name:"create user_place_role*:select begin_time:select@date end_time:select@date" role:"void"`
|
||||
list string `name:"list place_uid uid auto" help:"权限申请" icon:"https://img.icons8.com/officel/80/edit-property.png" role:"void"`
|
||||
cancel string `name:"cancel" role:"void"`
|
||||
submit string `name:"submit" role:"void"`
|
||||
}
|
||||
|
||||
func (s Apply) Init(m *ice.Message, arg ...string) {
|
||||
func (s apply) Init(m *ice.Message, arg ...string) {
|
||||
s.Table.Init(m, arg...)
|
||||
place_uid, user_place_role := s.Keys(s.Place, model.UID), s.Keys(s.UserPlace, model.ROLE)
|
||||
m.Design(s.Create, "", user_place_role+"*:select")
|
||||
m.Design(s.List, "", place_uid+" uid auto")
|
||||
}
|
||||
func (s Apply) Inputs(m *ice.Message, arg ...string) {
|
||||
s.Place.(interface{ Inputs(*ice.Message, ...string) }).Inputs(m, arg...)
|
||||
func (s apply) Inputs(m *ice.Message, arg ...string) {
|
||||
s.UserPlace.Inputs(m, arg...)
|
||||
}
|
||||
func (s Apply) Create(m *ice.Message, arg ...string) {
|
||||
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.UID), model.PLACE_UID)
|
||||
arg = kit.TransArgKeys(arg, s.Keys(s.UserPlace, model.ROLE), model.ROLE)
|
||||
func (s apply) Create(m *ice.Message, arg ...string) {
|
||||
PLACE_UID := s.Keys(s.Place, model.UID)
|
||||
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
|
||||
arg = kit.TransArgKeys(arg, PLACE_UID, model.PLACE_UID)
|
||||
arg = kit.TransArgKeys(arg, USER_PLACE_ROLE, model.ROLE)
|
||||
arg = kit.TransArgValueTime(arg, model.BEGIN_TIME, model.END_TIME)
|
||||
s.Table.Create(m, kit.Simple(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)), arg, m.OptionSimple(model.USER_UID), model.TABLES, s.Keys(s.Place, model.UID), model.STATUS, ApplyCreate)...)
|
||||
s.Table.Create(m, kit.Simple(model.PLACE_UID, m.Option(PLACE_UID), arg, m.OptionSimple(model.USER_UID), model.TABLES, PLACE_UID, model.STATUS, ApplyCreate)...)
|
||||
}
|
||||
func (s Apply) List(m *ice.Message, arg ...string) {
|
||||
func (s apply) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.user).FieldsWithCreatedAT(m, s, model.USER_AVATAR, model.USER_NAME,
|
||||
s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.APPLY_STATUS,
|
||||
model.BEGIN_TIME, model.END_TIME, model.PLACE_UID,
|
||||
model.PLACE_UID, s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.APPLY_STATUS,
|
||||
model.BEGIN_TIME, model.END_TIME,
|
||||
)
|
||||
if len(arg) == 0 {
|
||||
return
|
||||
if m.IsTech() {
|
||||
s.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
if len(arg) == 1 {
|
||||
if s.Table.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0]); m.Length() == 0 {
|
||||
m.EchoInfoButton(m.Trans("please create apply", "请创建权限申请"), s.Create)
|
||||
return
|
||||
@ -57,29 +53,29 @@ func (s Apply) List(m *ice.Message, arg ...string) {
|
||||
ApplyCancel.String(),
|
||||
}, ice.STR_R)
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
|
||||
s.Table.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0], model.APPLY_UID, arg[1])
|
||||
if ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) == ApplySubmit {
|
||||
m.EchoQRCode(Portal{}.Link(m, arg[0], m.Prefix("order"), arg[1]))
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
m.RenameAppend(model.PLACE_UID, s.Keys(s.Place, model.UID))
|
||||
s.SelectJoin(m, s.Place, model.NAME, model.TYPE)
|
||||
s.RenameAppend(m, model.PLACE_UID, s.Keys(s.Place, model.UID)).SelectJoin(m, s.Place, model.NAME, model.TYPE)
|
||||
m.Table(func(value ice.Maps) {
|
||||
switch ApplyStatus(kit.Int(value[model.APPLY_STATUS])) {
|
||||
case ApplyCreate:
|
||||
if ApplyStatus(kit.Int(value[model.APPLY_STATUS])) == ApplyCreate {
|
||||
m.PushButton(s.Cancel, s.Submit)
|
||||
default:
|
||||
} else {
|
||||
m.PushButton()
|
||||
}
|
||||
})
|
||||
s.UserPlace.RewriteAppend(m)
|
||||
s.Display(m)
|
||||
}
|
||||
func (s Apply) Cancel(m *ice.Message, arg ...string) {
|
||||
func (s apply) Cancel(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplyCreate, ApplyCancel)
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), m.Trans("role apply cancel", "权限申请 已取消"))
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), m.Trans("role apply canceled", "权限申请 已取消"))
|
||||
}
|
||||
func (s Apply) Submit(m *ice.Message, arg ...string) {
|
||||
func (s apply) Submit(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplyCreate, ApplySubmit)
|
||||
if m.WarnNotValid(msg.IsErr()) {
|
||||
return
|
||||
@ -96,24 +92,24 @@ func (s Apply) Submit(m *ice.Message, arg ...string) {
|
||||
if m.WarnNotFound(msg.Length() == 0, role.String()) {
|
||||
return
|
||||
}
|
||||
m.Cmd(Order{}, s.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, OrderCreate)
|
||||
m.Cmd(order{}, s.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, OrderCreate)
|
||||
admin := m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID)).Append(model.NAME)
|
||||
s.event.Record(m, kit.Format("🕑 %s"+m.Trans(" apply submit", "权限申请提交"), s.TransRole(m)), m.Option(model.UID))
|
||||
s.SendTemplate(m, admin, m.Option(model.USER_UID), m.Trans("role apply submit", "权限申请 已提交"))
|
||||
s.SendTemplate(m, admin, m.Option(model.USER_UID), m.Trans("role apply submited", "权限申请 已提交"))
|
||||
}
|
||||
func (s Apply) Reject(m *ice.Message, arg ...string) {
|
||||
func (s apply) Reject(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplySubmit, ApplyRejected)
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), m.Trans("role apply rejected", "权限申请 已驳回"))
|
||||
}
|
||||
func (s Apply) Approve(m *ice.Message, arg ...string) {
|
||||
func (s apply) Approve(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplySubmit, ApplyApproved)
|
||||
m.Cmd(s.UserPlace, s.Create, msg.AppendSimple(model.USER_UID, model.ROLE), s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), m.Trans("role apply approved", "权限申请 已通过"))
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(Apply{Table: newTable()}) }
|
||||
func init() { ice.TeamCtxCmd(apply{Table: newTable()}) }
|
||||
|
||||
func (s Apply) status(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message {
|
||||
func (s apply) status(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message {
|
||||
msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.UID)...)
|
||||
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
|
||||
if status := ApplyStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) {
|
||||
|
@ -10,8 +10,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
{text: [can.user.transValue(can, value, PLACE_TYPE), "", mdb.TYPE]},
|
||||
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
|
||||
]},
|
||||
{view: html.STATUS, list: [
|
||||
{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
|
||||
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
|
||||
{text: [can.user.transValue(can, value, APPLY_STATUS)+" "+(status == "create" || status == "submit"? "🕑": status == "rejected"? "❌": "✅"), "", mdb.STATUS]},
|
||||
]},
|
||||
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
|
||||
|
@ -5,15 +5,16 @@ import (
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
icebergs "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
// "shylinux.com/x/toolkits/logs"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
"shylinux.com/x/mysql-story/src/db"
|
||||
)
|
||||
|
||||
type Tabler interface {
|
||||
Inputs(m *ice.Message, arg ...string)
|
||||
RewriteAppend(m *ice.Message, arg ...string) *ice.Message
|
||||
TransValue(m *ice.Message, key string, arg ...string) string
|
||||
TransRole(m *ice.Message, arg ...string) string
|
||||
@ -52,33 +53,22 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
}
|
||||
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Table.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.SelectDetail(m, model.UID, arg[1])
|
||||
}
|
||||
return m
|
||||
func (s Table) List(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s Table) TablesWithRole(m *ice.Message, arg []string, target, userGroup, group Tabler, fields ...ice.Any) *ice.Message {
|
||||
s.Tables(m, kit.JoinWord("LEFT JOIN", s.TableName(kit.TypeName(userGroup)),
|
||||
"ON", s.Key(target, model.USER_UID), "=", s.Key(userGroup, model.USER_UID),
|
||||
"AND", s.Key(target, s.Keys(group, model.UID)), "=", s.Key(userGroup, s.Keys(group, model.UID)),
|
||||
)).FieldsWithCreatedAT(m, target, append([]ice.Any{s.Key(target, model.USER_UID), s.AS(s.Key(userGroup, model.ROLE), s.Keys(userGroup, model.ROLE))}, fields...)...)
|
||||
func (s Table) TablesWithRole(m *ice.Message, arg []string, target, userPlace, place Tabler, fields ...ice.Any) *ice.Message {
|
||||
s.Tables(m, kit.JoinWord("LEFT JOIN", s.TableName(kit.TypeName(userPlace)),
|
||||
"ON", s.Key(target, model.USER_UID), "=", s.Key(userPlace, model.USER_UID),
|
||||
"AND", s.Key(target, s.Keys(place, model.UID)), "=", s.Key(userPlace, s.Keys(place, model.UID)),
|
||||
)).FieldsWithCreatedAT(m, target, append([]ice.Any{s.Key(target, model.USER_UID), s.AS(s.Key(userPlace, model.ROLE), s.Keys(userPlace, model.ROLE))}, fields...)...)
|
||||
if len(arg) == 1 {
|
||||
s.Table.Select(m, s.Key(s, s.Keys(group, model.UID)), arg[0])
|
||||
s.Table.Select(m, s.Key(target, s.Keys(place, model.UID)), arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.Select(m, s.Key(s, s.Keys(group, model.UID)), arg[0], s.Key(s, model.UID), arg[1])
|
||||
s.Table.Select(m, s.Key(target, s.Keys(place, model.UID)), arg[0], s.Key(target, model.UID), arg[1])
|
||||
} else {
|
||||
return m
|
||||
}
|
||||
s.SelectJoinUser(m)
|
||||
group.RewriteAppend(m)
|
||||
return m
|
||||
userPlace.RewriteAppend(m)
|
||||
return s.SelectJoinUser(m)
|
||||
}
|
||||
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
|
||||
return s.SelectJoin(m, user{}, model.NAME, model.AVATAR)
|
||||
@ -96,6 +86,10 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
})
|
||||
return m
|
||||
}
|
||||
func (s Table) RenameAppend(m *ice.Message, arg ...string) Table {
|
||||
m.RenameAppend(arg...)
|
||||
return s
|
||||
}
|
||||
func (s Table) TransValue(m *ice.Message, key string, arg ...string) string {
|
||||
if value := kit.Select(m.Option(key), arg, 0); m.IsEnglish() {
|
||||
return value
|
||||
@ -120,8 +114,12 @@ func (s Table) Display(m *ice.Message) {
|
||||
m.Option("_place_type", s.ToLower(kit.TypeName(s.Place))+"_type")
|
||||
m.Option("_user_place_role", s.ToLower(kit.TypeName(s.UserPlace))+"_role")
|
||||
m.Option("_street_name", s.ToLower(kit.TypeName(s.Street))+"_name")
|
||||
m.Option(ice.MSG_USERPOD, "20240724-community")
|
||||
m.Display("/p/src/gonganxitong/" + m.CommandKey() + ".js?pod=20240724-community").DisplayCSS("")
|
||||
file := ""
|
||||
kit.If(file == "", func() { file = m.CommandKey() + ".js" })
|
||||
if !kit.HasPrefix(file, nfs.PS, web.HTTP) {
|
||||
file = m.Resource(path.Join(path.Dir(kit.FileLine(1, 100)), file))
|
||||
}
|
||||
m.Display(file).DisplayCSS("")
|
||||
}
|
||||
|
||||
type Tables struct {
|
||||
@ -139,32 +137,30 @@ func (s Tables) Link(m *ice.Message, arg ...string) string {
|
||||
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||
}
|
||||
|
||||
func newTables() Tables { return Tables{Table: newTable()} }
|
||||
|
||||
func newTable() Table { return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}} }
|
||||
|
||||
func newTables() Tables {
|
||||
return Tables{Table: newTable()}
|
||||
}
|
||||
func newTable() Table {
|
||||
return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}}
|
||||
}
|
||||
func NewTable(userPlace, place Tabler, street Container) Table {
|
||||
return Table{UserPlace: userPlace, Place: place, Street: street}
|
||||
}
|
||||
func NewPortal(userPlace, place Tabler, street Container) Portal {
|
||||
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
|
||||
}
|
||||
|
||||
func (s Portal) getTable() Table { return s.Table }
|
||||
|
||||
func (s Portal) getTable() Table {
|
||||
return s.Table
|
||||
}
|
||||
func PortalCmd(portal ice.Any) {
|
||||
h := kit.FileLine(-1, 100)
|
||||
p := kit.Keys("web.team", kit.ModPath(-1))
|
||||
cmd := func(name string, data ice.Any) {
|
||||
_, cmd := ice.Cmd(kit.Keys(p, name), data)
|
||||
cmd.RawHand = path.Join(path.Dir(h), name+".go")
|
||||
if name != "portal" {
|
||||
// return
|
||||
}
|
||||
h := cmd.Actions["beforeMigrate"].Hand
|
||||
cmd.Actions["beforeMigrate"].Hand = func(m *icebergs.Message, arg ...string) {
|
||||
msg := m.Cmd("web.team.gonganxitong.apply")
|
||||
ice.LoadTrans(msg, cmd)
|
||||
ice.LoadTrans(m.Cmd("web.team.gonganxitong.apply"), cmd)
|
||||
ice.LoadTrans(m, cmd)
|
||||
h(m, arg...)
|
||||
}
|
||||
@ -172,7 +168,7 @@ func PortalCmd(portal ice.Any) {
|
||||
table := portal.(interface{ getTable() Table }).getTable()
|
||||
cmd("portal", portal)
|
||||
cmd("qrcode", qrcode{Tables: Tables{Table: table}})
|
||||
cmd("apply", Apply{Table: table})
|
||||
cmd("order", Order{Table: table})
|
||||
cmd("apply", apply{Table: table})
|
||||
cmd("order", order{Table: table})
|
||||
cmd("event", event{})
|
||||
}
|
||||
|
@ -13,29 +13,25 @@ type event struct {
|
||||
user user
|
||||
portal string `data:"true"`
|
||||
domain string `data:"gonganxitong"`
|
||||
list string `name:"list place_uid uid auto" help:"事件流" icon:"https://img.icons8.com/officel/80/property-with-timer.png"`
|
||||
}
|
||||
|
||||
func (s event) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
|
||||
model.USER_AVATAR, model.USER_NAME,
|
||||
ctx.INDEX, model.OPERATE, ctx.ARGS, model.INFO,
|
||||
model.USER_UID,
|
||||
)
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.PLACE_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, s.Key(s, model.UID), arg[1])
|
||||
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
m.PushAction().Action()
|
||||
m.Display("")
|
||||
s.Display(m)
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(event{}) }
|
||||
func init() { ice.TeamCtxCmd(event{Table: newTable()}) }
|
||||
|
||||
func (s event) Record(m *ice.Message, info string, arg ...string) {
|
||||
m.Cmd(s, s.Create, m.OptionSimple(model.USER_UID, model.PLACE_UID), model.INFO, info, ctx.INDEX, m.PrefixKey(), model.OPERATE, m.ActionKey(), ctx.ARGS, kit.Join(arg, ","))
|
||||
|
@ -1 +0,0 @@
|
||||
$output>div.item.card.rejected div.title span.status { border:var(--box-danger); color:var(--danger-bg-color); }
|
@ -7,54 +7,49 @@ import (
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type Order struct {
|
||||
type order struct {
|
||||
Table
|
||||
user user
|
||||
event event
|
||||
apply Apply
|
||||
apply apply
|
||||
portal string `data:"true"`
|
||||
domain string `data:"gonganxitong"`
|
||||
list string `name:"list place_uid uid auto" help:"权限审批" icon:"https://img.icons8.com/officel/80/receipt-approved.png" role:"void"`
|
||||
create string `name:"create user_uid* apply_uid* status*"`
|
||||
reject string `name:"reject" role:"void"`
|
||||
approve string `name:"approve" role:"void"`
|
||||
}
|
||||
|
||||
func (s Order) Create(m *ice.Message, arg ...string) {
|
||||
func (s order) Create(m *ice.Message, arg ...string) {
|
||||
s.Table.Create(m, arg...)
|
||||
s.SendTemplate(m, "", m.Option(model.USER_UID), m.Trans("role order create", "权限审批 请处理"))
|
||||
}
|
||||
func (s Order) Reject(m *ice.Message, arg ...string) {
|
||||
func (s order) Reject(m *ice.Message, arg ...string) {
|
||||
defer m.ToastProcess()()
|
||||
if s.status(m, OrderCreate, OrderRejected); m.IsErr() {
|
||||
return
|
||||
}
|
||||
m.Cmd(s.apply, s.apply.Reject, m.Option(model.UID))
|
||||
s.event.Record(m, kit.Format("❌ "+m.Trans("order rejected", "审批驳回")+" %s %s", s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
|
||||
s.event.Record(m, kit.JoinWord("❌", m.Trans("order rejected", "审批驳回"), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
|
||||
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), m.Trans("role order rejected", "权限审批 已驳回"))
|
||||
m.ProcessRefresh()
|
||||
}
|
||||
func (s Order) Approve(m *ice.Message, arg ...string) {
|
||||
func (s order) Approve(m *ice.Message, arg ...string) {
|
||||
defer m.ToastProcess()()
|
||||
if s.status(m, OrderCreate, OrderApproved); m.IsErr() {
|
||||
return
|
||||
}
|
||||
m.Cmd(s.apply, s.apply.Approve, m.Option(model.UID))
|
||||
s.event.Record(m, kit.Format("✅ "+m.Trans("order approved", "审批通过")+" %s %s", s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
|
||||
s.event.Record(m, kit.JoinWord("✅", m.Trans("order approved", "审批通过"), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
|
||||
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), m.Trans("role order approved", "权限审批 已通过"))
|
||||
m.ProcessRefresh()
|
||||
}
|
||||
func (s Order) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid").Fields(m, s.Key(s, model.CREATED_AT),
|
||||
model.USER_AVATAR, model.USER_NAME, model.BEGIN_TIME, model.END_TIME,
|
||||
s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.ORDER_STATUS,
|
||||
s.AS(s.Key(s, model.UID), model.ORDER_UID), s.Key(s.apply, model.UID), model.PLACE_UID,
|
||||
).Orders(m, s.Desc(model.CREATED_AT))
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
func (s order) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid").FieldsWithCreatedAT(m, s.apply,
|
||||
model.USER_AVATAR, model.USER_NAME,
|
||||
model.PLACE_UID, s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.ORDER_STATUS,
|
||||
model.BEGIN_TIME, model.END_TIME, s.AS(s.Key(s, model.UID), model.ORDER_UID),
|
||||
)
|
||||
if len(arg) == 1 {
|
||||
s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), model.PLACE_UID, arg[0])
|
||||
defer m.Sort(kit.Fields(model.ORDER_STATUS, model.CREATED_AT), []string{OrderCreate.String(), OrderApproved.String(), OrderRejected.String()}, ice.STR_R)
|
||||
} else if len(arg) == 2 {
|
||||
@ -62,24 +57,21 @@ func (s Order) List(m *ice.Message, arg ...string) {
|
||||
} else {
|
||||
return
|
||||
}
|
||||
m.RenameAppend(model.PLACE_UID, s.Keys(s.Place, model.UID))
|
||||
s.SelectJoin(m, s.Place, model.NAME, model.TYPE)
|
||||
s.RenameAppend(m, model.PLACE_UID, s.Keys(s.Place, model.UID)).SelectJoin(m, s.Place, model.NAME, model.TYPE)
|
||||
m.Table(func(value ice.Maps) {
|
||||
switch OrderStatus(kit.Int(value[model.ORDER_STATUS])) {
|
||||
case OrderCreate:
|
||||
if OrderStatus(kit.Int(value[model.ORDER_STATUS])) == OrderCreate {
|
||||
m.PushButton(s.Reject, s.Approve)
|
||||
default:
|
||||
} else {
|
||||
m.PushButton()
|
||||
}
|
||||
})
|
||||
m.Action()
|
||||
}).Action()
|
||||
s.UserPlace.RewriteAppend(m)
|
||||
s.Display(m)
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(Order{Table: newTable()}) }
|
||||
func init() { ice.TeamCtxCmd(order{Table: newTable()}) }
|
||||
|
||||
func (s Order) status(m *ice.Message, from, todo OrderStatus, arg ...string) *ice.Message {
|
||||
func (s order) status(m *ice.Message, from, todo OrderStatus, arg ...string) *ice.Message {
|
||||
msg := s.Table.Select(m.Spawn(), model.UID, m.Option(model.ORDER_UID), model.USER_UID, m.Option(model.USER_UID))
|
||||
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
|
||||
if status := OrderStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) {
|
||||
|
@ -9,8 +9,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
{view: html.TITLE, list: [{text: value.user_name},
|
||||
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
|
||||
]},
|
||||
{view: html.STATUS, list: [
|
||||
{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
|
||||
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
|
||||
{text: [can.user.transValue(can, value, ORDER_STATUS)+" "+(status == "create" || status == "submit"? "🕑": status == "rejected"? "❌": "✅"), "", mdb.STATUS]},
|
||||
]},
|
||||
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
|
||||
|
@ -14,16 +14,14 @@ type place struct {
|
||||
func (s place) User(m *ice.Message, arg ...string) {
|
||||
userPlace := userPlace{}
|
||||
s.Tables(m, "left join user_places on places.uid = user_places.place_uid", s.user).FieldsWithCreatedAT(m, userPlace,
|
||||
model.USER_AVATAR, model.USER_NAME, model.BEGIN_TIME, model.END_TIME, model.USER_PLACE_ROLE,
|
||||
model.USER_AVATAR, model.USER_NAME, model.USER_PLACE_ROLE, model.BEGIN_TIME, model.END_TIME,
|
||||
)
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.PLACE_UID, arg[0])
|
||||
} else {
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(userPlace, model.UID), arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
s.RewriteAppend(m)
|
||||
}
|
||||
@ -35,9 +33,9 @@ const (
|
||||
PlaceHouse PlaceType = iota
|
||||
PlaceHotel
|
||||
PlaceStore
|
||||
PlacePublic
|
||||
PlaceSchool
|
||||
PlaceOffice
|
||||
PlacePublic
|
||||
PlaceFactory
|
||||
PlaceHospital
|
||||
)
|
||||
@ -46,9 +44,9 @@ var PlaceTypeList = map[PlaceType]string{
|
||||
PlaceHouse: "house",
|
||||
PlaceHotel: "hotel",
|
||||
PlaceStore: "store",
|
||||
PlacePublic: "public",
|
||||
PlaceSchool: "school",
|
||||
PlaceOffice: "office",
|
||||
PlacePublic: "public",
|
||||
PlaceFactory: "factory",
|
||||
PlaceHospital: "hospital",
|
||||
}
|
||||
|
@ -1,19 +1,12 @@
|
||||
package gonganxitong
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
import "shylinux.com/x/ice"
|
||||
|
||||
type placeUser struct {
|
||||
Tables
|
||||
place place
|
||||
}
|
||||
|
||||
func (s placeUser) Init(m *ice.Message, arg ...string) {
|
||||
s.Portal.Show(m, model.ROLE, "creator,landlord")
|
||||
}
|
||||
func (s placeUser) List(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(s.place, s.place.User, arg).PushAction().Action().Display("")
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
if (msg.IsDetail()) { can.onexport.share_title(can, msg, "user_place_role"); return msg.Show(can) }
|
||||
can.onimport.itemcards(can, msg, function(value) { value._style = [value.user_place_role]
|
||||
_init: function(can, msg) { var USER_PLACE_ROLE = "user_place_role"
|
||||
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
|
||||
can.onimport.itemcards(can, msg, function(value) { value._style = [value[USER_PLACE_ROLE]]
|
||||
return [
|
||||
{view: html.TITLE, list: [{text: value.user_name},
|
||||
{text: [can.user.transValue(can, value, "user_place_role"), "", [aaa.ROLE, value.user_place_role]]},
|
||||
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
|
||||
]},
|
||||
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
|
||||
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
|
||||
|
@ -18,11 +18,10 @@ type Portal struct {
|
||||
export string `data:"true"`
|
||||
short string `data:"index"`
|
||||
field string `data:"time,name,icons,index,order,enable,type,role"`
|
||||
inputs string `name:"inputs" role:"void"`
|
||||
list string `name:"list place_uid index uid auto" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
|
||||
placeRemove string `name:"placeRemove uid*" style:"danger" role:"void"`
|
||||
scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" role:"void"`
|
||||
placeRemove string `name:"placeRemove uid*" role:"void"`
|
||||
scanQRCode string `name:"scanQRCode type text" role:"void"`
|
||||
}
|
||||
|
||||
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||
@ -76,8 +75,7 @@ func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
|
||||
if m.Option(mdb.TYPE) == mdb.TEXT {
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID), s.Key(s.Place, model.UID), m.Option(mdb.TEXT))
|
||||
m.Cmdy(s.UserPlace, s.Create, args, model.ROLE, UserPlaceVisitor)
|
||||
}
|
||||
if m.Option(mdb.TYPE) == web.LINK {
|
||||
} else if m.Option(mdb.TYPE) == web.LINK {
|
||||
args := m.ParseURL(m.Option(mdb.TEXT))
|
||||
if len(args) > 1 && args[1] == m.Prefix("apply") {
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID), s.Key(s.Place, model.UID), args[0])
|
||||
|
@ -1,75 +1,55 @@
|
||||
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type", STREET_NAME = "street_name"
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.user.isMobile && can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
||||
can.isCmdMode() && can.user.isMobile && can.onappend.style(can, html.OUTPUT)
|
||||
can.onimport.myPortal(can, msg)
|
||||
},
|
||||
myValue: function(can, value, PLACE_UID, PLACE_NAME, STREET_NAME) {
|
||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
||||
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
|
||||
myValue: function(can, value) {
|
||||
return [
|
||||
{view: html.TITLE, list: [{text: value[PLACE_NAME]},
|
||||
{text: [can.user.transValue(can, value, PLACE_NAME.replace("_name", "_type")), "", mdb.TYPE]},
|
||||
value[USER_PLACE_ROLE] != "creator" && {text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", aaa.ROLE]},
|
||||
{view: html.TITLE, list: [{text: value._name},
|
||||
{text: [value.__type, "", [mdb.TYPE, value._type]]},
|
||||
value._role != "creator" && {text: [value.__role, "", [aaa.ROLE, value._role]]},
|
||||
]},
|
||||
{view: html.STATUS, list: [
|
||||
{text: value[PLACE_UID].slice(0, 6)}, {text: value.city_name}, {text: value[STREET_NAME]},
|
||||
{text: value._uid.slice(0, 6)}, {text: value.city_name}, {text: value._street},
|
||||
]},
|
||||
]
|
||||
},
|
||||
myPortal: function(can, msg) {
|
||||
var PLACE_UID = msg.Option("_place_uid"), PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name")
|
||||
can.sup.current = can.sup.current||{}, can.isCmdMode() && (can.db.hash = can.misc.SearchHash(can))
|
||||
can.isCmdMode() && (can.db.hash = can.misc.SearchHash(can)), can.db.hash[0] && can.onexport.session(can, PLACE_UID, can.db.hash[0])
|
||||
if (can.Option(PLACE_UID) == "") {
|
||||
msg.Table(function(value) { msg.Push(mdb.ICONS, can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE]))||"") })
|
||||
if (can.db.hash.length > 1 && can.db.hash[0]) { return can.Option(PLACE_UID, can.db.hash[0]), can.Option(ctx.INDEX, can.db.hash[1]), can.Update() }
|
||||
can.db.hash[0] && can.onexport.session(can, PLACE_UID, can.db.hash[0])
|
||||
can.ui = can.page.Append(can, can._output, ["myplace.list", "myindex.list"])
|
||||
can.page.Append(can, can.ui.myplace, [{view: html.TITLE, list: [
|
||||
{text: can.user.trans(can, "My "+can.base.capital(PLACE_NAME.replace("_name", "")), null, html.INPUT)},
|
||||
{view: html.ACTION, _init: function(target) { msg.Option(ice.MSG_ACTION) && can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}
|
||||
]}])
|
||||
var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME, STREET_NAME)
|
||||
var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE)
|
||||
msg.Length() > 0 && can.run({}, [uid], function(msg) {
|
||||
can.page.Append(can, can.ui.myindex, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Index", "我的应用")}]}])
|
||||
can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID), can.onimport.selectIndex(can, msg, can.sup.current, PLACE_UID, PLACE_NAME)
|
||||
}), can.user.agent.init(can)
|
||||
can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID), can.onimport.selectIndex(can, can.sup.current)
|
||||
})
|
||||
} else {
|
||||
can.onimport.myData(can, msg, can._output, PLACE_UID, PLACE_NAME)
|
||||
}
|
||||
},
|
||||
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME, STREET_NAME) { var place_uid
|
||||
var PLACE_UID = msg.Option("_place_uid"), PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME, PLACE_TYPE) { var place_uid
|
||||
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name")
|
||||
var _target = can.page.Append(can, target||can._output, [html.OUTPUT])._target
|
||||
can.page.Append(can, _target, msg.Table(function(value) {
|
||||
place_uid = place_uid||value[PLACE_UID], can.base.isIn(value[PLACE_UID], can.onexport.session(can, PLACE_UID)||"", can.db.hash[0]||"") && (place_uid = value[PLACE_UID])
|
||||
place_uid == value[PLACE_UID] && (can.onexport.title(can, value[PLACE_NAME]), can.sup.current = value)
|
||||
value._uid = value[PLACE_UID], value._name = value[PLACE_NAME], value._type = value[PLACE_TYPE], value._role = value[USER_PLACE_ROLE]
|
||||
can.ui._target = can.page.Append(can, target||can._output, [html.OUTPUT])._target
|
||||
can.page.Append(can, can.ui._target, msg.Table(function(value) {
|
||||
place_uid = place_uid||value[PLACE_UID], value[PLACE_UID] == can.onexport.session(can, PLACE_UID) && (place_uid = value[PLACE_UID])
|
||||
place_uid == value[PLACE_UID] && (can.sup.current = value, can.onexport.title(can, value[PLACE_NAME]))
|
||||
value._uid = value[PLACE_UID], value._name = value[PLACE_NAME], value._street = value[STREET_NAME]
|
||||
value._type = value[PLACE_TYPE], value.__type = can.user.transValue(can, value, PLACE_TYPE)
|
||||
value._role = value[USER_PLACE_ROLE], value.__role = can.user.transValue(can, value, USER_PLACE_ROLE)
|
||||
value.icons = can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE]))
|
||||
return can.onimport.itemcard(can, value, can.onimport.myValue(can, value, PLACE_UID, PLACE_NAME, STREET_NAME), function(event) {
|
||||
can.sup.current = value, can.onimport.selectIndex(can, msg, can.sup.current, PLACE_UID, PLACE_NAME)
|
||||
can.onexport.hash(can, value[PLACE_UID]), can.onexport.session(can, PLACE_UID, value[PLACE_UID]), can.onexport.title(can, value[PLACE_NAME])
|
||||
can.user.agent.init(can, can.user.info.titles)
|
||||
can.onexport.value(can, value, PLACE_UID, PLACE_NAME)
|
||||
})
|
||||
}))
|
||||
can.page.Select(can, _target, "div.item.card.uid-"+place_uid, function(item) { can.onmotion.select(can, _target, html.DIV_ITEM, item) })
|
||||
can.page.Append(can, target, [{view: html.ACTION, _init: function(target) { msg.Option(ice.MSG_ACTION) && can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}])
|
||||
can.onexport.hash(can, place_uid), can.onexport.session(can, PLACE_UID, place_uid); return place_uid
|
||||
},
|
||||
selectIndex: function(can, msg, value, PLACE_UID, PLACE_NAME) {
|
||||
var PLACE_UID = msg.Option("_place_uid"), PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name")
|
||||
can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) {
|
||||
var list = target.className.split(" ")
|
||||
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value[PLACE_TYPE]) == -1) {
|
||||
can.onmotion.toggle(can, target, false)
|
||||
} else if (list.indexOf(aaa.ROLE) > -1 && list.indexOf(value[USER_PLACE_ROLE]) == -1) {
|
||||
can.onmotion.toggle(can, target, false)
|
||||
} else {
|
||||
can.onmotion.toggle(can, target, true)
|
||||
}
|
||||
})
|
||||
})), can.sup.current && can.onexport.value(can, can.sup.current, PLACE_UID, PLACE_NAME)
|
||||
can.page.Append(can, target, [{view: html.ACTION, _init: function(target) { can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}])
|
||||
return place_uid
|
||||
},
|
||||
myIndex: function(can, msg, target, PLACE_UID) {
|
||||
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100), height = width+20; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4, height = width+20)
|
||||
@ -80,33 +60,50 @@ Volcanos(chat.ONIMPORT, {
|
||||
)], style: {height: height, width: width}, list: [
|
||||
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
|
||||
], onclick: function(event) {
|
||||
can.page.ClassList.del(can, can._fields, "_back")
|
||||
can.page.ClassList.add(can, can._fields, "_goto")
|
||||
can.Option(PLACE_UID, can.onexport.session(can, PLACE_UID)), can.Option(ctx.INDEX, value.index), can.Update()
|
||||
}}
|
||||
}))
|
||||
},
|
||||
selectIndex: function(can, value) {
|
||||
can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) {
|
||||
var list = target.className.split(" ")
|
||||
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value._type) == -1) {
|
||||
can.onmotion.toggle(can, target, false)
|
||||
} else if (list.indexOf(aaa.ROLE) > -1 && list.indexOf(value._role) == -1) {
|
||||
can.onmotion.toggle(can, target, false)
|
||||
} else {
|
||||
can.onmotion.toggle(can, target, true)
|
||||
}
|
||||
})
|
||||
},
|
||||
myData: function(can, msg, target, PLACE_UID, PLACE_NAME) {
|
||||
msg.Table(function(value) { function back() {} function refresh() {}
|
||||
var list = [can.page.button(can, can.user.trans(can, "goback", "返回"), function(event) { back() }), can.page.button(can, can.user.trans(can, "reload", "刷新"), function(event) { refresh() })]
|
||||
var ui = can.page.Append(can, can._output, [{view: html.ACTION}])
|
||||
if (can.db.hash.length > 2 && can.db.hash[0] && can.db.hash[2]) { value.args = [can.db.hash[0], can.db.hash[2]] }
|
||||
value.style = html.OUTPUT, value.height = can.ConfHeight()-html.ACTION_HEIGHT
|
||||
can.onexport.title(can, value.help, msg.Option(PLACE_NAME))
|
||||
can.onappend.plugin(can, value, function(sub) { refresh = function() { sub.Update() }
|
||||
can.core.List(["_trans", "_trans.input", "_trans.value", "_icons", "_style"], function(key) {
|
||||
can.core.List(["_trans", "_icons", "_style", "_trans.input", "_trans.value"], function(key) {
|
||||
var value = sub.Conf(key); value && can.core.Item(can.Conf(key), function(k, v) { value[k] = value[k]||v })
|
||||
})
|
||||
sub.Conf(PLACE_NAME, msg.Option(PLACE_NAME))
|
||||
can.onexport.title(can, value.help, sub.Conf(PLACE_NAME, msg.Option(PLACE_NAME)))
|
||||
sub.onexport.title = function(sub) { can.onexport.title.apply(can.onexport, [can].concat(can.core.List(arguments).slice(1))) }
|
||||
sub.onexport._output = function(_sub, msg) {
|
||||
can.core.Item(can.onimport, function(key, value) { _sub.onimport[key] = _sub.onimport[key]||value })
|
||||
can.core.Item(can.onexport, function(key, value) { _sub.onexport[key] = _sub.onexport[key]||value })
|
||||
}
|
||||
can.page.Appends(can, ui.action, list)
|
||||
back = function() { can.page.ClassList.add(can, can._fields, "_back")
|
||||
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update()
|
||||
}
|
||||
sub.onexport.output = function(_sub, msg) { can.onappend.style(sub, html.OUTPUT)
|
||||
can.page.Appends(can, ui.action, list), msg.Option(ice.MSG_ACTION) && can.onappend._action(sub, msg.Option(ice.MSG_ACTION), ui.action, null, true)
|
||||
can.onexport.hash(can, can.Option(PLACE_UID), value.index, sub.Option(UID))
|
||||
can.onexport.title(can, sub.ConfHelp(), sub.Conf(PLACE_NAME), msg.Option("_share_title")||"")
|
||||
can.user.agent.init(can, msg.Option("_share_content"), msg.Option("_share_icons")||value.icons)
|
||||
back = function() {
|
||||
can.page.Appends(can, ui.action, list), msg.Option(ice.MSG_ACTION) && can.onappend._action(sub, msg.Option(ice.MSG_ACTION), ui.action, null, true)
|
||||
back = function() { can.page.ClassList.add(can, can._fields, "_back")
|
||||
if (sub.Option(UID)) {
|
||||
can.onexport.hash(can, can.Option(PLACE_UID), can.Option(ctx.INDEX)), sub.Option(UID, ""), sub.Update()
|
||||
} else {
|
||||
@ -119,6 +116,11 @@ Volcanos(chat.ONIMPORT, {
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
value: function(can, value, PLACE_UID, PLACE_NAME) {
|
||||
can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(item) { can.onmotion.select(can, can.ui._target, html.DIV_ITEM, item) })
|
||||
can.sup.current = value, can.onimport.selectIndex(can, can.sup.current), can.onexport.title(can, value[PLACE_NAME])
|
||||
can.onexport.session(can, PLACE_UID, value[PLACE_UID]), can.onexport.hash(can, value[PLACE_UID]), can.user.agent.init(can)
|
||||
},
|
||||
share_title: function(can, msg, title, role) {
|
||||
msg.Option("_share_icons", msg.Append("user_avatar"))
|
||||
msg.Option("_share_content", can.user.transValue(can, msg, role)+" "+msg.Append("user_name"))
|
||||
|
@ -4,6 +4,9 @@
|
||||
"placeCreate": "添加场所",
|
||||
"placeRemove": "删除场所",
|
||||
"qrcode": "场所码",
|
||||
"apply": "权限申请",
|
||||
"order": "权限审批",
|
||||
"event": "事件流",
|
||||
"email": "邮箱配置",
|
||||
"placeUser": "场所用户",
|
||||
"cancel": "取消",
|
||||
@ -11,59 +14,36 @@
|
||||
"reject": "驳回",
|
||||
"approve": "通过",
|
||||
"icons": {
|
||||
"scanQRCode": "bi bi-qr-code-scan",
|
||||
"placeRemove": "bi bi-plus-square-dotted",
|
||||
"placeCreate": "bi bi-plus-square-dotted",
|
||||
"qrcode": "https://img.icons8.com/officel/80/qr-code.png",
|
||||
"apply": "https://img.icons8.com/officel/80/edit-property.png",
|
||||
"order": "https://img.icons8.com/officel/80/receipt-approved.png",
|
||||
"event": "https://img.icons8.com/officel/80/property-with-timer.png",
|
||||
"email": "https://img.icons8.com/officel/80/reading-confirmation.png",
|
||||
"placeUser": "https://img.icons8.com/officel/80/person-at-home.png"
|
||||
},
|
||||
"style": {
|
||||
"placeRemove": "danger"
|
||||
},
|
||||
"input": {
|
||||
"My Place": "我的场所",
|
||||
"city_uid": "城市",
|
||||
"city_name": "城市名称",
|
||||
"street_uid": "街道",
|
||||
"street_name": "街道名称",
|
||||
"place_uid": "场所",
|
||||
"apply_status": "申请状态",
|
||||
"order_status": "审批状态",
|
||||
"begin_time": "起始时间",
|
||||
"end_time": "结束时间",
|
||||
"operate": "操作",
|
||||
"user_name": "用户昵称",
|
||||
"user_avatar": "用户头像",
|
||||
"user_place_role": "用户角色",
|
||||
"place_name": "场所名称",
|
||||
"place_type": "场所类型",
|
||||
"place_address": "场所地址",
|
||||
"user_place_role": "用户角色",
|
||||
"user_uid": "用户",
|
||||
"user_name": "用户昵称",
|
||||
"user_avatar": "用户头像",
|
||||
"apply_status": "申请状态",
|
||||
"order_status": "审批状态",
|
||||
"order_uid": "审批",
|
||||
"begin_time": "起始时间",
|
||||
"end_time": "结束时间",
|
||||
"operate": "操作"
|
||||
"street_name": "街道名称",
|
||||
"city_name": "城市名称"
|
||||
},
|
||||
"value": {
|
||||
"place_type": {
|
||||
"house": "住宅",
|
||||
"hotel": "宾馆",
|
||||
"store": "商铺",
|
||||
"public": "公共",
|
||||
"school": "学校",
|
||||
"office": "办公",
|
||||
"factory": "工厂",
|
||||
"hospital": "医院",
|
||||
"icons": {
|
||||
"house": "https://img.icons8.com/officel/80/cottage.png",
|
||||
"hotel": "https://img.icons8.com/officel/80/5-star-hotel.png",
|
||||
"store": "https://img.icons8.com/officel/80/online-store.png",
|
||||
"public": "https://img.icons8.com/officel/80/university.png",
|
||||
"school": "https://img.icons8.com/officel/80/classroom.png",
|
||||
"office": "https://img.icons8.com/officel/80/building.png",
|
||||
"factory": "https://img.icons8.com/officel/80/manufacturing.png",
|
||||
"hospital": "https://img.icons8.com/officel/80/clinic.png"
|
||||
}
|
||||
},
|
||||
"user_place_role": {
|
||||
"creator": "创建人",
|
||||
"admin": "管理员",
|
||||
"landlord": "房东",
|
||||
"tenant": "租客",
|
||||
"visitor": "访客"
|
||||
},
|
||||
"apply_status": {
|
||||
"create": "待提交",
|
||||
"cancel": "已取消",
|
||||
@ -75,6 +55,33 @@
|
||||
"create": "待审批",
|
||||
"rejected": "已驳回",
|
||||
"approved": "已通过"
|
||||
},
|
||||
"user_place_role": {
|
||||
"creator": "创建人",
|
||||
"visitor": "访客",
|
||||
"landlord": "房东",
|
||||
"tenant": "租客",
|
||||
"admin": "管理员"
|
||||
},
|
||||
"place_type": {
|
||||
"house": "住宅",
|
||||
"hotel": "宾馆",
|
||||
"store": "商铺",
|
||||
"school": "学校",
|
||||
"office": "办公",
|
||||
"public": "公共",
|
||||
"factory": "工厂",
|
||||
"hospital": "医院",
|
||||
"icons": {
|
||||
"house": "https://img.icons8.com/officel/80/cottage.png",
|
||||
"hotel": "https://img.icons8.com/officel/80/5-star-hotel.png",
|
||||
"store": "https://img.icons8.com/officel/80/online-store.png",
|
||||
"school": "https://img.icons8.com/officel/80/classroom.png",
|
||||
"office": "https://img.icons8.com/officel/80/building.png",
|
||||
"public": "https://img.icons8.com/officel/80/university.png",
|
||||
"factory": "https://img.icons8.com/officel/80/manufacturing.png",
|
||||
"hospital": "https://img.icons8.com/officel/80/clinic.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,4 +8,4 @@ field web.code.mysql.client
|
||||
field web.code.mysql.query args `mysql gonganxitong`
|
||||
field web.code.db.database
|
||||
field web.code.db.driver
|
||||
field web.code.db.models
|
||||
field web.code.db.models
|
@ -13,6 +13,4 @@ func (s qrcode) List(m *ice.Message, arg ...string) {
|
||||
m.EchoQRCode(s.Link(m, arg[0]))
|
||||
}
|
||||
|
||||
func init() {
|
||||
ice.TeamCtxCmd(qrcode{Tables: Tables{Table: Table{UserPlace: userPlace{}, Place: place{}, Street: street{}}}})
|
||||
}
|
||||
func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) }
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
@ -13,7 +14,7 @@ import (
|
||||
type user struct {
|
||||
Table
|
||||
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
|
||||
create string `name:"create openid* headimgurl nickname"`
|
||||
create string `name:"create openid* avatar nickname"`
|
||||
email string `name:"email email*"`
|
||||
}
|
||||
|
||||
@ -31,7 +32,7 @@ func (s user) Email(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type name hash
|
||||
msg := s.Select(m, model.UID, arg[1])
|
||||
m.Cmdy("web.chat.wx.template", "", m.Config("template"), msg.Append(model.OPEN_ID), kit.Select("", arg, 2),
|
||||
m.Cmdy("web.chat.wx.template", "", m.Config(nfs.TEMPLATE), msg.Append(model.OPEN_ID), kit.Select("", arg, 2),
|
||||
"thing7", kit.Select("", arg, 3), "thing12", kit.Select("", arg, 4), "character_string2", kit.Cut(kit.Select("", arg, 5), 6),
|
||||
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", kit.Select(m.Option(ice.MSG_USERNICK), arg, 0),
|
||||
)
|
||||
|
@ -16,13 +16,14 @@ type userPlace struct {
|
||||
func (s userPlace) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.place, s.street, s.city).FieldsWithCreatedAT(m, s,
|
||||
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
|
||||
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS,
|
||||
model.PLACE_UID,
|
||||
model.PLACE_UID, model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS,
|
||||
)
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.USER_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.USER_UID, arg[0], model.PLACE_UID, arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
s.RewriteAppend(m)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user