This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-29 11:09:25 +08:00
parent 494cd55393
commit 3ea9d3b12a
22 changed files with 290 additions and 143 deletions

View File

@ -301,6 +301,7 @@ func PortalCmd(portal ice.Any) {
} }
table := portal.(interface{ getTable() Table }).getTable() table := portal.(interface{ getTable() Table }).getTable()
cmd("portal", portal) cmd("portal", portal)
cmd("search", search{Tables: Tables{Table: table}})
cmd("qrcode", qrcode{Tables: Tables{Table: table}}) cmd("qrcode", qrcode{Tables: Tables{Table: table}})
cmd("event", event{Table: table}) cmd("event", event{Table: table})
cmd("apply", apply{Table: table}) cmd("apply", apply{Table: table})

View File

@ -9,6 +9,7 @@ Volcanos(chat.ONIMPORT, {
{view: html.TITLE, list:[value.title||value.name||value.user_name, {view: html.TITLE, list:[value.title||value.name||value.user_name,
can.onimport.textView(can, value, PLACE_TYPE, mdb.TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE, aaa.ROLE), can.onimport.textView(can, value, PLACE_TYPE, mdb.TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE, aaa.ROLE),
]}, ]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.company_name]},
{view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]}, {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]},
value.address && {view: html.STATUS, list: [value.address]}, value.address && {view: html.STATUS, list: [value.address]},
value.content && {view: html.OUTPUT, list: [value.content]}, value.content && {view: html.OUTPUT, list: [value.content]},

View File

