index.js
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import locale from '../assets/i18n/i18n'
var formatHuman = (val) => {
if (!val) return '--';
let humanNum = null;
humanNum = val >= 100000 ? (val / 10000).toFixed(2) : val;
// humanNum = val;
return humanNum;
}
var formatHumanUnit = (val) => {
if (!val) return '';
let humanUnit = null;
humanUnit = val >= 100000 ? locale.t('format.millionTime') : locale.t('format.perTime');
// humanUnit = '人次';
return humanUnit;
}
var formatEffHuman = (val) => {
if (!val) return '--';
let humanNum = null;
humanNum = val >= 100000 ? (val / 10000).toFixed(2) : val;
// humanNum = val;
return humanNum;
}
var formatEffHumanUnit = (val) => {
if (!val) return '';
let humanUnit = null;
humanUnit = val >= 100000 ? locale.t('format.millionNum') : locale.t('format.perNum');
// humanUnit = '人';
return humanUnit;
}
var formatSales = (val) => {
if (!val) return '--';
let salesNum = null;
salesNum = (val >= 100000) ? (val / 10000).toFixed(2) : val;
// salesNum = val;
return salesNum;
}
var formatSalesUnit = (val) => {
if (!val) return '';
let salesUnit = null;
salesUnit = (val >= 100000) ? locale.t('format.salesUnit') : locale.t('format.saleUnit');
// salesUnit = '元';
return salesUnit;
}
var formatArea = (val) => {
if (!val) return '--';
let areaNum = null;
areaNum = (val >= 100000) ? (val / 10000).toFixed(2) : val;
// areaNum = val;
return areaNum;
}
var formatAreaUnit = (val) => {
if (!val) return '';
let areaUnit = null;
areaUnit = (val >= 100000) ? locale.t('format.millionSquareM') : locale.t('format.squareMeters');
// areaUnit = '平米';
return areaUnit;
}
var formatTime = (val) => {
if (!val || isNaN(Number(val))) return '--';
let timeNum = null;
timeNum = (val >= 1) ? val : (val * 60).toFixed(2);
// timeNum = val * 60;
return timeNum;
}
var formatTimeUnit = (val) => {
if (!val) return '';
let timeUnit = null;
timeUnit = (val >= 1) ? locale.t('format.hoursUnit') : locale.t('format.minutesUnit');
// timeUnit = '分';
return timeUnit;
}
var formatDensity = (val) => {
if (!val) return '';
let densityNum = null;
densityNum = (val > 100000) ? (val / 10000).toFixed(2) : val;
return densityNum;
}
var formatDensityUnit = (val) => {
if (!val) return '';
let DensityUnit = null;
DensityUnit = (val > 100000) ? locale.t('format.millionTime') : locale.t('format.perTime');
return DensityUnit;
}
var formatdayDensity = (val) => {
if (!val) return '';
let densityNum = null;
densityNum = (val > 100000) ? (val / 10000).toFixed(2) : val;
return densityNum;
}
var formatdayDensityUnit = (val) => {
if (!val) return '';
let DensityUnit = null;
DensityUnit = (val > 100000) ? locale.t('format.millionflDensity') : locale.t('format.flDensity');
return DensityUnit;
}
export { formatHuman, formatHumanUnit, formatEffHuman, formatEffHumanUnit, formatSales, formatSalesUnit, formatArea, formatAreaUnit, formatTime, formatTimeUnit, formatDensity, formatDensityUnit, formatdayDensity, formatdayDensityUnit}