瀏覽代碼

Merge branch 'needs/trip_close' into debug

hsun 1 年之前
父節點
當前提交
03fc539a2f
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      controllers/business_trip/business_apply.go

+ 4 - 3
controllers/business_trip/business_apply.go

@@ -700,12 +700,13 @@ func (this *BusinessTrip) ApplyDetail() {
 		return
 	}
 
-	// 审批人/申请人均可关闭
 	if item.ApproveId == sysUserId {
 		item.IsApprove = true
-		item.IsClose = true
 	}
-	if sysUserId == item.BusinessApplyId {
+	// 审批已通过且在出差日期之前时, 审批人/申请人均可关闭
+	nowDate, _ := time.ParseInLocation(utils.FormatDate, time.Now().Format(utils.FormatDate), time.Local)
+	arriveDate, _ := time.ParseInLocation(utils.FormatDate, item.ArriveDate, time.Local)
+	if item.Status == "已通过" && arriveDate.After(nowDate) && (sysUserId == item.ApproveId || sysUserId == item.ApplyAdminId) {
 		item.IsClose = true
 	}
 	this.OkDetailed(item, "获取成功")