浏览代码

导出确权pdf

shuhao 5 月之前
父节点
当前提交
aea08e72e4
共有 2 个文件被更改,包括 56 次插入27 次删除
  1. 28 27
      src/views/authentic/Pdf.vue
  2. 28 0
      src/views/authentic/pdfMap.js

+ 28 - 27
src/views/authentic/Pdf.vue

@@ -7,11 +7,11 @@
       @close="closeDialog()"
       @close="closeDialog()"
   >
   >
     <div  class="pdf-main">
     <div  class="pdf-main">
+      <div class="title" >
+        <div class="name" ></div>
+        <div class="pdf-close cursor-pointer" @click="closeDialog"></div>
+      </div>
       <div id="printTest" class="pdf-dialog-box">
       <div id="printTest" class="pdf-dialog-box">
-        <div class="title" >
-          <div class="name" ></div>
-          <div class="pdf-close cursor-pointer" @click="closeDialog"></div>
-        </div>
         <div class="pdf-my-body"  >
         <div class="pdf-my-body"  >
         <div class="pdfBox" >
         <div class="pdfBox" >
           <div class="a4" >
           <div class="a4" >
@@ -47,10 +47,10 @@
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
-        <div style="text-align: left">
-          <el-button size="large" color="#626aef"    v-print="'#printTest'">打印</el-button>
-<!--          <el-button size="large" color="#626aef"  @click="closeDialog">关闭</el-button>-->
-        </div>
+      </div>
+      <div style="text-align: left">
+        <el-button size="large" color="#626aef"  v-print="printObj">打印</el-button>
+        <!--          <el-button size="large" color="#626aef"  @click="closeDialog">关闭</el-button>-->
       </div>
       </div>
 
 
     </div>
     </div>
@@ -61,7 +61,6 @@
 import {reactive, ref, toRefs, computed, nextTick, onMounted} from "vue";
 import {reactive, ref, toRefs, computed, nextTick, onMounted} from "vue";
 import {useStore} from "vuex";
 import {useStore} from "vuex";
 import {WKT} from "ol/format";
 import {WKT} from "ol/format";
-import html2canvas from "html2canvas"
 import PdfMap from "./pdfMap";
 import PdfMap from "./pdfMap";
 import { dateFormat } from "@/utils/date_util";
 import { dateFormat } from "@/utils/date_util";
 import {getAreaByWkt} from "../../utils/map";
 import {getAreaByWkt} from "../../utils/map";
@@ -89,6 +88,21 @@ const props = defineProps({
   }
   }
 });
 });
 
 
+let printObj = {
+  id:"printTest",
+  popTitle: 'good print',
+  beforeOpenCallback (vue) {
+    toImg(pdfMap.kmap.map)
+    console.log('打开之前')
+  },
+  openCallback (vue) {
+    console.log('执行了打印')
+  },
+  closeCallback (vue) {
+    console.log('关闭了打印工具')
+  }
+}
+
 let imgUrl = ref(null)
 let imgUrl = ref(null)
 const executor = ref([])
 const executor = ref([])
 const executorList = ref([])
 const executorList = ref([])
@@ -111,15 +125,6 @@ function  toImg(map) {
 }
 }
 
 
 
 
-/**表单验证规则
- * @description:
- * @param {*} computed
- * @return {*}
- */
-const rules = computed(() => ({
-}));
-
-
 let pdfMap = new PdfMap()
 let pdfMap = new PdfMap()
 let rowData = ref({})
 let rowData = ref({})
 
 
@@ -130,12 +135,8 @@ onMounted(()=>{
     data.area = getAreaByWkt(data.geom)
     data.area = getAreaByWkt(data.geom)
     rowData.value = data
     rowData.value = data
     pdfMap.initMap(data,mapRef.value)
     pdfMap.initMap(data,mapRef.value)
-    setTimeout(function(){
-      toImg(pdfMap.kmap.map)
-    },2000)
   })
   })
 })
 })
-
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
@@ -152,11 +153,6 @@ $body-height:calc(100% - $title-height);
   border-radius: 4px;
   border-radius: 4px;
   border: 2px solid rgba(81,233,240,0.6);
   border: 2px solid rgba(81,233,240,0.6);
   position: absolute;
   position: absolute;
-}
-.pdf-dialog-box{
-  font-family: PingFangSC-Regular, PingFang SC;
-  width: 100%;
-  height: 100%;
   .title{
   .title{
     width: 100%;
     width: 100%;
     height: $title-height;
     height: $title-height;
@@ -181,6 +177,11 @@ $body-height:calc(100% - $title-height);
       background-size: 100% 100%;
       background-size: 100% 100%;
     }
     }
   }
   }
+}
+.pdf-dialog-box{
+  font-family: PingFangSC-Regular, PingFang SC;
+  width: 100%;
+  height: 100%;
   .pdf-my-body{
   .pdf-my-body{
     width: 100%;
     width: 100%;
     height: $body-height;
     height: $body-height;

+ 28 - 0
src/views/authentic/pdfMap.js

@@ -95,6 +95,7 @@ class PdfMap {
     this.kmap.addLayer(this.clickPointLayer.layer);
     this.kmap.addLayer(this.clickPointLayer.layer);
     this.kmap.addLayer(this.locationLayer.layer);
     this.kmap.addLayer(this.locationLayer.layer);
     this.getSelectPointArr(data.id)
     this.getSelectPointArr(data.id)
+    this.lock(false)
   }
   }
 
 
   getSelectPointArr(id) {
   getSelectPointArr(id) {
@@ -128,6 +129,33 @@ class PdfMap {
     );
     );
     this.clickPointLayer.source.addFeatures(arrPoints);
     this.clickPointLayer.source.addFeatures(arrPoints);
   }
   }
+
+  lock(lockval) {
+    let pan;
+    let mousezoom;
+    this.kmap.map.getInteractions().forEach(function (element) {
+      if (element instanceof DragPan)//获取 控制能否使用鼠标,手指拖动地图的对象
+        pan = element;
+      if(element instanceof MouseWheelZoom)//获取 控制能否使用滚轮滚动放大缩小地图的对象
+        mousezoom = element;
+      if (pan) {
+        if (lockval) {
+          pan.setActive(true);//此对象的setActive方法用来设置是否可以拖动滚动查看
+        }
+        else {
+          pan.setActive(false);
+        }
+      }
+      if (mousezoom) {
+        if (lockval) {
+          mousezoom.setActive(true);
+        }
+        else {
+          mousezoom.setActive(false);
+        }
+      }
+    });
+  }
 }
 }
 
 
 export default PdfMap;
 export default PdfMap;