feat: 列合计新增精度

This commit is contained in:
liushaozhen 2020-05-21 17:07:15 +08:00
parent 386af02ce8
commit b9c99bb547
6 changed files with 99915 additions and 27629 deletions

View File

@ -13,6 +13,7 @@ import sum from "../../src/lib/sum.js";
import multiSelect from "../../src/lib/multiSelect.js"; import multiSelect from "../../src/lib/multiSelect.js";
let ComplexTable = multiSelect(sum(Table), Checkbox); let ComplexTable = multiSelect(sum(Table), Checkbox);
//sum第二个参数可以设置精度例如 sum(Table,4); 设计精度为4
let _sum = 0; let _sum = 0;
const columns = [ const columns = [
{ {

File diff suppressed because one or more lines are too long

127530
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -340,6 +340,9 @@ import { Table } from 'tinper-bee';
const SumTable = sum(Table); const SumTable = sum(Table);
//[v2.2.49新增]precision为精度默认为2
const SumTable = sum(Table,precision);
``` ```
#### API #### API
@ -351,7 +354,7 @@ column 数组参数:
| sumCol | 该列设置为合计列,合计行中会显示合计数据 | boolean | false | | sumCol | 该列设置为合计列,合计行中会显示合计数据 | boolean | false |
#### sum 使用示例 #### sum 使用示例
- [列合计(总计)](http://design.yonyoucloud.com/tinper-bee/bee-table#%E5%88%97%E5%90%88%E8%AE%A1%EF%BC%88%E6%80%BB%E8%AE%A1%EF%BC%89) - [列合计(总计)](http://bee.tinper.org/tinper-bee/bee-table#%E5%88%97%E5%90%88%E8%AE%A1%EF%BC%88%E6%80%BB%E8%AE%A1%EF%BC%89)
### dragColumn 拖拽列功能 ### dragColumn 拖拽列功能

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import {DicimalFormater} from "./utils"; import {DicimalFormater} from "./utils";
export default function sum(Table) { export default function sum(Table,precision=2) {
return class SumTable extends React.Component { return class SumTable extends React.Component {
//无状态 //无状态
constructor(props) { constructor(props) {
@ -64,7 +64,7 @@ export default function sum(Table) {
} }
}) })
sumdata[column.dataIndex] = DicimalFormater(count,2); sumdata[column.dataIndex] = DicimalFormater(count,precision);
} }
if(index == 0){ if(index == 0){
sumdata[column.dataIndex] = "合计 "+sumdata[column.dataIndex]; sumdata[column.dataIndex] = "合计 "+sumdata[column.dataIndex];