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

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

@ -0,0 +1,23 @@
package base
import "shylinux.com/x/ice"
type base struct{ Table }
func init() { ice.TeamCtxCmd(base{}) }
type BaseType int
const (
BaseRD BaseType = iota
BaseOP
BaseHR
)
var BaseTypeList = map[BaseType]string{
BaseRD: "RD",
BaseOP: "OP",
BaseHR: "HR",
}
func (s BaseType) String() string { return BaseTypeList[s] }

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

@ -0,0 +1,41 @@
package base
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/guanlixitong"
"shylinux.com/x/operation/src/base/model"
)
type Table struct {
guanlixitong.Table
list string `name:"list base_uid uid auto" role:"void"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_BASE_ROLE:
s.InputsListRole(m, UserBaseRoleList, arg...)
case model.BASE_TYPE:
s.InputsList(m, BaseTypeList, 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_BASE_ROLE:
value = UserBaseRole(kit.Int(value)).String()
case model.BASE_TYPE:
value = BaseType(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
}
type Tables struct { Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

15
src/base/core.go Normal file
View File

@ -0,0 +1,15 @@
package base
import "shylinux.com/x/ice"
type core 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 core) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func init() { ice.TeamCtxCmd(core{}) }

9
src/base/core.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/base/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_BASE_ROLE = "user_base_role"
BASE_UID = "base_uid"
BASE_NAME = "base_name"
BASE_TYPE = "base_type"
CORE_UID = "_uid"
)
type UserBase struct {
db.ModelUserPlace
BaseUID string `gorm:"type:char(32);index"`
}
type Base struct {
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
}
type Core struct {
db.ModelContent
BaseUID string `gorm:"type:char(32);index"`
}
func init() { db.CmdModels("", &UserBase{}, &Base{}, &Core{}) }

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

@ -0,0 +1,13 @@
package base
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* base_name* base_type:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userBase{}, base{})}) }

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

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

15
src/base/userBase.go Normal file
View File

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

View File

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

View File

@ -76,6 +76,13 @@
"type": "hash"
}
},
"aebfef525e0ba7d237afd94e5c118d11": {
"meta": {
"index": "web.team.h3.portal",
"time": "2024-10-05 19:03:37.710",
"type": "hash"
}
},
"bb5d4d821ab5b4dc53816410bfb975b3": {
"meta": {
"index": "web.team.operation.portal",