mirror of
https://shylinux.com/x/community
synced 2025-04-25 09:38:06 +08:00
opt some
This commit is contained in:
parent
009c46dc69
commit
74cec0823b
@ -1,4 +1,7 @@
|
||||
body.light.mobile { --plugin-bg-color:#f4f5f9; --output-bg-color:#fefefd; }
|
||||
body.mobile fieldset.panel.Action>div.output { background-color:var(--plugin-bg-color); }
|
||||
$output { background-color:var(--plugin-bg-color); }
|
||||
$output div.item.card img { padding:0; margin:0; margin-right:10px; height:48px; width:48px; }
|
||||
$output>div>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; }
|
||||
$output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; }
|
||||
$output>div>div.list>div.title span:first-child { flex-grow:1; }
|
||||
@ -7,12 +10,16 @@ $output>div>div.list>div.title div.action div.item.button.icons input { display:
|
||||
$output>div>div.list>div.role:not(.hide) { display:flex; align-items:center; justify-content:space-around; }
|
||||
$output>div>div.list>div.role span { padding:5px; cursor:pointer; }
|
||||
$output>div>div.list>div.role span.select { border-bottom:var(--box-notice); }
|
||||
$output>div>div.list>div.output>div.item.index:not(.hide) { padding:10px; display:flex; flex-direction:column; align-items:center; float:left; }
|
||||
$output>div>div.list>div.output>div.item.index img { width:100%; }
|
||||
$output>div>div.list>div.role span:not(.select) { color:gray; }
|
||||
$output>div>div.list>div.output>div.item.index:not(.hide) { padding:5px 10px; display:flex; flex-direction:column; align-items:center; float:left; }
|
||||
$output>div>div.list>div.output>div.item.index img { height:48px; width:48px; object-fit:contain; }
|
||||
$output>div>div.list>div.action { display:flex; justify-content:center; }
|
||||
$output>div>div.list>div.action div.item { margin-right:5px; }
|
||||
$output>div>div.list>div.action div.item input[type=button] { color:var(--notice-bg-color); border:none; }
|
||||
$output>div>div.list>div.action div.item i { display:none; }
|
||||
$output>div>div.list.myorder div.item span { font-size:12px; }
|
||||
// $output>div>div.list.myorder { padding:0 10px; }
|
||||
// $output>div>div.list.myorder div.title { display:none; }
|
||||
$output>div.output>div.list:last-child { margin-bottom:0; }
|
||||
$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:60px; float:left; }
|
||||
@ -42,6 +49,7 @@ $output fieldset.story>div.output { background-color:var(--plugin-bg-color); }
|
||||
$output fieldset.story>div.output table.content td { box-shadow:none; }
|
||||
$output fieldset.story>div.output table.content tr.uid { display:none; }
|
||||
$output fieldset.story>div.output table.content td img { max-width:100%; }
|
||||
// $output>fieldset.story>div.output div.item.card img { border-radius:50%; }
|
||||
$output>fieldset.story>div.output div.item.card>div.output { padding:10px; }
|
||||
$output>fieldset.story>div.output div.item.card>div.output div.output { padding:10px 0; white-space:pre-line; }
|
||||
$output fieldset.story>div.output>div.code { text-align:center; }
|
||||
|
@ -67,12 +67,12 @@ Volcanos(chat.ONIMPORT, {
|
||||
return place_uid||""
|
||||
},
|
||||
myList: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) {
|
||||
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100), height = width+20; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4, height = width+20)
|
||||
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100), height = width; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4, height = width)
|
||||
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(
|
||||
value.type? [mdb.TYPE]: [], can.core.Split(value.type||""),
|
||||
value.role? [aaa.ROLE]: [], can.core.Split(value.role||""),
|
||||
)], style: {height: height, width: width}, list: [
|
||||
)], style: {width: width}, list: [
|
||||
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
|
||||
], onclick: function(event) {
|
||||
can.page.ClassList.del(can, can._fields, "_back"), can.page.ClassList.add(can, can._fields, "_goto")
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"portal": "用户场景", "placeCreate": "添加场景", "placeRemove": "删除场景", "scanQRCode": "扫码添加",
|
||||
"qrcode": "场景码", "event": "事件流", "apply": "权限申请", "allow": "权限审批",
|
||||
"email": "邮箱配置", "member": "服务人员", "placeUser": "场景用户",
|
||||
"email": "邮箱配置", "member": "场景成员", "placeUser": "场景成员",
|
||||
"message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持",
|
||||
"cancel": "取消", "submit": "提交", "finish": "完成", "reject": "驳回", "approve": "通过",
|
||||
"read": "已读", "done": "完成",
|
||||
|
25
src/huodongzuzhi/activity.go
Normal file
25
src/huodongzuzhi/activity.go
Normal file
@ -0,0 +1,25 @@
|
||||
package huodongzuzhi
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/huodongzuzhi/model"
|
||||
)
|
||||
|
||||
type activity struct {
|
||||
Table
|
||||
group group
|
||||
userGroup userGroup
|
||||
create string `name:"create title* content*" role:"leader"`
|
||||
}
|
||||
|
||||
func (s activity) Create(m *ice.Message, arg ...string) {
|
||||
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.GROUP_UID))...)
|
||||
s.recordEventWithName(m, "")
|
||||
}
|
||||
func (s activity) List(m *ice.Message, arg ...string) {
|
||||
s.TablesWithRole(m, arg, s.userGroup, s.group, s, model.TITLE, model.CONTENT).Display("")
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(activity{}) }
|
12
src/huodongzuzhi/activity.js
Normal file
12
src/huodongzuzhi/activity.js
Normal file
@ -0,0 +1,12 @@
|
||||
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.title]},
|
||||
{view: html.STATUS, list: [
|
||||
value.uid.slice(0, 6), can.base.TimeTrim(value.created_at),
|
||||
value.user_name, can.onimport.textView(can, value, "user_group_role", aaa.ROLE),
|
||||
]},
|
||||
{view: html.OUTPUT, list: [value.content]},
|
||||
] })
|
||||
},
|
||||
})
|
52
src/huodongzuzhi/common.go
Normal file
52
src/huodongzuzhi/common.go
Normal file
@ -0,0 +1,52 @@
|
||||
package huodongzuzhi
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/huodongzuzhi/model"
|
||||
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||
)
|
||||
|
||||
type Table struct {
|
||||
guanlixitong.Table
|
||||
list string `name:"list group_uid uid auto" role:"void"`
|
||||
}
|
||||
|
||||
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case model.USER_GROUP_ROLE:
|
||||
s.InputsListRole(m, UserGroupRoleList, arg...)
|
||||
case model.GROUP_TYPE:
|
||||
s.InputsList(m, GroupTypeList, arg...)
|
||||
default:
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
}
|
||||
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
switch key {
|
||||
case model.USER_GROUP_ROLE:
|
||||
value = UserGroupRole(kit.Int(value)).String()
|
||||
case model.GROUP_TYPE:
|
||||
value = GroupType(kit.Int(value)).String()
|
||||
}
|
||||
return value
|
||||
})
|
||||
return s.Table.RewriteAppend(m)
|
||||
}
|
||||
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
|
||||
role := UserGroupRole(kit.Int(m.Cmd(userGroup{}, s.Select, m.OptionSimple(model.GROUP_UID, model.USER_UID)).Append(model.ROLE)))
|
||||
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserGroupCreator.String())...), role.String())
|
||||
return m
|
||||
}
|
||||
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
|
||||
s.Table.RecordEvent(m, m.Option(model.GROUP_UID), info, kit.Select(m.Option(model.UID), arg, 0))
|
||||
}
|
||||
func (s Table) recordEventWithName(m *ice.Message, info string, arg ...string) {
|
||||
s.Table.RecordEventWithName(m, m.Option(model.GROUP_UID), info)
|
||||
}
|
||||
|
||||
type Tables struct{ Table }
|
||||
|
||||
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|
23
src/huodongzuzhi/group.go
Normal file
23
src/huodongzuzhi/group.go
Normal file
@ -0,0 +1,23 @@
|
||||
package huodongzuzhi
|
||||
|
||||
import "shylinux.com/x/ice"
|
||||
|
||||
type group struct{ Table }
|
||||
|
||||
func init() { ice.TeamCtxCmd(group{}) }
|
||||
|
||||
type GroupType int
|
||||
|
||||
const (
|
||||
GroupRD GroupType = iota
|
||||
GroupOP
|
||||
GroupHR
|
||||
)
|
||||
|
||||
var GroupTypeList = map[GroupType]string{
|
||||
GroupRD: "RD",
|
||||
GroupOP: "OP",
|
||||
GroupHR: "HR",
|
||||
}
|
||||
|
||||
func (s GroupType) String() string { return GroupTypeList[s] }
|
42
src/huodongzuzhi/model/model.go
Normal file
42
src/huodongzuzhi/model/model.go
Normal file
@ -0,0 +1,42 @@
|
||||
package model
|
||||
|
||||
import "shylinux.com/x/mysql-story/src/db"
|
||||
|
||||
const (
|
||||
UID = "uid"
|
||||
NAME = "name"
|
||||
TYPE = "type"
|
||||
ROLE = "role"
|
||||
TITLE = "title"
|
||||
CONTENT = "content"
|
||||
USER_UID = "user_uid"
|
||||
USER_GROUP_ROLE = "user_group_role"
|
||||
GROUP_UID = "group_uid"
|
||||
GROUP_NAME = "group_name"
|
||||
GROUP_TYPE = "group_type"
|
||||
ACTIVITY_UID = "_uid"
|
||||
COMPANY_UID = "company_uid"
|
||||
CITY_UID = "city_uid"
|
||||
)
|
||||
|
||||
type UserGroup struct {
|
||||
db.ModelWithUID
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
GroupUID string `gorm:"type:char(32);index"`
|
||||
Role uint8 `gorm:"default:0"`
|
||||
}
|
||||
type Group struct {
|
||||
db.ModelWithUID
|
||||
CompanyUID string `gorm:"type:char(32);index"`
|
||||
Name string `gorm:"type:varchar(64)"`
|
||||
Type uint8 `gorm:"default:0"`
|
||||
}
|
||||
type Activity struct {
|
||||
db.ModelWithUID
|
||||
GroupUID string `gorm:"type:char(32);index"`
|
||||
UserUID string `gorm:"type:char(32);index"`
|
||||
Title string `gorm:"type:varchar(64)"`
|
||||
Content string
|
||||
}
|
||||
|
||||
func init() { db.CmdModels("", &UserGroup{}, &Group{}, &Activity{}) }
|
15
src/huodongzuzhi/portal.go
Normal file
15
src/huodongzuzhi/portal.go
Normal file
@ -0,0 +1,15 @@
|
||||
package huodongzuzhi
|
||||
|
||||
import (
|
||||
"shylinux.com/x/community/src/gonganxitong"
|
||||
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||
)
|
||||
|
||||
type Portal struct {
|
||||
gonganxitong.Portal
|
||||
placeCreate string `name:"placeCreate city_name* company_name* group_name*" role:"void"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userGroup{}, group{}, guanlixitong.Company{})})
|
||||
}
|
34
src/huodongzuzhi/portal.json
Normal file
34
src/huodongzuzhi/portal.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"portal": "活动组织",
|
||||
"placeCreate": "创建组织",
|
||||
"placeRemove": "删除组织",
|
||||
"activity": "活动安排",
|
||||
"member": "组织成员",
|
||||
"icons": {
|
||||
"activity": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
},
|
||||
"input": {
|
||||
"My Group": "我的组织",
|
||||
"user_group_role": "用户角色",
|
||||
"group_name": "组织名称",
|
||||
"group_type": "组织类型"
|
||||
},
|
||||
"value": {
|
||||
"user_group_role": {
|
||||
"visitor": "访客",
|
||||
"creator": "创建人",
|
||||
"leader": "组长",
|
||||
"worker": "成员",
|
||||
"server": "服务人员",
|
||||
"style": {
|
||||
"creator": "danger"
|
||||
}
|
||||
},
|
||||
"group_type": {
|
||||
"term": "学期制",
|
||||
"weekly": "周期性",
|
||||
"step": "阶段性",
|
||||
"free": "自由式"
|
||||
}
|
||||
}
|
||||
}
|
62
src/huodongzuzhi/userGroup.go
Normal file
62
src/huodongzuzhi/userGroup.go
Normal file
@ -0,0 +1,62 @@
|
||||
package huodongzuzhi
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
|
||||
"shylinux.com/x/community/src/huodongzuzhi/model"
|
||||
)
|
||||
|
||||
type userGroup struct {
|
||||
Table
|
||||
group group
|
||||
}
|
||||
|
||||
func (s userGroup) User(m *ice.Message, arg ...string) {
|
||||
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.GROUP_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.GROUP_UID, arg[0], model.UID, arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
m.RenameAppend(model.ROLE, model.USER_GROUP_ROLE)
|
||||
s.SelectJoinUser(m)
|
||||
}
|
||||
func (s userGroup) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.group).FieldsWithCreatedAT(m, s,
|
||||
model.GROUP_NAME, model.GROUP_TYPE, model.USER_GROUP_ROLE,
|
||||
model.COMPANY_UID, model.GROUP_UID,
|
||||
)
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.USER_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.GROUP_UID), arg[1])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
s.SelectJoinCompany(m)
|
||||
s.SelectJoinCity(m)
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(userGroup{}) }
|
||||
|
||||
type UserGroupRole int
|
||||
|
||||
const (
|
||||
UserGroupVisitor UserGroupRole = iota
|
||||
UserGroupCreator
|
||||
UserGroupLeader
|
||||
UserGroupWorker
|
||||
UserGroupServer
|
||||
)
|
||||
|
||||
var UserGroupRoleList = map[UserGroupRole]string{
|
||||
UserGroupVisitor: "visitor",
|
||||
UserGroupCreator: "creator",
|
||||
UserGroupLeader: "leader",
|
||||
UserGroupWorker: "worker",
|
||||
UserGroupServer: "server",
|
||||
}
|
||||
|
||||
func (s UserGroupRole) String() string { return UserGroupRoleList[s] }
|
@ -4,6 +4,7 @@ import (
|
||||
"shylinux.com/x/ice"
|
||||
|
||||
_ "shylinux.com/x/community/src/gonganxitong"
|
||||
_ "shylinux.com/x/community/src/huodongzuzhi"
|
||||
_ "shylinux.com/x/community/src/yuehaoxitong"
|
||||
)
|
||||
|
||||
|
@ -321,6 +321,13 @@
|
||||
"type": "hash"
|
||||
}
|
||||
},
|
||||
"598fb7e39af779346798777c2515bde9": {
|
||||
"meta": {
|
||||
"index": "web.team.huodongzuzhi.portal",
|
||||
"time": "2024-08-25 12:53:10.185",
|
||||
"type": "hash"
|
||||
}
|
||||
},
|
||||
"5a8dd0f1c42e4cac51ce0610e0c6d08e": {
|
||||
"meta": {
|
||||
"index": "web.team.chejianguanli.apply",
|
||||
|
@ -34,7 +34,7 @@
|
||||
"enable": "true",
|
||||
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
|
||||
"index": "web.team.gonganxitong.placeUser",
|
||||
"name": "场景用户",
|
||||
"name": "场景成员",
|
||||
"order": "5",
|
||||
"role": "creator,landlord",
|
||||
"time": "2024-08-07 19:32:54.758"
|
||||
|
@ -45,7 +45,7 @@
|
||||
],
|
||||
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
|
||||
"index": "web.team.guanlixitong.member",
|
||||
"name": "服务人员",
|
||||
"name": "场景成员",
|
||||
"order": "5",
|
||||
"time": "2024-08-12 08:56:10.780"
|
||||
}
|
||||
|
@ -177,7 +177,7 @@
|
||||
"enable": "true",
|
||||
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
|
||||
"index": "web.team.yuehaoxitong.member",
|
||||
"name": "服务人员",
|
||||
"name": "场景成员",
|
||||
"order": "5",
|
||||
"time": "2024-08-12 08:56:10.816"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user