This commit is contained in:
jingganjiaoyu 2024-08-05 02:09:58 +08:00
parent 4ef9c83924
commit bf9fb9afcd
27 changed files with 300 additions and 253 deletions

View File

@ -13,70 +13,34 @@ type Apply struct {
event event
portal string `data:"true"`
domain string `data:"gonganxitong"`
create string `name:"create place_uid* 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"`
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) 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) {
s.Table.Init(m, arg...)
place_uid := s.Keys(s.Place, model.UID)
user_place_role := s.Keys(s.UserPlace, model.ROLE)
m.Design("create", "", place_uid+"* "+user_place_role+"*:select")
m.Design("list", "", place_uid+" uid auto")
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) 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)
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)...)
}
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))
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) List(m *ice.Message, arg ...string) {
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
model.USER_AVATAR, model.USER_NAME,
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.BEGIN_TIME, model.END_TIME, model.PLACE_UID,
)
if len(arg) == 0 {
return
if m.IsTech() {
s.Select(m)
}
@ -93,7 +57,7 @@ func (s Apply) List(m *ice.Message, arg ...string) {
ApplyCancel.String(),
}, ice.STR_R)
} 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 {
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.Info("what %v", m.FormatMeta())
s.UserPlace.(interface {
RewriteAppend(*ice.Message, ...string) *ice.Message
}).RewriteAppend(m)
m.Info("what %v", m.FormatMeta())
m.Info("what %v", m.FormatMeta())
s.UserPlace.RewriteAppend(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 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 {
msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.UID)...)
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {

View File

@ -1,20 +1,22 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
var PLACE_NAME = msg.Option("_place_name")
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
var STREET_NAME = msg.Option("_street_name")
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.place_type, value.user_place_role, value.apply_status]
return can.onimport.itemcard(can, value, [
_init: function(can, msg) {
var 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"), APPLY_STATUS = "apply_status"
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[APPLY_STATUS]]
var status = value[APPLY_STATUS]
return [
{view: html.TITLE, list: [{text: value[PLACE_NAME]},
{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, "apply_status"), "", mdb.STATUS]},
{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)},
{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.city_name}, {text: value[STREET_NAME]}]},
])
}))
]
})
},
})

View File

@ -18,7 +18,3 @@ func (s city) FindOrCreateByName(m *ice.Message, arg ...string) {
arg[0], arg[1] = model.CITY_UID, msg.Append(model.UID)
}
}
type City struct{ city }
func init() { ice.TeamCtxCmd(City{}) }

View File

@ -4,17 +4,28 @@ import (
"path"
"shylinux.com/x/ice"
icebergs "shylinux.com/x/icebergs"
"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 {
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 {
db.Table
UserPlace ice.Any
Place ice.Any
UserPlace Tabler
Place Tabler
Street Container
inputs string `name:"inputs" 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 {
if len(arg) == 0 || len(arg) == 1 {
if len(arg) == 0 {
if m.IsTech() {
s.Table.List(m)
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) 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 {
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
}
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) {
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)),
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) {
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_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("")
@ -84,7 +127,7 @@ func (s Table) Display(m *ice.Message) {
type Tables struct {
Table
Portal Portal
list string `name:"list place_uid auto" role:"void"`
portal string `data:"true"`
}
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(userPlace, place ice.Any, street Container) Table {
func NewTable(userPlace, place Tabler, street Container) Table {
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}}
}
type Container interface {
FindOrCreateByName(m *ice.Message, arg ...string)
}
func (s Portal) getTable() Table { return s.Table }
func PortalCmd(portal ice.Any) {
@ -119,6 +158,16 @@ func PortalCmd(portal ice.Any) {
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)
h(m, arg...)
}
}
table := portal.(interface{ getTable() Table }).getTable()
cmd("portal", portal)

View File

@ -12,15 +12,19 @@ import (
)
type email struct {
user user
portal Portal
creds emails.Creds
apply string `name:"apply username* password*" role:"void"`
reset string `name:"reset password*" help:"重置密码" role:"void"`
Tables
user user
creds emails.Creds
apply string `name:"apply username* password*" role:"void"`
reset string `name:"reset password*" help:"重置密码" role:"void"`
}
func (s email) Init(m *ice.Message, arg ...string) {
s.portal.Show(m)
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 (s email) Apply(m *ice.Message, arg ...string) {
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))
}
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{}) }

View File

@ -12,15 +12,15 @@ type event struct {
Table
user user
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"`
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,
s.Key(s, model.UID), model.USER_UID,
model.USER_UID,
)
if len(arg) == 0 {
if m.IsTech() {
@ -29,17 +29,14 @@ func (s event) List(m *ice.Message, arg ...string) {
} else if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0])
} 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("")
}
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) {
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, ","))
}

