Yi 1 месяц назад
Родитель
Сommit
4a85a2594a

+ 57 - 1
locales/en.json

@@ -200,5 +200,61 @@
   "config.abortion.reasons7": "Heat Stress Abortion",
   "config.abortion.reasons8": "Infectious Disease Abortion",
   "config.abortion.reasons19": "Unknown Reason",
-  "config.abortion.reasons20": "Other Reason"
+  "config.abortion.reasons20": "Other Reason",
+  "config.diseaseAnalysisMethod0": "All",
+  "config.diseaseAnalysisMethod1": "Month",
+  "config.diseaseAnalysisMethod2": "Disease Category",
+  "config.diseaseAnalysisMethod3": "Disease Name",
+  "config.diseaseAnalysisMethod4": "Veterinarian",
+  "config.diseaseAnalysisMethod5": "Prescription",
+  "config.singleFactorAnalysisMethod0": "All",
+  "config.singleFactorAnalysisMethod1": "Periodic Analysis",
+  "config.singleFactorAnalysisMethod2": "Month Analysis",
+  "config.singleFactorAnalysisMethod3": "Mathing Count Analysis",
+  "config.singleFactorAnalysisMethod4": "Mathing Method",
+  "config.singleFactorAnalysisMethod5": "Breeding Company Analysis",
+  "config.singleFactorAnalysisMethod6": "Veterinary Analysis",
+  "config.singleFactorAnalysisMethod7": "Mating Interval Analysis",
+  "config.singleFactorAnalysisMethod8": "Bull Number Analysis",
+  "config.singleFactorAnalysisMethod9": "Mating Cycle Analysis",
+  "config.singleFactorAnalysisMethod10": "Week Analysis",
+  "config.singleFactorAnalysisMethod11": "Parity Analysis",
+  "config.lactIntervalSymbol0": "All",
+  "config.lactIntervalSymbol1": "Less Than",
+  "config.lactIntervalSymbol2": "Less Than AND Equal",
+  "config.lactIntervalSymbol3": "Greater Than",
+  "config.lactIntervalSymbol4": "Greater Than AND Equal",
+  "config.lactIntervalSymbol5": "Equal",
+  "config.lactIntervalSymbol6": "Not Equal",
+  "config.lactIntervalSymbol7": "Between",
+  "config.lactIntervalSymbol8": "Include",
+  "config.lactIntervalSymbol9": "Not Include",
+  "config.multiFactorAnalysisMethod0": "All",
+  "config.multiFactorAnalysisMethod1": "Month",
+  "config.multiFactorAnalysisMethod2": "Week",
+  "config.multiFactorAnalysisMethod3": "Breeder",
+  "config.multiFactorAnalysisMethod4": "Bull",
+  "config.multiFactorAnalysisMethod5": "Lact",
+  "config.multiFactorAnalysisMethod6": "Mating Times",
+  "config.multiFactorAnalysisMethod7": "Mating Type",
+  "config.neckRingIsbind0": "All",
+  "config.neckRingIsbind1": "Bind",
+  "config.neckRingIsbind2": "Not Bind",
+  "config.neckRingStatus0": "All",
+  "config.neckRingStatus1": "Normal",
+  "config.neckRingStatus2": "Abnormal",
+  "config.calendarType0": "All",
+  "config.calendarType1": "Immunity",
+  "config.calendarType2": "PG",
+  "config.calendarType3": "RnGH",
+  "config.calendarType4": "Pregnancy Test",
+  "config.calendarType5": "Work Order",
+  "config.calendarType6": "Weaning",
+  "config.calendarType7": "Disease",
+  "config.calendarType8": "Mating",
+  "config.calendarType9": "Calving",
+  "config.calendarType10": "Dry Milk",
+  "config.calvingAnalysisMethod0": "All",
+  "config.calvingAnalysisMethod1": "Month",
+  "config.calvingAnalysisMethod2": "Cow Kind"
 }

+ 73 - 1
locales/zh.json

@@ -256,5 +256,77 @@
   "config.abortion.reasons7": "热应激流产",
   "config.abortion.reasons8": "传染病性流产",
   "config.abortion.reasons19": "未知原因",
