|
@@ -10,12 +10,7 @@
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- :icon="Plus"
|
|
|
|
- style="width: 100%"
|
|
|
|
- @click="addSceneMode = true"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button type="primary" :icon="Plus" style="width: 100%" @click="addHandler">
|
|
添加场景
|
|
添加场景
|
|
</el-button>
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -58,7 +53,7 @@
|
|
<span class="oper">
|
|
<span class="oper">
|
|
<template v-if="router.currentRoute.value.name === 'map'">
|
|
<template v-if="router.currentRoute.value.name === 'map'">
|
|
<el-icon color="#409efc" v-if="data.type === 'scene'">
|
|
<el-icon color="#409efc" v-if="data.type === 'scene'">
|
|
- <Delete @click.stop="delScene(data.raw)" />
|
|
|
|
|
|
+ <Delete @click.stop="delRelicsScene(data.raw)" />
|
|
</el-icon>
|
|
</el-icon>
|
|
<el-icon v-else color="#409efc">
|
|
<el-icon v-else color="#409efc">
|
|
<Edit @click.stop="inputPoint = data.raw" />
|
|
<Edit @click.stop="inputPoint = data.raw" />
|
|
@@ -80,9 +75,23 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <el-button type="primary" :icon="Document" style="width: 100%" @click="exportFile">
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ :icon="Document"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ @click="exportFile(getSelectPoints())"
|
|
|
|
+ >
|
|
导出四普数据
|
|
导出四普数据
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ :icon="Document"
|
|
|
|
+ style="width: 100%; margin-top: 20px; margin-left: 0"
|
|
|
|
+ @click="exportImage(getSelectPoints())"
|
|
|
|
+ >
|
|
|
|
+ 下载全景图
|
|
|
|
+ </el-button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<SingleInput
|
|
<SingleInput
|
|
@@ -92,13 +101,6 @@
|
|
:update-value="updatePointName"
|
|
:update-value="updatePointName"
|
|
title="修改点位名称"
|
|
title="修改点位名称"
|
|
/>
|
|
/>
|
|
- <SingleInput
|
|
|
|
- :visible="!!addSceneMode"
|
|
|
|
- @update:visible="addSceneMode = false"
|
|
|
|
- :value="''"
|
|
|
|
- :update-value="addSceneHandler"
|
|
|
|
- title="添加场景"
|
|
|
|
- />
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
@@ -113,43 +115,34 @@ import {
|
|
} from "@element-plus/icons-vue";
|
|
} from "@element-plus/icons-vue";
|
|
import { computed, ref, watchEffect } from "vue";
|
|
import { computed, ref, watchEffect } from "vue";
|
|
import {
|
|
import {
|
|
- RelicsScene,
|
|
|
|
|
|
+ Scene,
|
|
scenes,
|
|
scenes,
|
|
- RelicsScenePoint,
|
|
|
|
- addScene,
|
|
|
|
- delScene,
|
|
|
|
|
|
+ ScenePoint,
|
|
|
|
+ delRelicsScene,
|
|
updateScenePointName,
|
|
updateScenePointName,
|
|
gotoScene,
|
|
gotoScene,
|
|
- relics,
|
|
|
|
- updateRelicsName,
|
|
|
|
|
|
+ relicsId,
|
|
|
|
+ refreshScenes,
|
|
} from "@/store/scene";
|
|
} from "@/store/scene";
|
|
|
|
+import { relics, updateRelicsName } from "@/store/relics";
|
|
import SingleInput from "@/components/single-input.vue";
|
|
import SingleInput from "@/components/single-input.vue";
|
|
-import { downloadPointsXLSL } from "@/util/pc4xlsl";
|
|
|
|
import { ElMessage } from "element-plus";
|
|
import { ElMessage } from "element-plus";
|
|
import { router } from "@/router";
|
|
import { router } from "@/router";
|
|
|
|
+import { selectScenes } from "../quisk";
|
|
|
|
+import { addRelicsSceneFetch, delRelicsSceneFetch } from "@/request";
|
|
|
|
+import { exportFile, exportImage } from "./pc4Helper";
|
|
|
|
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
- (e: "flyScene", data: RelicsScene): void;
|
|
|
|
- (e: "flyPoint", data: RelicsScenePoint): void;
|
|
|
|
- (e: "gotoPoint", data: RelicsScenePoint): void;
|
|
|
|
|
|
+ (e: "flyScene", data: Scene): void;
|
|
|
|
+ (e: "flyPoint", data: ScenePoint): void;
|
|
|
|
+ (e: "gotoPoint", data: ScenePoint): void;
|
|
}>();
|
|
}>();
|
|
|
|
|
|
-const inputPoint = ref<RelicsScenePoint | null>(null);
|
|
|
|
|
|
+const inputPoint = ref<ScenePoint | null>(null);
|
|
const updatePointName = async (title: string) => {
|
|
const updatePointName = async (title: string) => {
|
|
await updateScenePointName(inputPoint.value!, title);
|
|
await updateScenePointName(inputPoint.value!, title);
|
|
};
|
|
};
|
|
|
|
|
|
-const addSceneMode = ref(false);
|
|
|
|
-const addSceneHandler = async (sceneCode: string) => {
|
|
|
|
- const sceneTypes = ["SS", "KJ", "SG"];
|
|
|
|
- if (sceneTypes.every((type) => !sceneCode.startsWith(type))) {
|
|
|
|
- ElMessage.error("场景码不正确");
|
|
|
|
- throw "场景码不正确";
|
|
|
|
- } else {
|
|
|
|
- await addScene(sceneCode);
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
const relicsName = ref("");
|
|
const relicsName = ref("");
|
|
watchEffect(() => (relicsName.value = relics.value?.name || ""));
|
|
watchEffect(() => (relicsName.value = relics.value?.name || ""));
|
|
const updateRelics = async () => {
|
|
const updateRelics = async () => {
|
|
@@ -175,27 +168,43 @@ const treeNode = computed(() =>
|
|
}))
|
|
}))
|
|
);
|
|
);
|
|
|
|
|
|
-const exportFile = async () => {
|
|
|
|
- let points: RelicsScenePoint[] = treeRef
|
|
|
|
|
|
+const getSelectPoints = () =>
|
|
|
|
+ treeRef
|
|
.value!.getCheckedNodes(false, false)
|
|
.value!.getCheckedNodes(false, false)
|
|
.filter((option: any) => option.type === "point")
|
|
.filter((option: any) => option.type === "point")
|
|
- .map((option: any) => option.raw);
|
|
|
|
- if (!points.length) {
|
|
|
|
- ElMessage.error("请选择要导出的点位");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- points = points.filter((point) => !!point.pos);
|
|
|
|
|
|
+ .map((option: any) => option.raw) as ScenePoint[];
|
|
|
|
+
|
|
|
|
+const addHandler = async () => {
|
|
|
|
+ const sceneCodes = scenes.value.map((scene) => scene.sceneCode);
|
|
|
|
+ await selectScenes({
|
|
|
|
+ sceneCodes: sceneCodes,
|
|
|
|
+ submit: async (nSceneCodes) => {
|
|
|
|
+ const requests: Promise<any>[] = [];
|
|
|
|
+ for (let i = 0; i < sceneCodes.length; i++) {
|
|
|
|
+ if (!nSceneCodes.includes(sceneCodes[i])) {
|
|
|
|
+ requests.push(delRelicsSceneFetch(relicsId.value, scenes.value[i].id));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (let i = 0; i < nSceneCodes.length; i++) {
|
|
|
|
+ if (!sceneCodes.includes(nSceneCodes[i])) {
|
|
|
|
+ requests.push(addSceneHandler(nSceneCodes[i]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if (points.length === 0) {
|
|
|
|
- ElMessage.error("当前选择点位没有gis信息");
|
|
|
|
- return;
|
|
|
|
|
|
+ await Promise.all(requests);
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ await refreshScenes();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const addSceneHandler = async (sceneCode: string) => {
|
|
|
|
+ const sceneTypes = ["SS", "KJ", "SG"];
|
|
|
|
+ if (sceneTypes.every((type) => !sceneCode.startsWith(type))) {
|
|
|
|
+ ElMessage.error("场景码不正确");
|
|
|
|
+ throw "场景码不正确";
|
|
|
|
+ } else {
|
|
|
|
+ await addRelicsSceneFetch(relicsId.value!, sceneCode);
|
|
}
|
|
}
|
|
- await downloadPointsXLSL(
|
|
|
|
- points.map((point) => point.pos),
|
|
|
|
- points.map((point) => ({ title: point.name, desc: point.name })),
|
|
|
|
- "test"
|
|
|
|
- );
|
|
|
|
- ElMessage.success("文件导出成功");
|
|
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|