預設2d圖更新 | 系統小卡預設色號 | deleteBuilding()
This commit is contained in:
parent
3427058cd2
commit
3976540280
@ -12,10 +12,11 @@ import SettingManagement from "@/views/setting/SettingManagement.vue";
|
||||
import HeadquartersManagement from "@/views/headquarters/HeadquartersManagement.vue";
|
||||
import Login from "@/views/login/Login.vue";
|
||||
import useUserInfoStore from "@/stores/useUserInfoStore";
|
||||
import useBuildingStore from "@/stores/useBuildingStore";
|
||||
import useGetCookie from "@/hooks/useGetCookie";
|
||||
import System from "@/views/system/System.vue";
|
||||
import SystemFloor from "@/views/system/SystemFloor.vue";
|
||||
|
||||
|
||||
import Test from "@/views/Test.vue";
|
||||
import SystemMain from "@/views/system/SystemMain.vue";
|
||||
|
||||
@ -112,9 +113,11 @@ router.beforeEach(async (to, from, next) => {
|
||||
const auth = useUserInfoStore();
|
||||
const token = useGetCookie("JWT-Authorization");
|
||||
const user_name = useGetCookie("user_name");
|
||||
const buildingStore = useBuildingStore();
|
||||
|
||||
if ((authRequired && !token) || to.path === "/") {
|
||||
auth.user.token = "";
|
||||
buildingStore.deleteBuilding();
|
||||
next({ path: "/login" });
|
||||
} else if (!authRequired) {
|
||||
document.cookie = "JWT-Authorization=; Max-Age=0";
|
||||
|
@ -35,16 +35,23 @@ watch(
|
||||
(newBuilding) => {
|
||||
if (newBuilding) {
|
||||
formState.value.building_guid = newBuilding.building_guid;
|
||||
imgBaseUrl.value = store.previewImageExt
|
||||
? `${FILE_BASEURL}/upload/setting/previewImage/${newBuilding.building_guid}${store.previewImageExt}`
|
||||
: import.meta.env.MODE === "production"
|
||||
? "dist/build_img.jpg"
|
||||
: "/build_img.jpg";
|
||||
}
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => store.previewImageExt,
|
||||
(newExt) => {
|
||||
if (formState.value.building_guid) {
|
||||
imgBaseUrl.value = newExt
|
||||
? `${FILE_BASEURL}/upload/setting/previewImage/${formState.value.building_guid}${newExt}`
|
||||
: "/build_img.jpg";
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => formState.value,
|
||||
(newVal) => {
|
||||
@ -139,7 +146,7 @@ onUnmounted(() => {
|
||||
<template v-else>
|
||||
<img
|
||||
alt="build"
|
||||
:src="imgBaseUrl || '/build_img.jpg'"
|
||||
:src="imgBaseUrl"
|
||||
class="area-img-box w-full h-[460px] block relative rounded-sm mt-3"
|
||||
/>
|
||||
</template>
|
||||
|
@ -88,7 +88,7 @@ watch(
|
||||
<th
|
||||
class="text-base border text-white text-center bg-cyan-600 bg-opacity-30"
|
||||
>
|
||||
{{ $t("table.time") }}
|
||||
{{ $t("operation.updated_time") }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -28,7 +28,11 @@ import ElecCompare from "./components/ElecCompare.vue";
|
||||
<SysProgress />
|
||||
</div>
|
||||
<div class="col-span-2 h-full border border-cyan-400 shadow-md shadow-cyan-500/40">
|
||||
<SysMap />
|
||||
<img
|
||||
src="/CviLux_globalmap.png"
|
||||
alt=""
|
||||
class="w-full h-full object-cover "
|
||||
/>
|
||||
</div>
|
||||
<div class="col-span-1 grid grid-cols-1 xl:grid-rows-3 gap-4">
|
||||
<ElecRank />
|
||||
|
@ -93,7 +93,7 @@ watch(
|
||||
<th
|
||||
class="text-base border text-white text-center bg-cyan-600 bg-opacity-30"
|
||||
>
|
||||
{{ $t("table.time") }}
|
||||
{{ $t("operation.updated_time") }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -130,11 +130,6 @@ watch(
|
||||
(newBuilding) => {
|
||||
if (Boolean(newBuilding)) {
|
||||
getData();
|
||||
imgBaseUrl.value = buildingStore.previewImageExt
|
||||
? `${FILE_BASEURL}/upload/setting/previewImage/${newBuilding.building_guid}${buildingStore.previewImageExt}`
|
||||
: import.meta.env.MODE === "production"
|
||||
? "dist/build_img.jpg"
|
||||
: "/build_img.jpg";
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -143,6 +138,19 @@ watch(
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
watch(
|
||||
() => buildingStore.previewImageExt,
|
||||
(newValue) => {
|
||||
if (buildingStore.selectedBuilding && buildingStore.selectedBuilding.building_guid) {
|
||||
imgBaseUrl.value = buildingStore.previewImageExt
|
||||
? `${FILE_BASEURL}/upload/setting/previewImage/${buildingStore.selectedBuilding.building_guid}${newValue}`
|
||||
: "/build_img.jpg";
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
() => deptData.value,
|
||||
(newVal) => {
|
||||
|
@ -25,8 +25,8 @@ const getDeviceStatusColor = (device) => {
|
||||
if (device.full_name === 'SmartSocket-AA001') return 'red';
|
||||
if (device.full_name === 'SmartSocket-AA003' || device.full_name === 'SmartSocket-AA004') return 'gray';
|
||||
const state = getDeviceRealtimeState(device.device_number);
|
||||
if (state === 'offnormal' || state === '') return device.device_close_color || 'gray';
|
||||
return device.device_normal_color;
|
||||
if (state === 'offnormal' || state === '') return device.device_close_color || '#9D9D9D';
|
||||
return device.device_normal_color || '#009100';
|
||||
};
|
||||
|
||||
// 狀態文字
|
||||
|
Loading…
Reference in New Issue
Block a user