-  "config.abortion.reasons20": "其他原因"
+  "config.abortion.reasons20": "其他原因",
+  "config.lact0": "全部",
+  "config.lact1": "1",
+  "config.lact2": "2",
+  "config.lact3": "3",
+  "config.lact4": "4",
+  "config.diseaseAnalysisMethod0": "全部",
+  "config.diseaseAnalysisMethod1": "月份",
+  "config.diseaseAnalysisMethod2": "疾病分类",
+  "config.diseaseAnalysisMethod3": "疾病名称",
+  "config.diseaseAnalysisMethod4": "兽医",
+  "config.diseaseAnalysisMethod5": "处方",
+  "config.diseaseType0": "全部",
+  "config.diseaseType1": "繁殖系统疾病",
+  "config.diseaseType2": "消化系统疾病",
+  "config.diseaseType3": "乳房疾病",
+  "config.diseaseType4": "代谢系统疾病",
+  "config.diseaseType5": "呼吸系统疾病",
+  "config.diseaseType6": "蹄病",
+  "config.diseaseType7": "皮肤系统疾病",
+  "config.diseaseType8": "传染系统疾病",
+  "config.diseaseType9": "外科系统疾病",
+  "config.diseaseType10": "其他疾病",
+  "config.singleFactorAnalysisMethod0": "全部",
+  "config.singleFactorAnalysisMethod1": "按周期分析",
+  "config.singleFactorAnalysisMethod2": "按月份分析",
+  "config.singleFactorAnalysisMethod3": "按配种次数分析",
+  "config.singleFactorAnalysisMethod4": "按配种方式分析",
+  "config.singleFactorAnalysisMethod5": "按育种公司分析",
+  "config.singleFactorAnalysisMethod6": "按兽医人员分析",
+  "config.singleFactorAnalysisMethod7": "按配种间隔分析",
+  "config.singleFactorAnalysisMethod8": "按公牛号分析",
+  "config.singleFactorAnalysisMethod9": "按配种周期分析",
+  "config.singleFactorAnalysisMethod10": "按星期分析",
+  "config.singleFactorAnalysisMethod11": "按胎次分析",
+  "config.lactIntervalSymbol0": "全部",
+  "config.lactIntervalSymbol1": "小于",
+  "config.lactIntervalSymbol2": "小于等于",
+  "config.lactIntervalSymbol3": "大于",
+  "config.lactIntervalSymbol4": "大于等于",
+  "config.lactIntervalSymbol5": "等于",
+  "config.lactIntervalSymbol6": "不等于",
+  "config.lactIntervalSymbol7": "区间",
+  "config.lactIntervalSymbol8": "包含",
+  "config.lactIntervalSymbol9": "不包含",
+  "config.multiFactorAnalysisMethod0": "全部",
+  "config.multiFactorAnalysisMethod1": "月份",
+  "config.multiFactorAnalysisMethod2": "周",
+  "config.multiFactorAnalysisMethod3": "配种员",
+  "config.multiFactorAnalysisMethod4": "公牛",
+  "config.multiFactorAnalysisMethod5": "胎次",
+  "config.multiFactorAnalysisMethod6": "配种次数",
+  "config.multiFactorAnalysisMethod7": "配种方式",
+  "config.neckRingIsbind0": "全部",
+  "config.neckRingIsbind1": "已绑定",
+  "config.neckRingIsbind2": "未绑定",
+  "config.neckRingStatus0": "全部",
+  "config.neckRingStatus1": "正常",
+  "config.neckRingStatus2": "异常",
+  "config.calendarType0": "全部",
+  "config.calendarType1": "免疫",
+  "config.calendarType2": "PG同期",
+  "config.calendarType3": "RnGH",
+  "config.calendarType4": "孕检",
+  "config.calendarType5": "工单",
+  "config.calendarType6": "断奶",
+  "config.calendarType7": "疾病",
+  "config.calendarType8": "配种",
+  "config.calendarType9": "产犊",
+  "config.calendarType10": "干奶",
+  "config.calvingAnalysisMethod0": "全部",
+  "config.calvingAnalysisMethod1": "月份",
+  "config.calvingAnalysisMethod2": "品种"
 }

