|
@@ -395,9 +395,25 @@ export default {
|
|
console.log("/tEquipment/eliminate", e);
|
|
console.log("/tEquipment/eliminate", e);
|
|
};
|
|
};
|
|
const showDateTime = (date) => {
|
|
const showDateTime = (date) => {
|
|
- return date
|
|
|
|
- ? dateUtil.formateDate(new Date(date), "yyyy-MM-dd hh:mm:ss")
|
|
|
|
- : "";
|
|
|
|
|
|
+ if (!date) {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ const currentDate = new Date(dateUtil.formateDate(new Date(date), "yyyy-MM-dd hh:mm:ss"));
|
|
|
|
+ // 获取设备的时区偏移量(分钟)
|
|
|
|
+ const deviceTimezoneOffset = new Date().getTimezoneOffset();
|
|
|
|
+ // 获取北京时间的时区偏移量(分钟)
|
|
|
|
+ const beijingTimezoneOffset = -480; // -480分钟为北京时区偏移量
|
|
|
|
+ // 计算设备时区与北京时区的偏移量差
|
|
|
|
+ const offsetDifference = deviceTimezoneOffset - beijingTimezoneOffset;
|
|
|
|
+ // 将设备的时区偏移量转换为毫秒数
|
|
|
|
+ const offsetMilliseconds = offsetDifference * 60 * 1000;
|
|
|
|
+ // 将北京时间的毫秒数加上设备的时区偏移量的毫秒数(仅对非北京时间进行调整)
|
|
|
|
+ const adjustedMilliseconds = offsetMilliseconds !== 0 ? currentDate.getTime() + offsetMilliseconds : currentDate.getTime();
|
|
|
|
+ // 使用调整后的时间创建一个新的Date对象
|
|
|
|
+ const adjustedDate = new Date(adjustedMilliseconds);
|
|
|
|
+ // 格式化调整后的时间
|
|
|
|
+ const formattedDate = dateUtil.formateDate(adjustedDate, 'yyyy-MM-dd hh:mm:ss');
|
|
|
|
+ return formattedDate;
|
|
};
|
|
};
|
|
|
|
|
|
// 点击查看定位
|
|
// 点击查看定位
|