大屏以及质量管理

This commit is contained in:
Teo
2025-07-30 16:25:45 +08:00
parent c069b53636
commit 3d5a77b732
24 changed files with 479 additions and 473 deletions

View File

@ -13,24 +13,24 @@
</div>
<div class="title">XXX智慧工地管理平台</div>
<div class="calendar flex items-center">
<WeatherListScroll :items="weatherData" class="weatherList" :interval="3500" v-if="weatherData.length">
<!-- <WeatherListScroll :items="weatherData" class="weatherList" :interval="3500" v-if="weatherData.length">
<template #default="{ item, index }">
<div class="flex items-center">
<div class="Weather text-white flex items-center">
<img :src="`../../../src/assets/images/${weatherimgUrl(item)}.png`" alt="" />
<div>
<div class="textBlack">{{ item.dayStatus + ' ' }}&nbsp;</div>
<div class="textBlack">{{ item.textDay + ' ' }}&nbsp;</div>
<div class="robotocondensed">{{ item.tempMin }}°/{{ item.tempMax }}°</div>
</div>
</div>
<div class="weeks">
<span class="textBlack">{{ item.week }}&nbsp;(</span>
<span class="robotocondensed">{{ item.date }}</span>
<span class="textBlack">{{ week(item.fxDate) }}&nbsp;(</span>
<span class="robotocondensed">{{ item.fxDate }}</span>
<span class="textBlack">)</span>
</div>
</div>
</template>
</WeatherListScroll>
</WeatherListScroll> -->
<div class="Segmentation">
<div class="bg-#43E2CB"></div>
<div class="bg-#43E2CB"></div>
@ -72,6 +72,11 @@ const userStore = useUserStoreHook();
const currentProject = computed(() => userStore.selectedProject);
const weatherData = ref([]);
const safetyDay = ref(null);
const week = computed(() => (time: string) => {
const date = new Date(time);
const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return days[date.getDay()];
});
const goHome = () => {
let routeUrl = router.resolve({
path: '/index'
@ -79,45 +84,52 @@ const goHome = () => {
window.open(routeUrl.href, 'index');
};
//获取天气
const getweatherData = async () => {
const res = await getweatherList(currentProject.value.id);
weatherData.value = res.data;
};
// const getweatherData = async () => {
// const res = await getweatherList();
// weatherData.value = res.data.daily;
// };
//获取生产天数
const getProductionDays = async () => {
const res = await getSafetyDay(currentProject.value.id);
safetyDay.value = res.data.safetyDay.toLocaleString();
const start = new Date('2024-01-01');
const today = new Date();
// 去除时分秒影响,仅比对日期
start.setHours(0, 0, 0, 0);
today.setHours(0, 0, 0, 0);
const diffTime = today.getTime() - start.getTime();
safetyDay.value = Math.floor(diffTime / (1000 * 60 * 60 * 24));
};
//获取白天或夜晚
const weatherimgUrl = computed(() => (item) => {
let startTime = item.sunRise; // 开始时间
let endTime = item.sunSet; // 结束时间
// 获取当前时间
const now = new Date();
// const weatherimgUrl = computed(() => (item) => {
// let startTime = item.sunrise; // 开始时间
// let endTime = item.sunset; // 结束时间
// // 获取当前时间
// const now = new Date();
// 解析开始时间和结束时间格式HH:MM
const [startHours, startMinutes] = startTime.split(':').map(Number);
const [endHours, endMinutes] = endTime.split(':').map(Number);
// // 解析开始时间和结束时间格式HH:MM
// const [startHours, startMinutes] = startTime.split(':').map(Number);
// const [endHours, endMinutes] = endTime.split(':').map(Number);
// 创建今天的开始时间和结束时间对象
const start = new Date(now.getFullYear(), now.getMonth(), now.getDate(), startHours, startMinutes);
const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), endHours, endMinutes);
// // 创建今天的开始时间和结束时间对象
// const start = new Date(now.getFullYear(), now.getMonth(), now.getDate(), startHours, startMinutes);
// const end = new Date(now.getFullYear(), now.getMonth(), now.getDate(), endHours, endMinutes);
// 如果结束时间早于开始时间,将结束时间设为明天
if (end <= start) {
end.setDate(end.getDate() + 1);
}
// // 如果结束时间早于开始时间,将结束时间设为明天
// if (end <= start) {
// end.setDate(end.getDate() + 1);
// }
// 判断当前时间是否在区间内
if (now >= start && now <= end) {
return item.dayIcon;
} else {
return item.nightIcon;
}
});
// // 判断当前时间是否在区间内
// if (now >= start && now <= end) {
// return item.dayIcon;
// } else {
// return item.nightIcon;
// }
// });
onMounted(() => {
getweatherData();
// getweatherData();
getProductionDays();
});
</script>