正在显示
5 个修改的文件
包含
15 行增加
和
7 行删除
@@ -494,7 +494,7 @@ func GetItemValues(transactionContext application.TransactionContext, q *query.C | @@ -494,7 +494,7 @@ func GetItemValues(transactionContext application.TransactionContext, q *query.C | ||
494 | var result = make([]itemValue, 0) | 494 | var result = make([]itemValue, 0) |
495 | result = append(result, itemValue{ | 495 | result = append(result, itemValue{ |
496 | Name: querySet.Name, | 496 | Name: querySet.Name, |
497 | - Value: value, | 497 | + Value: domain.RoundValue(value), |
498 | }) | 498 | }) |
499 | 499 | ||
500 | for _, f := range q.Formula.TableFields { | 500 | for _, f := range q.Formula.TableFields { |
@@ -511,7 +511,7 @@ func GetItemValues(transactionContext application.TransactionContext, q *query.C | @@ -511,7 +511,7 @@ func GetItemValues(transactionContext application.TransactionContext, q *query.C | ||
511 | }) | 511 | }) |
512 | result = append(result, itemValue{ | 512 | result = append(result, itemValue{ |
513 | Name: f.FieldName, | 513 | Name: f.FieldName, |
514 | - Value: value, | 514 | + Value: domain.RoundValue(value), |
515 | }) | 515 | }) |
516 | } | 516 | } |
517 | return querySet, result | 517 | return querySet, result |
@@ -96,7 +96,7 @@ func (t *DataTable) Values(f *Field) []string { | @@ -96,7 +96,7 @@ func (t *DataTable) Values(f *Field) []string { | ||
96 | for i := range t.Data { | 96 | for i := range t.Data { |
97 | for j := range t.Data[i] { | 97 | for j := range t.Data[i] { |
98 | if j == index { | 98 | if j == index { |
99 | - res = append(res, t.Data[i][j]) | 99 | + res = append(res, RoundFieldValue(f, t.Data[i][j])) |
100 | break | 100 | break |
101 | } | 101 | } |
102 | } | 102 | } |
@@ -264,6 +264,14 @@ func RoundFieldValue(f *Field, v string) string { | @@ -264,6 +264,14 @@ func RoundFieldValue(f *Field, v string) string { | ||
264 | //return fmt.Sprintf("%v", fv) | 264 | //return fmt.Sprintf("%v", fv) |
265 | } | 265 | } |
266 | 266 | ||
267 | +func RoundValue(v string) string { | ||
268 | + fv, err := strconv.ParseFloat(v, 64) | ||
269 | + if err != nil { | ||
270 | + return v | ||
271 | + } | ||
272 | + return fmt.Sprintf("%v", fv) | ||
273 | +} | ||
274 | + | ||
267 | func GripData(data []map[string]string, total int64) map[string]interface{} { | 275 | func GripData(data []map[string]string, total int64) map[string]interface{} { |
268 | if len(data) == 0 { | 276 | if len(data) == 0 { |
269 | data = make([]map[string]string, 0) | 277 | data = make([]map[string]string, 0) |
@@ -372,7 +372,7 @@ func (d *DataLayoutDataTable) BlockData(cells *domain.LayoutCell) ([]string, int | @@ -372,7 +372,7 @@ func (d *DataLayoutDataTable) BlockData(cells *domain.LayoutCell) ([]string, int | ||
372 | if !ok { | 372 | if !ok { |
373 | return block, 0 | 373 | return block, 0 |
374 | } | 374 | } |
375 | - values := table.Values(&domain.Field{SQLName: cells.Data.TableField.FieldSqlName}) | 375 | + values := table.Values(&domain.Field{SQLName: cells.Data.TableField.FieldSqlName, SQLType: cells.Data.TableField.FieldSQLType}) |
376 | if len(values) == 0 { | 376 | if len(values) == 0 { |
377 | return block, 0 | 377 | return block, 0 |
378 | } | 378 | } |
@@ -216,9 +216,9 @@ func (c Condition) CastTypeByField(f *domain.Field, t string) string { | @@ -216,9 +216,9 @@ func (c Condition) CastTypeByField(f *domain.Field, t string) string { | ||
216 | } | 216 | } |
217 | 217 | ||
218 | func formatFiled(f *domain.Field) string { | 218 | func formatFiled(f *domain.Field) string { |
219 | - if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() { | ||
220 | - return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString()) | ||
221 | - } | 219 | + //if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() { |
220 | + // return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString()) | ||
221 | + //} | ||
222 | return f.SQLName | 222 | return f.SQLName |
223 | } | 223 | } |
224 | 224 |
-
请 注册 或 登录 后发表评论