View File

@ -1,13 +1,14 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
can.page.Append(can, can._output, msg.Table(function(value) {
return can.onimport.itemcard(can, value, [
_init: function(can, msg) {
var 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"), 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.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 File

@ -1,18 +1,10 @@
package express
import (
"shylinux.com/x/ice"
"shylinux.com/x/community/src/gonganxitong"
)
import "shylinux.com/x/ice"
type express struct {
Table
portal gonganxitong.Portal
}
func (s express) Init(m *ice.Message, arg ...string) {
s.portal.Show(m)
portal string `data:"true"`
}
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

View File

@ -10,9 +10,16 @@ const (
TYPE = "type"
ROLE = "role"
STATUS = "status"
TABLES = "tables"
ADDRESS = "address"
CONTENT = "content"
EMAIL = "email"
AVATAR = "avatar"
OPERATE = "operate"
OPERATOR = "operator"
CREATED_AT = "created_at"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
OPEN_ID = "open_id"
USER_UID = "user_uid"
USER_NAME = "user_name"
@ -22,34 +29,29 @@ const (
PLACE_NAME = "place_name"
PLACE_TYPE = "place_type"
PLACE_ADDRESS = "place_address"
STREET_NAME = "street_name"
STREET_UID = "street_uid"
CITY_NAME = "city_name"
STREET_NAME = "street_name"
CITY_UID = "city_uid"
CITY_NAME = "city_name"
EVENT_UID = "event_uid"
APPLY_UID = "apply_uid"
APPLY_STATUS = "apply_status"
ORDER_STATUS = "order_status"
ORDER_UID = "order_uid"
CREATED_AT = "created_at"
OPERATOR = "operator"
OPERATE = "operate"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
ORDER_STATUS = "order_status"
)
type Sess struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32)"`
IP string `gorm:"type:char(16)"`
Agent string `gorm:"size:char(256)"`
Agent string `gorm:"type:varchar(256)"`
}
type User struct {
db.ModelWithUID
OpenID string `gorm:"type:char(32)";index`
OpenID string `gorm:"type:char(32);index"`
Email 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 {
db.ModelWithUID
@ -63,7 +65,7 @@ type Place struct {
db.ModelWithUID
StreetUID 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 Street struct {
@ -80,16 +82,16 @@ type City struct {
type Event struct {
db.ModelWithUID
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)"`
Operate string `gorm:"type:char(32)"`
Args string `gorm:"type:char(32)"`
Info string `gorm:"size:1024"`
Info string
}
type Apply struct {
db.ModelWithUID
UserUID 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)"`
Status uint8
Role uint8
@ -99,7 +101,7 @@ type Apply struct {
type Order struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
ApplyUID string `gorm:"type:char(32);index"`
ApplyUID string `gorm:"type:char(32)"`
Status uint8
}

View File

@ -10,11 +10,11 @@ import (
type Order struct {
Table
user user
apply Apply
event event
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"`
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"`
@ -22,36 +22,43 @@ type Order struct {
func (s Order) Create(m *ice.Message, arg ...string) {
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) {
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))
s.Table.Update(m, kit.Dict(model.STATUS, OrderRejected), model.UID, m.Option(model.ORDER_UID))
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_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), m.Trans("role order rejected", "权限审批 已驳回"))
m.ProcessRefresh()
}
func (s Order) Approve(m *ice.Message, arg ...string) {
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))
s.Table.Update(m, kit.Dict(model.STATUS, OrderApproved), model.UID, m.Option(model.ORDER_UID))
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_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), 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.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,
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,
).Orders(m, s.Desc(model.CREATED_AT))
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 {
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 {
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 {
return
}
@ -65,14 +72,23 @@ func (s Order) List(m *ice.Message, arg ...string) {
m.PushButton()
}
})
s.UserPlace.(interface {
RewriteAppend(*ice.Message, ...string) *ice.Message
}).RewriteAppend(m)
m.Action()
s.UserPlace.RewriteAppend(m)
s.Display(m)
}
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
const (

View File

@ -1,20 +1,21 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
if (msg.IsDetail()) { msg.Option("_share_icons", msg.Append("user_avatar"))
msg.Option("_share_content", can.user.transValue(can, msg, "user_place_role")+" "+msg.Append("user_name"))
return msg.Dump(can)
}
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.place_type, value.user_place_role, value.order_status]
return can.onimport.itemcard(can, value, [
var 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"), 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) { value._style = [value[PLACE_TYPE], value[USER_PLACE_ROLE], value[ORDER_STATUS]]
var status = value[ORDER_STATUS]
return [
{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]},
{text: [can.user.transValue(can, value, "order_status"), "", mdb.STATUS]},
{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)},
{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.city_name}, {text: value.street_name}, {text: value.place_address}]},
])
}))
{view: html.STATUS, list: [{text: value.city_name}, {text: value[STREET_NAME]}]},
]
})
},
})