+ 16 - 15
model/config_calendar_type.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigCalendarType struct {
-	Id        int32                       `json:"id"`
-	PastureId int64                       `json:"pastureId"`
-	Kind      pasturePb.CalendarType_Kind `json:"kind"`
-	Zh        string                      `json:"zh"`
-	En        string                      `json:"en"`
-	Remarks   string                      `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind       `json:"is_show"`
-	CreatedAt int64                       `json:"created_at"`
-	UpdatedAt int64                       `json:"updated_at"`
+	Id           int32                       `json:"id"`
+	PastureId    int64                       `json:"pastureId"`
+	Kind         pasturePb.CalendarType_Kind `json:"kind"`
+	I18nFieldTag string                      `json:"i18nFieldTag"`
+	Remarks      string                      `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind       `json:"is_show"`
+	CreatedAt    int64                       `json:"created_at"`
+	UpdatedAt    int64                       `json:"updated_at"`
 }
 
 func (c *ConfigCalendarType) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigCalendarType) TableName() string {
 
 type ConfigCalendarTypeSlice []*ConfigCalendarType
 
-func (c ConfigCalendarTypeSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigCalendarTypeSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 16 - 15
model/config_calving_analysis_method.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigCalvingAnalysisMethod struct {
-	Id        int32                                `json:"id"`
-	PastureId int64                                `json:"pastureId"`
-	Kind      pasturePb.CalvingAnalysisMethod_Kind `json:"kind"`
-	Zh        string                               `json:"zh"`
-	En        string                               `json:"en"`
-	Remarks   string                               `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind                `json:"is_show"`
-	CreatedAt int64                                `json:"created_at"`
-	UpdatedAt int64                                `json:"updated_at"`
+	Id           int32                                `json:"id"`
+	PastureId    int64                                `json:"pastureId"`
+	Kind         pasturePb.CalvingAnalysisMethod_Kind `json:"kind"`
+	I18nFieldTag string                               `json:"i18nFieldTag"`
+	Remarks      string                               `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind                `json:"is_show"`
+	CreatedAt    int64                                `json:"created_at"`
+	UpdatedAt    int64                                `json:"updated_at"`
 }
 
 func (c *ConfigCalvingAnalysisMethod) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigCalvingAnalysisMethod) TableName() string {
 
 type ConfigCalvingAnalysisMethodSlice []*ConfigCalvingAnalysisMethod
 
-func (c ConfigCalvingAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigCalvingAnalysisMethodSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 16 - 15
model/config_disease_analysis_method.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigDiseaseAnalysisMethod struct {
-	Id        int32                                `json:"id"`
-	PastureId int64                                `json:"pastureId"`
-	Kind      pasturePb.DiseaseAnalysisMethod_Kind `json:"kind"`
-	Zh        string                               `json:"zh"`
-	En        string                               `json:"en"`
-	Remarks   string                               `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind                `json:"is_show"`
-	CreatedAt int64                                `json:"created_at"`
-	UpdatedAt int64                                `json:"updated_at"`
+	Id           int32                                `json:"id"`
+	PastureId    int64                                `json:"pastureId"`
+	Kind         pasturePb.DiseaseAnalysisMethod_Kind `json:"kind"`
+	I18nFieldTag string                               `json:"i18NFieldTag"`
+	Remarks      string                               `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind                `json:"is_show"`
+	CreatedAt    int64                                `json:"created_at"`
+	UpdatedAt    int64                                `json:"updated_at"`
 }
 
 func (c *ConfigDiseaseAnalysisMethod) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigDiseaseAnalysisMethod) TableName() string {
 
 type ConfigDiseaseAnalysisMethodSlice []*ConfigDiseaseAnalysisMethod
 
-func (c ConfigDiseaseAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigDiseaseAnalysisMethodSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 21 - 25
model/config_disease_type.go

@@ -2,19 +2,18 @@ package model
 
 import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
-	"golang.org/x/text/language"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 )
 
 type ConfigDiseaseType struct {
-	Id        int64                 `json:"id"`
-	PastureId int64                 `json:"pastureId"`
-	Kind      int32                 `json:"kind"`
-	Zh        string                `json:"Zh"`
-	En        string                `json:"En"`
-	Remarks   string                `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind `json:"is_show"`
-	CreatedAt int64                 `json:"created_at"`
-	UpdatedAt int64                 `json:"updated_at"`
+	Id           int64                 `json:"id"`
+	PastureId    int64                 `json:"pastureId"`
+	Kind         int32                 `json:"kind"`
+	I18nFieldTag string                `json:"i18nFieldTag"`
+	Remarks      string                `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind `json:"is_show"`
+	CreatedAt    int64                 `json:"created_at"`
+	UpdatedAt    int64                 `json:"updated_at"`
 }
 
 func (c *ConfigDiseaseType) TableName() string {
@@ -23,13 +22,12 @@ func (c *ConfigDiseaseType) TableName() string {
 
 type ConfigDiseaseTypeSlice []*ConfigDiseaseType
 
-func (c ConfigDiseaseTypeSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigList {
+func (c ConfigDiseaseTypeSlice) ToPB(userModel *UserModel) []*pasturePb.SearchBaseConfigList {
 	res := make([]*pasturePb.SearchBaseConfigList, len(c))
 	for i, d := range c {
-		name := d.Zh
-		if lang == language.English.String() {
-			name = d.En
-		}
+		name, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18nFieldTag,
+		})
 		res[i] = &pasturePb.SearchBaseConfigList{
 			Id:        int32(d.Id),
 			Name:      name,
@@ -42,7 +40,7 @@ func (c ConfigDiseaseTypeSlice) ToPB(lang string) []*pasturePb.SearchBaseConfigL
 	return res
 }
 
-func (c ConfigDiseaseTypeSlice) ToPB2(lang string, diseaseList []*Disease) []*pasturePb.ConfigOptionsList {
+func (c ConfigDiseaseTypeSlice) ToPB2(userModel *UserModel, diseaseList []*Disease) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, len(c))
 	for i, d := range c {
 		children := make([]*pasturePb.ConfigOptionsList, 0)
@@ -58,10 +56,9 @@ func (c ConfigDiseaseTypeSlice) ToPB2(lang string, diseaseList []*Disease) []*pa
 				})
 			}
 		}
-		label := d.Zh
-		if lang == language.English.String() {
-			label = d.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: d.I18nFieldTag,
+		})
 		res[i] = &pasturePb.ConfigOptionsList{
 			Value:    int32(d.Id),
 			Label:    label,
@@ -71,13 +68,12 @@ func (c ConfigDiseaseTypeSlice) ToPB2(lang string, diseaseList []*Disease) []*pa
 	}
 	return res
 }
-func (c ConfigDiseaseTypeSlice) ToPB3(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigDiseaseTypeSlice) ToPB3(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 17 - 16
model/config_lact.go

@@ -1,18 +1,20 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigLact struct {
-	Id        int32                          `json:"id"`
-	PastureId int64                          `json:"pastureId"`
-	Kind      int32                          `json:"kind"`
-	Zh        string                         `json:"zh"`
-	En        string                         `json:"en"`
-	Category  pasturePb.PastureCategory_Kind `json:"category"`
-	Remarks   string                         `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind          `json:"is_show"`
-	CreatedAt int64                          `json:"created_at"`
-	UpdatedAt int64                          `json:"updated_at"`
+	Id           int32                          `json:"id"`
+	PastureId    int64                          `json:"pastureId"`
+	Kind         int32                          `json:"kind"`
+	I18nFieldTag string                         `json:"i18nFieldTag"`
+	Category     pasturePb.PastureCategory_Kind `json:"category"`
+	Remarks      string                         `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind          `json:"is_show"`
+	CreatedAt    int64                          `json:"created_at"`
+	UpdatedAt    int64                          `json:"updated_at"`
 }
 
 func (c *ConfigLact) TableName() string {
@@ -21,13 +23,12 @@ func (c *ConfigLact) TableName() string {
 
 type ConfigLactSlice []*ConfigLact
 
-func (c ConfigLactSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigLactSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    v.Kind,
 			Label:    label,

+ 16 - 15
model/config_lact_interval_symbol.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigLactIntervalSymbol struct {
-	Id        int32                        `json:"id"`
-	PastureId int64                        `json:"pastureId"`
-	Kind      pasturePb.CompareSymbol_Kind `json:"kind"`
-	Zh        string                       `json:"zh"`
-	En        string                       `json:"en"`
-	Remarks   string                       `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind        `json:"is_show"`
-	CreatedAt int64                        `json:"created_at"`
-	UpdatedAt int64                        `json:"updated_at"`
+	Id           int32                        `json:"id"`
+	PastureId    int64                        `json:"pastureId"`
+	Kind         pasturePb.CompareSymbol_Kind `json:"kind"`
+	I18nFieldTag string                       `json:"i18nFieldTag"`
+	Remarks      string                       `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind        `json:"is_show"`
+	CreatedAt    int64                        `json:"created_at"`
+	UpdatedAt    int64                        `json:"updated_at"`
 }
 
 func (c *ConfigLactIntervalSymbol) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigLactIntervalSymbol) TableName() string {
 
 type ConfigLactIntervalSymbolSlice []*ConfigLactIntervalSymbol
 
-func (c ConfigLactIntervalSymbolSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigLactIntervalSymbolSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 17 - 16
model/config_multi_factor_analysis_method.go

@@ -1,18 +1,20 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigMultiFactorAnalysisMethod struct {
-	Id        int32                                    `json:"id"`
-	PastureId int64                                    `json:"pastureId"`
-	Kind      pasturePb.MultiFactorAnalysisMethod_Kind `json:"kind"`
-	Zh        string                                   `json:"zh"`
-	En        string                                   `json:"en"`
-	Props     string                                   `json:"props"`
-	Remarks   string                                   `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind                    `json:"is_show"`
-	CreatedAt int64                                    `json:"created_at"`
-	UpdatedAt int64                                    `json:"updated_at"`
+	Id           int32                                    `json:"id"`
+	PastureId    int64                                    `json:"pastureId"`
+	Kind         pasturePb.MultiFactorAnalysisMethod_Kind `json:"kind"`
+	I18nFieldTag string                                   `json:"i18nFieldTag"`
+	Props        string                                   `json:"props"`
+	Remarks      string                                   `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind                    `json:"is_show"`
+	CreatedAt    int64                                    `json:"created_at"`
+	UpdatedAt    int64                                    `json:"updated_at"`
 }
 
 func (c *ConfigMultiFactorAnalysisMethod) TableName() string {
@@ -21,13 +23,12 @@ func (c *ConfigMultiFactorAnalysisMethod) TableName() string {
 
 type ConfigMultiFactorAnalysisMethodSlice []*ConfigMultiFactorAnalysisMethod
 
-func (c ConfigMultiFactorAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigMultiFactorAnalysisMethodSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 16 - 15
model/config_neck_ring_isbind.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigNeckRingIsBind struct {
-	Id        int32                         `json:"id"`
-	PastureId int64                         `json:"pastureId"`
-	Kind      pasturePb.NeckRingIsBind_Kind `json:"kind"`
-	Zh        string                        `json:"zh"`
-	En        string                        `json:"en"`
-	Remarks   string                        `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind         `json:"is_show"`
-	CreatedAt int64                         `json:"created_at"`
-	UpdatedAt int64                         `json:"updated_at"`
+	Id           int32                         `json:"id"`
+	PastureId    int64                         `json:"pastureId"`
+	Kind         pasturePb.NeckRingIsBind_Kind `json:"kind"`
+	I18nFieldTag string                        `json:"i18nFieldTag"`
+	Remarks      string                        `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind         `json:"is_show"`
+	CreatedAt    int64                         `json:"created_at"`
+	UpdatedAt    int64                         `json:"updated_at"`
 }
 
 func (c *ConfigNeckRingIsBind) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigNeckRingIsBind) TableName() string {
 
 type ConfigNeckRingIsBindSlice []*ConfigNeckRingIsBind
 
-func (c ConfigNeckRingIsBindSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigNeckRingIsBindSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 16 - 15
model/config_neck_ring_status.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigNeckRingStatus struct {
-	Id        int32                         `json:"id"`
-	PastureId int64                         `json:"pastureId"`
-	Kind      pasturePb.NeckRingStatus_Kind `json:"kind"`
-	Zh        string                        `json:"zh"`
-	En        string                        `json:"en"`
-	Remarks   string                        `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind         `json:"is_show"`
-	CreatedAt int64                         `json:"created_at"`
-	UpdatedAt int64                         `json:"updated_at"`
+	Id           int32                         `json:"id"`
+	PastureId    int64                         `json:"pastureId"`
+	Kind         pasturePb.NeckRingStatus_Kind `json:"kind"`
+	I18nFieldTag string                        `json:"i18nFieldTag"`
+	Remarks      string                        `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind         `json:"is_show"`
+	CreatedAt    int64                         `json:"created_at"`
+	UpdatedAt    int64                         `json:"updated_at"`
 }
 
 func (c *ConfigNeckRingStatus) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigNeckRingStatus) TableName() string {
 
 type ConfigNeckRingStatusSlice []*ConfigNeckRingStatus
 
-func (c ConfigNeckRingStatusSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigNeckRingStatusSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 16 - 15
model/config_single_factor_analysis_method.go

@@ -1,17 +1,19 @@
 package model
 
-import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+import (
+	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+)
 
 type ConfigSingleFactorAnalysisMethod struct {
-	Id        int32                                     `json:"id"`
-	PastureId int64                                     `json:"pastureId"`
-	Kind      pasturePb.SingleFactorAnalysisMethod_Kind `json:"kind"`
-	Zh        string                                    `json:"zh"`
-	En        string                                    `json:"en"`
-	Remarks   string                                    `json:"remarks"`
-	IsShow    pasturePb.IsShow_Kind                     `json:"is_show"`
-	CreatedAt int64                                     `json:"created_at"`
-	UpdatedAt int64                                     `json:"updated_at"`
+	Id           int32                                     `json:"id"`
+	PastureId    int64                                     `json:"pastureId"`
+	Kind         pasturePb.SingleFactorAnalysisMethod_Kind `json:"kind"`
+	I18nFieldTag string                                    `json:"i18NFieldTag"`
+	Remarks      string                                    `json:"remarks"`
+	IsShow       pasturePb.IsShow_Kind                     `json:"is_show"`
+	CreatedAt    int64                                     `json:"created_at"`
+	UpdatedAt    int64                                     `json:"updated_at"`
 }
 
 func (c *ConfigSingleFactorAnalysisMethod) TableName() string {
@@ -20,13 +22,12 @@ func (c *ConfigSingleFactorAnalysisMethod) TableName() string {
 
 type ConfigSingleFactorAnalysisMethodSlice []*ConfigSingleFactorAnalysisMethod
 
-func (c ConfigSingleFactorAnalysisMethodSlice) ToPB(lang string) []*pasturePb.ConfigOptionsList {
+func (c ConfigSingleFactorAnalysisMethodSlice) ToPB(userModel *UserModel) []*pasturePb.ConfigOptionsList {
 	res := make([]*pasturePb.ConfigOptionsList, 0)
 	for _, v := range c {
-		label := v.Zh
-		if lang == "en" {
-			label = v.En
-		}
+		label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+			MessageID: v.I18nFieldTag,
+		})
 		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(v.Kind),
 			Label:    label,

+ 7 - 5
model/disease.go

@@ -3,6 +3,8 @@ package model
 import (
 	"strings"
 
+	"github.com/nicksnyder/go-i18n/v2/i18n"
+
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 )
 
@@ -26,7 +28,7 @@ func (d *Disease) TableName() string {
 
 type DiseaseSlice []*Disease
 
-func (d DiseaseSlice) ToPB(lang string, user []*SystemUser, diseaseTypeList []*ConfigDiseaseType) []*pasturePb.SearchDiseaseList {
+func (d DiseaseSlice) ToPB(userModel *UserModel, user []*SystemUser, diseaseTypeList []*ConfigDiseaseType) []*pasturePb.SearchDiseaseList {
 	res := make([]*pasturePb.SearchDiseaseList, len(d))
 	for i, dl := range d {
 		operationName, diseaseTypeName := "", ""
@@ -39,10 +41,10 @@ func (d DiseaseSlice) ToPB(lang string, user []*SystemUser, diseaseTypeList []*C
 
 		for _, dt := range diseaseTypeList {
 			if dt.Id == int64(dl.DiseaseType) {
-				diseaseTypeName = dt.Zh
-				if lang == "en" {
-					diseaseTypeName = dt.En
-				}
+				label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+					MessageID: dt.I18nFieldTag,
+				})
+				diseaseTypeName = label
 				break
 			}
 		}

+ 23 - 256
module/backend/config_data_breed.go

@@ -25,27 +25,7 @@ func (s *StoreEntry) LactEnumList(userModel *model.UserModel, isAll string) []*p
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigLactSlice(configLactList).ToPB(userModel.Language)
-	/*
-		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-				Value:    int32(1),
-				Label:    "1",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(2),
-				Label:    "2",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(3),
-				Label:    "3",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(4),
-				Label:    ">3",
-				Disabled: true,
-			})
-			return configOptions
-	*/
+	return model.ConfigLactSlice(configLactList).ToPB(userModel)
 }
 
 func (s *StoreEntry) DiseaseAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -65,44 +45,27 @@ func (s *StoreEntry) DiseaseAnalysisMethodEnumList(userModel *model.UserModel, i
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigDiseaseAnalysisMethodSlice(dataList).ToPB(userModel.Language)
-	/*
-		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DiseaseAnalysisMethod_Months),
-				Label:    "按月份",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease_Category),
-				Label:    "疾病分类",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DiseaseAnalysisMethod_Disease),
-				Label:    "疾病名称",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DiseaseAnalysisMethod_Operator),
-				Label:    "兽医",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.DiseaseAnalysisMethod_Prescription),
-				Label:    "处方",
-				Disabled: true,
-			})
-			return configOptions
-	*/
+	return model.ConfigDiseaseAnalysisMethodSlice(dataList).ToPB(userModel)
 }
 
 func (s *StoreEntry) diseaseTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
-	configDiseaseTypeList := make([]*model.ConfigDiseaseType, 0)
-	if err := s.DB.Model(new(model.ConfigDiseaseType)).
-		Where("pasture_id = ?", userModel.AppPasture.Id).
-		Where("is_show = ?", pasturePb.IsShow_Ok).
-		Find(&configDiseaseTypeList).Error; err != nil {
-		zaplog.Error("diseaseTypeEnumList", zap.Any("Find", err))
+	dataList := make([]*model.ConfigDiseaseType, 0)
+	pref := s.DB.Model(new(model.ConfigDiseaseType)).
+		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Where("pasture_id =? ", userModel.AppPasture.Id)
+	if isAll == model.IsAllYes {
+		pref = pref.Where("kind >= ?", 0)
+	} else {
+		pref = pref.Where("kind > ?", 0)
+	}
+
+	if err := pref.Order("kind ASC").
+		Find(&dataList).Error; err != nil {
+		zaplog.Error("DiseaseAnalysisMethodEnumList", zap.Any("err", err))
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigDiseaseTypeSlice(configDiseaseTypeList).ToPB3(userModel.Language)
+	return model.ConfigDiseaseTypeSlice(dataList).ToPB3(userModel)
 }
 
 func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -122,58 +85,7 @@ func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(userModel *model.UserMod
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigSingleFactorAnalysisMethodSlice(dataList).ToPB(userModel.Language)
-
-	/*
-		func (s *StoreEntry) SingleFactorAnalysisMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
-			configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-			configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Cycle),
-				Label:    "按周期分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Months),
-				Label:    "按月份分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Times),
-				Label:    "按配种次数分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Method),
-				Label:    "按配种方式分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Company),
-				Label:    "按育种公司分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Operation),
-				Label:    "按兽医人员分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Mating_Interval),
-				Label:    "按配种间隔分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Bull),
-				Label:    "按公牛号分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Breeding_Cycle),
-				Label:    "按配种周期分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Week),
-				Label:    "按星期分析",
-				Disabled: true,
-			}, &pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.SingleFactorAnalysisMethod_Lact),
-				Label:    "按胎次分析",
-				Disabled: true,
-			})
-			return configOptions
-	*/
+	return model.ConfigSingleFactorAnalysisMethodSlice(dataList).ToPB(userModel)
 }
 
 func (s *StoreEntry) LactIntervalSymbolEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -193,47 +105,7 @@ func (s *StoreEntry) LactIntervalSymbolEnumList(userModel *model.UserModel, isAl
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigLactIntervalSymbolSlice(dataList).ToPB(userModel.Language)
-
-	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Less_Than),
-		Label:    "<",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Less_Than_Or_Equal_To),
-		Label:    "<=",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Greater_Than),
-		Label:    ">",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Greater_Than_Or_Equal_To),
-		Label:    ">=",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Equal_To),
-		Label:    "=",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Not_Equal_To),
-		Label:    "!=",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Between),
-		Label:    "区间",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Include),
-		Label:    "包含",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CompareSymbol_Not_Include),
-		Label:    "不包含",
-		Disabled: true,
-	})
-	return configOptions*/
+	return model.ConfigLactIntervalSymbolSlice(dataList).ToPB(userModel)
 }
 
 func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -253,45 +125,7 @@ func (s *StoreEntry) MultiFactorAnalysisMethodEnumList(userModel *model.UserMode
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigMultiFactorAnalysisMethodSlice(dataList).ToPB(userModel.Language)
-	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Months),
-		Label:    "月份",
-		Props:    "months",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Week),
-		Label:    "周",
-		Props:    "week",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Operation),
-		Label:    "配种员",
-		Props:    "operationName",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Bull),
-		Label:    "公牛",
-		Props:    "bull",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Lact),
-		Label:    "胎次",
-		Props:    "lact",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Mating_Times),
-		Label:    "配次",
-		Props:    "matingTimes",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.MultiFactorAnalysisMethod_Breeding_Method),
-		Label:    "配种方式",
-		Props:    "exposeEstrusType",
-		Disabled: true,
-	})
-	return configOptions*/
+	return model.ConfigMultiFactorAnalysisMethodSlice(dataList).ToPB(userModel)
 }
 
 func (s *StoreEntry) SaleCowAnalysisMethodEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -312,17 +146,6 @@ func (s *StoreEntry) SaleCowAnalysisMethodEnumList(userModel *model.UserModel, i
 	}
 
 	return model.ConfigSaleCowAnalysisMethodSlice(dataList).ToPB(userModel)
