| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package menu
-
- import (
- "context"
-
- "git.x2erp.com/qdy/go-base/ctx"
- "git.x2erp.com/qdy/go-base/logger"
- "git.x2erp.com/qdy/go-base/model/response"
- "git.x2erp.com/qdy/go-base/util"
- )
-
- // MenuItem 顶部菜单项结构
- type MenuItem struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Icon string `json:"icon,omitempty"`
- Type string `json:"type"` // top-menu
- Route string `json:"route,omitempty"`
- }
-
- // GetTopMenu 获取顶部菜单
- func GetTopMenu(ctx context.Context, reqCtx *ctx.RequestContext) *response.QueryResult[[]MenuItem] {
- logger.Debug("GetTopMenu-开始获取顶部菜单")
-
- // 构建顶部菜单项
- menu := []MenuItem{
- {
- ID: "replenish",
- Name: "补货",
- Icon: "inventory_2", // 库存补充图标
- Type: "top-menu",
- Route: "/replenish",
- },
- {
- ID: "transfer",
- Name: "调拨",
- Icon: "swap_horiz", // 横向交换图标
- Type: "top-menu",
- Route: "/transfer",
- },
- {
- ID: "allocation",
- Name: "配货",
- Icon: "local_shipping", // 本地货运图标
- Type: "top-menu",
- Route: "/allocation",
- },
- {
- ID: "report",
- Name: "报表",
- Icon: "assessment", // 评估报表图标
- Type: "top-menu",
- Route: "/report",
- },
- }
-
- logger.Debug("返回顶部菜单结构")
- return util.CreateSuccessResultData(menu, reqCtx)
- }
|