mirror of
https://shylinux.com/x/community
synced 2025-04-25 17:48:06 +08:00
opt some
This commit is contained in:
parent
4ef9c83924
commit
bf9fb9afcd
@ -13,70 +13,34 @@ type Apply struct {
|
|||||||
event event
|
event event
|
||||||
portal string `data:"true"`
|
portal string `data:"true"`
|
||||||
domain string `data:"gonganxitong"`
|
domain string `data:"gonganxitong"`
|
||||||
create string `name:"create place_uid* user_place_role*:select begin_time:select@date end_time:select@date" role:"void"`
|
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" role:"void" help:"权限申请" icon:"https://img.icons8.com/officel/80/edit-property.png"`
|
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"`
|
cancel string `name:"cancel" role:"void"`
|
||||||
submit string `name:"submit" role:"void"`
|
submit string `name:"submit" role:"void"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Apply) Inputs(m *ice.Message, arg ...string) {
|
|
||||||
s.Place.(interface{ Inputs(*ice.Message, ...string) }).Inputs(m, arg...)
|
|
||||||
}
|
|
||||||
func (s Apply) Init(m *ice.Message, arg ...string) {
|
func (s Apply) Init(m *ice.Message, arg ...string) {
|
||||||
s.Table.Init(m, arg...)
|
s.Table.Init(m, arg...)
|
||||||
place_uid := s.Keys(s.Place, model.UID)
|
place_uid, user_place_role := s.Keys(s.Place, model.UID), s.Keys(s.UserPlace, model.ROLE)
|
||||||
user_place_role := s.Keys(s.UserPlace, model.ROLE)
|
m.Design(s.Create, "", user_place_role+"*:select")
|
||||||
m.Design("create", "", place_uid+"* "+user_place_role+"*:select")
|
m.Design(s.List, "", place_uid+" uid auto")
|
||||||
m.Design("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) Create(m *ice.Message, arg ...string) {
|
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.Place, model.UID), model.PLACE_UID)
|
||||||
arg = kit.TransArgKeys(arg, s.Keys(s.UserPlace, model.ROLE), model.ROLE)
|
arg = kit.TransArgKeys(arg, s.Keys(s.UserPlace, model.ROLE), model.ROLE)
|
||||||
arg = kit.TransArgValueTime(arg, model.BEGIN_TIME, model.END_TIME)
|
arg = kit.TransArgValueTime(arg, model.BEGIN_TIME, model.END_TIME)
|
||||||
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID), "tables", s.Keys(s.Place, model.UID), model.STATUS, ApplyCreate)...)
|
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)...)
|
||||||
}
|
|
||||||
func (s Apply) Cancel(m *ice.Message, arg ...string) {
|
|
||||||
msg := s.status(m, ApplyCreate, ApplyCancel)
|
|
||||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), "权限申请 已取消")
|
|
||||||
}
|
|
||||||
func (s Apply) Submit(m *ice.Message, arg ...string) {
|
|
||||||
msg := s.status(m, ApplyCreate, ApplySubmit)
|
|
||||||
if m.WarnNotValid(msg.IsErr()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer s.event.Record(m, m.Option(model.UID))
|
|
||||||
defer m.ToastProcess()()
|
|
||||||
role := UserPlaceCreator
|
|
||||||
switch UserPlaceRole(kit.Int(msg.Append(model.ROLE))) {
|
|
||||||
case UserPlaceLandlord:
|
|
||||||
role = UserPlaceCreator
|
|
||||||
case UserPlaceTenant, UserPlaceAdmin:
|
|
||||||
role = UserPlaceLandlord
|
|
||||||
}
|
|
||||||
msg = m.Cmd(s.UserPlace, s.Select, m.OptionSimple(s.Keys(s.Place, model.UID)), model.ROLE, role)
|
|
||||||
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)
|
|
||||||
s.SendTemplate(m, m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID)).Append(model.NAME), m.Option(model.USER_UID), "场所权限申请 已提交")
|
|
||||||
}
|
|
||||||
func (s Apply) Reject(m *ice.Message, arg ...string) {
|
|
||||||
msg := s.status(m, ApplySubmit, ApplyRejected)
|
|
||||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), "权限申请 已驳回 ❌")
|
|
||||||
}
|
|
||||||
func (s Apply) Approve(m *ice.Message, arg ...string) {
|
|
||||||
msg := s.status(m, ApplySubmit, ApplyApproved)
|
|
||||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), "权限申请 已通过 ✅")
|
|
||||||
m.Cmd(s.UserPlace, s.Create, msg.AppendSimple(model.USER_UID, model.ROLE), s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
|
|
||||||
}
|
}
|
||||||
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,
|
s.Tables(m, s.user).FieldsWithCreatedAT(m, s, model.USER_AVATAR, model.USER_NAME,
|
||||||
model.USER_AVATAR, model.USER_NAME,
|
|
||||||
s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.APPLY_STATUS,
|
s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.APPLY_STATUS,
|
||||||
model.BEGIN_TIME, model.END_TIME,
|
model.BEGIN_TIME, model.END_TIME, model.PLACE_UID,
|
||||||
model.PLACE_UID,
|
|
||||||
)
|
)
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
|
return
|
||||||
if m.IsTech() {
|
if m.IsTech() {
|
||||||
s.Select(m)
|
s.Select(m)
|
||||||
}
|
}
|
||||||
@ -93,7 +57,7 @@ func (s Apply) List(m *ice.Message, arg ...string) {
|
|||||||
ApplyCancel.String(),
|
ApplyCancel.String(),
|
||||||
}, ice.STR_R)
|
}, ice.STR_R)
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
s.Table.SelectDetail(m, 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], s.Key(s, model.UID), arg[1])
|
||||||
if ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) == ApplySubmit {
|
if ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) == ApplySubmit {
|
||||||
m.EchoQRCode(Portal{}.Link(m, arg[0], m.Prefix("order"), arg[1]))
|
m.EchoQRCode(Portal{}.Link(m, arg[0], m.Prefix("order"), arg[1]))
|
||||||
}
|
}
|
||||||
@ -108,21 +72,47 @@ func (s Apply) List(m *ice.Message, arg ...string) {
|
|||||||
m.PushButton()
|
m.PushButton()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
m.Info("what %v", m.FormatMeta())
|
s.UserPlace.RewriteAppend(m)
|
||||||
s.UserPlace.(interface {
|
|
||||||
RewriteAppend(*ice.Message, ...string) *ice.Message
|
|
||||||
}).RewriteAppend(m)
|
|
||||||
m.Info("what %v", m.FormatMeta())
|
|
||||||
m.Info("what %v", m.FormatMeta())
|
|
||||||
s.Display(m)
|
s.Display(m)
|
||||||
}
|
}
|
||||||
|
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", "权限申请 已取消"))
|
||||||
|
}
|
||||||
|
func (s Apply) Submit(m *ice.Message, arg ...string) {
|
||||||
|
msg := s.status(m, ApplyCreate, ApplySubmit)
|
||||||
|
if m.WarnNotValid(msg.IsErr()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer m.ToastProcess()()
|
||||||
|
role := UserPlaceCreator
|
||||||
|
switch UserPlaceRole(kit.Int(msg.Append(model.ROLE))) {
|
||||||
|
case UserPlaceLandlord:
|
||||||
|
role = UserPlaceCreator
|
||||||
|
case UserPlaceTenant, UserPlaceAdmin:
|
||||||
|
role = UserPlaceLandlord
|
||||||
|
}
|
||||||
|
msg = m.Cmd(s.UserPlace, s.Select, m.OptionSimple(s.Keys(s.Place, model.UID)), model.ROLE, role)
|
||||||
|
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)
|
||||||
|
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", "权限申请 已提交"))
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
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 NewApply(userPlace, place ice.Any, street Container) Apply {
|
|
||||||
return Apply{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
|
|
||||||
}
|
|
||||||
|
|
||||||
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)...)
|
msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.UID)...)
|
||||||
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
|
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
|
_init: function(can, msg) {
|
||||||
var PLACE_NAME = msg.Option("_place_name")
|
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), APPLY_STATUS = "apply_status"
|
||||||
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
|
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
|
||||||
var STREET_NAME = msg.Option("_street_name")
|
can.onimport.itemcards(can, msg, function(value) { value._style = [value[PLACE_TYPE], value[USER_PLACE_ROLE], value[APPLY_STATUS]]
|
||||||
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.place_type, value.user_place_role, value.apply_status]
|
var status = value[APPLY_STATUS]
|
||||||
return can.onimport.itemcard(can, value, [
|
return [
|
||||||
{view: html.TITLE, list: [{text: value[PLACE_NAME]},
|
{view: html.TITLE, list: [{text: value[PLACE_NAME]},
|
||||||
{text: [can.user.transValue(can, value, PLACE_TYPE), "", mdb.TYPE]},
|
{text: [can.user.transValue(can, value, PLACE_TYPE), "", mdb.TYPE]},
|
||||||
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", aaa.ROLE]},
|
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
|
||||||
{text: [can.user.transValue(can, value, "apply_status"), "", mdb.STATUS]},
|
]},
|
||||||
|
{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.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]}]},
|
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
|
||||||
{view: html.STATUS, list: [{text: value.city_name}, {text: value[STREET_NAME]}]},
|
{view: html.STATUS, list: [{text: value.city_name}, {text: value[STREET_NAME]}]},
|
||||||
])
|
]
|
||||||
}))
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
@ -18,7 +18,3 @@ func (s city) FindOrCreateByName(m *ice.Message, arg ...string) {
|
|||||||
arg[0], arg[1] = model.CITY_UID, msg.Append(model.UID)
|
arg[0], arg[1] = model.CITY_UID, msg.Append(model.UID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type City struct{ city }
|
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(City{}) }
|
|
||||||
|
@ -4,17 +4,28 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
|
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
|
icebergs "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
|
// "shylinux.com/x/toolkits/logs"
|
||||||
|
|
||||||
"shylinux.com/x/community/src/gonganxitong/model"
|
"shylinux.com/x/community/src/gonganxitong/model"
|
||||||
"shylinux.com/x/mysql-story/src/db"
|
"shylinux.com/x/mysql-story/src/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Tabler interface {
|
||||||
|
RewriteAppend(m *ice.Message, arg ...string) *ice.Message
|
||||||
|
TransValue(m *ice.Message, key string, arg ...string) string
|
||||||
|
TransRole(m *ice.Message, arg ...string) string
|
||||||
|
}
|
||||||
|
type Container interface {
|
||||||
|
FindOrCreateByName(m *ice.Message, arg ...string)
|
||||||
|
}
|
||||||
|
|
||||||
type Table struct {
|
type Table struct {
|
||||||
db.Table
|
db.Table
|
||||||
UserPlace ice.Any
|
UserPlace Tabler
|
||||||
Place ice.Any
|
Place Tabler
|
||||||
Street Container
|
Street Container
|
||||||
inputs string `name:"inputs" role:"void"`
|
inputs string `name:"inputs" role:"void"`
|
||||||
list string `name:"list place_uid uid auto" role:"void"`
|
list string `name:"list place_uid uid auto" role:"void"`
|
||||||
@ -42,15 +53,33 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
|
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
|
||||||
if len(arg) == 0 || len(arg) == 1 {
|
if len(arg) == 0 {
|
||||||
if m.IsTech() {
|
if m.IsTech() {
|
||||||
s.Table.List(m)
|
s.Table.Select(m)
|
||||||
}
|
}
|
||||||
|
} else if len(arg) == 1 {
|
||||||
|
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
s.Table.SelectDetail(m, model.UID, arg[1])
|
s.Table.SelectDetail(m, model.UID, arg[1])
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
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...)...)
|
||||||
|
if len(arg) == 1 {
|
||||||
|
s.Table.Select(m, s.Key(s, s.Keys(group, 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])
|
||||||
|
} else {
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
s.SelectJoinUser(m)
|
||||||
|
group.RewriteAppend(m)
|
||||||
|
return m
|
||||||
|
}
|
||||||
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
|
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
|
||||||
return s.SelectJoin(m, user{}, model.NAME, model.AVATAR)
|
return s.SelectJoin(m, user{}, model.NAME, model.AVATAR)
|
||||||
}
|
}
|
||||||
@ -67,15 +96,29 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
})
|
})
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
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
|
||||||
|
} else {
|
||||||
|
return kit.Select(value, kit.Value(m.Target().Commands[m.CommandKey()].Meta, "_trans.value."+key+"."+value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s Table) TransRole(m *ice.Message, arg ...string) string {
|
||||||
|
value := kit.Select(m.Option(s.Keys(s.UserPlace, model.ROLE)), arg, 0)
|
||||||
|
role := s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE), arg...)
|
||||||
|
return kit.Format(`<span class="role %s">%s</span>`, value, role)
|
||||||
|
}
|
||||||
func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string) {
|
func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string) {
|
||||||
if !m.IsErr() {
|
if !m.IsErr() {
|
||||||
m.Cmd(user{}, user{}.SendTemplate, from, user_uid, Portal{}.Link(m, m.Option(s.Keys(s.Place, model.UID)), m.PrefixKey(), m.Option(model.UID)),
|
m.Cmd(user{}, user{}.SendTemplate, from, user_uid, Portal{}.Link(m, m.Option(s.Keys(s.Place, model.UID)), m.PrefixKey(), m.Option(model.UID)),
|
||||||
title, m.Option(s.Keys(s.Place, model.NAME))+" "+m.Option(s.Keys(s.UserPlace, model.ROLE)), kit.Cut(m.Option(model.UID), 6))
|
title, m.Option(s.Keys(s.Place, model.NAME))+" "+s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE)), kit.Cut(m.Option(model.UID), 6))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s Table) Display(m *ice.Message) {
|
func (s Table) Display(m *ice.Message) {
|
||||||
m.Option("_place_uid", s.ToLower(kit.TypeName(s.Place))+"_uid")
|
m.Option("_place_uid", s.ToLower(kit.TypeName(s.Place))+"_uid")
|
||||||
m.Option("_place_name", s.ToLower(kit.TypeName(s.Place))+"_name")
|
m.Option("_place_name", s.ToLower(kit.TypeName(s.Place))+"_name")
|
||||||
|
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("_street_name", s.ToLower(kit.TypeName(s.Street))+"_name")
|
||||||
m.Option(ice.MSG_USERPOD, "20240724-community")
|
m.Option(ice.MSG_USERPOD, "20240724-community")
|
||||||
m.Display("/p/src/gonganxitong/" + m.CommandKey() + ".js?pod=20240724-community").DisplayCSS("")
|
m.Display("/p/src/gonganxitong/" + m.CommandKey() + ".js?pod=20240724-community").DisplayCSS("")
|
||||||
@ -84,7 +127,7 @@ func (s Table) Display(m *ice.Message) {
|
|||||||
type Tables struct {
|
type Tables struct {
|
||||||
Table
|
Table
|
||||||
Portal Portal
|
Portal Portal
|
||||||
list string `name:"list place_uid auto" role:"void"`
|
portal string `data:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Tables) Init(m *ice.Message, arg ...string) {
|
func (s Tables) Init(m *ice.Message, arg ...string) {
|
||||||
@ -100,17 +143,13 @@ func newTables() Tables { return Tables{Table: newTable()} }
|
|||||||
|
|
||||||
func newTable() Table { return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}} }
|
func newTable() Table { return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}} }
|
||||||
|
|
||||||
func NewTable(userPlace, place ice.Any, street Container) Table {
|
func NewTable(userPlace, place Tabler, street Container) Table {
|
||||||
return Table{UserPlace: userPlace, Place: place, Street: street}
|
return Table{UserPlace: userPlace, Place: place, Street: street}
|
||||||
}
|
}
|
||||||
func NewPortal(userPlace, place ice.Any, street Container) Portal {
|
func NewPortal(userPlace, place Tabler, street Container) Portal {
|
||||||
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
|
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Container interface {
|
|
||||||
FindOrCreateByName(m *ice.Message, arg ...string)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s Portal) getTable() Table { return s.Table }
|
func (s Portal) getTable() Table { return s.Table }
|
||||||
|
|
||||||
func PortalCmd(portal ice.Any) {
|
func PortalCmd(portal ice.Any) {
|
||||||
@ -119,6 +158,16 @@ func PortalCmd(portal ice.Any) {
|
|||||||
cmd := func(name string, data ice.Any) {
|
cmd := func(name string, data ice.Any) {
|
||||||
_, cmd := ice.Cmd(kit.Keys(p, name), data)
|
_, cmd := ice.Cmd(kit.Keys(p, name), data)
|
||||||
cmd.RawHand = path.Join(path.Dir(h), name+".go")
|
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)
|
||||||
|
h(m, arg...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
table := portal.(interface{ getTable() Table }).getTable()
|
table := portal.(interface{ getTable() Table }).getTable()
|
||||||
cmd("portal", portal)
|
cmd("portal", portal)
|
||||||
|
@ -12,15 +12,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type email struct {
|
type email struct {
|
||||||
user user
|
Tables
|
||||||
portal Portal
|
user user
|
||||||
creds emails.Creds
|
creds emails.Creds
|
||||||
apply string `name:"apply username* password*" role:"void"`
|
apply string `name:"apply username* password*" role:"void"`
|
||||||
reset string `name:"reset password*" help:"重置密码" role:"void"`
|
reset string `name:"reset password*" help:"重置密码" role:"void"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s email) Init(m *ice.Message, arg ...string) {
|
func (s email) List(m *ice.Message, arg ...string) {
|
||||||
s.portal.Show(m)
|
if msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID)); msg.Append(model.EMAIL) == "" {
|
||||||
|
m.EchoInfoButton(m.Trans("please apply email", "请申请邮箱"), s.Apply)
|
||||||
|
} else {
|
||||||
|
m.EchoInfoButton(msg.Append(model.EMAIL), s.Reset)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func (s email) Apply(m *ice.Message, arg ...string) {
|
func (s email) Apply(m *ice.Message, arg ...string) {
|
||||||
defer m.ToastProcess()()
|
defer m.ToastProcess()()
|
||||||
@ -42,12 +46,5 @@ func (s email) Reset(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
m.Cmdy(s.creds, s.creds.Password, msg.Append(model.EMAIL), m.Option(aaa.PASSWORD))
|
m.Cmdy(s.creds, s.creds.Password, msg.Append(model.EMAIL), m.Option(aaa.PASSWORD))
|
||||||
}
|
}
|
||||||
func (s email) List(m *ice.Message, arg ...string) {
|
|
||||||
if msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID)); msg.Append(model.EMAIL) == "" {
|
|
||||||
m.EchoInfoButton(m.Trans("please apply email", "请申请邮箱"), s.Apply)
|
|
||||||
} else {
|
|
||||||
m.EchoInfoButton(msg.Append(model.EMAIL), s.Reset)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(email{}) }
|
func init() { ice.TeamCtxCmd(email{}) }
|
||||||
|
@ -12,15 +12,15 @@ type event struct {
|
|||||||
Table
|
Table
|
||||||
user user
|
user user
|
||||||
portal string `data:"true"`
|
portal string `data:"true"`
|
||||||
list string `name:"list auto" help:"事件流" icon:"https://img.icons8.com/officel/80/property-with-timer.png"`
|
|
||||||
domain string `data:"gonganxitong"`
|
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) {
|
func (s event) List(m *ice.Message, arg ...string) {
|
||||||
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
|
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
|
||||||
model.USER_AVATAR, model.USER_NAME,
|
model.USER_AVATAR, model.USER_NAME,
|
||||||
ctx.INDEX, model.OPERATE, ctx.ARGS, model.INFO,
|
ctx.INDEX, model.OPERATE, ctx.ARGS, model.INFO,
|
||||||
s.Key(s, model.UID), model.USER_UID,
|
model.USER_UID,
|
||||||
)
|
)
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
if m.IsTech() {
|
if m.IsTech() {
|
||||||
@ -29,17 +29,14 @@ func (s event) List(m *ice.Message, arg ...string) {
|
|||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
s.Select(m, model.PLACE_UID, arg[0])
|
s.Select(m, model.PLACE_UID, arg[0])
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
s.Select(m.FieldsSetDetail(), s.Key(s, model.UID), arg[1])
|
s.SelectDetail(m, s.Key(s, model.UID), arg[1])
|
||||||
}
|
}
|
||||||
|
m.PushAction().Action()
|
||||||
m.Display("")
|
m.Display("")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(event{}) }
|
func init() { ice.TeamCtxCmd(event{}) }
|
||||||
|
|
||||||
type Event struct{ event }
|
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(Event{}) }
|
|
||||||
|
|
||||||
func (s event) Record(m *ice.Message, info string, arg ...string) {
|
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, ","))
|
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,13 +1,14 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
|
_init: function(can, msg) {
|
||||||
can.page.Append(can, can._output, msg.Table(function(value) {
|
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||||
return can.onimport.itemcard(can, value, [
|
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), ORDER_STATUS = "order_status"
|
||||||
|
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
|
||||||
|
can.onimport.itemcards(can, msg, function(value) {
|
||||||
|
return [
|
||||||
{view: html.TITLE, list: [{text: value.user_name}]},
|
{view: html.TITLE, list: [{text: value.user_name}]},
|
||||||
{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)}]},
|
||||||
{view: html.STATUS, list: [{text: value.index}, {text: value.operate}]},
|
|
||||||
{view: html.STATUS, list: [{text: value.args}]},
|
|
||||||
{view: html.OUTPUT, list: [{text: value.info}]},
|
{view: html.OUTPUT, list: [{text: value.info}]},
|
||||||
])
|
]
|
||||||
}))
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
@ -1,18 +1,10 @@
|
|||||||
package express
|
package express
|
||||||
|
|
||||||
import (
|
import "shylinux.com/x/ice"
|
||||||
"shylinux.com/x/ice"
|
|
||||||
|
|
||||||
"shylinux.com/x/community/src/gonganxitong"
|
|
||||||
)
|
|
||||||
|
|
||||||
type express struct {
|
type express struct {
|
||||||
Table
|
Table
|
||||||
portal gonganxitong.Portal
|
portal string `data:"true"`
|
||||||
}
|
|
||||||
|
|
||||||
func (s express) Init(m *ice.Message, arg ...string) {
|
|
||||||
s.portal.Show(m)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(express{}) }
|
func init() { ice.TeamCtxCmd(express{}) }
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB |
@ -10,9 +10,16 @@ const (
|
|||||||
TYPE = "type"
|
TYPE = "type"
|
||||||
ROLE = "role"
|
ROLE = "role"
|
||||||
STATUS = "status"
|
STATUS = "status"
|
||||||
|
TABLES = "tables"
|
||||||
ADDRESS = "address"
|
ADDRESS = "address"
|
||||||
|
CONTENT = "content"
|
||||||
EMAIL = "email"
|
EMAIL = "email"
|
||||||
AVATAR = "avatar"
|
AVATAR = "avatar"
|
||||||
|
OPERATE = "operate"
|
||||||
|
OPERATOR = "operator"
|
||||||
|
CREATED_AT = "created_at"
|
||||||
|
BEGIN_TIME = "begin_time"
|
||||||
|
END_TIME = "end_time"
|
||||||
OPEN_ID = "open_id"
|
OPEN_ID = "open_id"
|
||||||
USER_UID = "user_uid"
|
USER_UID = "user_uid"
|
||||||
USER_NAME = "user_name"
|
USER_NAME = "user_name"
|
||||||
@ -22,34 +29,29 @@ const (
|
|||||||
PLACE_NAME = "place_name"
|
PLACE_NAME = "place_name"
|
||||||
PLACE_TYPE = "place_type"
|
PLACE_TYPE = "place_type"
|
||||||
PLACE_ADDRESS = "place_address"
|
PLACE_ADDRESS = "place_address"
|
||||||
STREET_NAME = "street_name"
|
|
||||||
STREET_UID = "street_uid"
|
STREET_UID = "street_uid"
|
||||||
CITY_NAME = "city_name"
|
STREET_NAME = "street_name"
|
||||||
CITY_UID = "city_uid"
|
CITY_UID = "city_uid"
|
||||||
|
CITY_NAME = "city_name"
|
||||||
EVENT_UID = "event_uid"
|
EVENT_UID = "event_uid"
|
||||||
APPLY_UID = "apply_uid"
|
APPLY_UID = "apply_uid"
|
||||||
APPLY_STATUS = "apply_status"
|
APPLY_STATUS = "apply_status"
|
||||||
ORDER_STATUS = "order_status"
|
|
||||||
ORDER_UID = "order_uid"
|
ORDER_UID = "order_uid"
|
||||||
CREATED_AT = "created_at"
|
ORDER_STATUS = "order_status"
|
||||||
OPERATOR = "operator"
|
|
||||||
OPERATE = "operate"
|
|
||||||
BEGIN_TIME = "begin_time"
|
|
||||||
END_TIME = "end_time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sess struct {
|
type Sess struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
UserUID string `gorm:"type:char(32)"`
|
UserUID string `gorm:"type:char(32)"`
|
||||||
IP string `gorm:"type:char(16)"`
|
IP string `gorm:"type:char(16)"`
|
||||||
Agent string `gorm:"size:char(256)"`
|
Agent string `gorm:"type:varchar(256)"`
|
||||||
}
|
}
|
||||||
type User struct {
|
type User struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
OpenID string `gorm:"type:char(32)";index`
|
OpenID string `gorm:"type:char(32);index"`
|
||||||
Email string `gorm:"type:char(32)"`
|
Email string `gorm:"type:char(32)"`
|
||||||
Name string `gorm:"type:char(32)"`
|
Name string `gorm:"type:char(32)"`
|
||||||
Avatar string `gorm:"size:256"`
|
Avatar string `gorm:"type:varchar(256)"`
|
||||||
}
|
}
|
||||||
type UserPlace struct {
|
type UserPlace struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
@ -63,7 +65,7 @@ type Place struct {
|
|||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
StreetUID string `gorm:"type:char(32)"`
|
StreetUID string `gorm:"type:char(32)"`
|
||||||
Name string `gorm:"type:char(32)"`
|
Name string `gorm:"type:char(32)"`
|
||||||
Address string `gorm:"size:256"`
|
Address string `gorm:"type:varchar(256)"`
|
||||||
Type uint8
|
Type uint8
|
||||||
}
|
}
|
||||||
type Street struct {
|
type Street struct {
|
||||||
@ -80,16 +82,16 @@ type City struct {
|
|||||||
type Event struct {
|
type Event struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
PlaceUID string `gorm:"type:char(32);index"`
|
PlaceUID string `gorm:"type:char(32);index"`
|
||||||
UserUID string `gorm:"type:char(32)";index`
|
UserUID string `gorm:"type:char(32);index"`
|
||||||
Index string `gorm:"type:char(32)"`
|
Index string `gorm:"type:char(32)"`
|
||||||
Operate string `gorm:"type:char(32)"`
|
Operate string `gorm:"type:char(32)"`
|
||||||
Args string `gorm:"type:char(32)"`
|
Args string `gorm:"type:char(32)"`
|
||||||
Info string `gorm:"size:1024"`
|
Info string
|
||||||
}
|
}
|
||||||
type Apply struct {
|
type Apply struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
|
UserUID string `gorm:"type:char(32);index"`
|
||||||
PlaceUID string `gorm:"type:char(32);index"`
|
PlaceUID string `gorm:"type:char(32);index"`
|
||||||
UserUID string `gorm:"type:char(32)"`
|
|
||||||
Tables string `gorm:"type:char(32)"`
|
Tables string `gorm:"type:char(32)"`
|
||||||
Status uint8
|
Status uint8
|
||||||
Role uint8
|
Role uint8
|
||||||
@ -99,7 +101,7 @@ type Apply struct {
|
|||||||
type Order struct {
|
type Order struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
UserUID string `gorm:"type:char(32);index"`
|
UserUID string `gorm:"type:char(32);index"`
|
||||||
ApplyUID string `gorm:"type:char(32);index"`
|
ApplyUID string `gorm:"type:char(32)"`
|
||||||
Status uint8
|
Status uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
type Order struct {
|
type Order struct {
|
||||||
Table
|
Table
|
||||||
user user
|
user user
|
||||||
apply Apply
|
|
||||||
event event
|
event event
|
||||||
|
apply Apply
|
||||||
portal string `data:"true"`
|
portal string `data:"true"`
|
||||||
domain string `data:"gonganxitong"`
|
domain string `data:"gonganxitong"`
|
||||||
list string `name:"list place_uid uid auto" help:"权限审批" icon:"https://img.icons8.com/officel/80/receipt-approved.png"`
|
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*"`
|
create string `name:"create user_uid* apply_uid* status*"`
|
||||||
reject string `name:"reject" role:"void"`
|
reject string `name:"reject" role:"void"`
|
||||||
approve string `name:"approve" role:"void"`
|
approve string `name:"approve" role:"void"`
|
||||||
@ -22,36 +22,43 @@ type Order struct {
|
|||||||
|
|
||||||
func (s Order) Create(m *ice.Message, arg ...string) {
|
func (s Order) Create(m *ice.Message, arg ...string) {
|
||||||
s.Table.Create(m, arg...)
|
s.Table.Create(m, arg...)
|
||||||
s.SendTemplate(m, "", m.Option(model.USER_UID), "权限审批 请处理")
|
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()()
|
defer m.ToastProcess()()
|
||||||
defer s.event.Record(m, kit.Format("审批驳回%s成为%s", m.Option(model.USER_NAME), m.Option(s.Key(s.UserPlace, model.ROLE))), m.Option(model.UID))
|
if s.status(m, OrderCreate, OrderRejected); m.IsErr() {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Cmd(s.apply, s.apply.Reject, m.Option(model.UID))
|
m.Cmd(s.apply, s.apply.Reject, m.Option(model.UID))
|
||||||
s.Table.Update(m, kit.Dict(model.STATUS, OrderRejected), model.UID, m.Option(model.ORDER_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.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_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()()
|
defer m.ToastProcess()()
|
||||||
defer s.event.Record(m, kit.Format("审批通过%s成为%s", m.Option(model.USER_NAME), m.Option(s.Key(s.UserPlace, model.ROLE))), m.Option(model.UID))
|
if s.status(m, OrderCreate, OrderApproved); m.IsErr() {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Cmd(s.apply, s.apply.Approve, m.Option(model.UID))
|
m.Cmd(s.apply, s.apply.Approve, m.Option(model.UID))
|
||||||
s.Table.Update(m, kit.Dict(model.STATUS, OrderApproved), model.UID, m.Option(model.ORDER_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.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_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) {
|
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),
|
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.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.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), s.Key(s.apply, model.UID), model.PLACE_UID,
|
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))
|
).Orders(m, s.Desc(model.CREATED_AT))
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID))
|
if m.IsTech() {
|
||||||
|
s.Select(m)
|
||||||
|
}
|
||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), model.PLACE_UID, arg[0])
|
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)
|
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 {
|
} else if len(arg) == 2 {
|
||||||
s.Table.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s.apply, model.UID), arg[1])
|
s.Table.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), model.PLACE_UID, arg[0], s.Key(s.apply, model.UID), arg[1])
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -65,14 +72,23 @@ func (s Order) List(m *ice.Message, arg ...string) {
|
|||||||
m.PushButton()
|
m.PushButton()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
s.UserPlace.(interface {
|
m.Action()
|
||||||
RewriteAppend(*ice.Message, ...string) *ice.Message
|
s.UserPlace.RewriteAppend(m)
|
||||||
}).RewriteAppend(m)
|
|
||||||
s.Display(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 {
|
||||||
|
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()) {
|
||||||
|
s.Table.Update(m, kit.Dict(model.STATUS, todo), model.UID, m.Option(model.ORDER_UID))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return msg
|
||||||
|
}
|
||||||
|
|
||||||
type OrderStatus int
|
type OrderStatus int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
if (msg.IsDetail()) { msg.Option("_share_icons", msg.Append("user_avatar"))
|
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||||
msg.Option("_share_content", can.user.transValue(can, msg, "user_place_role")+" "+msg.Append("user_name"))
|
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), ORDER_STATUS = "order_status"
|
||||||
return msg.Dump(can)
|
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[PLACE_TYPE], value[USER_PLACE_ROLE], value[ORDER_STATUS]]
|
||||||
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.place_type, value.user_place_role, value.order_status]
|
var status = value[ORDER_STATUS]
|
||||||
return can.onimport.itemcard(can, value, [
|
return [
|
||||||
{view: html.TITLE, list: [{text: value.user_name},
|
{view: html.TITLE, list: [{text: value.user_name},
|
||||||
{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]]]},
|
||||||
{text: [can.user.transValue(can, value, "user_place_role"), "", aaa.ROLE]},
|
]},
|
||||||
{text: [can.user.transValue(can, value, "order_status"), "", mdb.STATUS]},
|
{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.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]}]},
|
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
|
||||||
{view: html.STATUS, list: [{text: value.city_name}, {text: value.street_name}, {text: value.place_address}]},
|
{view: html.STATUS, list: [{text: value.city_name}, {text: value[STREET_NAME]}]},
|
||||||
])
|
]
|
||||||
}))
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
@ -13,10 +13,9 @@ type place struct {
|
|||||||
|
|
||||||
func (s place) User(m *ice.Message, arg ...string) {
|
func (s place) User(m *ice.Message, arg ...string) {
|
||||||
userPlace := userPlace{}
|
userPlace := userPlace{}
|
||||||
s.Tables(m, "left join user_places on places.uid = user_places.place_uid", s.user).Fields(m,
|
s.Tables(m, "left join user_places on places.uid = user_places.place_uid", s.user).FieldsWithCreatedAT(m, userPlace,
|
||||||
s.Key(userPlace, model.CREATED_AT), s.Key(userPlace, model.UID),
|
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,
|
)
|
||||||
).Orders(m, s.Desc(model.CREATED_AT))
|
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
if m.IsTech() {
|
if m.IsTech() {
|
||||||
s.Select(m)
|
s.Select(m)
|
||||||
@ -24,16 +23,12 @@ func (s place) User(m *ice.Message, arg ...string) {
|
|||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
s.Select(m, model.PLACE_UID, arg[0])
|
s.Select(m, model.PLACE_UID, arg[0])
|
||||||
} else {
|
} else {
|
||||||
s.Select(m.FieldsSetDetail(), s.Key(userPlace, model.UID), arg[1])
|
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(userPlace, model.UID), arg[1])
|
||||||
}
|
}
|
||||||
s.RewriteAppend(m)
|
s.RewriteAppend(m)
|
||||||
}
|
}
|
||||||
func init() { ice.TeamCtxCmd(place{}) }
|
func init() { ice.TeamCtxCmd(place{}) }
|
||||||
|
|
||||||
type Place struct{ place }
|
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(Place{}) }
|
|
||||||
|
|
||||||
type PlaceType int
|
type PlaceType int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -7,13 +7,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type placeUser struct {
|
type placeUser struct {
|
||||||
place place
|
Tables
|
||||||
portal Portal
|
place place
|
||||||
list string `name:"list place_uid uid auto" role:"void"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s placeUser) Init(m *ice.Message, arg ...string) {
|
func (s placeUser) Init(m *ice.Message, arg ...string) {
|
||||||
s.portal.Show(m, model.ROLE, "creator,landlord")
|
s.Portal.Show(m, model.ROLE, "creator,landlord")
|
||||||
}
|
}
|
||||||
func (s placeUser) List(m *ice.Message, arg ...string) {
|
func (s placeUser) List(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(s.place, s.place.User, arg).PushAction().Action().Display("")
|
m.Cmdy(s.place, s.place.User, arg).PushAction().Action().Display("")
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
|
_init: function(can, msg) {
|
||||||
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.user_place_role]
|
if (msg.IsDetail()) { can.onexport.share_title(can, msg, "user_place_role"); return msg.Show(can) }
|
||||||
return can.onimport.itemcard(can, value, [
|
can.onimport.itemcards(can, msg, function(value) { value._style = [value.user_place_role]
|
||||||
|
return [
|
||||||
{view: html.TITLE, list: [{text: value.user_name},
|
{view: html.TITLE, list: [{text: value.user_name},
|
||||||
{text: [can.user.transValue(can, value, "user_place_role"), "", aaa.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.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]}]},
|
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
|
||||||
])
|
]
|
||||||
}))
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
@ -7,6 +7,7 @@ $output>div.list>div.title div.action div.item.button.icons input { display:none
|
|||||||
$output>div.list>div.item.index { padding:10px; display:flex; flex-direction:column; align-items:center; float:left; }
|
$output>div.list>div.item.index { padding:10px; display:flex; flex-direction:column; align-items:center; float:left; }
|
||||||
$output>div.list>div.item.index.hide { display:none; }
|
$output>div.list>div.item.index.hide { display:none; }
|
||||||
$output>div.list>div.item.index img { width:100%; }
|
$output>div.list>div.item.index img { width:100%; }
|
||||||
|
$output>div.list>div.output { max-height:400px; }
|
||||||
$output>div.list>div.action { display:flex; justify-content:center; }
|
$output>div.list>div.action { display:flex; justify-content:center; }
|
||||||
$output>div.list>div.action div.item { margin-right:5px; }
|
$output>div.list>div.action div.item { margin-right:5px; }
|
||||||
$output>div.list>div.action div.item input[type=button] { color:var(--notice-bg-color); border:none; }
|
$output>div.list>div.action div.item input[type=button] { color:var(--notice-bg-color); border:none; }
|
||||||
@ -15,10 +16,18 @@ $output>div.action div.item.button { margin-right:5px; }
|
|||||||
$output>div.action div.item.button input { border:none; color:var(--notice-bg-color); min-width:80px; float:left; }
|
$output>div.action div.item.button input { border:none; color:var(--notice-bg-color); min-width:80px; float:left; }
|
||||||
$output>div.action div.item.button span { display:none; }
|
$output>div.action div.item.button span { display:none; }
|
||||||
$output>fieldset table.content td { box-shadow:none; }
|
$output>fieldset table.content td { box-shadow:none; }
|
||||||
|
$output div.item span.role { border:var(--box-notice); color:var(--notice-bg-color); padding:0 5px; }
|
||||||
|
$output div.item span.role.landlord { border-color:var(--box-danger); color:var(--danger-bg-color); }
|
||||||
|
$output div.item span.role.teacher { border-color:var(--box-danger); color:var(--danger-bg-color); }
|
||||||
|
body.en $output>fieldset table.content td:first-child { max-width:180px; width:unset;}
|
||||||
$output>fieldset table.content tr.uid { display:none; }
|
$output>fieldset table.content tr.uid { display:none; }
|
||||||
$output>fieldset table.content tr.order_uid { display:none; }
|
$output>fieldset table.content tr.order_uid { display:none; }
|
||||||
$output>fieldset table.content tr.place_uid { display:none; }
|
$output>fieldset table.content tr.place_uid { display:none; }
|
||||||
$output>fieldset table.content td img { max-width:100%; }
|
$output>fieldset table.content td img { max-width:100%; }
|
||||||
$output>fieldset.qrcode table.content td { text-align:center; }
|
$output>fieldset.qrcode table.content td { text-align:center; }
|
||||||
$output>fieldset.qrcode div.code { text-align:center; }
|
$output>fieldset.qrcode div.code { text-align:center; }
|
||||||
$output>fieldset.story { box-shadow:none; }
|
$output>fieldset.story { box-shadow:none; }
|
||||||
|
$output>fieldset.story>div.output { background-color:var(--plugin-bg-color); }
|
||||||
|
$output>fieldset.story>div.output div.item.card {}
|
||||||
|
$output>fieldset.story>div.output div.item.card>div.output { background-color:var(--output-bg-color); padding:10px; }
|
||||||
|
$output>fieldset.story>div.output div.item.card>div.output div.output { padding:10px 0; }
|
@ -20,13 +20,12 @@ type Portal struct {
|
|||||||
field string `data:"time,name,icons,index,order,enable,type,role"`
|
field string `data:"time,name,icons,index,order,enable,type,role"`
|
||||||
inputs string `name:"inputs" role:"void"`
|
inputs string `name:"inputs" role:"void"`
|
||||||
list string `name:"list place_uid index uid auto" 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*" role:"void" icon:"bi bi-plus-square-dotted"`
|
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*" role:"void" style:"danger"`
|
placeRemove string `name:"placeRemove uid*" style:"danger" role:"void"`
|
||||||
scanQRCode string `name:"scanQRCode type text" role:"void" icon:"bi bi-qr-code-scan"`
|
scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
|
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
func (s Portal) Inputs(m *ice.Message, arg ...string) {
|
func (s Portal) Inputs(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(s.Place, m.ActionKey(), arg)
|
m.Cmdy(s.Place, m.ActionKey(), arg)
|
||||||
@ -43,7 +42,7 @@ func (s Portal) List(m *ice.Message, arg ...string) {
|
|||||||
})
|
})
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
msg := m.Cmd(s.Place, s.Select, model.UID, arg[0])
|
msg := m.Cmd(s.Place, s.Select, model.UID, arg[0])
|
||||||
m.Option(s.Key(s.Place, model.NAME), msg.Append(model.NAME))
|
m.Option(s.Keys(s.Place, model.NAME), msg.Append(model.NAME))
|
||||||
m.Cmdy(ctx.COMMAND, arg[1]).Push(ctx.ARGS, arg[0])
|
m.Cmdy(ctx.COMMAND, arg[1]).Push(ctx.ARGS, arg[0])
|
||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
s.Hash.List(m, arg[1:]...).SortInt(mdb.ORDER)
|
s.Hash.List(m, arg[1:]...).SortInt(mdb.ORDER)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type", STREET_NAME = "street_name"
|
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type", STREET_NAME = "street_name"
|
||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onimport.myPortal(can, msg, msg.Option("_place_uid")||PLACE_UID, msg.Option("_place_name")||PLACE_NAME, msg.Option("_street_name"))
|
can.user.isMobile && can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
||||||
|
can.onimport.myPortal(can, msg)
|
||||||
},
|
},
|
||||||
myValue: function(can, value, PLACE_UID, PLACE_NAME, STREET_NAME) {
|
myValue: function(can, value, PLACE_UID, PLACE_NAME, STREET_NAME) {
|
||||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
||||||
@ -12,56 +13,53 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
value[USER_PLACE_ROLE] != "creator" && {text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", aaa.ROLE]},
|
value[USER_PLACE_ROLE] != "creator" && {text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", aaa.ROLE]},
|
||||||
]},
|
]},
|
||||||
{view: html.STATUS, list: [
|
{view: html.STATUS, list: [
|
||||||
{text: value.city_name}, {text: value[STREET_NAME]},
|
{text: value[PLACE_UID].slice(0, 6)}, {text: value.city_name}, {text: value[STREET_NAME]},
|
||||||
// {text: value[PLACE_UID].slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
|
|
||||||
]},
|
]},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
myPortal: function(can, msg, PLACE_UID, PLACE_NAME, STREET_NAME, title) { can.user.isMobile && can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
myPortal: function(can, msg) {
|
||||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
var PLACE_UID = msg.Option("_place_uid"), PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||||
can.isCmdMode() && (can.db.hash = can.misc.SearchHash(can))
|
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name")
|
||||||
can.sup.current = can.sup.current||{}
|
can.sup.current = can.sup.current||{}, can.isCmdMode() && (can.db.hash = can.misc.SearchHash(can))
|
||||||
if (can.Option(PLACE_UID) == "") {
|
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() }
|
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.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.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)}], _init: function(target) {
|
can.page.Append(can, can.ui.myplace, [{view: html.TITLE, list: [
|
||||||
can.page.Append(can, target, [{view: html.ACTION, _init: function(target) {
|
{text: can.user.trans(can, "My "+can.base.capital(PLACE_NAME.replace("_name", "")), null, html.INPUT)},
|
||||||
msg.Option(ice.MSG_ACTION) && can.onappend._action(can, msg.Option(ice.MSG_ACTION), target)
|
{view: html.ACTION, _init: function(target) { msg.Option(ice.MSG_ACTION) && can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}
|
||||||
}}])
|
]}])
|
||||||
}}])
|
|
||||||
msg.Table(function(value) { var key = "_trans.value."+PLACE_NAME.replace("_name", "_type")+".icons."
|
|
||||||
msg.Push(mdb.ICONS, can.Conf(key+value[PLACE_TYPE])||can.Conf(key+"office"))
|
|
||||||
})
|
|
||||||
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, STREET_NAME)
|
||||||
msg.Length() > 0 && can.run({}, [uid], function(msg) {
|
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.page.Append(can, can.ui.myindex, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Index", "我的应用")}]}])
|
||||||
for (var i = 0; i < 1; i++) { can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID) }
|
can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID), can.onimport.selectIndex(can, msg, can.sup.current, PLACE_UID, PLACE_NAME)
|
||||||
can.onimport.selectIndex(can, can.sup.current, PLACE_UID, PLACE_NAME)
|
}), can.user.agent.init(can)
|
||||||
})
|
|
||||||
can.user.agent.init(can)
|
|
||||||
} else {
|
} else {
|
||||||
can.onimport.myData(can, msg, can._output, PLACE_UID, PLACE_NAME)
|
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
|
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME, STREET_NAME) { var place_uid
|
||||||
can.page.Append(can, target||can._output, msg.Table(function(value) {
|
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")
|
||||||
|
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 = 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)
|
place_uid == value[PLACE_UID] && (can.onexport.title(can, value[PLACE_NAME]), can.sup.current = value)
|
||||||
value._uid = value[PLACE_UID]
|
value._uid = value[PLACE_UID], value._name = value[PLACE_NAME], value._type = value[PLACE_TYPE], value._role = value[USER_PLACE_ROLE]
|
||||||
return can.onimport.itemcard(can, value, can.onimport.myValue(can, value, PLACE_UID, PLACE_NAME, STREET_NAME), function(event) {
|
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, can.sup.current)
|
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.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.user.agent.init(can, can.user.info.titles)
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
can.page.Select(can, target, "div.item.card.uid-"+place_uid, function(_target) { can.onmotion.select(can, target, html.DIV_ITEM, _target) })
|
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.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
|
can.onexport.hash(can, place_uid), can.onexport.session(can, PLACE_UID, place_uid); return place_uid
|
||||||
},
|
},
|
||||||
selectIndex: function(can, value, PLACE_UID, PLACE_NAME) {
|
selectIndex: function(can, msg, value, PLACE_UID, PLACE_NAME) {
|
||||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
var PLACE_UID = msg.Option("_place_uid"), PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
|
||||||
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
|
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) {
|
can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) {
|
||||||
var list = target.className.split(" ")
|
var list = target.className.split(" ")
|
||||||
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value[PLACE_TYPE]) == -1) {
|
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value[PLACE_TYPE]) == -1) {
|
||||||
@ -75,13 +73,10 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
},
|
},
|
||||||
myIndex: function(can, msg, target, 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)
|
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)
|
||||||
can.page.Append(can, target||can._output, msg.Table(function(value) {
|
can.page.Append(can, target||can._output, msg.Table(function(value) { if (value.enable != ice.TRUE) { return }
|
||||||
if (value.enable != ice.TRUE) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return {view: [[html.ITEM, ctx.INDEX].concat(
|
return {view: [[html.ITEM, ctx.INDEX].concat(
|
||||||
value.type? ["type"]: [], can.core.Split(value.type||""),
|
value.type? [mdb.TYPE]: [], can.core.Split(value.type||""),
|
||||||
value.role? ["role"]: [], can.core.Split(value.role||""),
|
value.role? [aaa.ROLE]: [], can.core.Split(value.role||""),
|
||||||
)], style: {height: height, width: width}, list: [
|
)], style: {height: height, width: width}, list: [
|
||||||
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
|
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
|
||||||
], onclick: function(event) {
|
], onclick: function(event) {
|
||||||
@ -95,14 +90,22 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
var ui = can.page.Append(can, can._output, [{view: html.ACTION}])
|
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]] }
|
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
|
value.style = html.OUTPUT, value.height = can.ConfHeight()-html.ACTION_HEIGHT
|
||||||
// can.onexport.title(can, value.help, can.user.trans(can, msg.Option("place_type"), null, "value.place_type"), msg.Option("place_name"))
|
|
||||||
can.onexport.title(can, value.help, msg.Option(PLACE_NAME))
|
can.onexport.title(can, value.help, msg.Option(PLACE_NAME))
|
||||||
can.onappend.plugin(can, value, function(sub) { refresh = function() { sub.Update() }
|
can.onappend.plugin(can, value, function(sub) { refresh = function() { sub.Update() }
|
||||||
|
can.core.List(["_trans", "_trans.input", "_trans.value", "_icons", "_style"], 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))
|
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 })
|
||||||
|
}
|
||||||
sub.onexport.output = function(_sub, msg) { can.onappend.style(sub, html.OUTPUT)
|
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.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.hash(can, can.Option(PLACE_UID), value.index, sub.Option(UID))
|
||||||
can.user.agent.init(can, msg.Option("_share_content")||value.help, msg.Option("_share_icons")||value.icons)
|
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() {
|
back = function() {
|
||||||
if (sub.Option(UID)) {
|
if (sub.Option(UID)) {
|
||||||
can.onexport.hash(can, can.Option(PLACE_UID), can.Option(ctx.INDEX)), sub.Option(UID, ""), sub.Update()
|
can.onexport.hash(can, can.Option(PLACE_UID), can.Option(ctx.INDEX)), sub.Option(UID, ""), sub.Update()
|
||||||
@ -115,3 +118,9 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Volcanos(chat.ONEXPORT, {
|
||||||
|
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"))
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -65,16 +65,16 @@
|
|||||||
"visitor": "访客"
|
"visitor": "访客"
|
||||||
},
|
},
|
||||||
"apply_status": {
|
"apply_status": {
|
||||||
"create": "待提交 🕑",
|
"create": "待提交",
|
||||||
"cancel": "已取消 ❌",
|
"cancel": "已取消",
|
||||||
"submit": "已提交 🕑",
|
"submit": "已提交",
|
||||||
"rejected": "已驳回 ❌",
|
"rejected": "已驳回",
|
||||||
"approved": "已通过 ✅"
|
"approved": "已通过"
|
||||||
},
|
},
|
||||||
"order_status": {
|
"order_status": {
|
||||||
"create": "待审批 🕑",
|
"create": "待审批",
|
||||||
"rejected": "已驳回 ❌",
|
"rejected": "已驳回",
|
||||||
"approved": "已通过 ✅"
|
"approved": "已通过"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
type sess struct {
|
type sess struct {
|
||||||
Table
|
Table
|
||||||
user user
|
user user
|
||||||
create string `name:"create user_uid"`
|
create string `name:"create user_uid*"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s sess) Create(m *ice.Message, arg ...string) {
|
func (s sess) Create(m *ice.Message, arg ...string) {
|
||||||
|
@ -38,7 +38,3 @@ func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(user{}) }
|
func init() { ice.TeamCtxCmd(user{}) }
|
||||||
|
|
||||||
type User struct{ user }
|
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(User{}) }
|
|
||||||
|
@ -22,17 +22,13 @@ func (s userPlace) List(m *ice.Message, arg ...string) {
|
|||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
s.Select(m, model.USER_UID, arg[0])
|
s.Select(m, model.USER_UID, arg[0])
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
s.Select(m.FieldsSetDetail(), model.USER_UID, arg[0], model.PLACE_UID, arg[1])
|
s.SelectDetail(m, model.USER_UID, arg[0], model.PLACE_UID, arg[1])
|
||||||
}
|
}
|
||||||
s.RewriteAppend(m)
|
s.RewriteAppend(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(userPlace{}) }
|
func init() { ice.TeamCtxCmd(userPlace{}) }
|
||||||
|
|
||||||
type UserPlace struct{ userPlace }
|
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(UserPlace{}) }
|
|
||||||
|
|
||||||
type UserPlaceRole int
|
type UserPlaceRole int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"index": "web.team.gonganxitong.apply",
|
"index": "web.team.gonganxitong.apply",
|
||||||
"name": "权限申请",
|
"name": "权限申请",
|
||||||
"order": "3",
|
"order": "3",
|
||||||
"time": "2024-08-04 10:59:49.031"
|
"time": "2024-08-04 20:40:00.961"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"58724bdcc3cae3e26700cb3199e0602c": {
|
"58724bdcc3cae3e26700cb3199e0602c": {
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"name": "场所用户",
|
"name": "场所用户",
|
||||||
"order": "5",
|
"order": "5",
|
||||||
"role": "creator,landlord",
|
"role": "creator,landlord",
|
||||||
"time": "2024-08-04 10:21:38.110"
|
"time": "2024-08-04 20:31:58.911"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"91dd0e9590d3021944f14f3ec8653beb": {
|
"91dd0e9590d3021944f14f3ec8653beb": {
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"name": "权限审批",
|
"name": "权限审批",
|
||||||
"order": "4",
|
"order": "4",
|
||||||
"role": "creator,landlord",
|
"role": "creator,landlord",
|
||||||
"time": "2024-08-04 10:18:03.398"
|
"time": "2024-08-04 21:29:49.710"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ad574b9493741774ef8cb3fd5efd8026": {
|
"ad574b9493741774ef8cb3fd5efd8026": {
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"name": "事件流",
|
"name": "事件流",
|
||||||
"order": "2",
|
"order": "2",
|
||||||
"role": "creator,landlord",
|
"role": "creator,landlord",
|
||||||
"time": "2024-08-04 11:53:34.283"
|
"time": "2024-08-04 20:45:03.518"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"e2117b53c036a72fe7e4885449488a6f": {
|
"e2117b53c036a72fe7e4885449488a6f": {
|
||||||
@ -59,7 +59,7 @@
|
|||||||
"index": "web.team.gonganxitong.qrcode",
|
"index": "web.team.gonganxitong.qrcode",
|
||||||
"name": "场所码",
|
"name": "场所码",
|
||||||
"order": "1",
|
"order": "1",
|
||||||
"time": "2024-08-04 09:47:55.478"
|
"time": "2024-08-04 21:19:42.289"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fd86aad80a667152781bb188fb1249a2": {
|
"fd86aad80a667152781bb188fb1249a2": {
|
||||||
@ -69,7 +69,7 @@
|
|||||||
"index": "web.team.gonganxitong.email",
|
"index": "web.team.gonganxitong.email",
|
||||||
"name": "邮箱配置",
|
"name": "邮箱配置",
|
||||||
"role": "creator",
|
"role": "creator",
|
||||||
"time": "2024-08-04 10:57:25.060"
|
"time": "2024-08-04 19:51:30.768"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user