|
@@ -1,43 +1,45 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
|
|
+import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
|
import { deepClone } from "@meta2d/core";
|
|
|
import { monitorRoomData } from "./pens/monitorRoom";
|
|
|
import { monitorNoRoomData } from "./pens/monitorNoRoom";
|
|
|
-import { monitorPointData } from "./pens/monitorPoint";
|
|
|
+import { monitorPointData, MonitorPointPen } from "./pens/monitorPoint";
|
|
|
import { useMonitorPointPen } from "@/services/monitor-point-pen";
|
|
|
+import { RegionsPointsItem } from "@/types";
|
|
|
|
|
|
type AssetsType = "space" | "monitor";
|
|
|
|
|
|
+interface Props {
|
|
|
+ areaData?: RegionsPointsItem;
|
|
|
+}
|
|
|
+
|
|
|
+const props = defineProps<Props>();
|
|
|
+
|
|
|
const activeAssets = ref<AssetsType>("space");
|
|
|
-const monitorPoints = ref([
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "3F-办公室-01",
|
|
|
- disabled: false,
|
|
|
- data: {
|
|
|
- ...monitorPointData,
|
|
|
- pointId: 1,
|
|
|
- pointName: "3F-办公室-01",
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "3F-办公室-02",
|
|
|
- disabled: false,
|
|
|
- data: {
|
|
|
- ...monitorPointData,
|
|
|
- pointId: 2,
|
|
|
- pointName: "3F-办公室-02",
|
|
|
- },
|
|
|
- },
|
|
|
-]);
|
|
|
+
|
|
|
+interface MonitorPointItem {
|
|
|
+ id: number;
|
|
|
+ name: string;
|
|
|
+ disabled: boolean;
|
|
|
+ data: MonitorPointPen;
|
|
|
+}
|
|
|
|
|
|
const { monitorPointIds } = useMonitorPointPen();
|
|
|
|
|
|
-watch(monitorPointIds, () => {
|
|
|
- monitorPoints.value.forEach(item => {
|
|
|
- item.disabled = monitorPointIds.value.includes(item.id)
|
|
|
- });
|
|
|
+const monitorPoints = computed<MonitorPointItem[]>(() => {
|
|
|
+ if (!props.areaData) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ return props.areaData.points.map<MonitorPointItem>((item) => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name,
|
|
|
+ disabled: monitorPointIds.value.includes(item.id),
|
|
|
+ data: {
|
|
|
+ ...monitorPointData,
|
|
|
+ monitorPointInfo: item,
|
|
|
+ },
|
|
|
+ }));
|
|
|
});
|
|
|
|
|
|
const roomList = [
|