|
@@ -1,5 +1,4 @@
|
|
-
|
|
|
|
-import CryptoJS from '@/common/crypto-js.js'
|
|
|
|
|
|
+import CryptoJS from '@/common/crypto-js.js';
|
|
function formatTime(time) {
|
|
function formatTime(time) {
|
|
if (typeof time !== 'number' || time < 0) {
|
|
if (typeof time !== 'number' || time < 0) {
|
|
return time
|
|
return time
|
|
@@ -212,39 +211,7 @@ const format = (obj) => {
|
|
Minutes = Minutes > 9 ? Minutes : '0' + Minutes;
|
|
Minutes = Minutes > 9 ? Minutes : '0' + Minutes;
|
|
return `${year}-${month}-${day}` + ' ' + Hours + ':' + Minutes;
|
|
return `${year}-${month}-${day}` + ' ' + Hours + ':' + Minutes;
|
|
}
|
|
}
|
|
-// 将时间戳转化为指定时间
|
|
|
|
-// way:方式(1=年月日,2=年月日时分秒)默认1, 也可以指定格式:yyyy-MM-dd HH:mm:ss
|
|
|
|
-const forDate = (inputTime, way) => {
|
|
|
|
- var date = new Date(inputTime);
|
|
|
|
- var y = date.getFullYear();
|
|
|
|
- var m = date.getMonth() + 1;
|
|
|
|
- m = m < 10 ? ('0' + m) : m;
|
|
|
|
- var d = date.getDate();
|
|
|
|
- d = d < 10 ? ('0' + d) : d;
|
|
|
|
- var h = date.getHours();
|
|
|
|
- h = h < 10 ? ('0' + h) : h;
|
|
|
|
- var minute = date.getMinutes();
|
|
|
|
- var second = date.getSeconds();
|
|
|
|
- minute = minute < 10 ? ('0' + minute) : minute;
|
|
|
|
- second = second < 10 ? ('0' + second) : second;
|
|
|
|
- var ms = date.getMilliseconds();
|
|
|
|
|
|
|
|
- way = way || 1;
|
|
|
|
- // way == 1 年月日
|
|
|
|
- if (way === 1) {
|
|
|
|
- return y + '-' + m + '-' + d;
|
|
|
|
- }
|
|
|
|
- // way == 1 年月日时分秒
|
|
|
|
- if (way === 2) {
|
|
|
|
- return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
|
|
|
|
- }
|
|
|
|
- // way == 具体格式 标准格式: yyyy-MM-dd HH:mm:ss
|
|
|
|
- if (typeof way == 'string') {
|
|
|
|
- return way.replace("yyyy", y).replace("MM", m).replace("dd", d).replace("HH", h).replace("mm", minute)
|
|
|
|
- .replace("ss", second).replace("ms", ms);
|
|
|
|
- }
|
|
|
|
- return y + '-' + m + '-' + d;
|
|
|
|
-}
|
|
|
|
const encrypt = (word) => {
|
|
const encrypt = (word) => {
|
|
let key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
|
|
let key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
|
|
let srcs = CryptoJS.enc.Utf8.parse(word);
|
|
let srcs = CryptoJS.enc.Utf8.parse(word);
|
|
@@ -266,6 +233,5 @@ module.exports = {
|
|
getdiffdate: getdiffdate,
|
|
getdiffdate: getdiffdate,
|
|
selectDictLabel: selectDictLabel,
|
|
selectDictLabel: selectDictLabel,
|
|
hasPermi: hasPermi,
|
|
hasPermi: hasPermi,
|
|
- forDate:forDate,
|
|
|
|
encrypt:encrypt
|
|
encrypt:encrypt
|
|
}
|
|
}
|