fix: 修复打印中文乱码、XLS导入100条截断、Nginx图片路由

- 打印改为 Web 平台用 HTML+CSS 方案,避免 pdf 包中文字体 bug
- 新增 print_util.dart 条件导入层(web/stub),彻底隔离 platform channel
- XLS 导入不再依赖 DIMENSIONS 记录的 MaxRow,改为读到连续5空行停止
- Nginx /images/ 加 ^~ 前缀,防止 .jpg 正则 location 拦截

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-04-30 22:07:17 +08:00
parent 6fc6b52631
commit 50b139c97a
9 changed files with 131 additions and 35 deletions
+20 -1
View File
@@ -522,12 +522,31 @@ func parseUploadedExcel(c *gin.Context) ([][]string, error) {
if numCols == 0 {
numCols = 20
}
for r := 0; r <= int(sheet.MaxRow); r++ {
// sheet.MaxRow 依赖 DIMENSIONS 记录,旧软件导出的 XLS 该值可能偏小。
// 改为读到连续 5 行全空为止,最多 100000 行防止死循环。
const maxRows = 100000
const maxEmpty = 5
emptyStreak := 0
for r := 0; r < maxRows; r++ {
row := sheet.Row(r)
cells := make([]string, numCols)
isEmpty := true
for c := 0; c < numCols; c++ {
cells[c] = strings.TrimSpace(row.Col(c))
if cells[c] != "" {
isEmpty = false
}
}
if isEmpty {
emptyStreak++
if emptyStreak >= maxEmpty {
break
}
// 保留空行,让调用方自行跳过
rows = append(rows, cells)
continue
}
emptyStreak = 0
rows = append(rows, cells)
}
} else {