Эх сурвалжийг харах

Merge branch 'bzq1/fix_excel_history_data_cf' of eta_server/eta_api into debug

baoziqiang 5 сар өмнө
parent
commit
f78a2ca2e1

+ 18 - 0
services/excel/lucky_sheet.go

@@ -1763,12 +1763,30 @@ func GetTableDataByMixedTableData(config [][]request.MixedTableCellDataReq, hide
 					}
 					showFormatValue := fmt.Sprintf("%v", cell.ShowFormatValue)
 					tmp.Monitor = showFormatValue
+					// 如果没有showValue, 则使用value
+					if cell.ShowValue == "" {
+						_, err := strconv.ParseFloat(cell.Value, 64)
+						if err == nil {
+							cell.ShowValue = cell.Value
+						}
+					}
 					_, err := strconv.ParseFloat(cell.Value, 64)
 					if err == nil {
 						hasPercent := false
 						if styleConfig.Nt == "percent" {
 							hasPercent = true
 						}
+						// 修复历史数据
+						if styleConfig.Pn != 0 {
+							if styleConfig.Decimal == nil {
+								styleConfig.Decimal = new(int)
+							}
+							*styleConfig.Decimal += styleConfig.Pn
+							if *styleConfig.Decimal < 0 {
+								*styleConfig.Decimal = 0
+							}
+						}
+
 						if styleConfig.Decimal != nil {
 							tmp.Monitor = utils.RoundNumber(cell.ShowValue, *styleConfig.Decimal, hasPercent)
 						} else {