Selaa lähdekoodia

options: 添加全部选项

Yi 5 kuukautta sitten
vanhempi
commit
3a216d91f5

+ 6 - 3
http/handler/config/config.go

@@ -23,11 +23,12 @@ func BarnTypeOptions(c *gin.Context) {
 func BarnListOptions(c *gin.Context) {
 	penTypeStr := c.Query("pen_type")
 	penTypeId, _ := strconv.Atoi(penTypeStr)
+	isAll := c.Query("is_all")
 	if err := valid.Validate(penTypeId, valid.Required, valid.Min(-1)); err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
-	res, err := middleware.Dependency(c).StoreEventHub.OpsService.BarnListOptions(c, penTypeId)
+	res, err := middleware.Dependency(c).StoreEventHub.OpsService.BarnListOptions(c, penTypeId, isAll)
 	if err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return
@@ -90,12 +91,13 @@ func CowSourceOptions(c *gin.Context) {
 
 func CowTypeOptions(c *gin.Context) {
 	optionName := c.Query("option_name")
+	isAll := c.Query("is_all")
 	if err := valid.Validate(optionName, valid.Required, valid.Length(1, 50)); err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
 
-	res, err := middleware.Dependency(c).StoreEventHub.OpsService.CowTypeOptions(c, optionName)
+	res, err := middleware.Dependency(c).StoreEventHub.OpsService.CowTypeOptions(c, optionName, isAll)
 	if err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return
@@ -138,11 +140,12 @@ func BullListOptions(c *gin.Context) {
 
 func SystemBaseConfigOptions(c *gin.Context) {
 	optionName := c.Query("option_name")
+	isAll := c.Query("is_all")
 	if err := valid.Validate(optionName, valid.Required, valid.Length(1, 50)); err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return
 	}
-	res, err := middleware.Dependency(c).StoreEventHub.OpsService.SystemBaseConfigOptions(c, optionName)
+	res, err := middleware.Dependency(c).StoreEventHub.OpsService.SystemBaseConfigOptions(c, optionName, isAll)
 	if err != nil {
 		apierr.ClassifiedAbort(c, err)
 		return

+ 14 - 5
model/pen.go

@@ -6,6 +6,8 @@ import (
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 )
 
+const IsAllYes = "Yes"
+
 type Pen struct {
 	Id                int64                 `json:"id"`
 	Name              string                `json:"name"`
@@ -60,9 +62,16 @@ func (p PenSlice) ToPB(configBarnTypes []*ConfigPenType) []*pasturePb.SearchBarn
 	return res
 }
 
-func (p PenSlice) ToPB2(req []*pasturePb.ConfigOptionsList) []*pasturePb.ConfigOptionsList {
-	res := make([]*pasturePb.ConfigOptionsList, len(p))
-	for i, d := range p {
+func (p PenSlice) ToPB2(req []*pasturePb.ConfigOptionsList, isAll string) []*pasturePb.ConfigOptionsList {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == IsAllYes {
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    int32(0),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
+	for _, d := range p {
 		label := d.Name
 		for _, r := range req {
 			if r.Value != d.PenType {
@@ -70,11 +79,11 @@ func (p PenSlice) ToPB2(req []*pasturePb.ConfigOptionsList) []*pasturePb.ConfigO
 			}
 			label = fmt.Sprintf("%s-%s", label, r.Label)
 		}
-		res[i] = &pasturePb.ConfigOptionsList{
+		res = append(res, &pasturePb.ConfigOptionsList{
 			Value:    int32(d.Id),
 			Label:    label,
 			Disabled: true,
-		}
+		})
 	}
 	return res
 }

+ 154 - 26
module/backend/config_data.go

@@ -138,8 +138,15 @@ func (s *StoreEntry) CowSourceEnumList() []*pasturePb.ConfigOptionsList {
 	})
 	return cowSourceList
 }
-func (s *StoreEntry) CowTypeEnumList(optionName string) []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) CowTypeEnumList(optionName, isAll string) []*pasturePb.ConfigOptionsList {
 	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.CowType_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	if optionName == "breed" {
 		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.CowType_Reserve_Calf),
@@ -186,8 +193,15 @@ func (s *StoreEntry) CowTypeEnumList(optionName string) []*pasturePb.ConfigOptio
 	return cowTypeList
 }
 
-func (s *StoreEntry) SameTimeCowTypeEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) SameTimeCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.SameTimeStatus_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.SameTimeCowType_Empty),
 		Label:    "空怀牛",
@@ -200,8 +214,15 @@ func (s *StoreEntry) SameTimeCowTypeEnumList() []*pasturePb.ConfigOptionsList {
 	return cowTypeList
 }
 
-func (s *StoreEntry) SameTimeTypeEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) SameTimeTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.SameTimeStatus_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.SameTimeType_PGBJ),
 		Label:    "PG保健",
@@ -222,7 +243,7 @@ func (s *StoreEntry) SameTimeTypeEnumList() []*pasturePb.ConfigOptionsList {
 	return cowTypeList
 }
 
-func (s *StoreEntry) ImmunizationCowTypeEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) ImmunizationCowTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
 	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.CowType_Lactating_Calf),
