Kaynağa Gözat

fix: 修改bug

bill 1 yıl önce
ebeveyn
işleme
78bfe7f4a2

+ 27 - 15
src/components/single-input.vue

@@ -1,7 +1,17 @@
 <template>
-  <el-dialog :model-value="visible" @update:model-value="(val) => emit('update:visible', val)" :title="title"
-    width="500">
-    <el-input v-model.trim="ivalue" :maxlength="100" show-word-limit type="textarea" :placeholder="placeholder" />
+  <el-dialog
+    :model-value="visible"
+    @update:model-value="(val) => emit('update:visible', val)"
+    :title="title"
+    width="500"
+  >
+    <el-input
+      v-model.trim="ivalue"
+      :maxlength="100"
+      show-word-limit
+      type="textarea"
+      :placeholder="placeholder"
+    />
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="emit('update:visible', false)">取消</el-button>
@@ -15,17 +25,19 @@
 import { ElMessage } from "element-plus";
 import { ref, watchEffect } from "vue";
 
-
-
-const props = withDefaults(defineProps<{
-  visible: boolean;
-  value: string;
-  title: string;
-  placeholder: string;
-  updateValue: (value: string) => void;
-}>(), {
-  placeholder: '请输入',
-})
+const props = withDefaults(
+  defineProps<{
+    visible: boolean;
+    value: string;
+    title: string;
+    name?: string;
+    placeholder: string;
+    updateValue: (value: string) => void;
+  }>(),
+  {
+    placeholder: "请输入",
+  }
+);
 const emit = defineEmits<{
   (e: "update:visible", visible: boolean): void;
 }>();