View File

@ -13,10 +13,9 @@ 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).Fields(m,
s.Key(userPlace, model.CREATED_AT), s.Key(userPlace, model.UID),
model.USER_AVATAR, model.USER_NAME, model.USER_PLACE_ROLE, model.BEGIN_TIME, model.END_TIME,
).Orders(m, s.Desc(model.CREATED_AT))
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,
)
if len(arg) == 0 {
if m.IsTech() {
s.Select(m)
@ -24,16 +23,12 @@ func (s place) User(m *ice.Message, arg ...string) {
} else if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0])
} 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)
}
func init() { ice.TeamCtxCmd(place{}) }
type Place struct{ place }
func init() { ice.TeamCtxCmd(Place{}) }
type PlaceType int
const (

View File

@ -7,13 +7,12 @@ import (
)
type placeUser struct {
place place
portal Portal
list string `name:"list place_uid uid auto" role:"void"`
Tables
place place
}
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) {
m.Cmdy(s.place, s.place.User, arg).PushAction().Action().Display("")

View File

@ -1,13 +1,14 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
can.page.Append(can, can._output, msg.Table(function(value) { value._style = [value.user_place_role]
return can.onimport.itemcard(can, value, [
_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]
return [
{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.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
])
}))
]
})
},
})

View File

@ -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.hide { display:none; }
$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 div.item { margin-right:5px; }
$output>div.list>div.action div.item input[type=button] { color:var(--notice-bg-color); border:none; }
@ -15,6 +16,10 @@ $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 span { display: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.order_uid { display:none; }
$output>fieldset table.content tr.place_uid { display:none; }
@ -22,3 +27,7 @@ $output>fieldset table.content td img { max-width:100%; }
$output>fieldset.qrcode table.content td { text-align:center; }
$output>fieldset.qrcode div.code { text-align:center; }
$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; }

View File

@ -20,13 +20,12 @@ type Portal struct {
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*" role:"void" icon:"bi bi-plus-square-dotted"`
placeRemove string `name:"placeRemove uid*" role:"void" style:"danger"`
scanQRCode string `name:"scanQRCode type text" role:"void" icon:"bi bi-qr-code-scan"`
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"`
}
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
}
func (s Portal) Inputs(m *ice.Message, arg ...string) {
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 {
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])
} else if len(arg) == 1 {
s.Hash.List(m, arg[1:]...).SortInt(mdb.ORDER)

View File

@ -1,7 +1,8 @@
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.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) {
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]},
]},
{view: html.STATUS, list: [
{text: value.city_name}, {text: value[STREET_NAME]},
// {text: value[PLACE_UID].slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
{text: value[PLACE_UID].slice(0, 6)}, {text: value.city_name}, {text: value[STREET_NAME]},
]},
]
},
myPortal: function(can, msg, PLACE_UID, PLACE_NAME, STREET_NAME, title) { can.user.isMobile && can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
can.isCmdMode() && (can.db.hash = can.misc.SearchHash(can))
can.sup.current = can.sup.current||{}
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))
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)}], _init: function(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)
}}])
}}])
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"))
})
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)
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", "我的应用")}]}])
for (var i = 0; i < 1; i++) { can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID) }
can.onimport.selectIndex(can, 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, msg, can.sup.current, PLACE_UID, PLACE_NAME)
}), can.user.agent.init(can)
} 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
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 == 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) {
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.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.onexport.hash(can, place_uid), can.onexport.session(can, PLACE_UID, place_uid); return place_uid
},
selectIndex: function(can, value, PLACE_UID, PLACE_NAME) {
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
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) {
@ -75,13 +73,10 @@ Volcanos(chat.ONIMPORT, {
},
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)
can.page.Append(can, target||can._output, msg.Table(function(value) {
if (value.enable != ice.TRUE) {
return
}
can.page.Append(can, target||can._output, msg.Table(function(value) { if (value.enable != ice.TRUE) { return }
return {view: [[html.ITEM, ctx.INDEX].concat(
value.type? ["type"]: [], can.core.Split(value.type||""),
value.role? ["role"]: [], can.core.Split(value.role||""),
value.type? [mdb.TYPE]: [], can.core.Split(value.type||""),
value.role? [aaa.ROLE]: [], can.core.Split(value.role||""),
)], 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) {
@ -95,14 +90,22 @@ Volcanos(chat.ONIMPORT, {
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, 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.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.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)
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.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() {
if (sub.Option(UID)) {
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"))
},
})

View File

@ -65,16 +65,16 @@
"visitor": "访客"
},
"apply_status": {
"create": "待提交 🕑",
"cancel": "已取消",
"submit": "已提交 🕑",
"rejected": "已驳回",
"approved": "已通过"
"create": "待提交",
"cancel": "已取消",
"submit": "已提交",
"rejected": "已驳回",
"approved": "已通过"
},
"order_status": {
"create": "待审批 🕑",
"rejected": "已驳回",
"approved": "已通过"
"create": "待审批",
"rejected": "已驳回",
"approved": "已通过"
}
}
}

View File

@ -12,7 +12,7 @@ import (
type sess struct {
Table
user user
create string `name:"create user_uid"`
create string `name:"create user_uid*"`
}
func (s sess) Create(m *ice.Message, arg ...string) {

View File

@ -38,7 +38,3 @@ func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type
}
func init() { ice.TeamCtxCmd(user{}) }
type User struct{ user }
func init() { ice.TeamCtxCmd(User{}) }

View File

@ -22,17 +22,13 @@ func (s userPlace) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} 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)
}
func init() { ice.TeamCtxCmd(userPlace{}) }
type UserPlace struct{ userPlace }
func init() { ice.TeamCtxCmd(UserPlace{}) }
type UserPlaceRole int
const (

View File

@ -6,7 +6,7 @@
"index": "web.team.gonganxitong.apply",
"name": "权限申请",
"order": "3",
"time": "2024-08-04 10:59:49.031"
"time": "2024-08-04 20:40:00.961"
}
},
"58724bdcc3cae3e26700cb3199e0602c": {
@ -17,7 +17,7 @@
"name": "场所用户",
"order": "5",
"role": "creator,landlord",
"time": "2024-08-04 10:21:38.110"
"time": "2024-08-04 20:31:58.911"
}
},
"91dd0e9590d3021944f14f3ec8653beb": {
@ -28,7 +28,7 @@
"name": "权限审批",
"order": "4",
"role": "creator,landlord",
"time": "2024-08-04 10:18:03.398"
"time": "2024-08-04 21:29:49.710"
}
},
"ad574b9493741774ef8cb3fd5efd8026": {
@ -49,7 +49,7 @@
"name": "事件流",
"order": "2",
"role": "creator,landlord",
"time": "2024-08-04 11:53:34.283"
"time": "2024-08-04 20:45:03.518"
}
},
"e2117b53c036a72fe7e4885449488a6f": {
@ -59,7 +59,7 @@
"index": "web.team.gonganxitong.qrcode",
"name": "场所码",
"order": "1",
"time": "2024-08-04 09:47:55.478"
"time": "2024-08-04 21:19:42.289"
}
},
"fd86aad80a667152781bb188fb1249a2": {
@ -69,7 +69,7 @@
"index": "web.team.gonganxitong.email",
"name": "邮箱配置",
"role": "creator",
"time": "2024-08-04 10:57:25.060"
"time": "2024-08-04 19:51:30.768"
}
}
}