@@ -256,8 +277,15 @@ func (s *StoreEntry) ImmunizationCowTypeEnumList() []*pasturePb.ConfigOptionsLis
 	return cowTypeList
 }
 
-func (s *StoreEntry) ImmunizationConditionsEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) ImmunizationConditionsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	cowTypeList := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.ImmunizationConditions_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	cowTypeList = append(cowTypeList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.ImmunizationConditions_Days_Age),
 		Label:    "日龄",
@@ -282,8 +310,15 @@ func (s *StoreEntry) ImmunizationConditionsEnumList() []*pasturePb.ConfigOptions
 	return cowTypeList
 }
 
-func (s *StoreEntry) TransferPenEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) TransferPenEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	transferPenList := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.TransferPenReason_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	transferPenList = append(transferPenList, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.TransferPenReason_Normal),
 		Label:    "正常转群",
@@ -308,8 +343,16 @@ func (s *StoreEntry) TransferPenEnumList() []*pasturePb.ConfigOptionsList {
 	return transferPenList
 }
 
-func (s *StoreEntry) ChildNumberEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) ChildNumberEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.ChildNumber_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.ChildNumber_One),
@@ -331,8 +374,16 @@ func (s *StoreEntry) ChildNumberEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) CalvingLevelEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) CalvingLevelEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.CalvingLevel_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.CalvingLevel_Natural_Childbirth),
@@ -354,8 +405,16 @@ func (s *StoreEntry) CalvingLevelEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) DystociaReasonEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) DystociaReasonEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DystociaReason_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.DystociaReason_Malposition),
@@ -381,8 +440,16 @@ func (s *StoreEntry) DystociaReasonEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) PregnantCheckResultEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) PregnantCheckResultEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.PregnantCheckResult_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.PregnantCheckResult_Pregnant),
 		Label:    "有胎",
@@ -395,8 +462,14 @@ func (s *StoreEntry) PregnantCheckResultEnumList() []*pasturePb.ConfigOptionsLis
 	return configOptions
 }
 
-func (s *StoreEntry) PregnantCheckMethodEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) PregnantCheckMethodEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value: int32(pasturePb.PregnantCheckMethod_Invalid),
+			})
+	}
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.PregnantCheckMethod_B_Ultrasound),
 		Label:    "B超",
@@ -413,8 +486,16 @@ func (s *StoreEntry) PregnantCheckMethodEnumList() []*pasturePb.ConfigOptionsLis
 	return configOptions
 }
 
-func (s *StoreEntry) DrugCategoryEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) DrugCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DrugCategory_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.DrugCategory_Antibiotics),
 		Label:    "抗生素类",
