tuoling805 vor 2 Jahren
Ursprung
Commit
38100442d4

+ 7 - 2
controllers/business_trip/business_approve.go

@@ -49,8 +49,12 @@ func (this *BusinessTrip) ApproveList() {
 	}
 
 	if status != "" {
-		condition += ` AND status=? `
-		pars = append(pars, status)
+		if status == "已审批" {
+			condition += ` AND status IN('已审批','已驳回') `
+		} else {
+			condition += ` AND status=? `
+			pars = append(pars, status)
+		}
 	}
 
 	condition += ` AND status IN('待审批','已审批') `
@@ -113,6 +117,7 @@ func (this *BusinessTrip) ApplyApprove() {
 		updateParams["status"] = "已审批"
 	} else {
 		updateParams["status"] = "已驳回"
+		updateParams["refuse_reason"] = req.RefuseReason
 	}
 	updateParams["modify_time"] = time.Now()
 	updateParams["approve_time"] = time.Now()

+ 28 - 27
controllers/business_trip/business_calendar.go

@@ -50,6 +50,32 @@ func (this *BusinessTrip) BusinessTripCalendar() {
 	groupLen := len(groupList)
 
 	fmt.Println("groupLen:", groupLen)
+	//获取当天周日期
+	nowWeekStart := utils.GetNowWeekMonday().AddDate(0, 0, -2)
+	//nowWeekEnd := utils.GetNowWeekLastDay()
+	//获取下周日期
+	nextWeekStart := utils.GetNextWeekMonday().AddDate(0, 0, -2)
+	nextWeekEnd := utils.GetNextWeekLastDay().AddDate(0, 0, -2)
+
+	//获取出差信息
+	businessTripList, err := business_trip.GetBusinessTripList(adminId, nowWeekStart.Format(utils.FormatDate), nextWeekEnd.Format(utils.FormatDate))
+	if err != nil {
+		this.FailWithMessage("获取信息失败!", "获取路演信息失败!,GetBusinessTripList Err:"+err.Error())
+		return
+	}
+
+	btMap := make(map[int][]*business_trip.BusinessApplyView)
+
+	for _, v := range businessTripList {
+		if findVals, ok := btMap[v.ApplyAdminId]; ok {
+			findVals = append(findVals, v)
+			btMap[v.ApplyAdminId] = findVals
+		} else {
+			items := make([]*business_trip.BusinessApplyView, 0)
+			items = append(items, v)
+			btMap[v.ApplyAdminId] = items
+		}
+	}
 
 	for i := 0; i < groupLen; i++ {
 		group := groupList[i]
@@ -61,33 +87,6 @@ func (this *BusinessTrip) BusinessTripCalendar() {
 			return
 		}
 
-		//获取当天周日期
-		nowWeekStart := utils.GetNowWeekMonday().AddDate(0, 0, -2)
-		//nowWeekEnd := utils.GetNowWeekLastDay()
-		//获取下周日期
-		nextWeekStart := utils.GetNextWeekMonday().AddDate(0, 0, -2)
-		nextWeekEnd := utils.GetNextWeekLastDay().AddDate(0, 0, -2)
-
-		//获取出差信息
-		businessTripList, err := business_trip.GetBusinessTripList(adminId, nowWeekStart.Format(utils.FormatDate), nextWeekEnd.Format(utils.FormatDate))
-		if err != nil {
-			this.FailWithMessage("获取信息失败!", "获取路演信息失败!,GetBusinessTripList Err:"+err.Error())
-			return
-		}
-
-		btMap := make(map[int][]*business_trip.BusinessApplyView)
-
-		for _, v := range businessTripList {
-			if findVals, ok := btMap[v.ApplyAdminId]; ok {
-				findVals = append(findVals, v)
-				btMap[v.ApplyAdminId] = findVals
-			} else {
-				items := make([]*business_trip.BusinessApplyView, 0)
-				items = append(items, v)
-				btMap[v.ApplyAdminId] = items
-			}
-		}
-
 		setAdminList := make([]*business_trip.BusinessTripCalendarAdmin, 0)
 
 		for _, v := range adminList {
@@ -103,6 +102,7 @@ func (this *BusinessTrip) BusinessTripCalendar() {
 						if r != nil && (newDay.Equal(startDateT) || (newDay.Equal(endDateT)) || (newDay.Before(endDateT) && newDay.After(startDateT))) {
 							tripItem.City = r.City
 							tripItem.BusinessApplyId = r.BusinessApplyId
+							tripItem.Status = r.Status
 						}
 					}
 					tripItem.WeekDate = weekDate
@@ -121,6 +121,7 @@ func (this *BusinessTrip) BusinessTripCalendar() {
 						if r != nil && (newDay.Equal(startDateT) || (newDay.Equal(endDateT)) || (newDay.Before(endDateT) && newDay.After(startDateT))) {
 							tripItem.City = r.City
 							tripItem.BusinessApplyId = r.BusinessApplyId
+							tripItem.Status = r.Status
 						}
 					}
 					tripItem.WeekDate = weekDate

+ 1 - 0
models/tables/business_trip/business_calendar.go

@@ -12,6 +12,7 @@ type BusinessTripCalendarAdmin struct {
 
 type BusinessTripCalendar struct {
 	BusinessApplyId int    `description:"出差申请id"`
+	Status          string `description:"状态:'待审批','已审批','已驳回','已撤回','已过期'"`
 	WeekDate        string `description:"开始日期"`
 	City            string `description:"城市"`
 	Week            string `description:"周"`