首頁溫溼度

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,
tempOption,
building_guid,
option
}) => {
const res = await instance.post(GET_DASHBOARD_TEMP_API, {
timeInterval,
tempOption,
building_guid,
option
});
return apihandler(res.code, res.data, {

View File

@ -56,7 +56,7 @@ const getData = async () => {
const y = coordinates[1];
//
let state = "online";
let state = "Online";
let bgColor = device.device_normal_color;
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,
tempOption, // 1 2:
timeInterval: 1, // =>1.4.8
option: 2, // 2:
});
if (res.isSuccess) {
if (tempOption === 1) {
console.log("室內度資料:", res.data["室溫"]);
console.log("室內度資料:", res.data["室溫"]);
data.value = res.data["室溫"] || [];
} else {
console.log("冷藏度資料:", res.data["冷藏溫度"]);
console.log("冷藏度資料:", res.data["冷藏溫度"]);
data.value = res.data["冷藏溫度"] || [];
}
}
@ -81,29 +82,15 @@ watch(
(newValue) => {
if (newValue) {
// sysConfig
const itemsArr = [];
if (buildingStore.sysConfig?.show_room) {
itemsArr.push({
title: "室內溫度",
key: 1,
active: false,
});
}
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);
}
const itemsArr = buildingStore.sysConfig?.humiture_options
? Object.entries(buildingStore.sysConfig.humiture_options).map(
([key, title], index) => ({
key: Number(key),
title,
active: index === 0,
})
)
: [];
setItems(itemsArr);
} else {
//

View File

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

View File

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

View File

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