-	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SaleCowAnalysisMethod_Months),
-		Label:    "月份",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.SaleCowAnalysisMethod_Dealer),
-		Label:    "经销商",
-		Disabled: true,
-	})
-	return configOptions*/
 }
 
 func (s *StoreEntry) NeckRingIsBindEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -342,26 +165,7 @@ func (s *StoreEntry) NeckRingIsBindEnumList(userModel *model.UserModel, isAll st
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigNeckRingIsBindSlice(dataList).ToPB(userModel.Language)
-	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	if isAll == model.IsAllYes {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.NeckRingIsBind_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
-	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.NeckRingIsBind_Bind),
-		Label:    "已绑定",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.NeckRingIsBind_Unbind),
-		Label:    "未绑定",
-		Disabled: true,
-	})
-	return configOptions*/
+	return model.ConfigNeckRingIsBindSlice(dataList).ToPB(userModel)
 }
 
 func (s *StoreEntry) NeckRingStatusEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -381,26 +185,7 @@ func (s *StoreEntry) NeckRingStatusEnumList(userModel *model.UserModel, isAll st
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigNeckRingStatusSlice(dataList).ToPB(userModel.Language)
-	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	if isAll == model.IsAllYes {
-		configOptions = append(configOptions,
-			&pasturePb.ConfigOptionsList{
-				Value:    int32(pasturePb.NeckRingStatus_Invalid),
-				Label:    "全部",
-				Disabled: true,
-			})
-	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.NeckRingStatus_Normal),
-		Label:    "正常",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.NeckRingStatus_Abnormal),
-		Label:    "异常",
-		Disabled: true,
-	})
-	return configOptions*/
+	return model.ConfigNeckRingStatusSlice(dataList).ToPB(userModel)
 }
 
 func (s *StoreEntry) CalendarTypeEnumList(userModel *model.UserModel, isAll string) []*pasturePb.ConfigOptionsList {
@@ -420,7 +205,7 @@ func (s *StoreEntry) CalendarTypeEnumList(userModel *model.UserModel, isAll stri
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigCalendarTypeSlice(dataList).ToPB(userModel.Language)
+	return model.ConfigCalendarTypeSlice(dataList).ToPB(userModel)
 }
 
 func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
@@ -509,23 +294,5 @@ func (s *StoreEntry) CalvingAnalysisMethodEnumList(userModel *model.UserModel, i
 		return make([]*pasturePb.ConfigOptionsList, 0)
 	}
 
-	return model.ConfigCalvingAnalysisMethodSlice(dataList).ToPB(userModel.Language)
-	/*configOptions := make([]*pasturePb.ConfigOptionsList, 0)
-	if isAll == model.IsAllYes {
-		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-			Value:    int32(pasturePb.CalvingAnalysisMethod_Invalid),
-			Label:    "全部",
-			Disabled: true,
-		})
-	}
-	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CalvingAnalysisMethod_Months),
-		Label:    "按月份统计",
-		Disabled: true,
-	}, &pasturePb.ConfigOptionsList{
-		Value:    int32(pasturePb.CalvingAnalysisMethod_CowKind),
-		Label:    "按照品种统计",
-		Disabled: true,
-	})
-	return configOptions*/
+	return model.ConfigCalvingAnalysisMethodSlice(dataList).ToPB(userModel)
 }