@@ -479,8 +560,16 @@ func (s *StoreEntry) DrugCategoryEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) DrugUsageEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) DrugUsageEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.DrugUsage_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.DrugUsage_Oral_Medications),
@@ -506,7 +595,7 @@ func (s *StoreEntry) DrugUsageEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) UnitEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) UnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
@@ -553,8 +642,17 @@ func (s *StoreEntry) UnitEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) ExposeEstrusTypeEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) ExposeEstrusTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.ExposeEstrusType_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
+
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.ExposeEstrusType_Neck_Ring),
@@ -572,8 +670,16 @@ func (s *StoreEntry) ExposeEstrusTypeEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) FrozenSemenTypeEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) FrozenSemenTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions,
+			&pasturePb.ConfigOptionsList{
+				Value:    int32(pasturePb.FrozenSemenType_Invalid),
+				Label:    "全部",
+				Disabled: true,
+			})
+	}
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
 			Value:    int32(pasturePb.FrozenSemenType_Ordinary),
@@ -587,7 +693,7 @@ func (s *StoreEntry) FrozenSemenTypeEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) BullNumberEnumList() []*pasturePb.BullOptionsList {
+func (s *StoreEntry) BullNumberEnumList(isAll string) []*pasturePb.BullOptionsList {
 	frozenSemenList := make([]*model.FrozenSemen, 0)
 	bullNumberList := make([]*pasturePb.BullOptionsList, 0)
 	if err := s.DB.Where("quantity > 0").Group("bull_id").Find(&frozenSemenList).Error; err != nil {
@@ -604,7 +710,7 @@ func (s *StoreEntry) BullNumberEnumList() []*pasturePb.BullOptionsList {
 	return bullNumberList
 }
 
-func (s *StoreEntry) WeekEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WeekEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions,
 		&pasturePb.ConfigOptionsList{
@@ -639,7 +745,7 @@ func (s *StoreEntry) WeekEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) MonthEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) MonthEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	for v := 1; v <= 31; v++ {
 		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
@@ -651,7 +757,7 @@ func (s *StoreEntry) MonthEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderFrequencyEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderFrequencyEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.WorkOrderFrequency_None),
@@ -673,7 +779,7 @@ func (s *StoreEntry) WorkOrderFrequencyEnumList() []*pasturePb.ConfigOptionsList
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderSubUnitEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderSubUnitEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.WorkOrderSubscribeUnit_Person),
@@ -687,7 +793,7 @@ func (s *StoreEntry) WorkOrderSubUnitEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderPriorityEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderPriorityEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.Priority_Low),
@@ -705,7 +811,7 @@ func (s *StoreEntry) WorkOrderPriorityEnumList() []*pasturePb.ConfigOptionsList
 	return configOptions
 }
 
-func (s *StoreEntry) WorkOrderCategoryEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) WorkOrderCategoryEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.WorkOrderCategory_Health),
@@ -731,8 +837,15 @@ func (s *StoreEntry) WorkOrderCategoryEnumList() []*pasturePb.ConfigOptionsList
 	return configOptions
 }
 
-func CalendarTypeEnumList() []*pasturePb.ConfigOptionsList {
+func CalendarTypeEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.SameTimeStatus_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.CalendarType_Immunisation),
 		Label:    "免疫",
@@ -769,8 +882,15 @@ func CalendarTypeEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) AbortionReasonsEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) AbortionReasonsEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.AbortionReasons_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.AbortionReasons_Mechanical_Abortion),
 		Label:    "机械性流产",
@@ -811,8 +931,16 @@ func (s *StoreEntry) AbortionReasonsEnumList() []*pasturePb.ConfigOptionsList {
 	return configOptions
 }
 
