caed718b by 杨威

工具条添加打印功能

1 parent 7c9cc085
This diff could not be displayed because it is too large.
......@@ -6,6 +6,104 @@
"description": "",
"glyphs": [
{
"icon_id": "19479731",
"name": "打印",
"font_class": "dayin",
"unicode": "e7af",
"unicode_decimal": 59311
},
{
"icon_id": "19449217",
"name": "饼图",
"font_class": "bingtu",
"unicode": "e7a6",
"unicode_decimal": 59302
},
{
"icon_id": "19449218",
"name": "快捷入口",
"font_class": "kuaijierukou",
"unicode": "e7a7",
"unicode_decimal": 59303
},
{
"icon_id": "19449219",
"name": "展开",
"font_class": "zhankai2",
"unicode": "e7a8",
"unicode_decimal": 59304
},
{
"icon_id": "19449220",
"name": "展开ing",
"font_class": "zhankaiing",
"unicode": "e7a9",
"unicode_decimal": 59305
},
{
"icon_id": "19449221",
"name": "下载",
"font_class": "xiazai1",
"unicode": "e7aa",
"unicode_decimal": 59306
},
{
"icon_id": "19449222",
"name": "通知公告",
"font_class": "tongzhigonggao",
"unicode": "e7ab",
"unicode_decimal": 59307
},
{
"icon_id": "19449223",
"name": "梯状数据",
"font_class": "tizhuangshuju",
"unicode": "e7ac",
"unicode_decimal": 59308
},
{
"icon_id": "19449224",
"name": "工作箱",
"font_class": "gongzuoxiang",
"unicode": "e7ad",
"unicode_decimal": 59309
},
{
"icon_id": "19449225",
"name": "汇交成果",
"font_class": "huijiaochengguo",
"unicode": "e7ae",
"unicode_decimal": 59310
},
{
"icon_id": "19448838",
"name": "行政区ing",
"font_class": "hangzhengquing",
"unicode": "e7a2",
"unicode_decimal": 59298
},
{
"icon_id": "19448839",
"name": "地籍区",
"font_class": "dijiqu",
"unicode": "e7a3",
"unicode_decimal": 59299
},
{
"icon_id": "19448840",
"name": "行政区",
"font_class": "hangzhengqu",
"unicode": "e7a4",
"unicode_decimal": 59300
},
{
"icon_id": "19448841",
"name": "国有",
"font_class": "guoyou",
"unicode": "e7a5",
"unicode_decimal": 59301
},
{
"icon_id": "19383167",
"name": "树目录",
"font_class": "shumulu",
......
......@@ -176,6 +176,45 @@ export default {
clearPostionLayer(viewId){
var view = maps[viewId];
view.graphics.removeAll();
},
//打印地图
printMap(viewId,outSpatialReference,serverUrl,priTemParames,callBackFunction){
var self = this;
loadModules([
"esri/tasks/PrintTask",
"esri/tasks/support/PrintParameters",
"esri/tasks/support/PrintTemplate"
]).then(([
PrintTask,
PrintParameters,
PrintTemplate
]) => {
var view = maps[viewId],
printTask = new PrintTask({
url:serverUrl
}),
template = new PrintTemplate({
layout:priTemParames.layOut,
format:priTemParames.format,
layoutOptions: {
titleText:priTemParames.title,
scalebarUnit:'Meters',
authorText:priTemParames.author
}
}),
paramets = new PrintParameters({
view:view,
template:template
});
paramets.outSpatialReference = outSpatialReference ? outSpatialReference : view.spatialReference;
printTask.execute(paramets).then(res => {
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(res);
}
});
}).catch(err => {
console.log(err);
})
}
}
}
\ No newline at end of file
......
......@@ -38,11 +38,15 @@
<span>缩小</span>
</li>
<li @click="info">
<i class="iconfont iconxinxi"></i>
<i class="iconfont iconshibie"></i>
<span>识别</span>
</li>
<li @click="print">
<i class="iconfont iconxinxi"></i>
<span>打印</span>
</li>
<li @click="clear">
<i class="iconfont iconqingchu"></i>
<i class="iconfont icondayin"></i>
<span>清除</span>
</li>
</ul>
......@@ -59,6 +63,9 @@
</el-form-item>
</el-form>
</div>
<el-dialog title="地图打印" :visible.sync="printDialog" :close-on-click-modal="false" width="30%">
<print-template :viewId='viewId'></print-template>
</el-dialog>
</div>
</template>
<script>
......@@ -71,6 +78,8 @@ import mapTools from "./js/mapTools";
import {loadModules} from "esri-loader"
import printTemplate from './printTemplate.vue'
export default {
props:{
viewId:{
......@@ -90,9 +99,13 @@ export default {
x:"",
y:""
},
isPostion:false
isPostion:false,
printDialog:false
}
},
components:{
printTemplate
},
methods:{
fullMap(){
var view = maps[this.viewId];
......@@ -129,7 +142,9 @@ export default {
},true,'all',3,view.extent);
});
},
print(){
this.printDialog = true;
},
zoomOut(){
var view = maps[this.viewId];
this.initDraw("rectangle",this.viewId,null,function(geo){
......@@ -227,5 +242,8 @@ export default {
top: 58px;
}
}
/deep/ .v-modal{
z-index:10
}
</style>
\ No newline at end of file
......