@@ -37,7 +49,7 @@ watchEffect(() => {
 
 const submit = async () => {
   if (ivalue.value.length === 0) {
-    return ElMessage.error("点位名称不能为空!");
+    return ElMessage.error(`${props.name || "点位"}名称不能为空!`);
   }
   await props.updateValue(ivalue.value);
   emit("update:visible", false);

+ 11 - 7
src/view/map/coord.vue

@@ -142,7 +142,7 @@
 </template>
 
 <script setup lang="ts">
-import { boardDataChange, queryMode } from "./install";
+import { boardDataChange, noValidPoint, queryMode, validScene } from "./install";
 import {
   Plus,
   Delete,
@@ -172,7 +172,7 @@ 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 { alert } from "@/helper/message";
+import { alert, confirm } from "@/helper/message";
 import {
   PolygonsPointAttrib,
   getWholeLineLinesByPointId,
@@ -208,12 +208,12 @@ const treeNode = computed(() =>
     id: scene.id,
     type: "scene",
     run: scene.calcStatus !== SceneStatus.SUCCESS,
-    disable: scene.scenePos.every((pos) => !pos.pos || pos.pos.length === 0),
+    disable: !validScene(scene),
     raw: scene,
     children: scene.scenePos.map((pos) => ({
       label: pos.uuid,
       run: scene.calcStatus !== SceneStatus.SUCCESS,
-      disable: !pos.pos || pos.pos.length === 0,
+      disable: noValidPoint(pos),
       id: pos.id,
       type: "point",
       raw: { ...pos, name: pos.name, cameraType: scene.cameraType },
@@ -236,7 +236,7 @@ watchEffect(() => {
 });
 
 const delScenesBeforeCheck = async (scenes: Scene[]) => {
-  if (scenes.length === 0) return true;
+  if (scenes.length === 0 || !(await confirm("确定要删除场景吗?"))) return true;
   for (const scene of scenes) {
     const que = scene.scenePos.some((pos) => {
       const id = pos.id.toString();
@@ -256,7 +256,6 @@ const addHandler = async () => {
     scenes: scenes.value,
     selfScenes: scenes.value.filter((scene) => scene.creationMethod === 2),
     submit: async (nScene) => {
-
       const requests: Promise<any>[] = [];
       const delScenes = sceneCodes
         .filter((sceneCode) => !nScene.some((scene) => scene.sceneCode === sceneCode))
@@ -362,12 +361,17 @@ onBeforeUnmount(() => {
     display: flex;
     flex-direction: column;
     justify-content: center;
-    width: 100%;
+    width: 90%;
+    overflow: hidden;
     flex-wrap: nowrap;
 
     .name {
       padding-left: 15px;
       color: #999;
+      display: block;
+      text-overflow: ellipsis; //文本溢出显示省略号
+      overflow: hidden;
+      white-space: nowrap; //文本不会换行
     }
   }
 

+ 3 - 3
src/view/map/install.ts

@@ -15,11 +15,11 @@ export const mapManage = createMap();
 mapManage.setCenter(defaultCenter);
 watchEffect(() => mapManage.setTileType(tileType.value));
 
-const noValidPoint = (pos: ScenePoint) => !pos.pos || pos.pos.length === 0;
-const validScene = (scene: Scene) => !scene.scenePos.every(noValidPoint);
+export const noValidPoint = (pos: ScenePoint) =>
+  !pos.pos || pos.pos.length === 0 || pos.pos.some((i) => !i);
+export const validScene = (scene: Scene) => !scene.scenePos.every(noValidPoint);
 
 export const flyScene = (scene: Scene) => {
-  console.log("flyScene", scene);
   const totalPos = [0, 0];
   let numCalc = 0;
   for (let i = 0; i < scene.scenePos.length; i++) {

+ 1 - 1
src/view/map/layout.vue

@@ -49,7 +49,7 @@
             </el-select>
           </div>
         </div>
-        <div class="map-bottom-out-pano">
+        <div class="map-bottom-out-pano" v-if="!isCoordPage">
           <div class="point-info">
             <div>
               <el-icon size="20" color="rgb(230, 162, 60)">

+ 3 - 1
src/view/map/pc4Helper.ts

@@ -9,6 +9,7 @@ import {
   downloadPointsXLSL1,
   downloadPointsXLSL2,
 } from "@/util/pc4xlsl";
+import { noValidPoint } from "./install";
 
 export const exportFile = async (
   points: ScenePoint[],
@@ -20,7 +21,8 @@ export const exportFile = async (
     return;
   }
   name = name ? name + "-" : "";
-  points = points.filter((point) => !!point.pos);
+
+  points = points.filter((point) => !noValidPoint(point));
 
   if (points.length === 0) {
     ElMessage.error("当前选择点位没有gis信息");

+ 11 - 2
src/view/map/polygons.vue

@@ -61,7 +61,8 @@
       :value="selectItem.name || ''"
       :update-value="(name) => boardDataChange(() => (selectItem.name = name))"
       placeholder="请输入"
-      title="修改边界名称"
+      title="矢量图名称"
+      name="矢量图"
     />
   </Teleport>
 </template>
@@ -77,6 +78,7 @@ import { getWholeLinePolygonPoints } from "drawing-board";
 import { board, boardDataChange, mapManage, queryMode } from "./install";
 import { confirm } from "@/helper/message";
 import picpenIcon from "@/assets/pic_pen.svg";
+import { ElMessage } from "element-plus";
 
 const boardStatus = board.polygon.status;
 const selectId = ref<string>();
@@ -116,6 +118,7 @@ const cleanupEdit = shallowRef<() => void>();
 const enterEdit = () => {
   cleanupEdit.value && cleanupEdit.value();
   const quitEdit = board.polygon.editPolygon(selectId.value);
+  const id = board.polygon.status.editPolygonId;
   let needUpdate = false;
   const stopWatch = watch(
     () => currentItem.value,
@@ -127,6 +130,11 @@ const enterEdit = () => {
     quitEdit();
     selectChange(null);
     stopWatch();
+    const points = getWholeLinePolygonPoints(board.polygon.attrib, id);
+    if (points.length <= 2) {
+      board.polygon.removePolygon(id);
+      ElMessage.error("请至少绘制3个点");
+    }
     needUpdate && boardDataChange();
     cleanupEdit.value = null;
   };
@@ -164,9 +172,10 @@ const handleDownload = async (item: any) => {
     return pos;
   });
   const dists = polygonPoints.map((p) => ({
-    title: p.id,
+    title: p.title || p.id,
     desc: p.title || p.id,
   }));
+  console.log(dists, polygonPoints);
   await downloadPointsXLSL1(
     points,
     dists,

+ 5 - 2
src/view/pano/pano.vue

@@ -14,7 +14,7 @@
         size="large"
         style="margin-right: 20px; width: 100px"
         @click="copyGis"
-        v-if="point?.pos && point.pos.length"
+        v-if="point && !noValidPoint(point)"
       >
         复制经纬度
       </el-button>
@@ -57,6 +57,7 @@ import { ElMessage } from "element-plus";
 import saveAs from "@/util/file-serve";
 import { DeviceType } from "@/store/device";
 import { initRelics, relics } from "@/store/relics";
+import { noValidPoint } from "../map/install";
 
 type Params = { pid?: string; relicsId?: string } | null;
 const params = computed(() => router.currentRoute.value.params as Params);
@@ -165,7 +166,9 @@ const photo = async () => {
   const ration = 3;
   setSize(ration, 1920, 1080);
   let dataURL = panoDomRef.value.toDataURL("image/jpg", 1);
-  dataURL = await addWatermark(dataURL, ration);
+  if (!noValidPoint(point.value)) {
+    dataURL = await addWatermark(dataURL, ration);
+  }
 
   await saveAs(dataURL, `${relics.value?.name}.jpg`);
   ElMessage.success("图片导出成功");

+ 6 - 3
src/view/relics.vue

@@ -101,7 +101,9 @@
               link
               type="primary"
               size="small"
-              @click="router.push({ name: 'map', params: { relicsId: row.relicsId } })"
+              @click="
+                router.push({ name: COORD_NAME, params: { relicsId: row.relicsId } })
+              "
             >
               数据提取
             </el-button>
@@ -141,11 +143,12 @@ import {
   relicsTypeDesc,
   creationMethodDesc,
 } from "@/store/relics";
-import { router } from "@/router";
+import { COORD_NAME, router } from "@/router";
 import { ElMessageBox } from "element-plus";
 import { relicsEdit } from "./quisk";
 import TexToolTip from "@/components/tex-tooltip.vue";
 import { debounce } from "@/util";
+import { QUERY_COORD_NAME } from "@/router";
 
 const initProps: RelicsPageProps = {
   pageNum: 1,
@@ -171,7 +174,7 @@ const delHandler = async (relicsId: number) => {
   }
 };
 const getQueryRouteLocation = (row: Relics) =>
-  router.resolve({ name: "query-map", params: { relicsId: row.relicsId } });
+  router.resolve({ name: QUERY_COORD_NAME, params: { relicsId: row.relicsId } });
 
 const shareHandler = async (row: Relics) => {
   const link = location.origin + location.pathname + getQueryRouteLocation(row).href;