-
{{$t("dashboard.energy_ranking")}}
+
+ {{ $t("dashboard.energy_ranking") }}
+
@@ -59,7 +51,7 @@ const getCurrentEnergyData = () => {
{
- const barWidth = 25;
+ const barWidth = 15;
return {
xAxis: {
type: "category",
@@ -71,7 +71,7 @@ const generateCylinderChartOption = (data) => {
},
},
{
- z: 12,
+ z: 15,
type: "pictorialBar",
symbolPosition: "end",
data: data.map((item) => item.energy),
@@ -83,7 +83,7 @@ const generateCylinderChartOption = (data) => {
},
},
{
- z: 12,
+ z: 10,
type: "pictorialBar",
data: data.map((item) => item.energy),
symbol: "diamond",
@@ -105,52 +105,118 @@ const generateCylinderChartOption = (data) => {
trigger: "axis",
formatter: function (params) {
const item = params[0];
- return `${item.name}
${item.marker}能耗 : ${item.value}
`;
+ return `${item.name}
${item.marker}Energy consumption : ${item.value}
`;
},
},
};
};
-const weekComparisonOption = generateCylinderChartOption(energyData.value);
+const processEnergyData = () => {
+ if (!props.energyCostData || !props.energyCostData.trend) {
+ chartData.value = [];
+ weekComparisonOption.value = generateCylinderChartOption(chartData.value);
+ return;
+ }
+
+ const dailyData = props.energyCostData.trend;
+
+ chartData.value = dailyData.map((item) => ({
+ date: dayjs(item.time).format("MM/DD"),
+ energy: item.value,
+ }));
+
+ weekComparisonOption.value = generateCylinderChartOption(chartData.value);
+};
watch(
- () => [storeBuild.deptList.length, storeBuild.floorList.length],
- ([deptListLength, floorListLength]) => {
- if (deptListLength > 0 && floorListLength > 0) {
- formState.value = {
- ...formState.value,
- floorId: storeBuild.floorList[0].key,
- deptId: storeBuild.deptList[0].key,
- };
+ () => props.energyCostData,
+ (newEnergyCostData) => {
+ processEnergyData();
+ },
+ { deep: true, immediate: true }
+);
+
+watch(
+ () => storeBuild.floorList,
+ (newValue) => {
+ if (newValue) {
+ console.log('newValue',newValue);
+
+ floorList.value = [
+ {
+ title: "All",
+ key: "all",
+ },
+ ...storeBuild.floorList,
+ ];
}
},
- { immediate: true }
+ {
+ immediate: true,
+ }
+);
+
+watch(
+ () => storeBuild.floorList,
+ (newValue) => {
+ if (newValue) {
+ floorList.value = [
+ {
+ title: "All",
+ key: "all",
+ },
+ ...storeBuild.floorList,
+ ];
+ }
+ },
+ {
+ immediate: true,
+ }
+);
+
+watch(
+ () => storeBuild.deptList,
+ (newValue) => {
+ if (newValue) {
+ deptList.value = [
+ {
+ title: "All",
+ key: "all",
+ },
+ ...storeBuild.deptList,
+ ];
+ }
+ },
+ {
+ deep: true,
+ immediate: true,
+ }
);
-
{{$t("dashboard.last_30_days_energy_trend")}}
+
{{ $t("dashboard.last_30_days_energy_trend") }}
@@ -126,7 +218,7 @@ const openModal = () => {
}
.state-box .title {
- @apply relative flex items-center mb-4;
+ @apply relative flex items-center mb-1;
}
.state-box .title .state-title01 {
diff --git a/src/views/dashboard/components/DashboardSysProgressModal.vue b/src/views/dashboard/components/DashboardSysProgressModal.vue
index 60b3019..6781805 100644
--- a/src/views/dashboard/components/DashboardSysProgressModal.vue
+++ b/src/views/dashboard/components/DashboardSysProgressModal.vue
@@ -2,44 +2,23 @@
import { ref, onMounted, defineProps, inject, watch } from "vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
-const { openToast } = inject("app_toast");
-
-const onCancel = () => {
- system_status_modal.close();
-};
-
-// 假資料 - 在線設備列表
-const mockEquipmentData = ref([
- { name: "12030182 (放空機-30噸)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12080043 (空壓機-50P 日立)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12030204 (注塑機-40噸)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12040084 (冷卻水)", lastOnline: "2024-12-17 17:15:00" },
- { name: "11060241 (蒸騰式冷氣機)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12060010 (串壓機-啟業)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12020005 (串壓機-工業30噸)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12030179 (注塑機-30噸)", lastOnline: "2024-12-17 17:15:00" },
- { name: "12040145 (串壓機-三銘)", lastOnline: "2024-12-17 17:15:00" },
- {
- name: "12030163 (注氨全自動加氨型-00:00-01:00)",
- lastOnline: "2024-12-17 17:15:00",
- },
-]);
+const props = defineProps({
+ onCancel: Function,
+ modalData: Object,
+});
-
在線設備
+
@@ -51,26 +30,34 @@ const mockEquipmentData = ref([
- 設備名稱
+ Serial Number
|
- 最近在線時間
+ Name
+ |
+
+ Time
|
+
+ {{ index+1 }}
+ |
{{ equipment.name }}
|
- {{ equipment.lastOnline }}
+ {{ equipment.time || "-" }}
|