diff --git a/src/components/forge/Forge.vue b/src/components/forge/Forge.vue
index 45d5310..51a602c 100644
--- a/src/components/forge/Forge.vue
+++ b/src/components/forge/Forge.vue
@@ -107,21 +107,6 @@ const initForge = () => {
viewer.isLoadDone()
);
updateForgeViewer(viewer);
-
- // const tree = viewer.model.getData().instanceTree;
- // hideAllObjects(tree, visibleDbid.value);
- // visibleDbid.value.forEach((dbid) => {
- // if (dbid === 58) {
- // viewer.setThemingColor(dbid, new THREE.Vector4(1, 0, 0, 1));
- // }
- // });
- // 印出被點選物件的 dbid
- // viewer.addEventListener(
- // Autodesk.Viewing.SELECTION_CHANGED_EVENT,
- // function (event) {
- // console.log("你選取的 forge_dbid:", event.dbIdArray);
- // }
- // );
}
);
viewer.addEventListener(
diff --git a/src/hooks/baja/useSystemStatusByBaja.js b/src/hooks/baja/useSystemStatusByBaja.js
index f8432b3..a912fbc 100644
--- a/src/hooks/baja/useSystemStatusByBaja.js
+++ b/src/hooks/baja/useSystemStatusByBaja.js
@@ -495,22 +495,6 @@ export default function useSystemStatusByBaja(updateHeatBarIsShow) {
}
});
- watch(initialData, (newValue) => {
- if (newValue) {
- getDevice(searchParams.value.option);
- }
- });
-
- watch(
- searchParams,
- (newValue) => {
- getDevice(newValue.option);
- },
- {
- deep: true,
- }
- );
-
// 動態Sprites創建函數
const createSprites = async (viewer, dbId, reverse = false) => {
try {
diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue
index ff25098..44f426f 100644
--- a/src/views/dashboard/Dashboard.vue
+++ b/src/views/dashboard/Dashboard.vue
@@ -9,13 +9,26 @@ import DashboardElectricity from "./components/DashboardElectricity.vue";
import DashboardAlert from "./components/DashboardAlert.vue";
import DashboardForgeOptionButton from "./components/DashboardForgeOptionButton.vue";
import DashboardForgeOptionCard from "./components/DashboardForgeOptionCard.vue";
-import { getDashboardInit, getDashboardOptionRealTimeData } from "@/apis/dashboard";
+import {
+ getDashboardInit,
+ getDashboardOptionRealTimeData,
+} from "@/apis/dashboard";
+import { getAssetFloorList } from "@/apis/asset";
+import { getOperationCompanyList } from "@/apis/operation";
import useSearchParams from "@/hooks/useSearchParam";
import dayjs from "dayjs";
const initialData = ref(null);
const realTimeData = ref(null);
const realTime = ref(null);
+// 電表列表
+const meterList = ref([]);
+const selectedMeter = ref(null);
+// 樓層列表
+const floors = ref([]);
+// 廠商列表
+const companyOptions = ref([]);
+
const { searchParams } = useSearchParams();
let intervalId = null;
@@ -34,6 +47,11 @@ const getDevice = async (option = 1) => {
option: parseInt(option),
});
realTimeData.value = res.data;
+ if (res.data?.meterData) {
+ meterList.value = (res.data?.meterData || []).sort();
+ } else {
+ meterList.value = [];
+ }
realTime.value = dayjs().format("YYYY-MM-DD HH:mm:ss");
console.log("實時數據:", realTimeData.value);
} catch (err) {
@@ -41,16 +59,26 @@ const getDevice = async (option = 1) => {
}
};
+const getFloors = async () => {
+ const res = await getAssetFloorList();
+ floors.value = res.data[0]?.floors.map((d) => ({ ...d, key: d.floor_guid }));
+};
+
+const getCompany = async () => {
+ const res = await getOperationCompanyList();
+ companyOptions.value = res.data.map((d) => ({ ...d, key: d.id }));
+};
+
// 開始定時器
const startInterval = (option) => {
// 清除之前的定時器
if (intervalId) {
clearInterval(intervalId);
}
-
+
// 立即執行一次
getDevice(option);
-
+
// 設定每5秒執行一次
intervalId = setInterval(() => {
getDevice(option);
@@ -66,7 +94,7 @@ const stopInterval = () => {
};
watch(
- ()=>searchParams.value.option,
+ () => searchParams.value.option,
(newValue) => {
if (newValue) {
startInterval(newValue);
@@ -80,6 +108,8 @@ watch(
onMounted(() => {
init();
+ getFloors();
+ getCompany();
});
onUnmounted(() => {
@@ -98,9 +128,19 @@ onUnmounted(() => {
-
-
-
+
+
+
diff --git a/src/views/dashboard/components/DashboardForgeOptionButton.vue b/src/views/dashboard/components/DashboardForgeOptionButton.vue
index 9b51f1f..636ee21 100644
--- a/src/views/dashboard/components/DashboardForgeOptionButton.vue
+++ b/src/views/dashboard/components/DashboardForgeOptionButton.vue
@@ -5,15 +5,18 @@ import { twMerge } from "tailwind-merge";
const props = defineProps({
initialData: Object,
+ meterList: Array,
+ selectedMeter: [String, Number, null],
});
const { changeParams, searchParams } = useSearchParams();
-
+const emit = defineEmits(["update:selectedMeter"]);
watch(
() => props.initialData,
(newValue) => {
if (newValue?.options[0]) {
- const { option, camera_position, target_position, top } = newValue.options[0];
+ const { option, camera_position, target_position, top } =
+ newValue.options[0];
changeParams({ option, camera_position, target_position, top });
}
},
@@ -27,30 +30,80 @@ watch(
v-for="option in initialData.options"
:key="`option_${option.option}`"
>
-
+
+
+
+
+
+
+
+
+
diff --git a/src/views/dashboard/components/DashboardForgeOptionCard.vue b/src/views/dashboard/components/DashboardForgeOptionCard.vue
index 3d4dd45..3ece1ef 100644
--- a/src/views/dashboard/components/DashboardForgeOptionCard.vue
+++ b/src/views/dashboard/components/DashboardForgeOptionCard.vue
@@ -15,16 +15,11 @@ import ValveCard from "./dashboardForgeCards/ValveCard.vue";
const { searchParams, changeParams } = useSearchParams();
const props = defineProps({
realTimeData: Object,
+ selectedMeter: String,
+ floors: Array,
+ companyOptions: Array,
});
-const tabs = [
- { label: "生產資訊" },
- { label: "投料進度" },
- { label: "品檢" },
- { label: "流量計" },
- { label: "SIP" },
-];
-
// 生產資訊卡片資料
const productionData = computed(() => {
return props.realTimeData?.productionData || [];
@@ -36,24 +31,9 @@ const heaterData = computed(() => {
return props.realTimeData?.heaterData || [];
});
-// 管理所有設備的activeTab狀態
-const deviceActiveTabs = ref(new Map());
-
-// 獲取或創建設備的activeTab
-const getDeviceActiveTab = (deviceName, defaultTab = "生產資訊") => {
- if (!deviceActiveTabs.value.has(deviceName)) {
- deviceActiveTabs.value.set(deviceName, ref(defaultTab));
- }
- return deviceActiveTabs.value.get(deviceName);
-};
-
// 二重釜資料
const vesselsData = computed(() => {
- const data = props.realTimeData?.productionData || [];
- return data.map((vessel) => ({
- ...vessel,
- activeTab: getDeviceActiveTab(vessel.name),
- }));
+ return props.realTimeData?.productionData || [];
});
// 加熱器資料
@@ -63,11 +43,7 @@ const heaterPotData = computed(() => {
// 調理鍋資料
const cookingPotData = computed(() => {
- const data = props.realTimeData?.cookingData || [];
- return data.map((pot) => ({
- ...pot,
- activeTab2: getDeviceActiveTab(pot.name),
- }));
+ return props.realTimeData?.cookingData || [];
});
// 冷藏室資料
@@ -78,7 +54,11 @@ const refrigerationData = computed(() => {
// 電錶資料
const meterData = computed(() => {
const data = props.realTimeData?.meterData || [];
- return data.sort((a, b) => a.name.localeCompare(b.name));
+ // 篩選出符合 selectedMeter 的資料
+ const filtered = props.selectedMeter
+ ? data.filter((meter) => meter.main_id === props.selectedMeter)
+ : [];
+ return filtered;
});
// 威鈦閥異常訊號資料
@@ -105,7 +85,6 @@ const valveData = computed(() => {
v-for="(vessel, index) in vesselsData"
:key="index"
:vessel="vessel"
- :tabs="tabs.filter(tab => tab.label !== '品檢')"
/>
@@ -120,7 +99,6 @@ const valveData = computed(() => {
v-for="(pot, index) in cookingPotData"
:key="index"
:pot="pot"
- :tabs="tabs"
/>
@@ -137,6 +115,8 @@ const valveData = computed(() => {
v-for="(meter, index) in meterData"
:key="index"
:meter="meter"
+ :floors="props.floors"
+ :companyOptions="props.companyOptions"
/>
diff --git a/src/views/dashboard/components/dashboardForgeCards/CookingPotCard.vue b/src/views/dashboard/components/dashboardForgeCards/CookingPotCard.vue
index 75b9da8..4833cb8 100644
--- a/src/views/dashboard/components/dashboardForgeCards/CookingPotCard.vue
+++ b/src/views/dashboard/components/dashboardForgeCards/CookingPotCard.vue
@@ -1,8 +1,16 @@
@@ -19,15 +27,15 @@ const props = defineProps({
class="tab"
:class="{
'tab-active !bg-green-500 !text-white shadow-sm shadow-slate-800':
- pot.activeTab2.value === tab.label,
+ activeTab === tab.label,
}"
- @click.prevent="pot.activeTab2.value = tab.label"
+ @click.prevent="activeTab = tab.label"
>
{{ tab.label }}
-
+
- 品名: {{ pot.productInfo?.product }}
- 鍋次: 第{{ pot.productInfo?.batch || "__" }}鍋
@@ -36,7 +44,7 @@ const props = defineProps({
- 狀態: {{ pot.productInfo?.status }}
-
+
@@ -68,7 +76,7 @@ const props = defineProps({
-
+
@@ -98,14 +106,17 @@ const props = defineProps({
{{ flow.actual_PH }} |
{{ flow.actual_Brix }} |
-
+
無品檢資料 |
-
+
@@ -133,7 +144,7 @@ const props = defineProps({
-
+
@@ -144,18 +155,16 @@ const props = defineProps({
-
+ class="border-0"
+ >
{{ value.count }} |
{{ value.startTime }} |
{{ value.endTime }} |
-
+
無SIP資料 |
diff --git a/src/views/dashboard/components/dashboardForgeCards/MeterCard.vue b/src/views/dashboard/components/dashboardForgeCards/MeterCard.vue
index 98909a9..5e59f88 100644
--- a/src/views/dashboard/components/dashboardForgeCards/MeterCard.vue
+++ b/src/views/dashboard/components/dashboardForgeCards/MeterCard.vue
@@ -1,17 +1,321 @@
-
+
{{ meter.name }}
-
-
- - 電流: {{ meter.current }}
- - 電壓: {{ meter.voltage }}
- - 功率: {{ meter.power }}
- - 用電量: {{ meter.energyConsumption }}
-
+
+
+
+
+ - 電流: {{ meter.current }}
+ - 電壓: {{ meter.voltage }}
+ - 功率: {{ meter.power }}
+ - 用電量: {{ meter.energyConsumption }}
+
+
+
+
+
+
+ 設備編號 |
+ {{ meterDetails?.device_number || "—" }} |
+
+
+ 設備名稱 |
+
+ {{ meterDetails?.full_name || meter.name || "—" }}
+ |
+
+
+ 資產編號 |
+ {{ meterDetails?.asset_number || "—" }} |
+
+
+ 設備位置 |
+ {{ meterDetails?.floor || "—" }} |
+
+
+ 圖面標識 |
+ {{ meterDetails?.device_coordinate || "—" }} |
+
+
+ 品牌 / 型號 |
+
+ {{ meterDetails?.brand || "—" }} /
+ {{ meterDetails?.device_model || "—" }}
+ |
+
+
+ 廠商 / 聯絡人 |
+
+ {{ meterDetails?.company || "—" }} /
+ {{ meterDetails?.contact_person || "—" }}
+ |
+
+
+ 購買日期 |
+ {{ meterDetails?.buying_date || "—" }} |
+
+
+ 建立時間 |
+ {{ meterDetails?.created_at || "—" }} |
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/dashboard/components/dashboardForgeCards/VesselCard.vue b/src/views/dashboard/components/dashboardForgeCards/VesselCard.vue
index 475d5e3..f34603e 100644
--- a/src/views/dashboard/components/dashboardForgeCards/VesselCard.vue
+++ b/src/views/dashboard/components/dashboardForgeCards/VesselCard.vue
@@ -1,8 +1,15 @@
@@ -19,15 +26,15 @@ const props = defineProps({
class="tab"
:class="{
'tab-active !bg-green-500 !text-white shadow-sm shadow-slate-800':
- vessel.activeTab.value === tab.label,
+ activeTab === tab.label,
}"
- @click.prevent="vessel.activeTab.value = tab.label"
+ @click.prevent="activeTab = tab.label"
>
{{ tab.label }}
-
+
- 品名: {{ vessel.productInfo?.product }}
- 鍋次: 第{{ vessel.productInfo?.batch || "__" }}鍋
@@ -35,7 +42,7 @@ const props = defineProps({
- 狀態: {{ vessel.productInfo?.status }}
-
+
@@ -67,7 +74,7 @@ const props = defineProps({
-
+
@@ -95,7 +102,7 @@ const props = defineProps({
-