-func (s *StoreEntry) HealthStatusEnumList() []*pasturePb.ConfigOptionsList {
+func (s *StoreEntry) HealthStatusEnumList(isAll string) []*pasturePb.ConfigOptionsList {
 	configOptions := make([]*pasturePb.ConfigOptionsList, 0)
+	if isAll == model.IsAllYes {
+		configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
+			Value:    int32(pasturePb.HealthStatus_Invalid),
+			Label:    "全部",
+			Disabled: true,
+		})
+	}
+
 	configOptions = append(configOptions, &pasturePb.ConfigOptionsList{
 		Value:    int32(pasturePb.HealthStatus_Health),
 		Label:    "健康",

+ 19 - 19
module/backend/enum_map.go

@@ -4,7 +4,7 @@ import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 
 func (s *StoreEntry) DrugCategoryMaps() map[pasturePb.DrugCategory_Kind]string {
 	res := make(map[pasturePb.DrugCategory_Kind]string)
-	for _, v := range s.DrugCategoryEnumList() {
+	for _, v := range s.DrugCategoryEnumList("") {
 		res[pasturePb.DrugCategory_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -12,7 +12,7 @@ func (s *StoreEntry) DrugCategoryMaps() map[pasturePb.DrugCategory_Kind]string {
 
 func (s *StoreEntry) DrugUsageMaps() map[pasturePb.DrugUsage_Kind]string {
 	res := make(map[pasturePb.DrugUsage_Kind]string)
-	for _, v := range s.DrugUsageEnumList() {
+	for _, v := range s.DrugUsageEnumList("") {
 		res[pasturePb.DrugUsage_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -20,7 +20,7 @@ func (s *StoreEntry) DrugUsageMaps() map[pasturePb.DrugUsage_Kind]string {
 
 func (s *StoreEntry) ExposeEstrusTypeMap() map[pasturePb.ExposeEstrusType_Kind]string {
 	res := make(map[pasturePb.ExposeEstrusType_Kind]string)
-	for _, v := range s.ExposeEstrusTypeEnumList() {
+	for _, v := range s.ExposeEstrusTypeEnumList("") {
 		res[pasturePb.ExposeEstrusType_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -28,7 +28,7 @@ func (s *StoreEntry) ExposeEstrusTypeMap() map[pasturePb.ExposeEstrusType_Kind]s
 
 func (s *StoreEntry) FrozenSemenTypeMap() map[pasturePb.FrozenSemenType_Kind]string {
 	res := make(map[pasturePb.FrozenSemenType_Kind]string)
-	for _, v := range s.FrozenSemenTypeEnumList() {
+	for _, v := range s.FrozenSemenTypeEnumList("") {
 		res[pasturePb.FrozenSemenType_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -36,7 +36,7 @@ func (s *StoreEntry) FrozenSemenTypeMap() map[pasturePb.FrozenSemenType_Kind]str
 
 func (s *StoreEntry) UnitMap() map[pasturePb.Unit_Kind]string {
 	res := make(map[pasturePb.Unit_Kind]string)
-	for _, v := range s.UnitEnumList() {
+	for _, v := range s.UnitEnumList("") {
 		res[pasturePb.Unit_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -44,7 +44,7 @@ func (s *StoreEntry) UnitMap() map[pasturePb.Unit_Kind]string {
 
 func (s *StoreEntry) WeekMap() map[pasturePb.Week_Kind]string {
 	res := make(map[pasturePb.Week_Kind]string)
-	for _, v := range s.WeekEnumList() {
+	for _, v := range s.WeekEnumList("") {
 		res[pasturePb.Week_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -52,7 +52,7 @@ func (s *StoreEntry) WeekMap() map[pasturePb.Week_Kind]string {
 
 func (s *StoreEntry) MonthMap() map[int32]string {
 	res := make(map[int32]string)
-	for _, v := range s.MonthEnumList() {
+	for _, v := range s.MonthEnumList("") {
 		res[v.Value] = v.Label
 	}
 	return res
@@ -60,8 +60,8 @@ func (s *StoreEntry) MonthMap() map[int32]string {
 
 func (s *StoreEntry) CowTypeMap() map[pasturePb.CowType_Kind]string {
 	res := make(map[pasturePb.CowType_Kind]string)
-	optionName := ""
-	for _, v := range s.CowTypeEnumList(optionName) {
+	optionName, isAll := "", ""
+	for _, v := range s.CowTypeEnumList(optionName, isAll) {
 		res[pasturePb.CowType_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -93,7 +93,7 @@ func (s *StoreEntry) CowSourceMap() map[pasturePb.CowSource_Kind]string {
 
 func (s *StoreEntry) WorkOrderCategoryMap() map[pasturePb.WorkOrderCategory_Kind]string {
 	res := make(map[pasturePb.WorkOrderCategory_Kind]string)
-	for _, v := range s.WorkOrderCategoryEnumList() {
+	for _, v := range s.WorkOrderCategoryEnumList("") {
 		res[pasturePb.WorkOrderCategory_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -101,7 +101,7 @@ func (s *StoreEntry) WorkOrderCategoryMap() map[pasturePb.WorkOrderCategory_Kind
 
 func (s *StoreEntry) WorkOrderFrequencyMap() map[pasturePb.WorkOrderFrequency_Kind]string {
 	res := make(map[pasturePb.WorkOrderFrequency_Kind]string)
-	for _, v := range s.WorkOrderFrequencyEnumList() {
+	for _, v := range s.WorkOrderFrequencyEnumList("") {
 		res[pasturePb.WorkOrderFrequency_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -109,7 +109,7 @@ func (s *StoreEntry) WorkOrderFrequencyMap() map[pasturePb.WorkOrderFrequency_Ki
 
 func (s *StoreEntry) WorkOrderSubUnitMap() map[pasturePb.WorkOrderSubscribeUnit_Kind]string {
 	res := make(map[pasturePb.WorkOrderSubscribeUnit_Kind]string)
-	for _, v := range s.WorkOrderSubUnitEnumList() {
+	for _, v := range s.WorkOrderSubUnitEnumList("") {
 		res[pasturePb.WorkOrderSubscribeUnit_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -117,7 +117,7 @@ func (s *StoreEntry) WorkOrderSubUnitMap() map[pasturePb.WorkOrderSubscribeUnit_
 
 func (s *StoreEntry) WorkOrderPriorityMap() map[pasturePb.Priority_Kind]string {
 	res := make(map[pasturePb.Priority_Kind]string)
-	for _, v := range s.WorkOrderPriorityEnumList() {
+	for _, v := range s.WorkOrderPriorityEnumList("") {
 		res[pasturePb.Priority_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -125,7 +125,7 @@ func (s *StoreEntry) WorkOrderPriorityMap() map[pasturePb.Priority_Kind]string {
 
 func (s *StoreEntry) SameTimeCowTypeMap() map[pasturePb.SameTimeCowType_Kind]string {
 	res := make(map[pasturePb.SameTimeCowType_Kind]string)
-	for _, v := range s.SameTimeCowTypeEnumList() {
+	for _, v := range s.SameTimeCowTypeEnumList("") {
 		res[pasturePb.SameTimeCowType_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -133,7 +133,7 @@ func (s *StoreEntry) SameTimeCowTypeMap() map[pasturePb.SameTimeCowType_Kind]str
 
 func CalendarTypeMap() map[pasturePb.CalendarType_Kind]string {
 	res := make(map[pasturePb.CalendarType_Kind]string)
-	for _, v := range CalendarTypeEnumList() {
+	for _, v := range CalendarTypeEnumList("") {
 		res[pasturePb.CalendarType_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -141,7 +141,7 @@ func CalendarTypeMap() map[pasturePb.CalendarType_Kind]string {
 
 func (s *StoreEntry) AbortionReasonsMap() map[pasturePb.AbortionReasons_Kind]string {
 	res := make(map[pasturePb.AbortionReasons_Kind]string)
-	for _, v := range s.AbortionReasonsEnumList() {
+	for _, v := range s.AbortionReasonsEnumList("") {
 		res[pasturePb.AbortionReasons_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -149,7 +149,7 @@ func (s *StoreEntry) AbortionReasonsMap() map[pasturePb.AbortionReasons_Kind]str
 
 func (s *StoreEntry) PregnantCheckMethodMap() map[pasturePb.PregnantCheckMethod_Kind]string {
 	res := make(map[pasturePb.PregnantCheckMethod_Kind]string)
-	for _, v := range s.PregnantCheckMethodEnumList() {
+	for _, v := range s.PregnantCheckMethodEnumList("") {
 		res[pasturePb.PregnantCheckMethod_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -157,7 +157,7 @@ func (s *StoreEntry) PregnantCheckMethodMap() map[pasturePb.PregnantCheckMethod_
 
 func (s *StoreEntry) PregnantCheckResultMap() map[pasturePb.PregnantCheckResult_Kind]string {
 	res := make(map[pasturePb.PregnantCheckResult_Kind]string)
-	for _, v := range s.PregnantCheckResultEnumList() {
+	for _, v := range s.PregnantCheckResultEnumList("") {
 		res[pasturePb.PregnantCheckResult_Kind(v.Value)] = v.Label
 	}
 	return res
@@ -165,7 +165,7 @@ func (s *StoreEntry) PregnantCheckResultMap() map[pasturePb.PregnantCheckResult_
 
 func (s *StoreEntry) HealthStatusMap() map[pasturePb.HealthStatus_Kind]string {
 	res := make(map[pasturePb.HealthStatus_Kind]string)
-	for _, v := range s.HealthStatusEnumList() {
+	for _, v := range s.HealthStatusEnumList("") {
 		res[pasturePb.HealthStatus_Kind(v.Value)] = v.Label
 	}
 	return res

+ 9 - 9
module/backend/enum_options.go

@@ -19,7 +19,7 @@ func (s *StoreEntry) BarnTypeOptions(ctx context.Context) (*pasturePb.ConfigOpti
 	}, nil
 }
 
-func (s *StoreEntry) BarnListOptions(ctx context.Context, penType int) (*pasturePb.ConfigOptionsListResponse, error) {
+func (s *StoreEntry) BarnListOptions(ctx context.Context, penType int, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
 	penList := make([]*model.Pen, 0)
 	pref := s.DB.Table(new(model.Pen).TableName()).
 		Where("is_delete = ?", pasturePb.IsShow_Ok)
@@ -33,7 +33,7 @@ func (s *StoreEntry) BarnListOptions(ctx context.Context, penType int) (*pasture
 	return &pasturePb.ConfigOptionsListResponse{
 		Code:    http.StatusOK,
 		Message: "ok",
-		Data:    model.PenSlice(penList).ToPB2(s.BarnTypeEnumList()),
+		Data:    model.PenSlice(penList).ToPB2(s.BarnTypeEnumList(), isAll),
 	}, nil
 }
 
@@ -105,11 +105,11 @@ func (s *StoreEntry) CowSourceOptions(ctx context.Context) (*pasturePb.ConfigOpt
 	}, nil
 }
 
-func (s *StoreEntry) CowTypeOptions(ctx context.Context, optionName string) (*pasturePb.ConfigOptionsListResponse, error) {
+func (s *StoreEntry) CowTypeOptions(ctx context.Context, optionName, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
 	return &pasturePb.ConfigOptionsListResponse{
 		Code:    http.StatusOK,
 		Message: "ok",
-		Data:    s.CowTypeEnumList(optionName),
+		Data:    s.CowTypeEnumList(optionName, isAll),
 	}, nil
 }
 
@@ -117,7 +117,7 @@ func (s *StoreEntry) CowTransferPenReasonOptions(ctx context.Context) (*pastureP
 	return &pasturePb.ConfigOptionsListResponse{
 		Code:    http.StatusOK,
 		Message: "ok",
-		Data:    s.TransferPenEnumList(),
+		Data:    s.TransferPenEnumList(""),
 	}, nil
 }
 
@@ -143,16 +143,16 @@ func (s *StoreEntry) BullOptions(ctx context.Context) (*pasturePb.BullOptionsLis
 	return &pasturePb.BullOptionsListResponse{
 		Code:    http.StatusOK,
 		Message: "ok",
-		Data:    s.BullNumberEnumList(),
+		Data:    s.BullNumberEnumList(""),
 	}, nil
 }
 
-func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName string) (*pasturePb.ConfigOptionsListResponse, error) {
+func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName, isAll string) (*pasturePb.ConfigOptionsListResponse, error) {
 	if optionsName == "" {
 		return nil, xerr.New("optionsName is empty")
 	}
 
-	getConfigFuncMap := map[string]func() []*pasturePb.ConfigOptionsList{
+	getConfigFuncMap := map[string]func(isAll string) []*pasturePb.ConfigOptionsList{
 		"childNumber":            s.ChildNumberEnumList,
 		"calvingLevel":           s.CalvingLevelEnumList,
 		"dystociaReason":         s.DystociaReasonEnumList,
@@ -183,7 +183,7 @@ func (s *StoreEntry) SystemBaseConfigOptions(ctx context.Context, optionsName st
 		return nil, fmt.Errorf("invalid optionsName: %s", optionsName)
 	}
 
-	configOptions := getConfigFunc()
+	configOptions := getConfigFunc(isAll)
 	if configOptions == nil {
 		return nil, fmt.Errorf("failed to retrieve configOptions for %s", optionsName)
 	}

+ 3 - 3
module/backend/interface.go

@@ -132,15 +132,15 @@ type PastureManageService interface {
 //go:generate mockgen -destination mock/ConfigDataService.go -package kptservicemock kpt-pasture/module/backend ConfigDataService
 type ConfigDataService interface {
 	BarnTypeOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
-	BarnListOptions(ctx context.Context, penType int) (*pasturePb.ConfigOptionsListResponse, error)
+	BarnListOptions(ctx context.Context, penType int, isAll string) (*pasturePb.ConfigOptionsListResponse, error)
 	BreedStatusOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
 	CowKindOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
 	CowSourceOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
-	CowTypeOptions(ctx context.Context, optionName string) (*pasturePb.ConfigOptionsListResponse, error)
+	CowTypeOptions(ctx context.Context, optionName, isAll string) (*pasturePb.ConfigOptionsListResponse, error)
 	CowTransferPenReasonOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
 	SystemUserOptions(ctx context.Context, depId int) (*pasturePb.ConfigOptionsListResponse, error)
 	BullOptions(ctx context.Context) (*pasturePb.BullOptionsListResponse, error)
-	SystemBaseConfigOptions(ctx context.Context, optionName string) (*pasturePb.ConfigOptionsListResponse, error)
+	SystemBaseConfigOptions(ctx context.Context, optionName, isAll string) (*pasturePb.ConfigOptionsListResponse, error)
 	DiseaseTypeOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
 	DiseaseOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)
 	PrescriptionOptions(ctx context.Context) (*pasturePb.ConfigOptionsListResponse, error)

+ 2 - 2
module/backend/prescription.go

@@ -347,8 +347,8 @@ func (s *StoreEntry) ImmunizationList(ctx context.Context, req *pasturePb.Immuni
 		return nil, xerr.WithStack(err)
 	}
 
-	CowTypeOptions := s.ImmunizationCowTypeEnumList()
-	conditionsOptions := s.ImmunizationConditionsEnumList()
+	CowTypeOptions := s.ImmunizationCowTypeEnumList("")
+	conditionsOptions := s.ImmunizationConditionsEnumList("")
 	return &pasturePb.SearchImmunizationResponse{
 		Code:    http.StatusOK,
 		Message: "ok",

+ 1 - 1
module/crontab/cow_cron.go

@@ -235,7 +235,7 @@ func (e *Entry) SameTimePlan() error {
 
 // UpdateSameTime 更新每天同情数据
 func (e *Entry) UpdateSameTime() error {
-	calendarTypeList := backend.CalendarTypeEnumList()
+	calendarTypeList := backend.CalendarTypeEnumList("")
 	showDay := time.Now().Format(model.LayoutDate2)
 	for _, v := range calendarTypeList {
 		count := int64(0)