Browse Source

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-pc-vue

wangsisi 4 months ago
parent
commit
41b1308b11
1 changed files with 7 additions and 8 deletions
  1. 7 8
      src/views/authentic/Pdf.vue

+ 7 - 8
src/views/authentic/Pdf.vue

@@ -98,8 +98,7 @@ let printObj = {
   id:"printTest",
   popTitle: 'good print',
   beforeOpenCallback (vue) {
-    toImg(pdfMap.kmap.map)
-
+    toImg(true)
     console.log('打开之前')
   },
   openCallback (vue) {
@@ -127,10 +126,12 @@ const closeDialog = (key) => {
   }
   emit("closeDialog", "pdf");
 };
-function toImg() {
+function toImg(show) {
   let canvas = pdfMap.kmap.map.getViewport().querySelector('canvas')
   let dataURL = canvas.toDataURL('image/png');
-  imgUrl.value = dataURL;
+  if(show){
+    imgUrl.value = dataURL;
+  }
 }
 
 
@@ -139,10 +140,8 @@ onMounted(()=>{
     data.createDate = dateFormat(new Date(), "YYYY-mm-dd HH:MM:SS");
     data.area = getAreaByWkt(data.geom)
     rowData.value = data
-    pdfMap.initMap(data,mapRef.value);
-    setTimeout(()=>{
-      toImg(pdfMap.kmap.map)
-    },500)
+    pdfMap.initMap(data,mapRef.value)
+    toImg(false)
   })
 })
 </script>