diff --git a/src/components/customUI/Input.vue b/src/components/customUI/Input.vue index 5930c2a..885cbe2 100644 --- a/src/components/customUI/Input.vue +++ b/src/components/customUI/Input.vue @@ -9,7 +9,7 @@ const props = defineProps({ type: String, default: "", }, - value: String, + value: Object || String, isTopLabelExist: { type: Boolean, default: true, diff --git a/src/components/navbar/Navbar.vue b/src/components/navbar/Navbar.vue index d271b3a..db2279d 100644 --- a/src/components/navbar/Navbar.vue +++ b/src/components/navbar/Navbar.vue @@ -21,7 +21,7 @@ const route = useRoute(); const authPages = ref([]); // 儲存從 API 獲取的 authPages const menu_array = ref([]); -const isDrawerOpen = ref(false); +const isDrawerOpen = ref(false); const iniFroList = async () => { try { @@ -69,7 +69,12 @@ watch(locale, () => { diff --git a/src/views/AssetManagement/components/AssetTableModalRightInfo.vue b/src/views/AssetManagement/components/AssetTableModalRightInfo.vue index cea990c..a8ed3e7 100644 --- a/src/views/AssetManagement/components/AssetTableModalRightInfo.vue +++ b/src/views/AssetManagement/components/AssetTableModalRightInfo.vue @@ -34,14 +34,25 @@ const defaultOption = (map, data = []) => { // 生成坐標數據,根據坐標值的不同設置不同顏色 const formattedData = data.map((coordinate) => { const coordString = JSON.stringify(coordinate); + + // 解析 device_coordinate 為數值陣列進行比對 + let isSelected = false; + if (formState.value.device_coordinate) { + try { + const deviceCoord = JSON.parse(formState.value.device_coordinate); + // 比對數值而非字串,避免精度問題 + isSelected = coordinate.length === deviceCoord.length && + coordinate.every((val, index) => Math.abs(val - deviceCoord[index]) < 0.001); + } catch (e) { + console.warn('解析 device_coordinate 失敗:', e); + } + } + return { name: coordString, value: coordinate, itemStyle: { - color: - coordString === formState.value.device_coordinate - ? "#0000FF" - : "#b02a02", + color: isSelected ? "#0000FF" : "#b02a02", }, }; }); diff --git a/src/views/dashboard/components/DashboardAlert.vue b/src/views/dashboard/components/DashboardAlert.vue index dcdeb5d..19fbe43 100644 --- a/src/views/dashboard/components/DashboardAlert.vue +++ b/src/views/dashboard/components/DashboardAlert.vue @@ -2,7 +2,9 @@ import dayjs from "dayjs"; import { computed, ref, onMounted } from "vue"; import { faker } from "@faker-js/faker"; // 引入 faker.js +import { useI18n } from "vue-i18n"; +const { t } = useI18n(); // 假資料 const fakeAlarmData = ref([]); @@ -36,15 +38,15 @@ const alarms = computed(() =>