This commit is contained in:
jingganjiaoyu 2024-08-04 14:54:41 +08:00
parent 9e66460435
commit 4ef9c83924
8 changed files with 59 additions and 49 deletions

View File

@ -14,7 +14,7 @@ type Apply struct {
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"`
list string `name:"list place_uid uid auto" role:"void" help:"权限申请" icon:"https://img.icons8.com/officel/80/edit-property.png"`
cancel string `name:"cancel" role:"void"`
submit string `name:"submit" role:"void"`
}
@ -37,7 +37,7 @@ func (s Apply) Create(m *ice.Message, arg ...string) {
}
func (s Apply) Cancel(m *ice.Message, arg ...string) {
msg := s.status(m, ApplyCreate, ApplyCancel)
s.SendTemplate(m, "", msg.Append(model.USER_UID), "场所权限申请 已取消")
s.SendTemplate(m, "", msg.Append(model.USER_UID), "权限申请 已取消")
}
func (s Apply) Submit(m *ice.Message, arg ...string) {
msg := s.status(m, ApplyCreate, ApplySubmit)
@ -62,11 +62,11 @@ func (s Apply) Submit(m *ice.Message, arg ...string) {
}
func (s Apply) Reject(m *ice.Message, arg ...string) {
msg := s.status(m, ApplySubmit, ApplyRejected)
s.SendTemplate(m, "", msg.Append(model.USER_UID), "场所权限申请 已驳回 ❌")
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), "场所权限申请 已通过 ✅")
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) {
@ -76,7 +76,11 @@ func (s Apply) List(m *ice.Message, arg ...string) {
model.BEGIN_TIME, model.END_TIME,
model.PLACE_UID,
)
if len(arg) == 1 {
if len(arg) == 0 {
if m.IsTech() {
s.Select(m)
}
} else if len(arg) == 1 {
if s.Table.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0]); m.Length() == 0 {
m.EchoInfoButton(m.Trans("please create apply", "请创建权限申请"), s.Create)
return
@ -104,10 +108,12 @@ 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)
s.RewriteAppend(m)
m.Info("what %v", m.FormatMeta())
m.Info("what %v", m.FormatMeta())
s.Display(m)
}

View File

@ -24,7 +24,22 @@ func (s Table) Init(m *ice.Message, arg ...string) {
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { Portal{}.Show(m) })
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.PLACE_TYPE:
for k, v := range PlaceTypeList {
m.Push(arg[0], k).Push(model.NAME, v)
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
case model.USER_PLACE_ROLE:
for k, v := range UserPlaceRoleList {
if k != UserPlaceCreator && k != UserPlaceVisitor {
m.Push(arg[0], k).Push(model.NAME, v)
}
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
default:
s.Table.Inputs(m, arg...)
}
}
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
if len(arg) == 0 || len(arg) == 1 {

View File

@ -12,6 +12,7 @@ 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"`
}

View File

@ -14,6 +14,7 @@ type Order struct {
event event
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"`
create string `name:"create user_uid* apply_uid* status*"`
reject string `name:"reject" role:"void"`
approve string `name:"approve" role:"void"`
@ -21,21 +22,21 @@ 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), "权限审批 请处理")
}
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))
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.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), "权限审批 已驳回 ❌")
}
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))
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.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), "权限审批 已通过 ✅")
}
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),
@ -67,7 +68,6 @@ func (s Order) List(m *ice.Message, arg ...string) {
s.UserPlace.(interface {
RewriteAppend(*ice.Message, ...string) *ice.Message
}).RewriteAppend(m)
s.RewriteAppend(m)
s.Display(m)
}

View File

@ -21,7 +21,7 @@ type Portal struct {
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"`
placeRemove string `name:"placeRemove uid*" role:"void" style:"danger"`
scanQRCode string `name:"scanQRCode type text" role:"void" icon:"bi bi-qr-code-scan"`
}

View File

