Browse Source

去掉之前的保留两位小数的逻辑

xyxie 1 year ago
parent
commit
db0d63fe5e
2 changed files with 12 additions and 6 deletions
  1. 6 6
      services/data/table/mixed_table.go
  2. 6 0
      utils/config.go

+ 6 - 6
services/data/table/mixed_table.go

@@ -206,7 +206,7 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 					if val, ok2 := tmpDateValMap[relationDate]; ok2 {
 						//cell.ShowValue = fmt.Sprint(val)
 						cellKeyVal[cell.Uid] = val
-						cell.ShowValue = utils.FormatTableDataShowValue(val)
+						cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 					}
 				} else {
 					// 如果不是取得一个关联的日期,那么就是指定日期
@@ -237,7 +237,7 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 									}
 								}
 								cellKeyVal[cell.Uid] = finalVal
-								cell.ShowValue = utils.FormatTableDataShowValue(finalVal)
+								cell.ShowValue = utils.FormatMixTableDataShowValue(finalVal)
 							}
 						}
 					} else {
@@ -271,7 +271,7 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 							if val, ok2 := tmpDateValMap[cell.DataTime]; ok2 {
 								//cell.ShowValue = fmt.Sprint(val)
 								cellKeyVal[cell.Uid] = val
-								cell.ShowValue = utils.FormatTableDataShowValue(val)
+								cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 							}
 						}
 					}
@@ -382,7 +382,7 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 				}
 				val := tmpDataMap[cellDateTime]
 				cellKeyVal[cell.Uid] = val
-				cell.ShowValue = utils.FormatTableDataShowValue(val)
+				cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 			case request.DateCalculateDataDT: //日期计算
 				dateCalculateList = append(dateCalculateList, cell.Uid)
 				// 遍历数组,根据公式进行计算,并将得到的结果放到对应的单元格中
@@ -436,7 +436,7 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq) (newMixedTableCe
 			}
 
 			cellKeyVal[cell.Uid] = val
-			cell.ShowValue = utils.FormatTableDataShowValue(val)
+			cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 			config[cellPosition.Column][cellPosition.Row] = cell
 
 		}
@@ -1053,7 +1053,7 @@ func handlerDateCalculate(dateCalculateList []string, calculateCellMap map[strin
 				return
 			}
 
-			cell.ShowValue = utils.FormatTableDataShowValue(val)
+			cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 			config[cellPosition.Column][cellPosition.Row] = cell
 		}
 	}

+ 6 - 0
utils/config.go

@@ -132,6 +132,12 @@ func init() {
 	}
 }
 
+// FormatMixTableDataShowValue 格式化自定表格显示数据
+func FormatMixTableDataShowValue(x float64) (res string) {
+	res = fmt.Sprint(x)
+	return
+}
+
 //http://8.136.199.33:8608/swagger/
 //http://8.136.199.33:8608/v1