|
@@ -10,11 +10,6 @@ import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
- "github.com/beego/beego/v2/core/logs"
|
|
|
|
- beego "github.com/beego/beego/v2/server/web"
|
|
|
|
- "github.com/gorilla/websocket"
|
|
|
|
- "github.com/signintech/gopdf"
|
|
|
|
- "github.com/xuri/excelize/v2"
|
|
|
|
"log"
|
|
"log"
|
|
"math"
|
|
"math"
|
|
"net/http"
|
|
"net/http"
|
|
@@ -22,6 +17,12 @@ import (
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
|
|
+
|
|
|
|
+ "github.com/beego/beego/v2/core/logs"
|
|
|
|
+ beego "github.com/beego/beego/v2/server/web"
|
|
|
|
+ "github.com/gorilla/websocket"
|
|
|
|
+ "github.com/signintech/gopdf"
|
|
|
|
+ "github.com/xuri/excelize/v2"
|
|
)
|
|
)
|
|
|
|
|
|
type DataController struct {
|
|
type DataController struct {
|
|
@@ -2382,12 +2383,12 @@ func (c *DataController) Device_Sensor_Data_BackUp_PDF() {
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- pages := pdf.GetNumberOfPages()
|
|
|
|
- pagenums := fmt.Sprintf("第 %d 页", pages)
|
|
|
|
- pagenum, _ := pdf.MeasureTextWidth(pagenums)
|
|
|
|
- pdf.SetX((595 / 2) - (pagenum / 2))
|
|
|
|
- pdf.SetY(830) // 设置页码位置
|
|
|
|
- pdf.Cell(nil, pagenums)
|
|
|
|
|
|
+ //pages := pdf.GetNumberOfPages()
|
|
|
|
+ //pagenums := fmt.Sprintf("第 %d 页", pages)
|
|
|
|
+ //pagenum, _ := pdf.MeasureTextWidth(pagenums)
|
|
|
|
+ //pdf.SetX((595 / 2) - (pagenum / 2))
|
|
|
|
+ //pdf.SetY(830) // 设置页码位置
|
|
|
|
+ //pdf.Cell(nil, pagenums)
|
|
var y float64 = 140
|
|
var y float64 = 140
|
|
|
|
|
|
err = pdf.SetFont("wts", "", 10)
|
|
err = pdf.SetFont("wts", "", 10)
|
|
@@ -2406,7 +2407,12 @@ func (c *DataController) Device_Sensor_Data_BackUp_PDF() {
|
|
//if err != nil {
|
|
//if err != nil {
|
|
// log.Fatalln(err)
|
|
// log.Fatalln(err)
|
|
//}
|
|
//}
|
|
-
|
|
|
|
|
|
+ pages := pdf.GetNumberOfPages()
|
|
|
|
+ pagenums := fmt.Sprintf("第 %d 页", pages)
|
|
|
|
+ pagenum, _ := pdf.MeasureTextWidth(pagenums)
|
|
|
|
+ pdf.SetX((595 / 2) - (pagenum / 2))
|
|
|
|
+ pdf.SetY(830) // 设置页码位置
|
|
|
|
+ pdf.Cell(nil, pagenums)
|
|
T_t := fmt.Sprintf(" %.1f ", v.T_t)
|
|
T_t := fmt.Sprintf(" %.1f ", v.T_t)
|
|
T_rh := fmt.Sprintf(" %.1f ", v.T_rh)
|
|
T_rh := fmt.Sprintf(" %.1f ", v.T_rh)
|
|
T_Tlu := fmt.Sprintf(" %.1f ~ %.1f ", v.T_tl, v.T_tu)
|
|
T_Tlu := fmt.Sprintf(" %.1f ~ %.1f ", v.T_tl, v.T_tu)
|