update
This commit is contained in:
parent
83b45364c1
commit
b82e7bda9f
@ -9,10 +9,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getStoredLanguage } from "../utils/languageStorage";
|
import { getStoredLanguage } from "../utils/languageStorage";
|
||||||
export function gettime(data = null,type = 1) {
|
export function gettime(data = null, type = 1) {
|
||||||
var time
|
var time
|
||||||
if (data) {
|
if (data) {
|
||||||
data instanceof Date? time=data : time = new Date(data);
|
data instanceof Date ? time = data : time = new Date(data);
|
||||||
} else {
|
} else {
|
||||||
time = new Date();
|
time = new Date();
|
||||||
}
|
}
|
||||||
@ -38,11 +38,11 @@ export function gettime(data = null,type = 1) {
|
|||||||
if (minutes < 10) minutes = "0" + minutes;
|
if (minutes < 10) minutes = "0" + minutes;
|
||||||
if (seconds < 10) seconds = "0" + seconds;
|
if (seconds < 10) seconds = "0" + seconds;
|
||||||
|
|
||||||
if(type==1){
|
if (type == 1) {
|
||||||
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
||||||
}else if (type == 2){
|
} else if (type == 2) {
|
||||||
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds;
|
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds;
|
||||||
}else{
|
} else {
|
||||||
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
return year + "-" + month + "-" + dates + " " + hours + ':' + minutes + ':' + seconds + ' ' + arr[day];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,3 +55,17 @@ export function clacendTime(endtime, nowtime) {
|
|||||||
var s = Math.floor(newDate / 1000 % 60)
|
var s = Math.floor(newDate / 1000 % 60)
|
||||||
return day + '天' + h + '时' + m + '分' + s + '秒'
|
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}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
<div class="num">{{ prop.data.count }}</div>
|
<div class="num">{{ prop.data.count }}</div>
|
||||||
<div class="name">当日总针数</div>
|
<div class="name">当日总针数</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart" ref="chart"></div>
|
<!-- <div class="chart" ref="chart"></div> -->
|
||||||
|
<div class="online-time">
|
||||||
|
<span style="font-size:20px; color: #fff;">运行时长</span>
|
||||||
|
<span>{{ timestampToTime(160000) }}</span>
|
||||||
|
</div>
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<text>{{ prop.data.name }}</text>
|
<text>{{ prop.data.name }}</text>
|
||||||
<small>{{ prop.data.label }}</small>
|
<small>{{ prop.data.label }}</small>
|
||||||
@ -20,6 +24,7 @@
|
|||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { getCurrentInstance, ref, onMounted,watch, computed } from 'vue';
|
import { getCurrentInstance, ref, onMounted,watch, computed } from 'vue';
|
||||||
|
import {timestampToTime} from '@/utils/time'
|
||||||
const { proxy } = getCurrentInstance()! as any;
|
const { proxy } = getCurrentInstance()! as any;
|
||||||
const chart = ref(null);
|
const chart = ref(null);
|
||||||
let myChart: any = null;
|
let myChart: any = null;
|
||||||
@ -46,42 +51,10 @@ let statusClass = computed(() => {
|
|||||||
return prop.data.status == '在线' ? 'online' : 'outline'
|
return prop.data.status == '在线' ? 'online' : 'outline'
|
||||||
})
|
})
|
||||||
|
|
||||||
const init = () => {
|
|
||||||
if (!myChart) {
|
|
||||||
myChart = proxy.$echarts.init(chart.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
let option = {
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'item'
|
|
||||||
},
|
|
||||||
color: ['#95A2FF', '#FA8080'],
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '',
|
|
||||||
type: 'pie',
|
|
||||||
radius: ['35%', '80%'],
|
|
||||||
avoidLabelOverlap: false,
|
|
||||||
label: {
|
|
||||||
formatter: '{c}小时',
|
|
||||||
position: 'inside',
|
|
||||||
color: '#fff',
|
|
||||||
},
|
|
||||||
labelLine: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
data: prop.data.series
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
myChart.setOption(option);
|
|
||||||
}
|
|
||||||
watch(() => prop.data, (newVal, oldVal) => {
|
|
||||||
init();
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init();
|
//init();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -160,6 +133,15 @@ onMounted(() => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
bottom: 50px;
|
bottom: 50px;
|
||||||
}
|
}
|
||||||
|
.online-time {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
.online {
|
.online {
|
||||||
color: rgb(255, 140, 0);
|
color: rgb(255, 140, 0);
|
||||||
|
@ -26,14 +26,14 @@ let { t } = useI18n();
|
|||||||
|
|
||||||
document.title = t('messages.微工厂缝纫设备看板');
|
document.title = t('messages.微工厂缝纫设备看板');
|
||||||
let titleTip = [
|
let titleTip = [
|
||||||
{
|
// {
|
||||||
color: "#95A2FF",
|
// color: "#95A2FF",
|
||||||
name: t('messages.工作时间'),
|
// name: t('messages.工作时间'),
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
color: "#FA8080",
|
// color: "#FA8080",
|
||||||
name: t('messages.空闲时间'),
|
// name: t('messages.空闲时间'),
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
let timer = null;
|
let timer = null;
|
||||||
let arr = ref([]);
|
let arr = ref([]);
|
||||||
|
@ -199,10 +199,10 @@ function recPlay() {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// recOpen()
|
// recOpen()
|
||||||
document.getElementById('app').style.background = '#fff'
|
//document.getElementById('app').style.background = '#fff'
|
||||||
})
|
})
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
document.getElementById('app').style.background = 'block'
|
//document.getElementById('app').style.background = 'block'
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user