diff --git a/src/apis/dashboard/index.js b/src/apis/dashboard/index.js index 4d60e1d..b6bc297 100644 --- a/src/apis/dashboard/index.js +++ b/src/apis/dashboard/index.js @@ -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, { diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 9548b61..ae2313e 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -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) { diff --git a/src/views/dashboard/components/DashboardHumidity.vue b/src/views/dashboard/components/DashboardHumidity.vue index 11ba8c1..5080e0a 100644 --- a/src/views/dashboard/components/DashboardHumidity.vue +++ b/src/views/dashboard/components/DashboardHumidity.vue @@ -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 { // 清除定時器 diff --git a/src/views/dashboard/components/DashboardSysCard.vue b/src/views/dashboard/components/DashboardSysCard.vue index 4f6a35b..81d8a04 100644 --- a/src/views/dashboard/components/DashboardSysCard.vue +++ b/src/views/dashboard/components/DashboardSysCard.vue @@ -23,12 +23,19 @@ const currentData = computed(() => {