@ -1,9 +1,10 @@
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.onimport.myPortal(can, msg, msg.Option("_place_uid")||PLACE_UID, msg.Option("_place_name")||PLACE_NAME, msg.Option("_street_name"))
},
myValue: function(can, value, PLACE_UID, PLACE_NAME, STREET_NAME) {
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
return [
{view: html.TITLE, list: [{text: value[PLACE_NAME]},
@ -24,7 +25,7 @@ Volcanos(chat.ONIMPORT, {
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", "")), title)}], _init: function(target) {
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)
}}])
@ -36,7 +37,7 @@ Volcanos(chat.ONIMPORT, {
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)
can.onimport.selectIndex(can, can.sup.current, PLACE_UID, PLACE_NAME)
})
can.user.agent.init(can)
} else {
@ -58,12 +59,14 @@ Volcanos(chat.ONIMPORT, {
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) {
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")
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) {
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value[PLACE_TYPE]) == -1) {
can.onmotion.toggle(can, target, false)
} else if (list.indexOf(aaa.ROLE) > -1 && list.indexOf(value.user_place_role) == -1) {
} else if (list.indexOf(aaa.ROLE) > -1 && list.indexOf(value[USER_PLACE_ROLE]) == -1) {
can.onmotion.toggle(can, target, false)
} else {
can.onmotion.toggle(can, target, true)

View File

@ -4,9 +4,6 @@
"placeCreate": "添加场所",
"placeRemove": "删除场所",
"qrcode": "场所码",
"apply": "申请单",
"order": "审批单",
"event": "事件流",
"email": "邮箱配置",
"placeUser": "场所用户",
"cancel": "取消",
@ -15,16 +12,11 @@
"approve": "通过",
"icons": {
"qrcode": "https://img.icons8.com/officel/80/qr-code.png",
"apply": "https://img.icons8.com/officel/80/edit-property.png",
"order": "https://img.icons8.com/officel/80/receipt-approved.png",
"event": "https://img.icons8.com/officel/80/property-with-timer.png",
"email": "https://img.icons8.com/officel/80/reading-confirmation.png",
"placeUser": "https://img.icons8.com/officel/80/person-at-home.png"
},
"style": {
"placeRemove": "danger"
},
"input": {
"My Place": "我的场所",
"city_uid": "城市",
"city_name": "城市名称",
"street_uid": "街道",

View File

@ -4,16 +4,9 @@
"enable": "true",
"icons": "https://img.icons8.com/officel/80/edit-property.png",
"index": "web.team.gonganxitong.apply",
"name": "申请单",
"order": "2",
"role": "visitor,tenant",
"time": "2024-08-04 01:26:56.140"
}
},
"3c12d065a7b2fb9a8a09f47d87bd5bef": {
"meta": {
"index": "web.team.gonganxitong.express.express",
"time": "2024-08-03 19:43:29.173"
"name": "权限申请",
"order": "3",
"time": "2024-08-04 10:59:49.031"
}
},
"58724bdcc3cae3e26700cb3199e0602c": {
@ -22,9 +15,9 @@
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
"index": "web.team.gonganxitong.placeUser",
"name": "场所用户",
"order": "6",
"order": "5",
"role": "creator,landlord",
"time": "2024-08-04 01:26:32.086"
"time": "2024-08-04 10:21:38.110"
}
},
"91dd0e9590d3021944f14f3ec8653beb": {
@ -32,10 +25,10 @@
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.gonganxitong.order",
"name": "审批",
"order": "3",
"name": "权限审批",
"order": "4",
"role": "creator,landlord",
"time": "2024-08-04 00:20:22.265"
"time": "2024-08-04 10:18:03.398"
}
},
"ad574b9493741774ef8cb3fd5efd8026": {
@ -43,8 +36,8 @@
"enable": "true",
"icons": "https://img.icons8.com/officel/80/shipped.png",
"index": "web.team.gonganxitong.express",
"name": "快递",
"order": "5",
"name": "收发快递",
"order": "6",
"time": "2024-08-02 12:47:45.588"
}
},
@ -54,9 +47,9 @@
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
"index": "web.team.gonganxitong.event",
"name": "事件流",
"order": "4",
"role": "creator",
"time": "2024-08-04 01:26:32.087"
"order": "2",
"role": "creator,landlord",
"time": "2024-08-04 11:53:34.283"
}
},
"e2117b53c036a72fe7e4885449488a6f": {
@ -66,7 +59,7 @@
"index": "web.team.gonganxitong.qrcode",
"name": "场所码",
"order": "1",
"time": "2024-08-04 00:43:23.253"
"time": "2024-08-04 09:47:55.478"
}
},
"fd86aad80a667152781bb188fb1249a2": {
@ -76,7 +69,7 @@
"index": "web.team.gonganxitong.email",
"name": "邮箱配置",
"role": "creator",
"time": "2024-08-04 00:45:57.464"
"time": "2024-08-04 10:57:25.060"
}
}
}