ztxkui 10.0.3 → 10.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,6 +23,8 @@ import TableAddDelColumn from '../table-adddel-column';
|
|
|
23
23
|
import TableHeadTooltip from '../table-headTooltip';
|
|
24
24
|
import { getInnerIndex } from './useInnerPagination';
|
|
25
25
|
import TableSortTitle from '../table-sort';
|
|
26
|
+
import dayjs from 'dayjs';
|
|
27
|
+
import { exactRound, toThousand } from 'ztxkutils/dist/tools';
|
|
26
28
|
// 获取表格columns完整数据
|
|
27
29
|
export var getTableLayoutFullData = function (columns, tableLayout) {
|
|
28
30
|
// const columns = _columns.map((item) => {
|
|
@@ -372,7 +374,16 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
372
374
|
// 添加render字段
|
|
373
375
|
if (!_column.render) {
|
|
374
376
|
_column.render = function (text, record, index) {
|
|
375
|
-
|
|
377
|
+
var value = text;
|
|
378
|
+
if (text == null || text === '')
|
|
379
|
+
value = '— —';
|
|
380
|
+
else if (_column.dateFormat)
|
|
381
|
+
return dayjs(text).format(_column.dateFormat);
|
|
382
|
+
if (_column.precision)
|
|
383
|
+
value = exactRound(text, _column.precision);
|
|
384
|
+
if (_column.thousand)
|
|
385
|
+
value = toThousand(text);
|
|
386
|
+
return value;
|
|
376
387
|
};
|
|
377
388
|
}
|
|
378
389
|
// 添加表头提示信息
|
|
@@ -39,6 +39,12 @@ export interface IColumnType<RecordType> extends ColumnType<RecordType> {
|
|
|
39
39
|
showCopy?: boolean;
|
|
40
40
|
/**表头提示信息 */
|
|
41
41
|
headTooltip?: ReactNode;
|
|
42
|
+
/**日期格式化 */
|
|
43
|
+
dateFormat?: string;
|
|
44
|
+
/**精度 */
|
|
45
|
+
precision?: number;
|
|
46
|
+
/**是否加上千分符 */
|
|
47
|
+
thousand?: boolean;
|
|
42
48
|
}
|
|
43
49
|
export interface IColumnGroupType<RecordType> extends Omit<IColumnType<RecordType>, ''> {
|
|
44
50
|
children: ColumnsType<RecordType>;
|