首頁溫溼度

This commit is contained in:
koko 2025-07-24 16:43:41 +08:00
parent 6e61679c1f
commit b3ae2db111
6 changed files with 44 additions and 60 deletions

View File

@ -70,11 +70,13 @@ export const getDashboardTemp = async ({
timeInterval, timeInterval,
tempOption, tempOption,
building_guid, building_guid,
option
}) => { }) => {
const res = await instance.post(GET_DASHBOARD_TEMP_API, { const res = await instance.post(GET_DASHBOARD_TEMP_API, {
timeInterval, timeInterval,
tempOption, tempOption,
building_guid, building_guid,
option
}); });
return apihandler(res.code, res.data, { return apihandler(res.code, res.data, {

View File

@ -56,7 +56,7 @@ const getData = async () => {
const y = coordinates[1]; const y = coordinates[1];
// //
let state = "online"; let state = "Online";
let bgColor = device.device_normal_color; let bgColor = device.device_normal_color;
if (device.device_status === "Offline" || device.device_status === null) { if (device.device_status === "Offline" || device.device_status === null) {

View File

@ -63,13 +63,14 @@ const getData = async (tempOption) => {
building_guid: buildingStore.selectedBuilding.building_guid, building_guid: buildingStore.selectedBuilding.building_guid,
tempOption, // 1 2: tempOption, // 1 2:
timeInterval: 1, // =>1.4.8 timeInterval: 1, // =>1.4.8
option: 2, // 2:
}); });
if (res.isSuccess) { if (res.isSuccess) {
if (tempOption === 1) { if (tempOption === 1) {
console.log("室內度資料:", res.data["室溫"]); console.log("室內度資料:", res.data["室溫"]);
data.value = res.data["室溫"] || []; data.value = res.data["室溫"] || [];
} else { } else {
console.log("冷藏度資料:", res.data["冷藏溫度"]); console.log("冷藏度資料:", res.data["冷藏溫度"]);
data.value = res.data["冷藏溫度"] || []; data.value = res.data["冷藏溫度"] || [];
} }
} }
@ -81,29 +82,15 @@ watch(
(newValue) => { (newValue) => {
if (newValue) { if (newValue) {
// sysConfig // sysConfig
const itemsArr = []; const itemsArr = buildingStore.sysConfig?.humiture_options
if (buildingStore.sysConfig?.show_room) { ? Object.entries(buildingStore.sysConfig.humiture_options).map(
itemsArr.push({ ([key, title], index) => ({
title: "室內溫度", key: Number(key),
key: 1, title,
active: false, active: index === 0,
}); })
} )
if (buildingStore.sysConfig?.show_refrigeration) { : [];
itemsArr.push({
title: "冷藏溫度",
key: 2,
active: false,
});
}
if (itemsArr.length > 0) {
itemsArr[0].active = true;
// getData(itemsArr[0].key);
// timeoutTimer.value = setInterval(() => {
// getData(itemsArr[0].key);
// }, 60 * 1000);
}
setItems(itemsArr); setItems(itemsArr);
} else { } else {
// //

View File

@ -23,12 +23,19 @@ const currentData = computed(() => {
<div class="item h-full cursor-pointer"> <div class="item h-full cursor-pointer">
<div class="left w-full h-full flex flex-wrap justify-center"> <div class="left w-full h-full flex flex-wrap justify-center">
<div class="sec02 w-full"> <div class="sec02 w-full">
<img <div
v-if="device[2]?.icon" v-if="device[2]?.icon"
:src="`${device[2]?.icon}`" class="border-2 rounded-lg shadow-sm shadow-slate-100 p-2 me-2"
:alt="device[2]?.full_name" :style="{
class="" backgroundColor: device[2]?.bgColor,
/> }"
>
<img
:src="`${device[2]?.icon}`"
:alt="device[2]?.full_name"
class=""
/>
</div>
<span v-else></span> <span v-else></span>
<span>{{ device[2]?.full_name }}</span> <span>{{ device[2]?.full_name }}</span>
</div> </div>
@ -37,8 +44,7 @@ const currentData = computed(() => {
<span <span
class="w-5 h-5 rounded-full" class="w-5 h-5 rounded-full"
:style="{ :style="{
backgroundColor: backgroundColor: device[2]?.bgColor,
device[2]?.bgColor,
}" }"
></span> ></span>
<span class="mx-2">{{ $t("system.status") }}:</span> <span class="mx-2">{{ $t("system.status") }}:</span>
@ -107,7 +113,7 @@ const currentData = computed(() => {
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
margin-bottom: 15px; margin-bottom: 10px;
} }
.item .sec02::after { .item .sec02::after {
@ -123,7 +129,7 @@ const currentData = computed(() => {
} }
.item .sec02 img { .item .sec02 img {
margin-right: 10px; /* margin-right: 10px; */
width: 1.5rem !important; width: 1.5rem !important;
height: 1.5rem; height: 1.5rem;
} }

View File

@ -63,6 +63,7 @@ const getData = async (tempOption) => {
building_guid: buildingStore.selectedBuilding.building_guid, building_guid: buildingStore.selectedBuilding.building_guid,
tempOption, // 1 2: tempOption, // 1 2:
timeInterval: 1, // =>1.4.8 timeInterval: 1, // =>1.4.8
option: 1, // 1:
}); });
if (res.isSuccess) { if (res.isSuccess) {
if (tempOption === 1) { if (tempOption === 1) {
@ -81,29 +82,15 @@ watch(
(newValue) => { (newValue) => {
if (newValue) { if (newValue) {
// sysConfig // sysConfig
const itemsArr = []; const itemsArr = buildingStore.sysConfig?.humiture_options
if (buildingStore.sysConfig?.show_room) { ? Object.entries(buildingStore.sysConfig.humiture_options).map(
itemsArr.push({ ([key, title], index) => ({
title: "室內溫度", key: Number(key),
key: 1, title,
active: false, active: index === 0,
}); })
} )
if (buildingStore.sysConfig?.show_refrigeration) { : [];
itemsArr.push({
title: "冷藏溫度",
key: 2,
active: false,
});
}
if (itemsArr.length > 0) {
itemsArr[0].active = true;
// getData(itemsArr[0].key);
// timeoutTimer.value = setInterval(() => {
// getData(itemsArr[0].key);
// }, 60 * 1000);
}
setItems(itemsArr); setItems(itemsArr);
} else { } else {
// //
@ -157,7 +144,9 @@ watch(
data: newValue.map(({ full_name }) => full_name), data: newValue.map(({ full_name }) => full_name),
}, },
xAxis: { xAxis: {
data: firstItem.data.map(({ time }) => dayjs(time).format("HH:mm:ss")), data: firstItem.data.map(({ time }) =>
dayjs(time).format("HH:mm:ss")
),
}, },
yAxis: { yAxis: {
min: Math.floor(minValue), min: Math.floor(minValue),

View File

@ -61,7 +61,7 @@ const defaultChartOption = {
axisLabel: { color: "#ffffff" }, axisLabel: { color: "#ffffff" },
// interval: 100, //Y // interval: 100, //Y
min: "dataMin", min: "dataMin",
max: "dataMax", max: "dataMax",
// splitArea: { show: false }, // splitArea: { show: false },
}, },
series: [], series: [],