t20-common-lib 0.7.10 → 0.7.11
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.
- package/package.json +1 -1
- package/src/index.js +3 -1
- package/src/utils/date.js +24 -0
- package/src/utils/exportFile.js +7 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import fitlers from './filters/index'
|
|
3
3
|
import repairEl from './utils/repairElementUI'
|
|
4
4
|
import { getColumnWidth, getCellAlign } from './utils/tableCellUtils'
|
|
5
|
+
import { getExportFileName } from './utils/exportFile'
|
|
5
6
|
// 导入组件
|
|
6
7
|
import MainPage from '../packages/main-page/index.js'
|
|
7
8
|
import TablePage from '../packages/table-page/index.js'
|
|
@@ -57,5 +58,6 @@ export {
|
|
|
57
58
|
PageHeader,
|
|
58
59
|
repairEl,
|
|
59
60
|
getColumnWidth,
|
|
60
|
-
getCellAlign
|
|
61
|
+
getCellAlign,
|
|
62
|
+
getExportFileName
|
|
61
63
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function parseDate(date, format) {
|
|
2
|
+
var o = {
|
|
3
|
+
"M+": date.getMonth() + 1,
|
|
4
|
+
"d+": date.getDate(),
|
|
5
|
+
"h+": date.getHours(),
|
|
6
|
+
"m+": date.getMinutes(),
|
|
7
|
+
"s+": date.getSeconds(),
|
|
8
|
+
"q+": Math.floor((date.getMonth() + 3) / 3),
|
|
9
|
+
S: date.getMilliseconds()
|
|
10
|
+
};
|
|
11
|
+
let yearReg = format.match(/(y+)/i);
|
|
12
|
+
if (yearReg) {
|
|
13
|
+
let year = date.getFullYear() + "";
|
|
14
|
+
year = year.substring(4 - yearReg[0].length);
|
|
15
|
+
format = format.replace(yearReg[0], year);
|
|
16
|
+
}
|
|
17
|
+
for (var k in o) {
|
|
18
|
+
let iReg = format.match(new RegExp("(" + k + ")"));
|
|
19
|
+
if (iReg) {
|
|
20
|
+
format = format.replace(iReg[0], iReg[0].length == 1 ? o[k] : ("00" + o[k]).substring(("" + o[k]).length));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return format;
|
|
24
|
+
}
|