|
@@ -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>
|