diff --git a/src/components/chart/EffectScatter.vue b/src/components/chart/EffectScatter.vue index 3ff8e1c..3893e4e 100644 --- a/src/components/chart/EffectScatter.vue +++ b/src/components/chart/EffectScatter.vue @@ -21,6 +21,8 @@ let currentClickPosition = ref([]); async function updateSvg(svg, option) { if (!chart.value && dom.value && svg) { init(); + } else { + clear() } axios.get(svg.path).then(({ data }) => { echarts.registerMap(svg.full_name, { svg: data }); @@ -44,6 +46,10 @@ async function updateSvg(svg, option) { console.log("updateSvg", svg.path); } +function clear() { + chart.value.clear() +} + function init() { const curChart = echarts.init(dom.value); chart.value = markRaw(curChart); @@ -62,7 +68,7 @@ defineExpose({ }); - + diff --git a/src/components/customUI/Modal.vue b/src/components/customUI/Modal.vue index f4c785a..7fffccf 100644 --- a/src/components/customUI/Modal.vue +++ b/src/components/customUI/Modal.vue @@ -1,6 +1,6 @@ - - + + {{ title }} @@ -68,13 +69,10 @@ const props = defineProps({ - { - onCancel ? onCancel() : cancel(); - } - " - > + { + onCancel ? onCancel() : cancel(); + } + "> close @@ -88,7 +86,7 @@ const props = defineProps({ } .modal-action::after { - @apply absolute -bottom-3 -left-4 h-5 w-5 rotate-90 bg-no-repeat z-10 bg-[url('../../assets/img/table/content-box-background05.svg')] bg-center; + @apply absolute -bottom-3 -left-4 h-5 w-5 rotate-90 bg-no-repeat z-10 bg-[url('../../assets/img/table/content-box-background05.svg')] bg-center; content: ""; } diff --git a/src/components/forge/ForgeForSystem.vue b/src/components/forge/ForgeForSystem.vue index fc539a0..000e6f6 100644 --- a/src/components/forge/ForgeForSystem.vue +++ b/src/components/forge/ForgeForSystem.vue @@ -163,7 +163,7 @@ const initForge = async () => { viewer.isLoadDone() ); // updateForgeViewer(viewer); - createSprites() + // createSprites() hideAllObjects(); }) diff --git a/src/views/system/System.vue b/src/views/system/System.vue index addf5fc..5862f30 100644 --- a/src/views/system/System.vue +++ b/src/views/system/System.vue @@ -1,10 +1,10 @@ @@ -169,7 +190,7 @@ provide("system_selectedDevice", { selectedDevice, getCurrentInfoModalData }) - + diff --git a/src/views/system/SystemFloor.vue b/src/views/system/SystemFloor.vue index 8ad6ea3..12166e0 100644 --- a/src/views/system/SystemFloor.vue +++ b/src/views/system/SystemFloor.vue @@ -1,11 +1,12 @@ - + diff --git a/src/views/system/components/SystemCard.vue b/src/views/system/components/SystemCard.vue index 1ee8ac5..65abbd3 100644 --- a/src/views/system/components/SystemCard.vue +++ b/src/views/system/components/SystemCard.vue @@ -3,7 +3,6 @@ import { inject } from "vue" const { data } = inject("system_deviceList") - const { getCurrentInfoModalData } = inject("system_selectedDevice") diff --git a/src/views/system/components/SystemFloorBar.vue b/src/views/system/components/SystemFloorBar.vue index ea541e5..9c99387 100644 --- a/src/views/system/components/SystemFloorBar.vue +++ b/src/views/system/components/SystemFloorBar.vue @@ -11,13 +11,11 @@ const store = useBuildingStore(); const { updateCurrentFloor } = inject("system_deviceList") - const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn(); const getFloors = async () => { const res = await getAssetFloorList() let data = res.data.find(d => d.building_tag === store.selectedBuilding?.building_tag) - console.log(data) - setItems([ + data = [ { title: "總覽", key: "main", @@ -29,35 +27,33 @@ const getFloors = async () => { active: route.params.floor_id === d.floor_guid, map_url: d.floor_map_url + ".svg" })) - ]); + ] + setItems(data); + + updateCurrentFloor(data) } const onClick = (item) => { changeActiveBtn(item) - updateCurrentFloor(item) + if (item.key == "main") { router.push({ name: 'sub_system', params: { ...route.params - } + }, query: { gas: route.query.gas } }) } else { router.push({ name: 'floor', params: { ...route.params, floor_id: item.key - } + }, query: { gas: route.query.gas } }) } } -watch(selectedBtn, (newValue) => { - console.log(newValue); -}) - watch(() => route.params.sub_system_id, (newValue, oldValue) => { - console.log(newValue !== oldValue) if (newValue !== oldValue) { setItems(items.value.map((item, index) => ({ ...item, active: index === 0 }))); } @@ -67,7 +63,6 @@ watch(() => route.params.sub_system_id, (newValue, oldValue) => { }) watch(() => store.selectedBuilding, (newValue) => { - console.log(newValue) newValue && getFloors() }, { deep: true, diff --git a/src/views/system/components/SystemInfoModal.vue b/src/views/system/components/SystemInfoModal.vue index 3ecadb8..a6df1d2 100644 --- a/src/views/system/components/SystemInfoModal.vue +++ b/src/views/system/components/SystemInfoModal.vue @@ -8,14 +8,27 @@ const { selectedDevice: data } = inject("system_selectedDevice") const position = ref({ left: "0px", top: "0px", + display: "none", }); watch( - () => data, + data, (newValue) => { - console.log(newValue); - position.value = newValue.initPos; - } + console.log(newValue.value) + if (!newValue.value) { + position.value = { + display: "none" + }; + } else { + position.value = { + ...data.value.initPos, + display: "block" + }; + } + + }, { + deep: true, +} ); diff --git a/src/views/system/components/SystemInfoModalContent.vue b/src/views/system/components/SystemInfoModalContent.vue index 89d289d..279aeb2 100644 --- a/src/views/system/components/SystemInfoModalContent.vue +++ b/src/views/system/components/SystemInfoModalContent.vue @@ -5,7 +5,7 @@ import SystemInfoModalCog from "./SystemInfoModalCog.vue"; import { twMerge } from "tailwind-merge"; -const { selectedDevice: data } = inject("system_selectedDevice") +const { selectedDevice: data, clearSelectedDeviceInfo } = inject("system_selectedDevice") const currentTab = ref("desktop"); @@ -21,13 +21,14 @@ const changeOpenKey = (key) => { const onCancel = () => { currentTab.value = "desktop"; document.getElementById('system_info_modal').close(); + clearSelectedDeviceInfo(); }; - {{ data?.value.full_name }} + {{ data?.value?.full_name }} changeOpenKey('desktop')"> { - + diff --git a/src/views/system/components/SystemInfoModalDesktop.vue b/src/views/system/components/SystemInfoModalDesktop.vue index 0687be5..7bb64e2 100644 --- a/src/views/system/components/SystemInfoModalDesktop.vue +++ b/src/views/system/components/SystemInfoModalDesktop.vue @@ -1,8 +1,15 @@ - + + diff --git a/src/views/system/components/SystemSubBar.vue b/src/views/system/components/SystemSubBar.vue index 76c890f..2820a31 100644 --- a/src/views/system/components/SystemSubBar.vue +++ b/src/views/system/components/SystemSubBar.vue @@ -2,23 +2,29 @@ import useActiveBtn from "@/hooks/useActiveBtn" import { inject, watch } from "vue"; import useBuildingStore from "@/stores/useBuildingStore" +import useSearchParam from "@/hooks/useSearchParam" +import { useRoute } from "vue-router"; const { updateDataByGas } = inject("system_deviceList") const buildingStore = useBuildingStore() const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn(); +const route = useRoute() watch(() => buildingStore, (newValue) => { newValue.selectedSystem?.points?.length > 0 && setItems(newValue.selectedSystem.points.map(d => ({ title: d.full_name, key: d.points, - active: d.points === "Temp", + active: route.query.gas ? route.query.gas === d.points : d.points === "Temp", }))) }, { deep: true, immediate: true }) + +const { changeParams } = useSearchParam(); const onClick = (item) => { + changeParams({ gas: item.key }) changeActiveBtn(item) updateDataByGas(item.key) }