This commit is contained in:
jingganjiaoyu 2024-10-05 19:03:33 +08:00
parent ac7fab72e6
commit a3daf64d13
10 changed files with 190 additions and 0 deletions

41
src/h3/common.go Normal file
View File

@ -0,0 +1,41 @@
package h3
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/guanlixitong"
"shylinux.com/x/operation/src/h3/model"
)
type Table struct {
guanlixitong.Table
list string `name:"list h3_uid uid auto" role:"void"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_H3_ROLE:
s.InputsListRole(m, UserH3RoleList, arg...)
case model.H3_TYPE:
s.InputsList(m, H3TypeList, 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_H3_ROLE:
value = UserH3Role(kit.Int(value)).String()
case model.H3_TYPE:
value = H3Type(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
}
type Tables struct { Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

23
src/h3/h3.go Normal file
View File

@ -0,0 +1,23 @@
package h3
import "shylinux.com/x/ice"
type h3 struct{ Table }
func init() { ice.TeamCtxCmd(h3{}) }
type H3Type int
const (
H3RD H3Type = iota
H3OP
H3HR
)
var H3TypeList = map[H3Type]string{
H3RD: "RD",
H3OP: "OP",
H3HR: "HR",
}
func (s H3Type) String() string { return H3TypeList[s] }

15
src/h3/h4.go Normal file
View File

@ -0,0 +1,15 @@
package h3
import "shylinux.com/x/ice"
type h4 struct {
Table
order string `data:"1"`
fields string `data:"title,content,user_uid"`
create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s h4) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func init() { ice.TeamCtxCmd(h4{}) }

9
src/h3/h4.js Normal file
View File

@ -0,0 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title||value.name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]},
] })
},
})

34
src/h3/model/model.go Normal file
View File

@ -0,0 +1,34 @@
package model
import "shylinux.com/x/mysql-story/src/db"
const (
UID = "uid"
NAME = "name"
INFO = "info"
TYPE = "type"
TITLE = "title"
CONTENT = "content"
USER_UID = "user_uid"
USER_H3_ROLE = "user_h3_role"
H3_UID = "h3_uid"
H3_NAME = "h3_name"
H3_TYPE = "h3_type"
H4_UID = "_uid"
)
type UserH3 struct {
db.ModelUserPlace
H3UID string `gorm:"type:char(32);index"`
}
type H3 struct {
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
}
type H4 struct {
db.ModelContent
H3UID string `gorm:"type:char(32);index"`
}
func init() { db.CmdModels("", &UserH3{}, &H3{}, &H4{}) }

13
src/h3/portal.go Normal file
View File

@ -0,0 +1,13 @@
package h3
import (
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type Portal struct {
guanlixitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* h3_name* h3_type:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userH3{}, h3{})}) }

31
src/h3/portal.json Normal file
View File

@ -0,0 +1,31 @@
{
"portal": "h3",
"": "场景应用",
"icons": {
"": "https://img.icons8.com/officel/80/activity-grid.png"
},
"input": {
"My H3": "我的场景",
"user_h3_role": "成员角色",
"h3_name": "场景名称",
"h3_type": "场景类型"
},
"value": {
"user_h3_role": {
"visitor": "访客",
"creator": "创建人",
"leader": "管理人员",
"worker": "工作人员",
"server": "服务人员",
"style": {
"creator": "danger",
"leader": "danger"
}
},
"h3_type": {
"RD": "研发群",
"OP": "运维群",
"HR": "人力群"
}
}
}

15
src/h3/userH3.go Normal file
View File

@ -0,0 +1,15 @@
package h3
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type userH3 struct{ Table }
func init() { ice.TeamCtxCmd(userH3{}) }
type UserH3Role = guanlixitong.UserGroupRole
var UserH3RoleList = guanlixitong.UserGroupRoleList

View File

@ -12,6 +12,8 @@ import (
_ "shylinux.com/x/operation/src/h1"
_ "shylinux.com/x/operation/src/h2"
_ "shylinux.com/x/operation/src/h3"
)
func main() { print(ice.Run()) }

View File

@ -62,6 +62,13 @@
"type": "hash"
}
},
"ae10a051342a01926761a84f477b66ec": {
"meta": {
"index": "web.team.h1.portal",
"time": "2024-10-05 19:02:24.393",
"type": "hash"
}
},
"bb5d4d821ab5b4dc53816410bfb975b3": {
"meta": {
"index": "web.team.operation.portal",