From 6d3b82ec896471d79a2a71ebb6e4f3c8b8238db9 Mon Sep 17 00:00:00 2001 From: JouChun Date: Sun, 27 Oct 2024 19:54:56 -0400 Subject: [PATCH] =?UTF-8?q?=E7=86=B1=E5=9C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/config.json | 24 +++++ src/components/forge/ForgeForSystem.vue | 34 +++---- src/hooks/forge/useForgeHeatmap.js | 110 ++++++++++++++------- src/hooks/forge/useForgeSprite.js | 17 +--- src/hooks/useSystemShowData.js | 27 +++++ src/stores/useHeatmapBarStore.js | 27 +++++ src/views/system/System.vue | 6 +- src/views/system/components/SystemCard.vue | 11 +-- 8 files changed, 176 insertions(+), 80 deletions(-) create mode 100644 public/config.json create mode 100644 src/hooks/useSystemShowData.js create mode 100644 src/stores/useHeatmapBarStore.js diff --git a/public/config.json b/public/config.json new file mode 100644 index 0000000..3d0a81e --- /dev/null +++ b/public/config.json @@ -0,0 +1,24 @@ +{ + "heatmap": { + "temp": { + "range": [0, 50], + "color": ["#0023F5", "#FF1C05"], + "unit": "°C" + }, + "humi": { + "range": [15, 95], + "color": ["#ADD8E6", "#00008B"], + "unit": "%" + }, + "CO2": { + "range": [0, 5000], + "color": ["#FFDAB9", "#FF8C00"], + "unit": "ppm" + }, + "CO": { + "range": [0, 1000], + "color": ["#FFFFE0", "#FFD700"], + "unit": "ppm" + } + } +} diff --git a/src/components/forge/ForgeForSystem.vue b/src/components/forge/ForgeForSystem.vue index b21ee06..9181cd2 100644 --- a/src/components/forge/ForgeForSystem.vue +++ b/src/components/forge/ForgeForSystem.vue @@ -16,6 +16,7 @@ import useSystemStatusByBaja from "@/hooks/baja/useSystemStatusByBaja"; import ForgeInfoModal from "../../views/system/components/SystemInfoModal.vue"; import useAlarmStore from "@/stores/useAlarmStore"; import useForgeSprite from "@/hooks/forge/useForgeSprite"; +import useHeatmapBarStore from "@/stores/useHeatmapBarStore"; const props = defineProps({ initialData: Object, @@ -27,11 +28,7 @@ const props = defineProps({ }, }, }); - -const heat_bar_isShow = ref(false); -const updateHeatBarIsShow = (isShow) => { - heat_bar_isShow.value = isShow; -}; +const store = useHeatmapBarStore(); const { updateDataVisualization, createSprites, showSubSystemObjects, forgeClickListener, clear } = useForgeSprite() @@ -92,9 +89,10 @@ const loadModel = (viewer, filePath) => { }); }; -// const loadModel = (viewer, urn) => { +// const loadModel = (viewer) => { // return new Promise(function (resolve, reject) { // async function onDocumentLoadSuccess(doc) { +// console.log("模型加載完成"); // viewer.setGroundShadow(false); // viewer.impl.renderer().setClearAlpha(0); //clear alpha channel // viewer.impl.glrenderer().setClearColor(0xffffff, 0); //set transparent background, color code does not matter @@ -201,22 +199,18 @@ onUnmounted(() => {