mirror of
https://shylinux.com/x/operation
synced 2025-04-25 01:08:04 +08:00
add some
This commit is contained in:
parent
0dced97b0f
commit
ac7fab72e6
41
src/h2/common.go
Normal file
41
src/h2/common.go
Normal file
@ -0,0 +1,41 @@
|
||||
package h2
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||
"shylinux.com/x/operation/src/h2/model"
|
||||
)
|
||||
|
||||
type Table struct {
|
||||
guanlixitong.Table
|
||||
list string `name:"list h2_uid uid auto" role:"void"`
|
||||
}
|
||||
|
||||
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case model.USER_H2_ROLE:
|
||||
s.InputsListRole(m, UserH2RoleList, arg...)
|
||||
case model.H2_TYPE:
|
||||
s.InputsList(m, H2TypeList, 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_H2_ROLE:
|
||||
value = UserH2Role(kit.Int(value)).String()
|
||||
case model.H2_TYPE:
|
||||
value = H2Type(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/h2/h2.go
Normal file
23
src/h2/h2.go
Normal file
@ -0,0 +1,23 @@
|
||||
package h2
|
||||
|
||||
import "shylinux.com/x/ice"
|
||||
|
||||
type h2 struct{ Table }
|
||||
|
||||
func init() { ice.TeamCtxCmd(h2{}) }
|
||||
|
||||
type H2Type int
|
||||
|
||||
const (
|
||||
H2RD H2Type = iota
|
||||
H2OP
|
||||
H2HR
|
||||
)
|
||||
|
||||
var H2TypeList = map[H2Type]string{
|
||||
H2RD: "RD",
|
||||
H2OP: "OP",
|
||||
H2HR: "HR",
|
||||
}
|
||||
|
||||
func (s H2Type) String() string { return H2TypeList[s] }
|
15
src/h2/h3.go
Normal file
15
src/h2/h3.go
Normal file
@ -0,0 +1,15 @@
|
||||
package h2
|
||||
|
||||
import "shylinux.com/x/ice"
|
||||
|
||||
type h3 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 h3) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
|
||||
|
||||
func init() { ice.TeamCtxCmd(h3{}) }
|
9
src/h2/h3.js
Normal file
9
src/h2/h3.js
Normal 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/h2/model/model.go
Normal file
34
src/h2/model/model.go
Normal 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_H2_ROLE = "user_h2_role"
|
||||
H2_UID = "h2_uid"
|
||||
H2_NAME = "h2_name"
|
||||
H2_TYPE = "h2_type"
|
||||
H3_UID = "_uid"
|
||||
)
|
||||
|
||||
type UserH2 struct {
|
||||
db.ModelUserPlace
|
||||
H2UID string `gorm:"type:char(32);index"`
|
||||
}
|
||||
type H2 struct {
|
||||
db.ModelPlace
|
||||
CompanyUID string `gorm:"type:char(32);index"`
|
||||
}
|
||||
type H3 struct {
|
||||
db.ModelContent
|
||||
H2UID string `gorm:"type:char(32);index"`
|
||||
}
|
||||
|
||||
|
||||
func init() { db.CmdModels("", &UserH2{}, &H2{}, &H3{}) }
|
13
src/h2/portal.go
Normal file
13
src/h2/portal.go
Normal file
@ -0,0 +1,13 @@
|
||||
package h2
|
||||
|
||||
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* h2_name* h2_type:select" role:"void"`
|
||||
}
|
||||
|
||||
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userH2{}, h2{})}) }
|
31
src/h2/portal.json
Normal file
31
src/h2/portal.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"portal": "h2",
|
||||
"": "场景应用",
|
||||
"icons": {
|
||||
"": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
},
|
||||
"input": {
|
||||
"My H2": "我的场景",
|
||||
"user_h2_role": "成员角色",
|
||||
"h2_name": "场景名称",
|
||||
"h2_type": "场景类型"
|
||||
},
|
||||
"value": {
|
||||
"user_h2_role": {
|
||||
"visitor": "访客",
|
||||
"creator": "创建人",
|
||||
"leader": "管理人员",
|
||||
"worker": "工作人员",
|
||||
"server": "服务人员",
|
||||
"style": {
|
||||
"creator": "danger",
|
||||
"leader": "danger"
|
||||
}
|
||||
},
|
||||
"h2_type": {
|
||||
"RD": "研发群",
|
||||
"OP": "运维群",
|
||||
"HR": "人力群"
|
||||
}
|
||||
}
|
||||
}
|
15
src/h2/userH2.go
Normal file
15
src/h2/userH2.go
Normal file
@ -0,0 +1,15 @@
|
||||
package h2
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
|
||||
"shylinux.com/x/enterprise/src/guanlixitong"
|
||||
)
|
||||
|
||||
type userH2 struct{ Table }
|
||||
|
||||
func init() { ice.TeamCtxCmd(userH2{}) }
|
||||
|
||||
type UserH2Role = guanlixitong.UserGroupRole
|
||||
|
||||
var UserH2RoleList = guanlixitong.UserGroupRoleList
|
@ -10,6 +10,8 @@ import (
|
||||
_ "shylinux.com/x/operation/src/storage"
|
||||
|
||||
_ "shylinux.com/x/operation/src/h1"
|
||||
|
||||
_ "shylinux.com/x/operation/src/h2"
|
||||
)
|
||||
|
||||
func main() { print(ice.Run()) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user