|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
- <div class="right-layout">
|
|
|
+ <div class="right-layout" @click="board.polygon.status.lightPointId = null">
|
|
|
<div class="right-content">
|
|
|
- <el-form :inline="false" v-if="router.currentRoute.value.name === 'map'">
|
|
|
+ <el-form :inline="false" v-if="!queryMode">
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" :icon="Plus" style="width: 100%" @click="addHandler">
|
|
|
添加场景
|
|
@@ -10,13 +10,33 @@
|
|
|
</el-form>
|
|
|
<div class="tree-layout">
|
|
|
<p class="sub-title">全部数据</p>
|
|
|
- <el-tree style="max-width: 600px" :data="treeNode" :props="{ disabled: 'run' }" node-key="id" ref="treeRef"
|
|
|
- :show-checkbox="router.currentRoute.value.name === 'map'" default-expand-all :expand-on-click-node="false">
|
|
|
+ <el-tree
|
|
|
+ style="max-width: 600px"
|
|
|
+ :data="treeNode"
|
|
|
+ node-key="id"
|
|
|
+ ref="treeRef"
|
|
|
+ :show-checkbox="!queryMode"
|
|
|
+ default-expand-all
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ >
|
|
|
<template #default="{ node, data }">
|
|
|
- <div class="tree-item"
|
|
|
- @click="!data.disable && emit((data.type === 'scene' ? 'flyScene' : 'flyPoint') as any, data.raw)">
|
|
|
- <el-tooltip v-if="data.type === 'scene'" class="box-item" effect="dark"
|
|
|
- :content="data.raw.sceneName + ' ' + node.label" placement="top">
|
|
|
+ <div
|
|
|
+ class="tree-item"
|
|
|
+ :class="{
|
|
|
+ active: board.polygon.status.lightPointId === data.raw.id.toString(),
|
|
|
+ }"
|
|
|
+ @click.stop="
|
|
|
+ !data.disable &&
|
|
|
+ (data.type === 'scene' ? flyScene(data) : flyPos(data.raw))
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-tooltip
|
|
|
+ v-if="data.type === 'scene'"
|
|
|
+ class="box-item"
|
|
|
+ effect="dark"
|
|
|
+ :content="data.raw.sceneName + ' ' + node.label"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<span :class="{ disable: data.disable }" class="title">
|
|
|
<el-icon>
|
|
|
<Grid />
|
|
@@ -26,7 +46,13 @@
|
|
|
<span class="tree-scene-name">{{ node.label }}</span>
|
|
|
</span>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip v-else class="box-item" effect="dark" :content="node.label" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ v-else
|
|
|
+ class="box-item"
|
|
|
+ effect="dark"
|
|
|
+ :content="data.raw.name || node.label"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<div class="title-box">
|
|
|
<span :class="{ disable: data.disable }" class="title">
|
|
|
<el-icon>
|
|
@@ -34,15 +60,14 @@
|
|
|
<DeleteLocation v-else />
|
|
|
</el-icon>
|
|
|
{{ node.label }}
|
|
|
- <!-- uu -->
|
|
|
</span>
|
|
|
<span :class="{ disable: data.disable }" class="name">
|
|
|
{{ data.raw.name }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</el-tooltip>
|
|
|
- <span class="oper">
|
|
|
- <template v-if="router.currentRoute.value.name === 'map'">
|
|
|
+ <span class="oper" @click.stop>
|
|
|
+ <template v-if="!queryMode">
|
|
|
<template v-if="data.type === 'scene'">
|
|
|
<el-icon color="#409efc" v-if="data.raw.creationMethod !== 2">
|
|
|
<Delete @click.stop="delSceneHandler([data.raw])" />
|
|
@@ -55,18 +80,24 @@
|
|
|
<el-icon color="#409efc" style="margin-left: 8px">
|
|
|
<!-- root -->
|
|
|
<template v-if="data.raw.scenePos">
|
|
|
- <FrameIcon v-if="!data.run" @click.stop="
|
|
|
- data.type === 'scene'
|
|
|
- ? gotoScene(data.raw)
|
|
|
- : emit('gotoPoint', data.raw)
|
|
|
- " />
|
|
|
+ <FrameIcon
|
|
|
+ v-if="!data.run"
|
|
|
+ @click.stop="
|
|
|
+ data.type === 'scene'
|
|
|
+ ? gotoScene(data.raw)
|
|
|
+ : gotoPointPage(data.raw)
|
|
|
+ "
|
|
|
+ />
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <PanoramaIcon v-if="!data.run" @click.stop="
|
|
|
- data.type === 'scene'
|
|
|
- ? gotoScene(data.raw)
|
|
|
- : emit('gotoPoint', data.raw)
|
|
|
- " />
|
|
|
+ <PanoramaIcon
|
|
|
+ v-if="!data.run"
|
|
|
+ @click.stop="
|
|
|
+ data.type === 'scene'
|
|
|
+ ? gotoScene(data.raw)
|
|
|
+ : gotoPointPage(data.raw)
|
|
|
+ "
|
|
|
+ />
|
|
|
</template>
|
|
|
</el-icon>
|
|
|
</span>
|
|
@@ -76,27 +107,39 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <template v-if="router.currentRoute.value.name === 'map'">
|
|
|
- <el-button type="primary" :icon="Download" style="width: 100%" @click="handlerExport(2, relics?.name)">
|
|
|
+ <template v-if="!queryMode">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :icon="Download"
|
|
|
+ style="width: 100%"
|
|
|
+ @click="exportFile(getSelectPoints(), 2, relics?.name)"
|
|
|
+ >
|
|
|
导出本体边界坐标
|
|
|
</el-button>
|
|
|
- <!-- <el-button type="primary" :icon="Download" style="width: 100%; margin-top: 20px; margin-left: 0"
|
|
|
- @click="exportFile(getSelectPoints(), 1, relics?.name)">
|
|
|
- 导出绘制矢量数据
|
|
|
- </el-button> -->
|
|
|
|
|
|
- <el-button type="primary" :icon="Download" style="width: 100%; margin-top: 20px; margin-left: 0"
|
|
|
- @click="exportImage(getSelectPoints(), relics?.name)">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :icon="Download"
|
|
|
+ style="width: 100%; margin-top: 20px; margin-left: 0"
|
|
|
+ @click="exportImage(getSelectPoints(), relics?.name)"
|
|
|
+ >
|
|
|
下载全景图
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</div>
|
|
|
|
|
|
- <SingleInput :visible="!!inputPoint" @update:visible="inputPoint = null" :value="inputPoint?.name || ''"
|
|
|
- :update-value="updatePointName" title="测点说明" placeholder="请填写测点说明" />
|
|
|
+ <SingleInput
|
|
|
+ :visible="!!inputPoint"
|
|
|
+ @update:visible="inputPoint = null"
|
|
|
+ :value="inputPoint?.name || ''"
|
|
|
+ :update-value="updatePointName"
|
|
|
+ title="测点说明"
|
|
|
+ placeholder="请填写测点说明"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { boardDataChange, queryMode } from "./install";
|
|
|
import {
|
|
|
Plus,
|
|
|
Delete,
|
|
@@ -105,7 +148,7 @@ import {
|
|
|
DeleteLocation,
|
|
|
Edit,
|
|
|
} from "@element-plus/icons-vue";
|
|
|
-import { computed, ref, watchEffect } from "vue";
|
|
|
+import { computed, onBeforeUnmount, ref, watchEffect } from "vue";
|
|
|
import {
|
|
|
Scene,
|
|
|
scenes,
|
|
@@ -114,10 +157,11 @@ import {
|
|
|
gotoScene,
|
|
|
relicsId,
|
|
|
refreshScenes,
|
|
|
+ boardData,
|
|
|
+ scenePoints,
|
|
|
} from "@/store/scene";
|
|
|
import { relics } from "@/store/relics";
|
|
|
import SingleInput from "@/components/single-input.vue";
|
|
|
-import { router } from "@/router";
|
|
|
import { selectScenes } from "../quisk";
|
|
|
import { addRelicsScenesFetch, delRelicsScenesFetch } from "@/request";
|
|
|
import { exportFile, exportImage } from "./pc4Helper";
|
|
@@ -125,24 +169,30 @@ import { SceneStatus } from "@/store/scene";
|
|
|
import StateGpsIcon from "@/assets/state_gps.svg";
|
|
|
import PanoramaIcon from "@/assets/panorama.svg";
|
|
|
import FrameIcon from "@/assets/frame.svg";
|
|
|
-import { DrawingDataType, getDrawingDetailFetch } from "@/request/drawing";
|
|
|
import { alert } from "@/helper/message";
|
|
|
-import { Polygons, getWholeLineLinesByPointId } from "drawing-board";
|
|
|
-import { ElMessageBox } from "element-plus";
|
|
|
-const props = defineProps<{
|
|
|
- data: DrawingDataType | null;
|
|
|
- boardPolygons: Polygons;
|
|
|
-}>();
|
|
|
-
|
|
|
-const emit = defineEmits<{
|
|
|
- (e: "flyScene", data: Scene): void;
|
|
|
- (e: "flyPoint", data: ScenePoint): void;
|
|
|
- (e: "gotoPoint", data: ScenePoint): void;
|
|
|
-}>();
|
|
|
+import {
|
|
|
+ PolygonsPointAttrib,
|
|
|
+ getWholeLineLinesByPointId,
|
|
|
+ getWholeLinePoint,
|
|
|
+} from "drawing-board";
|
|
|
+import { flyScene, gotoPointPage, mapManage } from "./install";
|
|
|
+import { board } from "./install";
|
|
|
|
|
|
const inputPoint = ref<ScenePoint | null>(null);
|
|
|
const updatePointName = async (title: string) => {
|
|
|
- await updateScenePointName(inputPoint.value!, title);
|
|
|
+ const point = getWholeLinePoint(
|
|
|
+ boardData.value,
|
|
|
+ inputPoint.value.id.toString()
|
|
|
+ ) as PolygonsPointAttrib;
|
|
|
+ await Promise.all([
|
|
|
+ boardDataChange(() => (point.title = title)),
|
|
|
+ updateScenePointName(inputPoint.value!, title),
|
|
|
+ ]);
|
|
|
+};
|
|
|
+
|
|
|
+const flyPos = (point: ScenePoint) => {
|
|
|
+ mapManage.map.getView().setCenter(point.pos);
|
|
|
+ board.polygon.status.lightPointId = point.id.toString();
|
|
|
};
|
|
|
|
|
|
const relicsName = ref("");
|
|
@@ -176,11 +226,27 @@ const getSelectPoints = () =>
|
|
|
|
|
|
watchEffect(() => {
|
|
|
if (treeRef.value) {
|
|
|
- props.boardPolygons.status.selectPoiIds = getSelectPoints().map((point) =>
|
|
|
+ board.polygon.status.selectPoiIds = getSelectPoints().map((point) =>
|
|
|
point.id.toString()
|
|
|
);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+const delScenesBeforeCheck = async (scenes: Scene[]) => {
|
|
|
+ if (scenes.length === 0) return true;
|
|
|
+ for (const scene of scenes) {
|
|
|
+ const que = scene.scenePos.some((pos) => {
|
|
|
+ const id = pos.id.toString();
|
|
|
+ return getWholeLineLinesByPointId(boardData.value, id).length !== 0;
|
|
|
+ });
|
|
|
+ if (que) {
|
|
|
+ await alert("已存在矢量图数据,不可删除。");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const addHandler = async () => {
|
|
|
const sceneCodes = scenes.value.map((scene) => scene.sceneCode);
|
|
|
await selectScenes({
|
|
@@ -192,9 +258,25 @@ const addHandler = async () => {
|
|
|
.filter((sceneCode) => !nScene.some((scene) => scene.sceneCode === sceneCode))
|
|
|
.map((sceneCode) => scenes.value.find((scene) => scene.sceneCode === sceneCode)!);
|
|
|
|
|
|
- delScenes.length && requests.push(delRelicsScenes(delScenes));
|
|
|
+ if (!(await delScenesBeforeCheck(delScenes))) {
|
|
|
+ throw "不可删除";
|
|
|
+ }
|
|
|
+
|
|
|
+ delScenes.length &&
|
|
|
+ requests.push(
|
|
|
+ delRelicsScenesFetch(
|
|
|
+ relicsId.value,
|
|
|
+ delScenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
|
|
|
+ )
|
|
|
+ );
|
|
|
const addScenes = nScene.filter(({ sceneCode }) => !sceneCodes.includes(sceneCode));
|
|
|
- addScenes.length && requests.push(addSceneHandler(addScenes));
|
|
|
+ addScenes.length &&
|
|
|
+ requests.push(
|
|
|
+ addRelicsScenesFetch(
|
|
|
+ relicsId.value!,
|
|
|
+ addScenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
|
|
|
+ )
|
|
|
+ );
|
|
|
|
|
|
await Promise.all(requests);
|
|
|
requests.length && (await refreshScenes());
|
|
@@ -202,50 +284,33 @@ const addHandler = async () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const delRelicsScenes = (scenes: Pick<Scene, "sceneId" | "sceneCode">[]) =>
|
|
|
- delRelicsScenesFetch(
|
|
|
- relicsId.value,
|
|
|
- scenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
|
|
|
- );
|
|
|
-
|
|
|
const delSceneHandler = async (scenes: Scene[]) => {
|
|
|
-
|
|
|
- const ok = await ElMessageBox.confirm("确定要删除场景吗?", {
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
- if (ok) {
|
|
|
- const res = await getDrawingDetailFetch(String(relicsId.value));
|
|
|
- for (const scene of scenes) {
|
|
|
- const que = scene.scenePos.some((pos) => {
|
|
|
- const id = pos.id.toString();
|
|
|
- console.log(getWholeLineLinesByPointId(res.data as any, id), id);
|
|
|
- return getWholeLineLinesByPointId(res.data as any, id).length !== 0;
|
|
|
- });
|
|
|
- if (que) {
|
|
|
- await alert("已存在矢量图数据,不可删除。");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- console.log(res.data);
|
|
|
+ if (!(await delScenesBeforeCheck(scenes))) {
|
|
|
return;
|
|
|
- await delRelicsScenes(scenes);
|
|
|
- await refreshScenes();
|
|
|
}
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
-const addSceneHandler = async (scenes: Pick<Scene, "sceneId" | "sceneCode">[]) =>
|
|
|
- await addRelicsScenesFetch(
|
|
|
- relicsId.value!,
|
|
|
+ await delRelicsScenesFetch(
|
|
|
+ relicsId.value,
|
|
|
scenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
|
|
|
);
|
|
|
+ await refreshScenes();
|
|
|
+};
|
|
|
|
|
|
-const handlerExport = (type: number, name: string) => {
|
|
|
- console.log("type", type, name);
|
|
|
- console.log("getSelectPoints", getSelectPoints());
|
|
|
- exportFile(getSelectPoints(), type, name);
|
|
|
+const pointClickHandler = ({ id }: { id: any }) => {
|
|
|
+ const point = scenePoints.value.find((point) => point.id.toString() === id);
|
|
|
+ point && gotoPointPage(point);
|
|
|
};
|
|
|
+
|
|
|
+board.polygon.container.stage.on("click.checkPointSelect", (ev) => {
|
|
|
+ if (ev.target === board.polygon.container.stage) {
|
|
|
+ board.polygon.status.lightPointId = null;
|
|
|
+ }
|
|
|
+});
|
|
|
+board.polygon.bus.on("clickPoint", pointClickHandler);
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ board.polygon.bus.off("clickPoint", pointClickHandler);
|
|
|
+ board.polygon.container.stage.off("click.checkPointSelect");
|
|
|
+ board.polygon.status.lightPointId = null;
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -259,14 +324,12 @@ const handlerExport = (type: number, name: string) => {
|
|
|
:deep(.el-tree-node__children .el-tree-node__content) {
|
|
|
--el-tree-node-content-height: 52px;
|
|
|
|
|
|
- &>label.el-checkbox {
|
|
|
+ & > label.el-checkbox {
|
|
|
padding-top: 6px;
|
|
|
align-items: flex-start;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-:deep(.el-tree .tree-item) {}
|
|
|
-
|
|
|
.tree-item {
|
|
|
display: flex;
|
|
|
width: calc(100% - 50px);
|
|
@@ -274,6 +337,10 @@ const handlerExport = (type: number, name: string) => {
|
|
|
justify-content: space-between;
|
|
|
font-size: var(--font14);
|
|
|
|
|
|
+ &.active {
|
|
|
+ color: rgba(64, 158, 255, 1);
|
|
|
+ }
|
|
|
+
|
|
|
.title {
|
|
|
flex: 1;
|
|
|
overflow: hidden;
|