@ -13,6 +13,7 @@ const (
TITLE = "title" TITLE = "title"
CONTENT = "content" CONTENT = "content"
OPERATOR = "operator" OPERATOR = "operator"
CREATOR = "creator"
CREATED_AT = "created_at" CREATED_AT = "created_at"
UPDATED_AT = "updated_at" UPDATED_AT = "updated_at"
DELETED_AT = "deleted_at" DELETED_AT = "deleted_at"
@ -38,6 +39,7 @@ const (
SERVICE_TYPE = "service_type" SERVICE_TYPE = "service_type"
MESSAGE_STATUS = "message_status" MESSAGE_STATUS = "message_status"
SERVICE_STATUS = "service_status" SERVICE_STATUS = "service_status"
QRCODE_TYPE = "qrcode_type"
FROM_USER_UID = "from_user_uid" FROM_USER_UID = "from_user_uid"
TO_USER_UID = "to_user_uid" TO_USER_UID = "to_user_uid"
BEGIN_TIME = "begin_time" BEGIN_TIME = "begin_time"
@ -47,6 +49,7 @@ const (
EMAIL = "email" EMAIL = "email"
AVATAR = "avatar" AVATAR = "avatar"
ADDRESS = "address" ADDRESS = "address"
INDEX = "index"
INIT = "init" INIT = "init"
) )

View File

@ -23,6 +23,7 @@ type Portal struct {
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 place_name* address*" icon:"bi bi-plus-square-dotted" role:"void"` placeCreate string `name:"placeCreate city_name* street_name* place_type*:select place_name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
placeRemove string `name:"placeRemove uid*" role:"void"` placeRemove string `name:"placeRemove uid*" role:"void"`
placeSearch string `name:"placeSearch" icon:"bi bi-search" role:"void"`
scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"` scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"`
setIcons string `name:"setIcons icons" icon:"bi bi-info-square"` setIcons string `name:"setIcons icons" icon:"bi bi-info-square"`
} }
@ -79,12 +80,27 @@ func (s Portal) List(m *ice.Message, arg ...string) {
return return
} }
if len(arg) == 0 { if len(arg) == 0 {
m.Cmdy(s.UserPlace, m.Option(model.USER_UID)).PushAction(s.PlaceRemove).Action(s.PlaceCreate, s.ScanQRCode) m.Cmdy(s.UserPlace, m.Option(model.USER_UID)).PushAction(s.PlaceRemove).Action(s.PlaceCreate, s.ScanQRCode, s.PlaceSearch)
kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("", s.PlaceCreate, s.ScanQRCode) }) kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("", s.PlaceCreate, s.ScanQRCode, s.PlaceSearch) })
} else if len(arg) == 1 { } else if len(arg) == 1 {
if arg[0] != "" { if arg[0] != "" {
msg := m.Cmd(s.Place, s.Table.Select, model.UID, arg[0]) m.Option("_user_place_role", s.Keys(s.UserPlace, model.ROLE))
s.AddRecent(m.Spawn(), arg[0], msg.Append(model.NAME), msg.Append(mdb.ICONS)) m.Option("_street_name", s.Keys(s.Street, model.NAME))
msg := m.Cmd(s.UserPlace, m.Option(model.USER_UID), arg[0])
if msg.Length() == 0 {
msg = m.Cmd(s.Place, s.Table.Select, model.UID, arg[0])
msg.Push(s.Keys(s.UserPlace, model.ROLE), "0")
msg.RenameAppend(model.NAME, s.Keys(s.Place, model.NAME), model.TYPE, s.Keys(s.Place, model.TYPE))
s.SelectJoin(msg, s.Street, model.NAME, model.CITY_UID)
s.SelectJoin(msg, s.city)
}
s.UserPlace.RewriteAppend(msg)
m.Options(msg.AppendSimple(
s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE),
s.Keys(s.Street, model.NAME), model.CITY_NAME,
))
s.AddRecent(msg, arg[0], msg.Append(s.Keys(s.Place, model.NAME)), msg.Append(mdb.ICONS))
} }
s.Hash.List(m).SortInt(mdb.ORDER) s.Hash.List(m).SortInt(mdb.ORDER)
} else if len(arg) == 2 { } else if len(arg) == 2 {
@ -118,6 +134,9 @@ func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
defer m.ToastProcess()() defer m.ToastProcess()()
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID)) m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID))
} }
func (s Portal) PlaceSearch(m *ice.Message, arg ...string) {
m.ProcessRewrite(model.INDEX, m.Prefix("search"))
}
func (s Portal) ScanQRCode(m *ice.Message, arg ...string) { func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
defer m.ToastProcess()() defer m.ToastProcess()()
if m.Option(mdb.TYPE) == mdb.TEXT { if m.Option(mdb.TYPE) == mdb.TEXT {

View File

@ -1,21 +1,21 @@
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", CITY_NAME = "city_name"
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.isCmdMode() && can.user.isMobile && can.onappend.style(can, html.OUTPUT) if (can.user.isMobile && can.isCmdMode()) { can.onappend.style(can, html.OUTPUT)
can.isCmdMode() && can.user.isMobile && can.onmotion.delay(can, function() { can.sup.onimport.size(can.sup, window.innerHeight, window.innerWidth) }) can.onmotion.delay(can, function() { can.sup.onimport.size(can.sup, window.innerHeight, window.innerWidth) })
can.isCmdMode() && can.user.isMobile && can.onmotion.delay(can, function() { can.sup.onimport.size(can.sup, window.innerHeight, window.innerWidth) }, 300) can.onmotion.delay(can, function() { can.sup.onimport.size(can.sup, window.innerHeight, window.innerWidth) }, 300)
can.onmotion.delay(can, function() { can.sup.onimport.size(can.sup, window.innerHeight, window.innerWidth) }, 3000)
}
can.onimport.myPortal(can, msg) can.onimport.myPortal(can, msg)
}, },
typeStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" }, typeStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" },
roleStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" }, roleStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" },
myValue: function(can, value) { myValue: function(can, value) { return [
return [ {view: html.TITLE, list: [value._name, {text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]},
{view: html.TITLE, list: [value._name, {text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]}, value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]},
value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]}, ]},
]}, {view: html.STATUS, list: [value.uid.slice(0, 6), value.city_name, value._street]},
{view: html.STATUS, list: [value.uid.slice(0, 6), value.city_name, value._street]}, ] },
]
},
myPortal: function(can, msg) { myPortal: function(can, msg) {
var PLACE_UID = msg.Option("_place_uid"), PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type") 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 USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name")
@ -23,44 +23,48 @@ Volcanos(chat.ONIMPORT, {
if (can.Option(PLACE_UID) == "" && can.Option(ctx.INDEX) == "") { if (can.Option(PLACE_UID) == "" && can.Option(ctx.INDEX) == "") {
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.ui = can.page.Append(can, can._output, [ can.ui = can.page.Append(can, can._output, [
{view: html.OUTPUT, list: [ {view: html.OUTPUT, list: ["mydebug.list", "myplace.list", "myinit.list", "myindex.list", "myallow.list"]},
// "mydebug.list",
"myplace.list",
"myinit.list",
"myindex.list",
"myallow.list",
]},
{view: html.ACTION, list: ["myorder.list"]}, {view: html.ACTION, list: ["myorder.list"]},
]) ])
can.ui.mydebug && can.onimport.myDebug(can, msg, can.ui.mydebug) can.onimport.myDebug(can, msg, can.ui.mydebug)
var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE) var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE)
msg.Length() > 0? can.run({}, [uid], function(msg) { can._index_msg = msg msg.Length() > 0? can.run({}, [uid], function(msg) { can._index_msg = msg
can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID, USER_PLACE_ROLE), can.onimport.selectIndex(can, can.sup.current) can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID, USER_PLACE_ROLE), can.onimport.selectIndex(can, can.sup.current)
can.onimport.myAllow(can, msg, can.ui.myallow, PLACE_UID, USER_PLACE_ROLE) can.onimport.myAllow(can, msg, can.ui.myallow, PLACE_UID, USER_PLACE_ROLE)
can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE) can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE)
can.sup.current && can.onexport.value(can, can.sup.current, PLACE_UID, PLACE_NAME)
}): can.run({}, [uid], function(msg) { can._index_msg = msg }): can.run({}, [uid], function(msg) { can._index_msg = msg
can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE) can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE)
can.sup.current && can.onexport.value(can, can.sup.current, PLACE_UID, PLACE_NAME)
}), can.ui.place_count = msg.Length() }), can.ui.place_count = msg.Length()
} else if (can.Option(ctx.INDEX) == "") { } else if (can.Option(ctx.INDEX) == "") {
can.sup._back_args = [can.Option(PLACE_UID)]
can.ui = can.page.Append(can, can._output, [ can.ui = can.page.Append(can, can._output, [
{view: html.OUTPUT, list: [ {view: html.OUTPUT, list: ["myplace.list", "myindex.list", "myallow.list"]},
// "mydebug.list",
"myplace.list",
"myindex.list",
]},
{view: html.ACTION, list: ["myorder.list"]}, {view: html.ACTION, list: ["myorder.list"]},
]) ])
can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID, USER_PLACE_ROLE), can.onimport.selectIndex(can, { var _msg = can.request({}, {_user_place_role: msg.Option("_user_place_role"), _street_name: msg.Option("_street_name")}); _msg.Push(kit.Dict(
place_name: msg.Option("place_name"), UID, "", PLACE_UID, can.Option(PLACE_UID), PLACE_NAME, msg.Option(PLACE_NAME), PLACE_TYPE, msg.Option(PLACE_TYPE), USER_PLACE_ROLE, msg.Option(USER_PLACE_ROLE),
}, msg.Option("user_place_role")) STREET_NAME, msg.Option(STREET_NAME), CITY_NAME, msg.Option(CITY_NAME),
))
_msg.Option(ice.MSG_ACTION, msg.Option(USER_PLACE_ROLE) == "visitor"? '["placeSearch"]': '["placeCreate","scanQRCode","placeSearch"]')
can.onimport.myPlace(can, _msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE)
can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID, USER_PLACE_ROLE), can.onimport.selectIndex(can, can.sup.current)
can.onimport.myAllow(can, msg, can.ui.myallow, PLACE_UID, USER_PLACE_ROLE)
can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE) can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE)
} else { } else {
can.onimport.myData(can, msg, can._output, PLACE_UID, PLACE_NAME) can.onimport.story(can, msg, can._output, PLACE_UID, PLACE_NAME)
} }
}, },
myTrans: function(can, value, PLACE_UID, PLACE_NAME, PLACE_TYPE, USER_PLACE_ROLE, STREET_NAME) {
value.icons = can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE]))
value._uid = value[PLACE_UID], value._name = value[PLACE_NAME], value._street = value[STREET_NAME]
value._type = value[PLACE_TYPE], value.__type = can.user.transValue(can, value, PLACE_TYPE)
value._role = value[USER_PLACE_ROLE], value.__role = can.user.transValue(can, value, USER_PLACE_ROLE)
value._type_style = can.onimport.typeStyle(can, value, PLACE_TYPE)
value._role_style = can.onimport.roleStyle(can, value, USER_PLACE_ROLE)
value.icons = can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE]))
},
myDebug: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) { myDebug: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) {
can.onmotion.hidden(can, target)
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Debug", "我的调试")}]}]) can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Debug", "我的调试")}]}])
can.page.Append(can, target, [{text: window.innerWidth+", "+window.innerHeight}]) can.page.Append(can, target, [{text: window.innerWidth+", "+window.innerHeight}])
}, },
@ -73,30 +77,23 @@ Volcanos(chat.ONIMPORT, {
can.ui._target = can.page.Append(can, target||can._output, [html.OUTPUT])._target can.ui._target = can.page.Append(can, target||can._output, [html.OUTPUT])._target
msg.Length() > 0 && can.page.Append(can, can.ui._target, msg.Table(function(value) { msg.Length() > 0 && can.page.Append(can, can.ui._target, msg.Table(function(value) {
place_uid = place_uid||value[PLACE_UID], value[PLACE_UID] == can.onexport.session(can, PLACE_UID) && (place_uid = value[PLACE_UID]) place_uid = place_uid||value[PLACE_UID], value[PLACE_UID] == can.onexport.session(can, PLACE_UID) && (place_uid = value[PLACE_UID])
place_uid == value[PLACE_UID] && (can.sup.current = value, can.onexport.title(can, value[PLACE_NAME])) place_uid == value[PLACE_UID] && (can.sup.current = value)
value._uid = value[PLACE_UID], value._name = value[PLACE_NAME], value._street = value[STREET_NAME] can.onimport.myTrans(can, value, PLACE_UID, PLACE_NAME, PLACE_TYPE, USER_PLACE_ROLE, STREET_NAME)
value._type = value[PLACE_TYPE], value.__type = can.user.transValue(can, value, PLACE_TYPE)
value._role = value[USER_PLACE_ROLE], value.__role = can.user.transValue(can, value, USER_PLACE_ROLE)
value.icons = can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE]))
value._type_style = can.onimport.typeStyle(can, value, PLACE_TYPE)
value._role_style = can.onimport.roleStyle(can, 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.onexport.value(can, value, PLACE_UID, PLACE_NAME) can.onexport.value(can, value, PLACE_UID, PLACE_NAME)
}) })
})), can.sup.current && can.onexport.value(can, can.sup.current, PLACE_UID, PLACE_NAME) })), can.page.Append(can, target, [{view: html.ACTION, _init: function(target) { can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}])
can.page.Append(can, target, [{view: html.ACTION, _init: function(target) { can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}])
return place_uid||"" return place_uid||""
}, },
myInit: function(can, msg, value, target) { if (!msg) { return } myInit: function(can, msg, value, target) { if (!msg) { return }
can.onmotion.hidden(can, target)
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Init", "我的初始化")}]}]) can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Init", "我的初始化")}]}])
msg.Table(function(val) { msg.Table(function(val) {
if (parseInt(val.init) == parseInt(value.init)+1) { val.args = [value._uid], val.style = html.OUTPUT, value._init = true if (parseInt(val.init) == parseInt(value.init)+1) { val.args = [value._uid], val.style = html.OUTPUT, value._init = true
can.onappend.plugin(can, val, function(sub) { var run = sub.run can.onappend.plugin(can, val, function(sub) { var run = sub.run
sub.run = function(event, cmds, cb) { sub.run = function(event, cmds, cb) {
run(can.request(event, {user_place_uid: value.uid, user_place_init: value.init}), cmds, function(msg) { run(can.request(event, {user_place_uid: value.uid, user_place_init: value.init}), cmds, function(msg) {
if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { can.onmotion.clearInput(can), can.Update() } else { cb(msg) }
can.onmotion.clearInput(can), can.Update()
} else { cb(msg) }
}) })
} }
}, target) }, target)
@ -104,7 +101,7 @@ Volcanos(chat.ONIMPORT, {
}) })
}, },
myList: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) { myList: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) {
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100), height = width; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4, height = width) var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100); can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4)
can.page.Append(can, target, msg.Table(function(value) { if (value.order < 100 && value.enable != ice.TRUE) { return } can.page.Append(can, target, msg.Table(function(value) { if (value.order < 100 && value.enable != ice.TRUE) { return }
return {view: [[html.ITEM, ctx.INDEX].concat( return {view: [[html.ITEM, ctx.INDEX].concat(
value.type? [mdb.TYPE]: [], can.core.Split(value.type||""), value.type? [mdb.TYPE]: [], can.core.Split(value.type||""),
@ -121,8 +118,7 @@ Volcanos(chat.ONIMPORT, {
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Index", "我的应用")}]}]) can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Index", "我的应用")}]}])
var role = can.page.Append(can, target, [{view: aaa.ROLE, list: can.core.Item(can.Conf("_trans.value."+USER_PLACE_ROLE), function(key, value) { var role = can.page.Append(can, target, [{view: aaa.ROLE, list: can.core.Item(can.Conf("_trans.value."+USER_PLACE_ROLE), function(key, value) {
if (can.base.isIn(key, ctx.STYLE, mdb.ICONS)) { return } if (can.base.isIn(key, ctx.STYLE, mdb.ICONS)) { return }
return {text: [can.user.trans(can, key, value), "", key], onclick: function(event) { return {text: [can.user.trans(can, key, value), "", key], onclick: function(event) { can.onexport.value(can, can.sup.current, PLACE_UID)
can.onexport.value(can, can.sup.current, PLACE_UID)
can.onimport.selectIndex(can, can.sup.current, key), can.onmotion.select(can, role, html.SPAN, event.target) can.onimport.selectIndex(can, can.sup.current, key), can.onmotion.select(can, role, html.SPAN, event.target)
}} }}
}) }])._target; can.ui.role = role }) }])._target; can.ui.role = role
@ -135,14 +131,13 @@ Volcanos(chat.ONIMPORT, {
var _msg = can.request(); msg.Table(function(value) { if (value.order > 89 && value.order < 100) { _msg.Push(value) } }) var _msg = can.request(); msg.Table(function(value) { if (value.order > 89 && value.order < 100) { _msg.Push(value) } })
var output = can.page.Append(can, target, [html.OUTPUT])._target var output = can.page.Append(can, target, [html.OUTPUT])._target
can.onimport.myList(can, _msg, output, PLACE_UID, USER_PLACE_ROLE) can.onimport.myList(can, _msg, output, PLACE_UID, USER_PLACE_ROLE)
can.onimport.layout(can)
}, },
myOrder: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) { myOrder: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) {
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Order", "我的系统")}]}]) can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Order", "我的系统")}]}])
var _msg = can.request(); msg.Table(function(value) { if (value.order > 99) { _msg.Push(value) } }) var _msg = can.request(); msg.Table(function(value) { if (value.order > 99) { _msg.Push(value) } })
var output = can.page.Append(can, target, [html.OUTPUT])._target var output = can.page.Append(can, target, [html.OUTPUT])._target
can.onimport.myList(can, _msg, output, PLACE_UID, USER_PLACE_ROLE) can.onimport.myList(can, _msg, output, PLACE_UID, USER_PLACE_ROLE)
can.onimport.layout(can) can.onimport.layout(can), can.onexport.value(can, can.sup.current, PLACE_UID)
}, },
selectIndex: function(can, value, role) { role = role||value._role selectIndex: function(can, value, role) { role = role||value._role
can.ui.role && can.onmotion.toggle(can, can.ui.role, value._role == "creator") can.ui.role && can.onmotion.toggle(can, can.ui.role, value._role == "creator")
@ -157,28 +152,28 @@ Volcanos(chat.ONIMPORT, {
} }
}) })
}, },
myData: function(can, msg, target, PLACE_UID, PLACE_NAME) { story: function(can, msg, target, PLACE_UID, PLACE_NAME) {
msg.Table(function(value) { function back() {} function refresh() {} msg.Table(function(value) { function goback() {} function reload() {}
var list = [can.page.button(can, can.user.trans(can, "goback", "返回"), function(event) { back() }), can.page.button(can, can.user.trans(can, "reload", "刷新"), function(event) { refresh() })] var list = [can.page.button(can, can.user.trans(can, "goback", "返回"), function(event) { goback() }), can.page.button(can, can.user.trans(can, "reload", "刷新"), function(event) { reload() })]
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.onappend.plugin(can, value, function(sub) { can.onappend.plugin(can, value, function(sub) { sub.sup = can
can.core.List(["_trans", "_icons", "_style", "_trans.input", "_trans.value"], function(key) { can.core.List(["_trans", "_icons", "_style", "_trans.input", "_trans.value"], function(key) {
var value = sub.Conf(key); value && can.core.Item(can.Conf(key), function(k, v) { value[k] = value[k]||v }) var value = sub.Conf(key); value && can.core.Item(can.Conf(key), function(k, v) { value[k] = value[k]||v })
}) })
can.onexport.title(can, sub.Conf(PLACE_NAME, msg.Option(PLACE_NAME)), value.help) can.onexport.title(can, sub.Conf(PLACE_NAME, msg.Option(PLACE_NAME)), value.help)
sub.onexport.title = function(sub) { can.onexport.title.apply(can.onexport, [can].concat(can.core.List(arguments).slice(1))) } sub.onexport.title = function(sub) { can.onexport.title.apply(can.onexport, [can].concat(can.core.List(arguments).slice(1))) }
var run = sub.run; sub.run = function(event, cmds, cb) { run(can.request(event, {_place_name: sub.Conf(PLACE_NAME)}), cmds, cb) } var run = sub.run; sub.run = function(event, cmds, cb) { run(can.request(event, {_place_name: sub.Conf(PLACE_NAME)}), cmds, cb) }
can.page.Appends(can, ui.action, list)
goback = function() { can.page.ClassList.add(can, can._fields, "_back")
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update()
}
reload = function() { sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "reload") }, 300) }
sub.onexport._output = function(_sub, msg) { 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.onimport, function(key, value) { _sub.onimport[key] = _sub.onimport[key]||value })
can.core.Item(can.onexport, function(key, value) { _sub.onexport[key] = _sub.onexport[key]||value }) can.core.Item(can.onexport, function(key, value) { _sub.onexport[key] = _sub.onexport[key]||value })
} }
can.page.Appends(can, ui.action, list)
back = function() { can.page.ClassList.add(can, can._fields, "_back")
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update()
}
refresh = function() { sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "refresh") }, 300) }
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.styleHeight(can, _sub._target, can.ConfHeight() - 32) can.page.styleHeight(can, _sub._target, can.ConfHeight() - 32)
_sub.onimport._option = function(_sub, uid, index, place_uid) { _sub.onimport._option = function(_sub, uid, index, place_uid) {
@ -192,46 +187,51 @@ Volcanos(chat.ONIMPORT, {
can.onexport.title(can, sub.Conf(PLACE_NAME), sub.ConfHelp(), msg.Option("_share_title")||"") can.onexport.title(can, sub.Conf(PLACE_NAME), sub.ConfHelp(), msg.Option("_share_title")||"")
can.user.agent.init(can, msg.Option("_share_content"), msg.Option("_share_icons")||value.icons) can.user.agent.init(can, msg.Option("_share_content"), msg.Option("_share_icons")||value.icons)
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)
back = function() { can.page.ClassList.add(can, can._fields, "_back") goback = function() { can.page.ClassList.add(can, can._fields, "_back")
if (_sub.onaction._back && _sub.onaction._back(_sub)) { return } can.Update() if (_sub.onaction._goback && _sub.onaction._goback(_sub)) { return } can.Update()
} }
_sub.onaction._back = function(_sub) { _sub.onaction._goback = function(_sub) {
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()
} else { } else {
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update() if (can.sup._back_args) {
can.onexport.hash(can, ""), can.Option(PLACE_UID, can.sup._back_args[0]), can.Option(ctx.INDEX, ""), can.Update()
} else {
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update()
}
} }
} }
refresh = function() { reload = function() {
if (_sub.onaction._refresh) { return _sub.onaction._refresh(_sub) } if (_sub.onaction._reload) { return _sub.onaction._reload(_sub) }
sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "refresh") }, 300) sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "reload") }, 300)
} }
} }
}) })
}) })
}, },
plugin: function(can, value) { var action = can._root.Action plugin: function(can, value) { var action = can._root.Action
var key = [value.space, value.index, value.args].join(".") var sup = can.sup.sup
var sub = action._plugins[key] value.space = value.space||sup.ConfSpace()
value.index = value.index||sup.ConfIndex()
var key = [value.space, value.index, value.args].join(","), sub = action._plugins[key]
if (sub) { if (sub) {
can.page.SelectChild(can, action._output, html.FIELDSET_PLUGIN, function(target) { can.onmotion.toggle(can, target, target == sub._target) }) can.page.SelectChild(can, action._output, html.FIELDSET_PLUGIN, function(target) { can.onmotion.toggle(can, target, target == sub._target) })
sub.onimport.size(sub, window.innerHeight, window.innerWidth) sub.onimport.size(sub, window.innerHeight, window.innerWidth), can.user.title((value._title||"")+" "+sub.ConfHelp())
can.user.title((value._title||"")+" "+sub.ConfHelp())
return return
} }
can.misc.localStorage(can, [value.space, value.index, mdb.HASH].join(","), value.args? [value.args[0]]: "") can.misc.localStorage(can, [value.space, value.index, mdb.HASH].join(","), value.args? [value.args[0]]: "")
var args = value.args; value.args = []; value.type = html.PLUGIN, value.style = html.OUTPUT var args = value.args; args && (value.args = [args[0]]); value.type = html.PLUGIN, value.style = html.OUTPUT
can._root.Action.onappend.plugin(can._root.Action, value, function(sub) { action._plugins[key] = sub can._root.Action.onappend.plugin(can._root.Action, value, function(sub) { action._plugins[key] = sub
sub._back_args = value.args
can.page.SelectChild(can, action._output, html.FIELDSET_PLUGIN, function(target) { can.onmotion.toggle(can, target, target == sub._target) }) can.page.SelectChild(can, action._output, html.FIELDSET_PLUGIN, function(target) { can.onmotion.toggle(can, target, target == sub._target) })
sub.onimport.size(sub, window.innerHeight, window.innerWidth) sub.onimport.size(sub, window.innerHeight, window.innerWidth), can.user.title((value._title||"")+" "+sub.ConfHelp())
can.user.title((value._title||"")+" "+sub.ConfHelp())
sub.onexport.title = function(can, title) { can.user.title(can.core.List(arguments).slice(1).join(" ")) } sub.onexport.title = function(can, title) { can.user.title(can.core.List(arguments).slice(1).join(" ")) }
}, action._output) }, action._output)
}, },
float: function(can, value, cb) { value.style = html.OUTPUT float: function(can, value, cb) { value.style = html.OUTPUT
can.onappend.plugin(can, value, function(sub) { var _back = can.onaction._back can.onappend.plugin(can, value, function(sub) { var _goback = can.onaction._goback
can.onaction._back = function() { can.onaction._back = _back, can.page.Remove(can, sub._target), can.onexport.title(can); return true } can.onaction._goback = function() { can.onaction._goback = _goback, can.page.Remove(can, sub._target), can.onexport.title(can); return true }
can.onaction._refresh = function() { sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "refresh") }, 300) } can.onaction._reload = function() { sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "reload") }, 300) }
sub.onexport.output = function(_sub, msg) { can.onexport.title(can, sub.ConfHelp()+" "+msg.Option("_share_title")) sub.onexport.output = function(_sub, msg) { can.onexport.title(can, sub.ConfHelp()+" "+msg.Option("_share_title"))
sub.onimport.size(sub, window.innerHeight-html.ACTION_HEIGHT, window.innerWidth, false) sub.onimport.size(sub, window.innerHeight-html.ACTION_HEIGHT, window.innerWidth, false)
} }
@ -245,12 +245,13 @@ Volcanos(chat.ONIMPORT, {
}, },
}) })
Volcanos(chat.ONEXPORT, { Volcanos(chat.ONEXPORT, {
value: function(can, value, PLACE_UID) { value: function(can, value, PLACE_UID) { if (!value) { return }
can.sup.current = value, can.onimport.selectIndex(can, can.sup.current)
can.onexport.session(can, PLACE_UID, value._uid), can.onexport.hash(can, value._uid)
can.onexport.title(can, value._name, can.ConfHelp()), can.user.agent.init(can)
can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(item) { can.onmotion.select(can, can.ui._target, html.DIV_ITEM, item) }) can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(item) { can.onmotion.select(can, can.ui._target, html.DIV_ITEM, item) })
can.sup.current = value, can.onimport.selectIndex(can, can.sup.current), can.onexport.title(can, value._name, can.ConfHelp()) can.ui.myallow && can.onmotion.toggle(can, can.ui.myallow, can.page.Select(can, can.ui.myallow, "div.item.index.role."+value._role).length > 0)
can.onexport.session(can, PLACE_UID, value._uid), can.onexport.hash(can, value._uid), can.user.agent.init(can) can.ui.myinit && can.onmotion.delay(can, function() { can.onmotion.toggle(can, can.ui.myinit, !!value._init) })
can.onmotion.delay(can, function() { can.onmotion.toggle(can, can.ui.myinit, !!value._init) })
can.onmotion.toggle(can, can.ui.myallow, can.page.Select(can, can.ui.myallow, "div.item.index.role."+value._role).length > 0)
if (!can._index_msg || can.onmotion.cache(can, function() { return value._uid }, can.ui.myinit)) { return } if (!can._index_msg || can.onmotion.cache(can, function() { return value._uid }, can.ui.myinit)) { return }
can.ui.myinit && can.onimport.myInit(can, can._index_msg, value, can.ui.myinit) can.ui.myinit && can.onimport.myInit(can, can._index_msg, value, can.ui.myinit)
}, },

View File

@ -1,5 +1,7 @@
{ {
"portal": "用户场景", "placeCreate": "添加场景", "placeRemove": "删除场景", "scanQRCode": "扫码添加", "portal": "用户场景",
"placeCreate": "创建", "placeRemove": "删除",
"placeSearch": "搜索", "scanQRCode": "扫码",
"qrcode": "场景码", "event": "事件流", "apply": "权限申请", "allow": "权限审批", "qrcode": "场景码", "event": "事件流", "apply": "权限申请", "allow": "权限审批",
"email": "邮箱配置", "member": "场景成员", "placeUser": "场景成员", "email": "邮箱配置", "member": "场景成员", "placeUser": "场景成员",
"message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持", "message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持",
@ -36,6 +38,7 @@
"street_name": "街道名称", "street_name": "街道名称",
"company_name": "公司名称", "company_name": "公司名称",
"city_name": "城市名称", "city_name": "城市名称",
"qrcode_type": "链接类型",
"apply_status": "申请状态", "apply_status": "申请状态",
"allow_status": "审批状态", "allow_status": "审批状态",
"begin_time": "起始时间", "begin_time": "起始时间",
@ -93,6 +96,10 @@
"service_status": { "service_status": {
"online": "在线" "online": "在线"
}, },
"qrcode_type": {
"portal": "门户首页",
"apply": "权限申请"
},
"place_type": { "place_type": {
"house": "住宅", "house": "住宅",
"hotel": "宾馆", "hotel": "宾馆",

View File

@ -10,11 +10,22 @@ type qrcode struct {
Tables Tables
order string `data:"90"` order string `data:"90"`
role string `data:"creator"` role string `data:"creator"`
apply string `name:"apply" role:"void"`
} }
func (s qrcode) List(m *ice.Message, arg ...string) { func (s qrcode) Apply(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, m.Option(model.USER_UID), arg[0]).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME)) s.info(m, arg[0], "apply")
m.Option(ice.MSG_FG, "blue")
m.EchoQRCode(s.Link(m, arg[0])) m.EchoQRCode(s.Link(m, arg[0]))
} }
func (s qrcode) List(m *ice.Message, arg ...string) {
s.info(m, arg[0], "portal")
m.EchoQRCode(m.MergePodCmd("", m.Prefix("portal"), s.Keys(s.Place, model.UID), arg[0]))
}
func (s qrcode) info(m *ice.Message, place_uid, typ string) {
m.Cmdy(s.UserPlace, m.Option(model.USER_UID), place_uid).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
m.Push(model.QRCODE_TYPE, typ)
m.Action(s.Apply)
}
func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) } func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) }

View File

@ -5,13 +5,9 @@ Volcanos(chat.ONIMPORT, {
return [ return [
{view: html.TITLE, list: [[args[1]].join(" "), sub? {text: ["load", "", mdb.STATUS]}: ""]}, {view: html.TITLE, list: [[args[1]].join(" "), sub? {text: ["load", "", mdb.STATUS]}: ""]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.updated_at), value.name]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.updated_at), value.name]},
// {view: html.STATUS, list: [value.name]},
// {view: html.STATUS, list: [value.space]},
// {view: html.STATUS, list: [value.index]},
// {view: html.OUTPUT, list: [value.info]},
] ]
}, function(event, value) { var args = can.core.Split(value.args) }, function(event, value) { var args = can.core.Split(value.args)
can.onaction._back(can) can.onaction._goback(can)
can.onimport.plugin(can, {_title: args[1], space: value.space, index: value.index, args: [args[0]]}) can.onimport.plugin(can, {_title: args[1], space: value.space, index: value.index, args: [args[0]]})
}) })
}, },

View File

@ -0,0 +1,28 @@
package gonganxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/community/src/gonganxitong/model"
)
type search struct {
Tables
visitor string `name:"visitor" role:"void"`
}
func (s search) List(m *ice.Message, arg ...string) {
if len(arg) < 2 {
m.Cmdy(s.Place, s.Select).Action()
} else if len(arg) == 2 {
m.FieldsSetDetail().Cmdy(s.Place, s.Select, model.UID, arg[1]).Action()
}
m.RenameAppend(model.TYPE, s.Keys(s.Place, model.TYPE))
s.SelectJoin(m, s.Street, model.NAME, model.CITY_UID)
s.SelectJoinCity(m)
m.RenameAppend(model.CREATOR, model.USER_UID)
s.SelectJoinUser(m)
m.Display("")
}
func init() { ice.TeamCtxCmd(search{Tables: newTables()}) }

View File

@ -0,0 +1,15 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
can.onimport.itemcards(can, msg, function(value) {
return [
{view: html.TITLE, list: [value.name||value.title||value.user_name]},
{view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.company_name]},
{view: html.OUTPUT, list: [value.info||value.content]},
]
}, function(event, value) {
// can.onaction._goback(can)
can.onimport.plugin(can, {args: [value.uid]})
})
},
})

View File

@ -7,7 +7,7 @@ Volcanos(chat.ONIMPORT, {
{view: html.STATUS, list: [value.module, value.version]}, {view: html.STATUS, list: [value.module, value.version]},
{view: html.STATUS, list: [value.domain.split("?")[0]]}, {view: html.STATUS, list: [value.domain.split("?")[0]]},
] }, function(event, value) { ] }, function(event, value) {
can.onaction._back(can) can.onaction._goback(can)
can.onimport.plugin(can, {space: value.space||value.nodename, index: value.index}) can.onimport.plugin(can, {space: value.space||value.nodename, index: value.index})
}) })
}, },

View File

@ -1,7 +1,5 @@
{ {
"portal": "活动组织", "portal": "活动组织",
"placeCreate": "创建组织",
"placeRemove": "删除组织",
"activity": "活动安排", "activity": "活动安排",
"member": "组织成员", "member": "组织成员",
"icons": { "icons": {

View File

@ -19,8 +19,8 @@ type call struct {
func (s call) List(m *ice.Message, arg ...string) { func (s call) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
m.Option(mdb.ORDER, model.TAKE_TIME) m.Option(mdb.ORDER, model.TAKE_TIME)
s.Schedule.SelectByStatus(m, arg[0], kit.Format(ScheduleTake)) s.SelectByStatus(m, arg[0], kit.Format(ScheduleTake))
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found order", "没有等待")) }, func() { m.Action(s.Call) }) kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait take", "等待取号")) }, func() { m.Action(s.Call) })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.Cmdy(s.Schedule, arg[0], arg[1]).Action(s.Call) m.Cmdy(s.Schedule, arg[0], arg[1]).Action(s.Call)
} else if len(arg) == 3 { } else if len(arg) == 3 {

View File

@ -22,6 +22,7 @@ const (
SCHEDULE_UID = "schedule_uid" SCHEDULE_UID = "schedule_uid"
SCHEDULE_STATUS = "schedule_status" SCHEDULE_STATUS = "schedule_status"
COMPANY_UID = "company_uid" COMPANY_UID = "company_uid"
CALL_UID = "call_uid"
BEGIN_TIME = "begin_time" BEGIN_TIME = "begin_time"
END_TIME = "end_time" END_TIME = "end_time"
CANCEL_TIME = "cancel_time" CANCEL_TIME = "cancel_time"
@ -71,6 +72,7 @@ type Schedule struct {
ReceptionUID string `gorm:"type:char(32);index:idx_queue"` ReceptionUID string `gorm:"type:char(32);index:idx_queue"`
VolumeUID string `gorm:"type:char(32);index:idx_queue"` VolumeUID string `gorm:"type:char(32);index:idx_queue"`
UserUID string `gorm:"type:char(32);index"` UserUID string `gorm:"type:char(32);index"`
CallUID string `gorm:"type:char(32);index"`
CancelTime db.Time CancelTime db.Time
TakeTime db.Time TakeTime db.Time
CallTime db.Time CallTime db.Time

View File

@ -14,15 +14,15 @@ type plan struct {
} }
func (s plan) Create(m *ice.Message, arg ...string) { func (s plan) Create(m *ice.Message, arg ...string) {
s.Create(m, kit.Simple(arg, m.OptionSimple(model.QUEUE_UID, model.USER_UID), model.STATUS, SchedulePlan)...) s.Schedule.Create(m, kit.Simple(arg, m.OptionSimple(model.QUEUE_UID, model.USER_UID), model.STATUS, SchedulePlan)...)
} }
func (s plan) List(m *ice.Message, arg ...string) { func (s plan) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Cancel) s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Cancel)
kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) }, func() { m.Action(s.Create) }) kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) }, func() { m.Action(s.Create) })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.FieldsSetDetail() m.FieldsSetDetail()
s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Cancel) s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Cancel)
} }
} }

View File

@ -1,7 +1,5 @@
{ {
"portal": "约号系统", "portal": "约号系统",
"placeCreate": "创建场景",
"placeRemove": "删除场景",
"queueUser": "服务人员", "queueUser": "服务人员",
"reception": "服务场所", "reception": "服务场所",
"volume": "服务计划", "volume": "服务计划",
@ -37,6 +35,9 @@
"reception_name": "服务场所", "reception_name": "服务场所",
"volume_uid": "服务计划", "volume_uid": "服务计划",
"schedule_status": "订单状态", "schedule_status": "订单状态",
"begin_time": "开始时间",
"end_time": "结束时间",
"cancel_time": "取消时间",
"take_time": "取号时间", "take_time": "取号时间",
"call_time": "叫号时间", "call_time": "叫号时间",
"expire_time": "过期时间", "expire_time": "过期时间",

View File

@ -2,6 +2,7 @@ package yuehaoxitong
import ( import (
"shylinux.com/x/ice" "shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/yuehaoxitong/model" "shylinux.com/x/community/src/yuehaoxitong/model"
) )
@ -33,6 +34,7 @@ func (s reception) List(m *ice.Message, arg ...string) {
} }
} else if len(arg) == 1 { } else if len(arg) == 1 {
s.Table.Select(m, model.QUEUE_UID, arg[0]) s.Table.Select(m, model.QUEUE_UID, arg[0])
kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("") })
} else if len(arg) == 2 { } else if len(arg) == 2 {
s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1]) s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
} }

View File

@ -28,18 +28,24 @@ func (s Schedule) Create(m *ice.Message, arg ...string) {
s.addCount(m, mdb.COUNT, "1") s.addCount(m, mdb.COUNT, "1")
s.Table.Create(m, arg...) s.Table.Create(m, arg...)
}) })
s.SendMessage(m, m.Option(model.USER_UID), m.Option(model.USER_UID), m.Option(model.QUEUE_UID), m.Result())
s.sendTemplate(m, "约号成功", m.Result()) s.sendTemplate(m, "约号成功", m.Result())
} }
func (s Schedule) Call(m *ice.Message, arg ...string) { func (s Schedule) Call(m *ice.Message, arg ...string) {
defer m.ToastProcess("叫号中...")("叫号成功") defer m.ToastProcess("叫号中...")("叫号成功")
s.Orders(m, model.TAKE_TIME).Limit(m, 1) s.Orders(m, model.TAKE_TIME).Limit(m, 1)
s.SelectByStatus(m, m.Option(model.QUEUE_UID), kit.Format(ScheduleTake)).PushAction(s.Expire, s.Finish) user_uid := m.Option(model.USER_UID)
// s.Select(m, kit.Simple(m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID), mdb.STATUS, ScheduleTake)...) if m.Option(model.RECEPTION_UID) != "" {
s.SelectByStatus(m, kit.Simple(m.Option(model.QUEUE_UID), kit.Format(ScheduleTake), m.OptionSimple(model.RECEPTION_UID))...).PushAction(s.Expire, s.Finish)
} else {
s.SelectByStatus(m, m.Option(model.QUEUE_UID), kit.Format(ScheduleTake)).PushAction(s.Expire, s.Finish)
}
if m.Length() == 0 { if m.Length() == 0 {
m.ProcessRewrite(model.UID, "") m.ProcessRewrite(model.UID, "")
return return
} }
s.changeStatus(m, ScheduleTake, ScheduleCall, arg...) s.changeStatus(m, ScheduleTake, ScheduleCall, model.CALL_UID, user_uid)
s.SendMessage(m, user_uid, m.Append(model.USER_UID), m.Option(model.QUEUE_UID), m.Append(model.UID))
s.sendTemplate(m, "服务已叫号", m.Append(model.UID)) s.sendTemplate(m, "服务已叫号", m.Append(model.UID))
m.ProcessRewrite(model.UID, m.Append(model.UID)) m.ProcessRewrite(model.UID, m.Append(model.UID))
} }
@ -47,7 +53,7 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
role := UserQueueRole(kit.Int(m.Cmd(s.userQueue, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE))) role := UserQueueRole(kit.Int(m.Cmd(s.userQueue, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE)))
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME, s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME,
model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME, model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
s.Key(s, model.OPERATOR), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID, s.Key(s, model.CALL_UID), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID,
) )
if role == UserQueueCreator || role == UserQueueManager { if role == UserQueueCreator || role == UserQueueManager {
if len(arg) == 1 { if len(arg) == 1 {
@ -67,9 +73,9 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
}) })
} else if role == UserQueueWorker { } else if role == UserQueueWorker {
if len(arg) == 1 { if len(arg) == 1 {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.OPERATOR), m.Option(model.USER_UID)) s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 { } else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.OPERATOR), m.Option(model.USER_UID), s.Key(s, model.UID), arg[1]) s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
} }
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) { switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
@ -96,7 +102,7 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
} }
s.SelectJoin(m, s.reception) s.SelectJoin(m, s.reception)
s.SelectJoinUser(m) s.SelectJoinUser(m)
s.RewriteAppend(m) m.Display("")
m.Action() m.Action()
} }
func (s Schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message { func (s Schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
@ -109,49 +115,59 @@ func (s Schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
s.Select(m, kit.Simple(s.Key(s, model.QUEUE_UID), arg[0], model.STATUS, arg[1], arg[2:])...).Action() s.Select(m, kit.Simple(s.Key(s, model.QUEUE_UID), arg[0], model.STATUS, arg[1], arg[2:])...).Action()
s.SelectJoin(m, s.reception) s.SelectJoin(m, s.reception)
s.SelectJoinUser(m) s.SelectJoinUser(m)
s.RewriteAppend(m) m.Display("")
return m return m
} }
func (s Schedule) Cancel(m *ice.Message, arg ...string) { func (s Schedule) Cancel(m *ice.Message, arg ...string) {
defer m.ToastProcess("取消中...")("取消成功") defer m.ToastProcess("取消中...")("取消成功")
if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) { args := m.OptionSimple(model.USER_UID, model.UID)
if m.WarnNotFound(s.Select(m, args...).Length() == 0) {
return return
} }
s.Transaction(m, func() { s.Transaction(m, func() {
s.addCount(m, mdb.COUNT, "-1") s.addCount(m, mdb.COUNT, "-1")
s.changeStatus(m, SchedulePlan, ScheduleCancel, arg...) s.changeStatus(m, SchedulePlan, ScheduleCancel)
}) })
s.sendTemplate(m, "约号取消") s.sendTemplate(m, "约号取消")
m.ProcessRefresh() m.ProcessRefresh()
} }
func (s Schedule) Take(m *ice.Message, arg ...string) { func (s Schedule) Take(m *ice.Message, arg ...string) {
defer m.ToastProcess("取号中...")("取号成功") defer m.ToastProcess("取号中...")("取号成功")
if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) { args := m.OptionSimple(model.USER_UID, model.UID)
if m.WarnNotFound(s.Select(m, args...).Length() == 0) {
return return
} }
s.changeStatus(m, SchedulePlan, ScheduleTake, arg...) s.changeStatus(m, SchedulePlan, ScheduleTake)
s.sendTemplate(m, "取号成功") s.sendTemplate(m, "取号成功")
m.ProcessRefresh() m.ProcessRefresh()
} }
func (s Schedule) Expire(m *ice.Message, arg ...string) { func (s Schedule) Expire(m *ice.Message, arg ...string) {
defer m.ToastProcess("过号中...")("过号成功") defer m.ToastProcess("过号中...")("过号成功")
args := kit.Simple(model.CALL_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID))
if m.WarnNotFound(s.Select(m, args...).Length() == 0) {
return
}
s.Transaction(m, func() { s.Transaction(m, func() {
s.addCount(m, "", "1") s.addCount(m, "", "1")
s.changeStatus(m, ScheduleCall, ScheduleExpire, arg...) s.changeStatus(m, ScheduleCall, ScheduleExpire)
}) })
s.Select(m.FieldsSetDetail(), model.UID, m.Option(model.UID)) s.Select(m.FieldsSetDetail(), args...)
s.sendTemplate(m, "服务已过号") s.sendTemplate(m, "服务已过号")
m.ProcessRefresh() // m.ProcessRefresh()
} }
func (s Schedule) Finish(m *ice.Message, arg ...string) { func (s Schedule) Finish(m *ice.Message, arg ...string) {
defer m.ToastProcess("完成中...")("完成成功") defer m.ToastProcess("完成中...")("完成成功")
args := kit.Simple(model.CALL_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID))
if m.WarnNotFound(s.Select(m, args...).Length() == 0) {
return
}
s.Transaction(m, func() { s.Transaction(m, func() {
s.addCount(m, "", "1") s.addCount(m, "", "1")
s.changeStatus(m, ScheduleCall, ScheduleFinish, arg...) s.changeStatus(m, ScheduleCall, ScheduleFinish)
}) })
s.Select(m.FieldsSetDetail(), model.UID, m.Option(model.UID)) s.Select(m.FieldsSetDetail(), args...)
s.sendTemplate(m, "服务已完成") s.sendTemplate(m, "服务已完成")
m.ProcessRefresh() // m.ProcessRefresh()
} }
func init() { ice.TeamCtxCmd(Schedule{}) } func init() { ice.TeamCtxCmd(Schedule{}) }
@ -161,7 +177,7 @@ func (s Schedule) addCount(m *ice.Message, key, count string) {
} }
func (s Schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...string) *ice.Message { func (s Schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...string) *ice.Message {
key := m.ActionKey() + "_time" key := m.ActionKey() + "_time"
s.Table.ChangeStatus(m, m.Option(model.UID), int(from), int(to), kit.TransArgValueTime(append(arg, key, m.Time()), key)...) s.Table.ChangeStatus(m, m.Option(model.UID), int(from), int(to), append(arg, key, m.Time())...)
return m return m
} }
func (s Schedule) sendTemplate(m *ice.Message, title string, arg ...string) *ice.Message { func (s Schedule) sendTemplate(m *ice.Message, title string, arg ...string) *ice.Message {

View File

@ -14,11 +14,11 @@ type take struct {
func (s take) List(m *ice.Message, arg ...string) { func (s take) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Take) s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Take)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) }) kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.FieldsSetDetail() m.FieldsSetDetail()
s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Take) s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Take)
} }
} }

View File

@ -32,7 +32,7 @@ func (s userQueue) 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.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.QUEUE_UID), arg[1]) s.SelectDetail(m, model.USER_UID, arg[0], model.QUEUE_UID, arg[1])
} else { } else {
return return
} }

View File

@ -23,6 +23,18 @@
"type": "view" "type": "view"
} }
}, },
"69eab73272862fc0b0202533c8ea58a0": {
"meta": {
"index": "web.team.zhengshuxitong.portal",
"name": "证书系统",
"river": "2",
"scene": "main",
"space": "20240724-education",
"storm": "6",
"time": "2024-08-28 10:08:56.342",
"type": "view"
}
},
"6c428f2a2570bcb73784536c11cb90a1": { "6c428f2a2570bcb73784536c11cb90a1": {
"meta": { "meta": {
"name": "云社区", "name": "云社区",
@ -45,15 +57,27 @@
"type": "view" "type": "view"
} }
}, },
"7ea8d32a7a9cfe236d406e43392b0ddd": {
"meta": {
"index": "web.team.jiaocaiziliao.portal",
"name": "教材资料",
"river": "2",
"scene": "main",
"space": "20240724-education",
"storm": "3",
"time": "2024-08-28 10:06:47.277",
"type": "view"
}
},
"8b52c29cfbb4b823d4687022a143ba9e": { "8b52c29cfbb4b823d4687022a143ba9e": {
"meta": { "meta": {
"index": "web.team.operation.portal", "index": "web.team.shichangyingxiao.portal",
"name": "系统运维", "name": "市场营销",
"river": "3", "river": "3",
"scene": "main", "scene": "main",
"space": "20240724-enterprise", "space": "20240724-enterprise",
"storm": "5", "storm": "3",
"time": "2024-08-27 19:02:46.713", "time": "2024-08-28 10:29:27.373",
"type": "view" "type": "view"
} }
}, },
@ -79,15 +103,39 @@
"type": "view" "type": "view"
} }
}, },
"b736946fef122e25ade814a489b891f4": {
"meta": {
"index": "web.team.kaoshixitong.portal",
"name": "考试系统",
"river": "2",
"scene": "main",
"space": "20240724-education",
"storm": "5",
"time": "2024-08-28 10:08:25.805",
"type": "view"
}
},
"dc6bc74090f4baee2a44547c00168326": { "dc6bc74090f4baee2a44547c00168326": {
"meta": { "meta": {
"index": "web.team.development.portal", "index": "web.team.zijinlian.portal",
"name": "系统开发", "name": "资金链",
"river": "3", "river": "3",
"scene": "main", "scene": "main",
"space": "20240724-enterprise", "space": "20240724-enterprise",
"storm": "5",
"time": "2024-08-28 10:27:24.360",
"type": "view"
}
},
"dd0ee46421005876f5745a0f68fe1218": {
"meta": {
"index": "web.team.zaixianketang.portal",
"name": "在线课堂",
"river": "2",
"scene": "main",
"space": "20240724-education",
"storm": "4", "storm": "4",
"time": "2024-08-27 19:02:18.982", "time": "2024-08-28 10:07:46.050",
"type": "view" "type": "view"
} }
}, },
@ -98,7 +146,7 @@
"river": "3", "river": "3",
"scene": "main", "scene": "main",
"space": "20240724-enterprise", "space": "20240724-enterprise",
"storm": "3", "storm": "4",
"time": "2024-08-16 12:47:08.340", "time": "2024-08-16 12:47:08.340",
"type": "view" "type": "view"
} }

View File

@ -8,8 +8,7 @@
"icons": "https://img.icons8.com/officel/80/receipt.png", "icons": "https://img.icons8.com/officel/80/receipt.png",
"index": "web.team.yuehaoxitong.take", "index": "web.team.yuehaoxitong.take",
"name": "取号", "name": "取号",
"order": "13", "order": "12",
"role": "creator,visitor,waiter",
"time": "2024-08-11 09:30:00.532" "time": "2024-08-11 09:30:00.532"
} }
}, },
@ -23,7 +22,7 @@
"index": "web.team.yuehaoxitong.reception", "index": "web.team.yuehaoxitong.reception",
"init": "1", "init": "1",
"name": "服务场所", "name": "服务场所",
"order": "23", "order": "20",
"role": "creator,manager", "role": "creator,manager",
"time": "2024-08-11 09:30:00.536" "time": "2024-08-11 09:30:00.536"
} }
@ -62,7 +61,7 @@
"index": "web.team.yuehaoxitong.allow", "index": "web.team.yuehaoxitong.allow",
"name": "权限审批", "name": "权限审批",
"order": "93", "order": "93",
"role": "creator", "role": "creator,manager",
"time": "2024-08-16 10:29:53.817" "time": "2024-08-16 10:29:53.817"
} }
}, },
@ -75,8 +74,8 @@
"icons": "https://img.icons8.com/officel/80/calling.png", "icons": "https://img.icons8.com/officel/80/calling.png",
"index": "web.team.yuehaoxitong.call", "index": "web.team.yuehaoxitong.call",
"name": "叫号", "name": "叫号",
"order": "14", "order": "13",
"role": "creator,worker", "role": "creator,manager,worker",
"time": "2024-08-11 09:30:00.541" "time": "2024-08-11 09:30:00.541"
} }
}, },
@ -150,8 +149,9 @@
"enable": "true", "enable": "true",
"icons": "https://img.icons8.com/officel/80/open-sign.png", "icons": "https://img.icons8.com/officel/80/open-sign.png",
"index": "web.team.yuehaoxitong.open", "index": "web.team.yuehaoxitong.open",
"init": "2",
"name": "放号", "name": "放号",
"order": "11", "order": "10",
"role": "creator,manager", "role": "creator,manager",
"time": "2024-08-11 09:30:00.511" "time": "2024-08-11 09:30:00.511"
} }
@ -165,8 +165,7 @@
"icons": "https://img.icons8.com/officel/80/order-history.png", "icons": "https://img.icons8.com/officel/80/order-history.png",
"index": "web.team.yuehaoxitong.history", "index": "web.team.yuehaoxitong.history",
"name": "我的订单", "name": "我的订单",
"order": "20", "order": "23",
"role": "creator,worker,visitor,waiter",
"time": "2024-08-11 09:30:00.544" "time": "2024-08-11 09:30:00.544"
} }
}, },
@ -180,6 +179,7 @@
"index": "web.team.yuehaoxitong.member", "index": "web.team.yuehaoxitong.member",
"name": "场景成员", "name": "场景成员",
"order": "80", "order": "80",
"role": "creator,manager",
"time": "2024-08-12 08:56:10.816" "time": "2024-08-12 08:56:10.816"
} }
}, },
@ -193,7 +193,6 @@
"index": "web.team.yuehaoxitong.service", "index": "web.team.yuehaoxitong.service",
"name": "服务发现", "name": "服务发现",
"order": "102", "order": "102",
"role": "creator",
"time": "2024-08-11 09:30:00.529" "time": "2024-08-11 09:30:00.529"
} }
}, },
@ -206,8 +205,7 @@
"icons": "https://img.icons8.com/officel/80/calendar-plus.png", "icons": "https://img.icons8.com/officel/80/calendar-plus.png",
"index": "web.team.yuehaoxitong.plan", "index": "web.team.yuehaoxitong.plan",
"name": "约号", "name": "约号",
"order": "12", "order": "11",
"role": "creator,visitor,waiter",
"time": "2024-08-11 09:30:00.514" "time": "2024-08-11 09:30:00.514"
} }
}, },