应用集成平台服务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.5 KiB

4 days ago
package grantpowers
import (
"appPlatform/models/modelssystempermission"
"appPlatform/overall"
"encoding/json"
"strconv"
"time"
)
/*
*
@ 作者: 秦东
@ 时间: 2025-12-18 16:30:08
@ 功能: 解析自定义App菜单列表
*/
func (a *AppMenuAry) AppMenuTreeSubNew(AppMenuTree []AppMenuTreeInit, uuid int64) {
if len(AppMenuTree) > 0 {
for _, v := range AppMenuTree {
var menuInfo AppMenuInfo
menuInfo.Id = v.Id //识别符
menuInfo.Name = v.Name //名称
menuInfo.ParentId = v.ParentId //上级
menuInfo.IsPick = v.IsPick //是否激活
menuInfo.IsTrue = v.IsTrue //是否选中
menuInfo.AppKey = v.AppKey
menuInfo.PagePower = v.PagePower
menuInfo.FormPower = v.FormPower
menuInfo.ListPower = v.ListPower
menuInfo.VisibleRange = v.VisibleRange
menuInfo.MenuType = v.MenuType
a.List = append(a.List, menuInfo)
EditAppMenuPoserSave(uuid, menuInfo)
if len(v.Children) > 0 {
a.AppMenuTreeSubNew(v.Children, uuid)
}
}
}
}
func EditAppMenuPoserSave(uuid int64, v AppMenuInfo) {
// json, _ := json.Marshal(a.List)
// fmt.Printf("\n\n%v----------------->%v\n\n", uuid, string(json))
var saveInfo modelssystempermission.PowerInfo
saveInfo.AuthId = uuid //归属权限
saveInfo.ItemId, _ = strconv.ParseInt(v.Id, 10, 64) //项目ID
if v.IsTrue {
saveInfo.IsPick = 1 //是否有权(1:有;非1:无)
} else {
saveInfo.IsPick = 0 //是否有权(1:有;非1:无)
}
tpAry := MyCreateTablePower(v.FormPower)
if tpAry == "null" {
tpAry = "[]"
}
saveInfo.TablePower = tpAry //表单权限
lpAry := MyCreateTablePower(v.ListPower)
if lpAry == "null" {
lpAry = "[]"
}
saveInfo.ListPower = lpAry //列表权限
pgButAry := MyCreateTablePower(v.PagePower)
if pgButAry == "null" {
pgButAry = "[]"
}
saveInfo.PageButPower = pgButAry //列表权限
inStr := strconv.FormatInt(v.VisibleRange.Types, 10)
intVal, _ := strconv.Atoi(inStr)
saveInfo.VisibleRange = intVal //可见范围(1:本人;2:本岗位;3:本部门;4:本分部;5:指定行政组织;6:所有)
if len(v.VisibleRange.Attribute) > 0 {
visibleOrgStr, _ := json.Marshal(v.VisibleRange.Attribute)
saveInfo.VisibleOrg = string(visibleOrgStr) //可见范围辅助参数
} else {
saveInfo.VisibleOrg = "[]"
}
saveInfo.ButPower = "[]" //按钮权限
saveInfo.Time = time.Now().Unix() //编辑时间
overall.CONSTANT_DB_System_Permission.Create(&saveInfo)
}