diff --git a/src/utils/time.ts b/src/utils/time.ts index 698b05a..7c9180d 100644 --- a/src/utils/time.ts +++ b/src/utils/time.ts @@ -9,10 +9,10 @@ */ import { getStoredLanguage } from "../utils/languageStorage"; -export function gettime(data = null,type = 1) { +export function gettime(data = null, type = 1) { var time if (data) { - data instanceof Date? time=data : time = new Date(data); + data instanceof Date ? time = data : time = new Date(data); } else { time = new Date(); } @@ -38,14 +38,14 @@ export function gettime(data = null,type = 1) { if (minutes < 10) minutes = "0" + minutes; if (seconds < 10) seconds = "0" + seconds; - if(type==1){ + if (type == 1) { return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day]; - }else if (type == 2){ + } else if (type == 2) { return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds; - }else{ + } else { return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day]; } - + } export function clacendTime(endtime, nowtime) { let newDate = Math.abs(endtime - nowtime) @@ -55,3 +55,17 @@ export function clacendTime(endtime, nowtime) { var s = Math.floor(newDate / 1000 % 60) return day + '天' + h + '时' + m + '分' + s + '秒' } + +//时间戳转换 +export function timestampToTime(timestamp) { + const startDate = new Date(0); // 0 就是 1970年1月1日 + const targetDate = new Date(timestamp); + const diff = targetDate.getTime() - startDate.getTime(); // 计算时间差(毫秒) + // let day = Math.floor(diff / (1000 * 60 * 60 * 24)); // 转换为天数 + let hour = (Math.floor(diff / (1000 * 60 * 60) % 24)) < 10 ? '0'+(Math.floor(diff / (1000 * 60 * 60) % 24)) :(Math.floor(diff / (1000 * 60 * 60) % 24)); // 转换为小时 + let minute = Math.floor(diff / (1000 * 60) % 60) < 10 ? '0'+Math.floor(diff / (1000 * 60) % 60) :Math.floor(diff / (1000 * 60) % 60); // 转换为分钟 + let second = Math.floor(diff / 1000 % 60) < 10 ? '0'+Math.floor(diff / 1000 % 60):Math.floor(diff / 1000 % 60); // 转换为秒 + + return `${hour}:${minute}:${second}`; +} + diff --git a/src/views/MicrofactoryDevOnline/components/RingChart.vue b/src/views/MicrofactoryDevOnline/components/RingChart.vue index 7bb293a..059a69d 100644 --- a/src/views/MicrofactoryDevOnline/components/RingChart.vue +++ b/src/views/MicrofactoryDevOnline/components/RingChart.vue @@ -7,7 +7,11 @@
{{ prop.data.count }}
当日总针数
-
+ +
+ 运行时长 + {{ timestampToTime(160000) }} +
{{ prop.data.name }} {{ prop.data.label }} @@ -20,6 +24,7 @@ @@ -160,6 +133,15 @@ onMounted(() => { left: 0; bottom: 50px; } +.online-time { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + font-size: 44px; +} .online { color: rgb(255, 140, 0); diff --git a/src/views/MicrofactoryDevOnline/index.vue b/src/views/MicrofactoryDevOnline/index.vue index 60d55f5..71950b5 100644 --- a/src/views/MicrofactoryDevOnline/index.vue +++ b/src/views/MicrofactoryDevOnline/index.vue @@ -26,14 +26,14 @@ let { t } = useI18n(); document.title = t('messages.微工厂缝纫设备看板'); let titleTip = [ - { - color: "#95A2FF", - name: t('messages.工作时间'), - }, - { - color: "#FA8080", - name: t('messages.空闲时间'), - }, + // { + // color: "#95A2FF", + // name: t('messages.工作时间'), + // }, + // { + // color: "#FA8080", + // name: t('messages.空闲时间'), + // }, ]; let timer = null; let arr = ref([]); diff --git a/src/views/Recorder/index.vue b/src/views/Recorder/index.vue index 75a473e..a5fb785 100644 --- a/src/views/Recorder/index.vue +++ b/src/views/Recorder/index.vue @@ -199,10 +199,10 @@ function recPlay() { onMounted(() => { // recOpen() - document.getElementById('app').style.background = '#fff' + //document.getElementById('app').style.background = '#fff' }) onUnmounted(() => { - document.getElementById('app').style.background = 'block' + //document.getElementById('app').style.background = 'block' })