|
@@ -2,6 +2,7 @@ package backend
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "encoding/json"
|
|
|
"errors"
|
|
|
"kpt-pasture/model"
|
|
|
|
|
@@ -184,6 +185,30 @@ func (s *StoreEntry) PastureInit(ctx context.Context, pastureId int64) error {
|
|
|
zaplog.Error("PastureInit-SystemDept", zap.Any("error", err))
|
|
|
}
|
|
|
|
|
|
+ // 初始化菜单
|
|
|
+ systemMenuList := make([]*model.SystemPastureMenu, 0)
|
|
|
+ if err := tx.Model(new(model.SystemPastureMenu)).
|
|
|
+ Where("pasture_id = ?", 0).
|
|
|
+ Find(&systemMenuList).Error; err != nil {
|
|
|
+ zaplog.Error("PastureInit-SystemMenu", zap.Any("error", err))
|
|
|
+ }
|
|
|
+
|
|
|
+ newSystemMenuList := make([]*model.SystemPastureMenu, 0)
|
|
|
+ for _, systemMenu := range systemMenuList {
|
|
|
+ newSystemMenu := &model.SystemPastureMenu{
|
|
|
+ PastureId: pastureId,
|
|
|
+ MenuId: systemMenu.Id,
|
|
|
+ }
|
|
|
+ newSystemMenuList = append(newSystemMenuList, newSystemMenu)
|
|
|
+ }
|
|
|
+
|
|
|
+ if err := tx.Model(new(model.SystemPastureMenu)).
|
|
|
+ Create(newSystemMenuList).Error; err != nil {
|
|
|
+ zaplog.Error("PastureInit-SystemMenu", zap.Any("error", err))
|
|
|
+ }
|
|
|
+
|
|
|
+ // 初始化用户和角色
|
|
|
+
|
|
|
return nil
|
|
|
}); err != nil {
|
|
|
return xerr.WithStack(err)
|
|
@@ -244,3 +269,994 @@ func (s *StoreEntry) CalvingAge(ctx context.Context) error {
|
|
|
}*/
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+func (s *StoreEntry) SystemMenuInit(ctx context.Context) error {
|
|
|
+
|
|
|
+ items := menuDataInit()
|
|
|
+ if err := s.DB.Transaction(func(tx *gorm.DB) error {
|
|
|
+ if err := s.InsertCurrentMenuItem(tx, items, 0); err != nil {
|
|
|
+ zaplog.Error("SystemMenuInit", zap.Any("err", err))
|
|
|
+ return xerr.WithStack(err)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }); err != nil {
|
|
|
+ zaplog.Error("SystemMenuInit", zap.Any("err", err))
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (s *StoreEntry) InsertCurrentMenuItem(tx *gorm.DB, menuList []*model.MenuItem, parentId int64) error {
|
|
|
+ for _, menu := range menuList {
|
|
|
+ showLink := pasturePb.IsShow_Ok
|
|
|
+ if menu.Meta.Hidden || !menu.Meta.ShowLink {
|
|
|
+ showLink = pasturePb.IsShow_No
|
|
|
+ }
|
|
|
+ newSystemMenu := &model.SystemMenu{
|
|
|
+ Name: menu.Name,
|
|
|
+ Path: menu.Path,
|
|
|
+ Title: menu.Meta.Title,
|
|
|
+ MenuType: 1, // menu_type: 1 (menu)
|
|
|
+ ParentId: parentId,
|
|
|
+ FrameSrc: "", // frame_src
|
|
|
+ FrameLoading: 1, // frame_loading
|
|
|
+ Keepalive: 2, // keepalive
|
|
|
+ HiddenTag: 2, // hidden_tag
|
|
|
+ ShowLink: showLink,
|
|
|
+ ShowParent: 2, // show_parent
|
|
|
+ Icon: menu.Meta.Icon,
|
|
|
+ Component: "", // component
|
|
|
+ Redirect: "", // redirect
|
|
|
+ Auths: "", // auths
|
|
|
+ Rank: menu.Meta.Rank,
|
|
|
+ ExtraIcon: "", // extra_icon
|
|
|
+ EnterTransition: "", // enter_transition
|
|
|
+ //"", // leave_transition
|
|
|
+ ActivePath: "", // active_path
|
|
|
+ IsShow: 1, // is_show
|
|
|
+ IsDelete: 1, // is_delete
|
|
|
+ }
|
|
|
+ if err := tx.Model(new(model.SystemMenu)).
|
|
|
+ Create(newSystemMenu).Error; err != nil {
|
|
|
+ zaplog.Error("SystemMenuInit", zap.Any("error", err))
|
|
|
+ return xerr.WithStack(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(menu.Children) > 0 {
|
|
|
+ if err := s.InsertCurrentMenuItem(tx, menu.Children, newSystemMenu.Id); err != nil {
|
|
|
+ zaplog.Error("SystemMenuInit", zap.Any("error", err))
|
|
|
+ return xerr.WithStack(err)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func menuDataInit() []*model.MenuItem {
|
|
|
+ menuData := `[
|
|
|
+ {
|
|
|
+ "path": "/event",
|
|
|
+ "name": "Event",
|
|
|
+ "meta": {
|
|
|
+ "icon": "carbon:cics-sit-overrides",
|
|
|
+ "title": "menus.KptEvent",
|
|
|
+ "rank": 12
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/event/base",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBaseEvent"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/event/base/enter/index",
|
|
|
+ "name": "EnterEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptEnterEvent"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/base/group_transfer/index",
|
|
|
+ "name": "GroupTransferEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptGroupTransferEvent"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/base/add_group/index",
|
|
|
+ "name": "add_group",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/base/weight/index",
|
|
|
+ "name": "Weight",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptWeight"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/base/add_weight/index",
|
|
|
+ "name": "add_weight",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/base/die/index",
|
|
|
+ "name": "Die",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptDie"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/base/add_die/index",
|
|
|
+ "name": "add_die",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBreedEvent"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/event/breed/estrus/index",
|
|
|
+ "name": "estrusEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptEstrusEvent"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/mating/index",
|
|
|
+ "name": "MatingEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptMatingEvent"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/add_mating/index",
|
|
|
+ "name": "add_mating",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/pregnant_check/index",
|
|
|
+ "name": "PregnantCheckEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptPregnantCheckEvent"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/add_pregnant/index",
|
|
|
+ "name": "add_pregnant",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/add_estrus/index",
|
|
|
+ "name": "add_estrus",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/process/index",
|
|
|
+ "name": "Process",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.Process"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/add_process/index",
|
|
|
+ "name": "add_process",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/forbidden/index",
|
|
|
+ "name": "forbidden",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.forbidden"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/breed/add_forbidden/index",
|
|
|
+ "name": "add_forbidde",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/vet",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptVetEvent"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/event/vet/illness/index",
|
|
|
+ "name": "IllNessEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptIllNessEvent"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/vet/add_deworm/index",
|
|
|
+ "name": "add_deworm",
|
|
|
+ "hidden": true,
|
|
|
+ "meta": {
|
|
|
+ "title": "",
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/event/other",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptOtherEvent"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/event/other/saleMange/index",
|
|
|
+ "name": "saleMangeEvent",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptsaleMange"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/goods",
|
|
|
+ "redirect": "/goods/drugs/index",
|
|
|
+ "name": "Goods",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptGoods",
|
|
|
+ "icon": "ep:goods",
|
|
|
+ "rank": 23
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/goods/vetGoods",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptVetGoods"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/goods/drugs/index",
|
|
|
+ "name": "Drugs",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptDrugs",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/goods/medical_devices/index",
|
|
|
+ "name": "MedicalDevices",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptMedicalDevices",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/goods/hardWareGoods",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KpthardWareGoods"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/goods/nech_ring/index",
|
|
|
+ "name": "NechRingManage",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptNechRingManage",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/goods/application",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptApplication"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/goods/application_goods/index",
|
|
|
+ "name": "ApplicatGoods",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptApplicatGoods",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/goods/otherGoods",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptOtherGoods"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/goods/frozen_semen/index",
|
|
|
+ "name": "FrozenSemen",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptFrozenSemen",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture",
|
|
|
+ "redirect": "/pasture/barn/index",
|
|
|
+ "name": "Pasture",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.kptPasture",
|
|
|
+ "icon": "emojione-monotone:cow",
|
|
|
+ "rank": 25
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/pasture/barn",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.kptPastureBarn"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/pasture/barn/index",
|
|
|
+ "name": "BarnManage",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.kptPastureInfo",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture/disease",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptDisease"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/pasture/disease/disease/index",
|
|
|
+ "name": "DiseaseManage",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptDiseaseInfo",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture/disease/prescription/index",
|
|
|
+ "name": "PrescriptionManage",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptPrescription",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture/health",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.kptPastureHealth"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/pasture/immunization/index",
|
|
|
+ "name": "ImmunizationhManage",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptImmunization",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture/health/index",
|
|
|
+ "name": "HealthManage",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptHealth",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ],
|
|
|
+ "showLink": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture/same_time/index",
|
|
|
+ "name": "SameTime",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptSameTime",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/pasture/basic_setting/index",
|
|
|
+ "name": "BasicSetting",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBasicSettingTitle",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/pasture/basic_setting/index",
|
|
|
+ "name": "BasicSettingIndex",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBasicSetting",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis",
|
|
|
+ "redirect": "/analysis/BreedIndicators",
|
|
|
+ "name": "Analysis",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptAnalysis",
|
|
|
+ "icon": "carbon:analytics-custom",
|
|
|
+ "rank": 16
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/analysis/BreedIndicators",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBreedIndicators"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/analysis/21pregnancy_Rate/index",
|
|
|
+ "name": "21PregnancyRate",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.Kpt21PregnancyRate",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/miscarriage_Rate/index",
|
|
|
+ "name": "MiscarriageRate",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptMiscarriageRate",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/pregnancy_report/index",
|
|
|
+ "name": "pregnancyReport",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptPregnancyReport",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/timely_breed/index",
|
|
|
+ "name": "timelyBreed",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KpttimelyBreed",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/single_factor_conception/index",
|
|
|
+ "name": "SingleFactorConception",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptSingleFactorConception",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/multiple_factor_conception/index",
|
|
|
+ "name": "MultidimensionalConception",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptMultidimensionalConception",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/VetIndicators",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptVetIndicators"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/analysis/disease_cure/index",
|
|
|
+ "name": "DiseaseCure",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptDiseaseCure",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/production_report/index",
|
|
|
+ "name": "productionReport",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptproductionReport",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/FatIndicators",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptFatIndicators"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/analysis/growth_curve/index",
|
|
|
+ "name": "GrowthCurve",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptGrowthCurve",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/weight_distribution/index",
|
|
|
+ "name": "WeightDistribution",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptWeightDistribution",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/weight_Fance/index",
|
|
|
+ "name": "WeightFance",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptWeightByFance",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/OtherIndicators",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptOtherIndicators"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/analysis/cattleSales_Report/index",
|
|
|
+ "name": "CattleSalesReport",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptCattleSalesReport",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/behavior_curve/index",
|
|
|
+ "name": "PenGrowthCurve",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBehaviorCurve",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/pen_behavior_monitor/index",
|
|
|
+ "name": "PenBehaviorMonitor",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptPenBehaviorMonitor",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/analysis/cowBehavior/index",
|
|
|
+ "name": "CowBehavior",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptCowBehavior",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/information",
|
|
|
+ "redirect": "/information/cow/index",
|
|
|
+ "name": "Information",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptInformationQuery",
|
|
|
+ "icon": "carbon:document-preliminary",
|
|
|
+ "rank": 17
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/information/cow",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptCowIndexQuery"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/information/cowQuery/index",
|
|
|
+ "name": "CowQuery",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptCowQuery",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/information/groupQuery/index",
|
|
|
+ "name": "groupCow",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptGroupCowQuery",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/information/longTermInfertility/index",
|
|
|
+ "name": "LongTermInfertility",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptLongTermInfertility",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/information/overdueNoMating/index",
|
|
|
+ "name": "OverdueNoMating",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptOverdueNoMating",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/information/moreQuery",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptMoreQuery"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/information/indicatorComparisonQuery/index",
|
|
|
+ "name": "indicatorComparisonQuery",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptIndicatorComparisonQuery",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work",
|
|
|
+ "redirect": "/work/calendar/index",
|
|
|
+ "name": "Work",
|
|
|
+ "meta": {
|
|
|
+ "icon": "streamline:code-monitor-1",
|
|
|
+ "title": "menus.KptRoutine",
|
|
|
+ "rank": 13
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/work/workplan",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptWorkplan"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/work/calendar/index",
|
|
|
+ "name": "Calendar",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptCalendar",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/breedPlan",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBreedPlan"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/work/samePeriod/index",
|
|
|
+ "name": "samePeriod",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptsamePeriod",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/pregnancyTest/index",
|
|
|
+ "name": "PregnancyTest",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptPregnancyTest",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/breedList/index",
|
|
|
+ "name": "BreedList",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptBreedList",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/weanList/index",
|
|
|
+ "name": "WeanList",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptWeanList",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/calving/index",
|
|
|
+ "name": "CalvingList",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptCalvingEvent"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/vetPlan",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptVetPlan"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/work/illnessList/index",
|
|
|
+ "name": "illnessList",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptillnessList",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/work/immunitytList/index",
|
|
|
+ "name": "immunitytList",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptImmunitytList",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/earlyWarn",
|
|
|
+ "redirect": "/earlyWarn/estrueList/index",
|
|
|
+ "name": "earlyWarn",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptEarlyWarnManagementRoter",
|
|
|
+ "icon": "ri:alarm-warning-line",
|
|
|
+ "rank": 26
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/earlyWarn/RingWarn",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.kptRingEarlyWarn"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/earlyWarn/estrueList/index",
|
|
|
+ "name": "estrueList",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptEstrueList",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/earlyWarn/abortWarn/index",
|
|
|
+ "name": "abortWarn",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptabortWarn",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/earlyWarn/healthWarn/index",
|
|
|
+ "name": "healthWarn",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptHealthWarn",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/earlyWarn/stressWarn/index",
|
|
|
+ "name": "stressWarn",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.KptStressWarn",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/system",
|
|
|
+ "redirect": "/system/user/index",
|
|
|
+ "name": "System",
|
|
|
+ "meta": {
|
|
|
+ "icon": "ri:settings-3-line",
|
|
|
+ "title": "menus.pureSysManagement",
|
|
|
+ "rank": 32
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/system/all",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.sysManagement"
|
|
|
+ },
|
|
|
+ "children": [
|
|
|
+ {
|
|
|
+ "path": "/system/user/index",
|
|
|
+ "name": "SystemUser",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.pureUser",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/system/role/index",
|
|
|
+ "name": "SystemRole",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.pureRole",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/system/menu/index",
|
|
|
+ "name": "SystemMenu",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.pureSystemMenu",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "path": "/system/dept/index",
|
|
|
+ "name": "SystemDept",
|
|
|
+ "meta": {
|
|
|
+ "title": "menus.pureDept",
|
|
|
+ "roles": [
|
|
|
+ "admin"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+]`
|
|
|
+ menuList := make([]*model.MenuItem, 0)
|
|
|
+ if err := json.Unmarshal([]byte(menuData), &menuList); err != nil {
|
|
|
+ zaplog.Error("menuDataInit", zap.Any("err", err))
|
|
|
+ }
|
|
|
+ return menuList
|
|
|
+}
|