animeic 2 lat temu
rodzic
commit
34392a0c9a
2 zmienionych plików z 4 dodań i 3 usunięć
  1. 2 0
      boxcost/api/plan-cost-excel.go
  2. 2 3
      boxcost/api/plan.go

+ 2 - 0
boxcost/api/plan-cost-excel.go

@@ -234,6 +234,7 @@ func (b *PlanCostExcel) drawTableContent() error {
 					return err
 				}
 				compTotalPrice := fmt.Sprintf("%.2f", comp.TotalPrice)
+				b.FormatToEmpty(&compTotalPrice)
 				b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
 
 			}
@@ -248,6 +249,7 @@ func (b *PlanCostExcel) drawTableContent() error {
 
 		b.Excel.SetCellStyle(b.SheetName, endLCell, endLCell, b.AlignCenterStyle)
 		planTotalPrice := fmt.Sprintf("%.2f", b.Content.TotalPrice)
+		b.FormatToEmpty(&planTotalPrice)
 		b.Excel.SetCellValue(b.SheetName, endLCell, planTotalPrice)
 
 	}

+ 2 - 3
boxcost/api/plan.go

@@ -44,7 +44,7 @@ func DownLoadPlanCost(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	_planId := c.Query("id")
 	planId, err := primitive.ObjectIDFromHex(_planId)
 	if err != nil {
-		return nil, errors.New("packId错误")
+		return nil, errors.New("planId错误")
 	}
 	plan := model.ProductPlan{}
 	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
@@ -56,7 +56,6 @@ func DownLoadPlanCost(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	}
 
 	f := excelize.NewFile()
-	// Create a new sheet.
 	index := f.NewSheet("Sheet1")
 	f.SetActiveSheet(index)
 	f.SetDefaultFont("宋体")
@@ -90,7 +89,7 @@ func DownLoadPlan(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	compId := c.Query("compId")
 	planId, err := primitive.ObjectIDFromHex(_planId)
 	if err != nil {
-		return nil, errors.New("packId错误")
+		return nil, errors.New("planId错误")
 	}
 	plan := model.ProductPlan{}
 	found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{