Browse Source

fix: download

gemercheung 1 year ago
parent
commit
acd54e2ded

+ 1 - 1
src/submodule

@@ -1 +1 @@
-Subproject commit 30a7b241e2e64e3edb10cb20a057fdbbac88245a
+Subproject commit e5b60b68a0bb8e2ba2d65f11848d21407d9e5a60

+ 0 - 31
src/util/pc4xlsl.ts

@@ -87,34 +87,3 @@ export const downloadPointsXLSL = async (
 };
 
 
-export const downloadPointsPolys = async (
-  points: {
-    x: number
-    y: number
-    rtk: false
-    title: string
-    id: string
-  }[],
-  desc: { title: string; desc: string }[] = [],
-  name: string
-) => {
-  const tabs = points.map((point, i) => {
-    const des = desc[i] || { title: "无", desc: "无" };
-    return {
-      // fid: i.toString(),
-      title: des.title,
-      rtk: point.rtk,
-      id: point.id,
-      x: point.x,
-      y: point.y,
-    };
-  });
-
-  const data = await fetch(basePath + URL.exportCoordinateData, {
-    headers: gHeaders,
-    method: "post",
-    body: JSON.stringify(tabs),
-  }).then((res) => res.blob());
-
-  return saveAs(data, `${name}.xls`);
-};

+ 1 - 2
src/view/map/board/polygons.ts

@@ -10,7 +10,7 @@ import {
   shapeParentsEq,
   openEntityDrag,
   WholeLineInc,
-  wholeLineDelLineByPointIds,
+  // wholeLineDelLineByPointIds,
 } from "drawing-board";
 import { Group } from "konva/lib/Group";
 import { Path } from "konva/lib/shapes/Path";
@@ -284,7 +284,6 @@ export class Polygons extends PenEditWholeLine<PolygonsAttrib & Attrib> {
       }
     });
   }
-
   destory(): void {
     super.destory();
     this.container.stage.off("mousemove.anchor-move click.anchor-move");

+ 12 - 12
src/view/map/map-board.vue

@@ -104,6 +104,7 @@ const autoInitPos = () => {
   }
 };
 const flyPos = (pos: number[]) => mapManage.map.getView().setCenter(pos);
+
 const flyScene = (scene: Scene) => {
   const totalPos = [0, 0];
   let numCalc = 0;
@@ -280,7 +281,6 @@ watch(
       initPolyTabData();
     }
     if (oldTab == 1 && tab === 0) {
-      console.log('1-0')
       initCroodTabdata();
     }
   },
@@ -305,7 +305,7 @@ const initPolyTabData = async () => {
     setTimeout(async () => {
       const res = await getDrawingDetailFetch(String(relicsId.value));
       const points = scenePosTransform(scenes.value);
-      console.log("res", points, res.data);
+      // console.log("res", points, res.data);
       if (res.data) {
         boardData.value = res.data;
         boardData.value.points = points.concat(res.data.points)
@@ -333,16 +333,16 @@ const handlePolysEdit = (item: PolyDataType) => {
   handleSyncDataToServer();
 };
 
-const clearPolys = async () => {
-  await addOrUpdateDrawingFetch({
-    relicsId: String(relicsId.value),
-    data: {
-      points: [],
-      polygons: [],
-      lines: [],
-    },
-  });
-};
+// const clearPolys = async () => {
+//   await addOrUpdateDrawingFetch({
+//     relicsId: String(relicsId.value),
+//     data: {
+//       points: [],
+//       polygons: [],
+//       lines: [],
+//     },
+//   });
+// };
 </script>
 
 <style lang="scss">

+ 10 - 5
src/view/map/map-right-poly.vue

@@ -44,7 +44,10 @@ import {
     Edit,
 } from "@element-plus/icons-vue";
 import SingleInput from "@/components/single-input.vue";
-import { downloadPointsPolys } from "@/util/pc4xlsl";
+import { scenePosTransform } from "./board";
+import { downloadPointsXLSL2 } from "@/util/pc4xlsl";
+import { scenes } from "@/store/scene";
+
 import { relics } from "@/store/relics";
 import { ElMessageBox } from "element-plus";
 
@@ -98,10 +101,12 @@ const handleDownload = async () => {
             })
         })
     });
-    console.log('points', points)
-    console.log('handleDownload');
-    
-    // await downloadPointsPolys(points, [{ title: "xx", desc: "xxxx" }], 'xx');
+
+    points.map(item => (item.rtk = true))
+    const transPoints = scenePosTransform(scenes.value);
+    console.log('handleDownload', points, transPoints);
+    await downloadPointsXLSL2(points, [{ title: "", desc: "" }], "本体边界坐标");
+    // await downloadPointsXLSL2(points, [{ title: "xx", desc: "xxxx" }], 'xx');
 } 
 </script>
 

+ 7 - 3
src/view/map/map-right.vue

@@ -78,8 +78,7 @@
     </div>
 
     <template v-if="router.currentRoute.value.name === 'map'">
-      <el-button type="primary" :icon="Download" style="width: 100%"
-        @click="exportFile(getSelectPoints(), 2, relics?.name)">
+      <el-button type="primary" :icon="Download" style="width: 100%" @click="handlerExport(2, relics?.name)">
         导出本体边界坐标
       </el-button>
       <el-button type="primary" :icon="Download" style="width: 100%; margin-top: 20px; margin-left: 0"
@@ -183,7 +182,6 @@ const addHandler = async () => {
         .map((sceneCode) => scenes.value.find((scene) => scene.sceneCode === sceneCode)!);
 
       delScenes.length && requests.push(delRelicsScenes(delScenes));
-
       const addScenes = nScene.filter(({ sceneCode }) => !sceneCodes.includes(sceneCode));
       addScenes.length && requests.push(addSceneHandler(addScenes));
 
@@ -209,6 +207,12 @@ const addSceneHandler = async (scenes: Pick<Scene, "sceneId" | "sceneCode">[]) =
     relicsId.value!,
     scenes.map((item) => ({ sceneCode: item.sceneCode, id: item.sceneId }))
   );
+
+const handlerExport = (type: number, name: string) => {
+  console.log('type', type, name)
+  console.log('getSelectPoints', getSelectPoints())
+  exportFile(getSelectPoints(), type, name)
+}
 </script>