+ 2 - 1
module/backend/enum_options.go

@@ -67,6 +67,7 @@ func (s *StoreEntry) DiseaseTypeOptions(ctx context.Context, isChildren string)
 	diseaseTypeList := make([]*model.ConfigDiseaseType, 0)
 	if err = s.DB.Table(new(model.ConfigDiseaseType).TableName()).
 		Where("is_show =? ", pasturePb.IsShow_Ok).
+		Order("kind ASC").
 		Find(&diseaseTypeList).Error; err != nil {
 		return nil, xerr.WithStack(err)
 	}
@@ -84,7 +85,7 @@ func (s *StoreEntry) DiseaseTypeOptions(ctx context.Context, isChildren string)
 	return &pasturePb.ConfigOptionsListResponse{
 		Code: http.StatusOK,
 		Msg:  "ok",
-		Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(userModel.Language, diseaseList),
+		Data: model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB2(userModel, diseaseList),
 	}, nil
 }
 

+ 7 - 7
module/backend/prescription.go

@@ -9,7 +9,7 @@ import (
 	"strconv"
 	"strings"
 
-	"golang.org/x/text/language"
+	"github.com/nicksnyder/go-i18n/v2/i18n"
 
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 	"gitee.com/xuyiping_admin/pkg/xerr"
@@ -142,7 +142,7 @@ func (s *StoreEntry) SearchDiseaseList(ctx context.Context, req *pasturePb.Searc
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchDiseaseData{
-			List:     model.DiseaseSlice(diseaseList).ToPB(userModel.Language, systemUserList, diseaseTypeList),
+			List:     model.DiseaseSlice(diseaseList).ToPB(userModel, systemUserList, diseaseTypeList),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -169,10 +169,10 @@ func (s *StoreEntry) CreateOrUpdateDisease(ctx context.Context, req *pasturePb.S
 	if req.DiseaseTypeId > 0 {
 		for _, v := range diseaseTypeList {
 			if int32(v.Id) == req.DiseaseTypeId {
-				req.DiseaseTypeName = v.Zh
-				if userModel.Language == language.English.String() {
-					req.DiseaseTypeName = v.En
-				}
+				label, _ := userModel.LanguageContent.Localize(&i18n.LocalizeConfig{
+					MessageID: v.I18nFieldTag,
+				})
+				req.DiseaseTypeName = label
 			}
 		}
 	}
@@ -217,7 +217,7 @@ func (s *StoreEntry) SearchDiseaseTypeList(ctx context.Context, req *pasturePb.S
 		Code: http.StatusOK,
 		Msg:  "ok",
 		Data: &pasturePb.SearchBaseConfigData{
-			List:     model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB(userModel.Language),
+			List:     model.ConfigDiseaseTypeSlice(diseaseTypeList).ToPB(userModel),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,