animeic 1 anno fa
parent
commit
2314f44df7
1 ha cambiato i file con 4 aggiunte e 14 eliminazioni
  1. 4 14
      boxcost/api/report.go

+ 4 - 14
boxcost/api/report.go

@@ -30,7 +30,7 @@ func Report(r *GinRouter) {
 
 // 加工单
 func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	page, size, query := UtilQueryPageSize(c)
+	_, _, query := UtilQueryPageSize(c)
 	// start, stop := CreatePageRange(page, size)
 	supplierId := primitive.NilObjectID
 	if _supplierId, ok := query["supplierId"]; ok {
@@ -110,11 +110,7 @@ func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	}
 
 	if len(reports) < 1 {
-		return repo.PageResult{
-			Page:  page,
-			Size:  size,
-			Total: 0,
-		}, nil
+		return nil, errors.New("没有单据信息")
 	}
 	lists := []map[string]interface{}{}
 	for _, report := range reports {
@@ -152,6 +148,7 @@ func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error)
 		}
 	}
 	f := excelize.NewFile()
+	defer f.Close()
 	index := f.NewSheet("Sheet1")
 	f.SetActiveSheet(index)
 	f.SetDefaultFont("宋体")
@@ -181,6 +178,7 @@ func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	if err != nil {
 		return nil, err
 	}
+
 	return nil, nil
 }
 
@@ -312,18 +310,10 @@ func CreatePageRange(page, size int64) (int64, int64) {
 	if size < 1 {
 		size = 10
 	}
-	// var start int64 = 0
-	// var stop int64 = 9
-	// if size < 1 {
-	// 	return start, stop
-	// }
 
-	// if page > 0 {
 	start := (page - 1) * size
 	stop := page*size - 1
 
-	// }
-
 	return start, stop
 }