預設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 HeadquartersManagement from "@/views/headquarters/HeadquartersManagement.vue";
|
||||||
import Login from "@/views/login/Login.vue";
|
import Login from "@/views/login/Login.vue";
|
||||||
import useUserInfoStore from "@/stores/useUserInfoStore";
|
import useUserInfoStore from "@/stores/useUserInfoStore";
|
||||||
|
import useBuildingStore from "@/stores/useBuildingStore";
|
||||||
import useGetCookie from "@/hooks/useGetCookie";
|
import useGetCookie from "@/hooks/useGetCookie";
|
||||||
import System from "@/views/system/System.vue";
|
import System from "@/views/system/System.vue";
|
||||||
import SystemFloor from "@/views/system/SystemFloor.vue";
|
import SystemFloor from "@/views/system/SystemFloor.vue";
|
||||||
|
|
||||||
import Test from "@/views/Test.vue";
|
import Test from "@/views/Test.vue";
|
||||||
import SystemMain from "@/views/system/SystemMain.vue";
|
import SystemMain from "@/views/system/SystemMain.vue";
|
||||||
|
|
||||||
@ -112,9 +113,11 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
const auth = useUserInfoStore();
|
const auth = useUserInfoStore();
|
||||||
const token = useGetCookie("JWT-Authorization");
|
const token = useGetCookie("JWT-Authorization");
|
||||||
const user_name = useGetCookie("user_name");
|
const user_name = useGetCookie("user_name");
|
||||||
|
const buildingStore = useBuildingStore();
|
||||||
|
|
||||||
if ((authRequired && !token) || to.path === "/") {
|
if ((authRequired && !token) || to.path === "/") {
|
||||||
auth.user.token = "";
|
auth.user.token = "";
|
||||||
|
buildingStore.deleteBuilding();
|
||||||
next({ path: "/login" });
|
next({ path: "/login" });
|
||||||
} else if (!authRequired) {
|
} else if (!authRequired) {
|
||||||
document.cookie = "JWT-Authorization=; Max-Age=0";
|
document.cookie = "JWT-Authorization=; Max-Age=0";
|
||||||
|
@ -35,16 +35,23 @@ watch(
|
|||||||
(newBuilding) => {
|
(newBuilding) => {
|
||||||
if (newBuilding) {
|
if (newBuilding) {
|
||||||
formState.value.building_guid = newBuilding.building_guid;
|
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 }
|
{ 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(
|
watch(
|
||||||
() => formState.value,
|
() => formState.value,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
@ -139,7 +146,7 @@ onUnmounted(() => {
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<img
|
<img
|
||||||
alt="build"
|
alt="build"
|
||||||
:src="imgBaseUrl || '/build_img.jpg'"
|
:src="imgBaseUrl"
|
||||||
class="area-img-box w-full h-[460px] block relative rounded-sm mt-3"
|
class="area-img-box w-full h-[460px] block relative rounded-sm mt-3"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -88,7 +88,7 @@ watch(
|
|||||||
<th
|
<th
|
||||||
class="text-base border text-white text-center bg-cyan-600 bg-opacity-30"
|
class="text-base border text-white text-center bg-cyan-600 bg-opacity-30"
|
||||||
>
|
>
|
||||||
{{ $t("table.time") }}
|
{{ $t("operation.updated_time") }}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -28,7 +28,11 @@ import ElecCompare from "./components/ElecCompare.vue";
|
|||||||
<SysProgress />
|
<SysProgress />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2 h-full border border-cyan-400 shadow-md shadow-cyan-500/40">
|
<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>
|
||||||
<div class="col-span-1 grid grid-cols-1 xl:grid-rows-3 gap-4">
|
<div class="col-span-1 grid grid-cols-1 xl:grid-rows-3 gap-4">
|
||||||
<ElecRank />
|
<ElecRank />
|
||||||
|
@ -93,7 +93,7 @@ watch(
|
|||||||
<th
|
<th
|
||||||
class="text-base border text-white text-center bg-cyan-600 bg-opacity-30"
|
class="text-base border text-white text-center bg-cyan-600 bg-opacity-30"
|
||||||
>
|
>
|
||||||
{{ $t("table.time") }}
|
{{ $t("operation.updated_time") }}
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -130,11 +130,6 @@ watch(
|
|||||||
(newBuilding) => {
|
(newBuilding) => {
|
||||||
if (Boolean(newBuilding)) {
|
if (Boolean(newBuilding)) {
|
||||||
getData();
|
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(
|
watch(
|
||||||
() => deptData.value,
|
() => deptData.value,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
|
@ -25,8 +25,8 @@ const getDeviceStatusColor = (device) => {
|
|||||||
if (device.full_name === 'SmartSocket-AA001') return 'red';
|
if (device.full_name === 'SmartSocket-AA001') return 'red';
|
||||||
if (device.full_name === 'SmartSocket-AA003' || device.full_name === 'SmartSocket-AA004') return 'gray';
|
if (device.full_name === 'SmartSocket-AA003' || device.full_name === 'SmartSocket-AA004') return 'gray';
|
||||||
const state = getDeviceRealtimeState(device.device_number);
|
const state = getDeviceRealtimeState(device.device_number);
|
||||||
if (state === 'offnormal' || state === '') return device.device_close_color || 'gray';
|
if (state === 'offnormal' || state === '') return device.device_close_color || '#9D9D9D';
|
||||||
return device.device_normal_color;
|
return device.device_normal_color || '#009100';
|
||||||
};
|
};
|
||||||
|
|
||||||
// 狀態文字
|
// 狀態文字
|
||||||
|
Loading…
Reference in New Issue
Block a user