工具条添加打印功能
Showing
11 changed files
with
159 additions
and
4 deletions
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff could not be displayed because it is too large.
... | @@ -6,6 +6,104 @@ | ... | @@ -6,6 +6,104 @@ |
6 | "description": "", | 6 | "description": "", |
7 | "glyphs": [ | 7 | "glyphs": [ |
8 | { | 8 | { |
9 | "icon_id": "19479731", | ||
10 | "name": "打印", | ||
11 | "font_class": "dayin", | ||
12 | "unicode": "e7af", | ||
13 | "unicode_decimal": 59311 | ||
14 | }, | ||
15 | { | ||
16 | "icon_id": "19449217", | ||
17 | "name": "饼图", | ||
18 | "font_class": "bingtu", | ||
19 | "unicode": "e7a6", | ||
20 | "unicode_decimal": 59302 | ||
21 | }, | ||
22 | { | ||
23 | "icon_id": "19449218", | ||
24 | "name": "快捷入口", | ||
25 | "font_class": "kuaijierukou", | ||
26 | "unicode": "e7a7", | ||
27 | "unicode_decimal": 59303 | ||
28 | }, | ||
29 | { | ||
30 | "icon_id": "19449219", | ||
31 | "name": "展开", | ||
32 | "font_class": "zhankai2", | ||
33 | "unicode": "e7a8", | ||
34 | "unicode_decimal": 59304 | ||
35 | }, | ||
36 | { | ||
37 | "icon_id": "19449220", | ||
38 | "name": "展开ing", | ||
39 | "font_class": "zhankaiing", | ||
40 | "unicode": "e7a9", | ||
41 | "unicode_decimal": 59305 | ||
42 | }, | ||
43 | { | ||
44 | "icon_id": "19449221", | ||
45 | "name": "下载", | ||
46 | "font_class": "xiazai1", | ||
47 | "unicode": "e7aa", | ||
48 | "unicode_decimal": 59306 | ||
49 | }, | ||
50 | { | ||
51 | "icon_id": "19449222", | ||
52 | "name": "通知公告", | ||
53 | "font_class": "tongzhigonggao", | ||
54 | "unicode": "e7ab", | ||
55 | "unicode_decimal": 59307 | ||
56 | }, | ||
57 | { | ||
58 | "icon_id": "19449223", | ||
59 | "name": "梯状数据", | ||
60 | "font_class": "tizhuangshuju", | ||
61 | "unicode": "e7ac", | ||
62 | "unicode_decimal": 59308 | ||
63 | }, | ||
64 | { | ||
65 | "icon_id": "19449224", | ||
66 | "name": "工作箱", | ||
67 | "font_class": "gongzuoxiang", | ||
68 | "unicode": "e7ad", | ||
69 | "unicode_decimal": 59309 | ||
70 | }, | ||
71 | { | ||
72 | "icon_id": "19449225", | ||
73 | "name": "汇交成果", | ||
74 | "font_class": "huijiaochengguo", | ||
75 | "unicode": "e7ae", | ||
76 | "unicode_decimal": 59310 | ||
77 | }, | ||
78 | { | ||
79 | "icon_id": "19448838", | ||
80 | "name": "行政区ing", | ||
81 | "font_class": "hangzhengquing", | ||
82 | "unicode": "e7a2", | ||
83 | "unicode_decimal": 59298 | ||
84 | }, | ||
85 | { | ||
86 | "icon_id": "19448839", | ||
87 | "name": "地籍区", | ||
88 | "font_class": "dijiqu", | ||
89 | "unicode": "e7a3", | ||
90 | "unicode_decimal": 59299 | ||
91 | }, | ||
92 | { | ||
93 | "icon_id": "19448840", | ||
94 | "name": "行政区", | ||
95 | "font_class": "hangzhengqu", | ||
96 | "unicode": "e7a4", | ||
97 | "unicode_decimal": 59300 | ||
98 | }, | ||
99 | { | ||
100 | "icon_id": "19448841", | ||
101 | "name": "国有", | ||
102 | "font_class": "guoyou", | ||
103 | "unicode": "e7a5", | ||
104 | "unicode_decimal": 59301 | ||
105 | }, | ||
106 | { | ||
9 | "icon_id": "19383167", | 107 | "icon_id": "19383167", |
10 | "name": "树目录", | 108 | "name": "树目录", |
11 | "font_class": "shumulu", | 109 | "font_class": "shumulu", | ... | ... |
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
No preview for this file type
... | @@ -176,6 +176,45 @@ export default { | ... | @@ -176,6 +176,45 @@ export default { |
176 | clearPostionLayer(viewId){ | 176 | clearPostionLayer(viewId){ |
177 | var view = maps[viewId]; | 177 | var view = maps[viewId]; |
178 | view.graphics.removeAll(); | 178 | view.graphics.removeAll(); |
179 | }, | ||
180 | //打印地图 | ||
181 | printMap(viewId,outSpatialReference,serverUrl,priTemParames,callBackFunction){ | ||
182 | var self = this; | ||
183 | loadModules([ | ||
184 | "esri/tasks/PrintTask", | ||
185 | "esri/tasks/support/PrintParameters", | ||
186 | "esri/tasks/support/PrintTemplate" | ||
187 | ]).then(([ | ||
188 | PrintTask, | ||
189 | PrintParameters, | ||
190 | PrintTemplate | ||
191 | ]) => { | ||
192 | var view = maps[viewId], | ||
193 | printTask = new PrintTask({ | ||
194 | url:serverUrl | ||
195 | }), | ||
196 | template = new PrintTemplate({ | ||
197 | layout:priTemParames.layOut, | ||
198 | format:priTemParames.format, | ||
199 | layoutOptions: { | ||
200 | titleText:priTemParames.title, | ||
201 | scalebarUnit:'Meters', | ||
202 | authorText:priTemParames.author | ||
203 | } | ||
204 | }), | ||
205 | paramets = new PrintParameters({ | ||
206 | view:view, | ||
207 | template:template | ||
208 | }); | ||
209 | paramets.outSpatialReference = outSpatialReference ? outSpatialReference : view.spatialReference; | ||
210 | printTask.execute(paramets).then(res => { | ||
211 | if(callBackFunction && typeof callBackFunction == 'function'){ | ||
212 | callBackFunction(res); | ||
213 | } | ||
214 | }); | ||
215 | }).catch(err => { | ||
216 | console.log(err); | ||
217 | }) | ||
179 | } | 218 | } |
180 | } | 219 | } |
181 | } | 220 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -38,11 +38,15 @@ | ... | @@ -38,11 +38,15 @@ |
38 | <span>缩小</span> | 38 | <span>缩小</span> |
39 | </li> | 39 | </li> |
40 | <li @click="info"> | 40 | <li @click="info"> |
41 | <i class="iconfont iconxinxi"></i> | 41 | <i class="iconfont iconshibie"></i> |
42 | <span>识别</span> | 42 | <span>识别</span> |
43 | </li> | 43 | </li> |
44 | <li @click="print"> | ||
45 | <i class="iconfont iconxinxi"></i> | ||
46 | <span>打印</span> | ||
47 | </li> | ||
44 | <li @click="clear"> | 48 | <li @click="clear"> |
45 | <i class="iconfont iconqingchu"></i> | 49 | <i class="iconfont icondayin"></i> |
46 | <span>清除</span> | 50 | <span>清除</span> |
47 | </li> | 51 | </li> |
48 | </ul> | 52 | </ul> |
... | @@ -59,6 +63,9 @@ | ... | @@ -59,6 +63,9 @@ |
59 | </el-form-item> | 63 | </el-form-item> |
60 | </el-form> | 64 | </el-form> |
61 | </div> | 65 | </div> |
66 | <el-dialog title="地图打印" :visible.sync="printDialog" :close-on-click-modal="false" width="30%"> | ||
67 | <print-template :viewId='viewId'></print-template> | ||
68 | </el-dialog> | ||
62 | </div> | 69 | </div> |
63 | </template> | 70 | </template> |
64 | <script> | 71 | <script> |
... | @@ -71,6 +78,8 @@ import mapTools from "./js/mapTools"; | ... | @@ -71,6 +78,8 @@ import mapTools from "./js/mapTools"; |
71 | 78 | ||
72 | import {loadModules} from "esri-loader" | 79 | import {loadModules} from "esri-loader" |
73 | 80 | ||
81 | import printTemplate from './printTemplate.vue' | ||
82 | |||
74 | export default { | 83 | export default { |
75 | props:{ | 84 | props:{ |
76 | viewId:{ | 85 | viewId:{ |
... | @@ -90,9 +99,13 @@ export default { | ... | @@ -90,9 +99,13 @@ export default { |
90 | x:"", | 99 | x:"", |
91 | y:"" | 100 | y:"" |
92 | }, | 101 | }, |
93 | isPostion:false | 102 | isPostion:false, |
103 | printDialog:false | ||
94 | } | 104 | } |
95 | }, | 105 | }, |
106 | components:{ | ||
107 | printTemplate | ||
108 | }, | ||
96 | methods:{ | 109 | methods:{ |
97 | fullMap(){ | 110 | fullMap(){ |
98 | var view = maps[this.viewId]; | 111 | var view = maps[this.viewId]; |
... | @@ -129,7 +142,9 @@ export default { | ... | @@ -129,7 +142,9 @@ export default { |
129 | },true,'all',3,view.extent); | 142 | },true,'all',3,view.extent); |
130 | }); | 143 | }); |
131 | }, | 144 | }, |
132 | 145 | print(){ | |
146 | this.printDialog = true; | ||
147 | }, | ||
133 | zoomOut(){ | 148 | zoomOut(){ |
134 | var view = maps[this.viewId]; | 149 | var view = maps[this.viewId]; |
135 | this.initDraw("rectangle",this.viewId,null,function(geo){ | 150 | this.initDraw("rectangle",this.viewId,null,function(geo){ |
... | @@ -227,5 +242,8 @@ export default { | ... | @@ -227,5 +242,8 @@ export default { |
227 | top: 58px; | 242 | top: 58px; |
228 | } | 243 | } |
229 | } | 244 | } |
245 | /deep/ .v-modal{ | ||
246 | z-index:10 | ||
247 | } | ||
230 | 248 | ||
231 | </style> | 249 | </style> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment