map.vue
20 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
<template>
<div class="testMap">
<div class="mapTools">
<mapTools :viewId="viewId"></mapTools>
</div>
<EsriMap :viewId = "viewId" :afterLoaderFunction="addLayer"></EsriMap>
<div class="searchDiv">
<el-input placeholder="请输入宗地代码或不动产单元号" clearable @focus = "isShowCondition = true" v-model="inputBsm"> <el-button slot="append" type="primary" icon="el-icon-search" @click="doSearch"></el-button> </el-input>
<!-- 搜索条件选择 -->
<div class="searchCondition" v-if="isShowCondition">
<ul>
<li @click="fieldName = 'ZDDM'">
<span :class="fieldName == 'ZDDM'?'active':''">
<i class="iconfont iconzongdidaima"></i>
<span>宗地代码</span>
</span>
</li>
<li @click="fieldName = 'BDCDYH'">
<span :class="fieldName == 'BDCDYH'?'active':''">
<i class="iconfont iconbudongchandanyuanhao"></i>
<span>不动产单元号</span>
</span>
</li>
</ul>
</div>
<!--搜索弹出框-->
<div class="searchResult" v-show="dialogVisible">
<div class="-header">
<span class="title">共有搜索结果 {{totalResults}}条</span>
<span class="closeButton">
<i class="close el-icon-close" @click="closeResultDialog"></i>
</span>
</div>
<el-card class="box-card">
<div slot="header" class="clearfix" v-show="resultLayers.length > 1">
<!-- 图层选择-->
<span class="formTitle">图层选择:</span>
<el-select v-model="selectResLayerId" size="mini" @change="selectLayerChange" placeholder="请选择">
<el-option
v-for="(item,index) in resultLayers"
:key="index"
:label="item.label"
:value="item.id"
>
</el-option>
</el-select>
</div>
<!-- 数据结果-->
<div class="text item" v-for="(item,index) in features" :key="index">
<P>
<span class="title"><i class="iconfont iconxinxi"></i> 基本信息</span>
<a href="#" @click="toMap(item)">缩放至</a>
</P>
<hr/>
<!-- <div class="contentItem" v-for="(value,key,index) in item.attributes" :key="index">
<span class="key">{{key}}:</span>
<span class="value" :title="value">{{value == 'Null' ?"":value}}</span>
</div> -->
<div class="contentItem">
<span class="key">宗地代码:</span>
<span class="value" :title="item.attributes['宗地代码']">{{item.attributes['宗地代码'] == 'Null'?"":item.attributes['宗地代码']}}</span>
</div>
<div class="contentItem">
<span class="key">不动产单元号:</span>
<span class="value" :title="item.attributes['不动产单元号']">{{item.attributes['不动产单元号'] == 'Null'?"":item.attributes['不动产单元号']}}</span>
</div>
<div class="contentItem">
<span class="key">项目名称:</span>
<span class="value" :title="item.attributes['项目名称']">{{item.attributes['项目名称'] == 'Null'?"":item.attributes['项目名称']}}</span>
</div>
<div class="contentItem">
<span class="key">不动产证号:</span>
<span class="value" :title="item.attributes['不动产证号']">{{item.attributes['不动产证号'] == 'Null'?"":item.attributes['不动产证号']}}</span>
</div>
<div class="contentItem">
<span class="key">权利人:</span>
<span class="value" :title="item.attributes['QLR']">{{item.attributes['QLR'] == 'Null'?"":item.attributes['QLR']}}</span>
</div>
<div class="contentItem">
<span class="key">坐落:</span>
<span class="value" :title="item.attributes['坐落']">{{item.attributes['坐落'] == 'Null'?"":item.attributes['坐落']}}</span>
</div>
</div>
</el-card>
</div>
</div>
<!-- 侧边栏 -->
<div class="rightSide">
<side-tools :viewId="viewId"></side-tools>
</div>
<div class="changeMap">
<ChangeMap :viewId="viewId"></ChangeMap>
</div>
<!-- 底部数据展示区域 -->
<div class="bottomResult" v-if="bottomResultDialog">
<div class="closeButn" @click="closeBufferDialog(false)">
<i class="el-icon-close"></i>
</div>
<el-tabs v-model="activeName" >
<el-tab-pane v-for="(item,index) in results" :label="item.label+'('+item.features.length+')个'" :name="'tab'+index" :key="index">
<el-table
:data="item.features"
stripe
border
highlight-current-row
@row-click="resultTabClick"
style="width: 100%">
<el-table-column
label="序号"
type="index"
width="50">
</el-table-column>
<el-table-column
label="宗地代码">
<template slot-scope="scope">
<span>{{ scope.row.attributes['宗地代码'] == 'Null'?'':scope.row.attributes['宗地代码'] }}</span>
</template>
</el-table-column>
<el-table-column
label="不动产单元号">
<template slot-scope="scope">
<span>{{ scope.row.attributes['不动产单元号'] == 'Null'?'':scope.row.attributes['不动产单元号'] }}</span>
</template>
</el-table-column>
<el-table-column
label="项目名称">
<template slot-scope="scope">
<span>{{ scope.row.attributes['项目名称'] == 'Null'?'':scope.row.attributes['项目名称'] }}</span>
</template>
</el-table-column>
<el-table-column
label="不动产权证号">
<template slot-scope="scope">
<span>{{ scope.row.attributes['不动产权证号'] == 'Null'?'':scope.row.attributes['不动产权证号'] }}</span>
</template>
</el-table-column>
<el-table-column
label="权利人">
<template slot-scope="scope">
<span>{{ scope.row.attributes['QLR'] == 'Null'?'':scope.row.attributes['QLR'] }}</span>
</template>
</el-table-column>
<el-table-column
label="坐落">
<template slot-scope="scope">
<span>{{ scope.row.attributes['坐落'] == 'Null'?'':scope.row.attributes['坐落'] }}</span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import EsriMap from '@/components/map/EsriMap'
import MapTools from './mapWeight/mapTools'
import {loadModules} from 'esri-loader'
import {maps} from '@/libs/map/mapUtils'
import mapLayerManager from "./mapWeight/js/mapLayerManager";
import layers from '@/assets/json/layers.json'
import findTask from '@/libs/map/findTask'
import ChangeMap from "@/components/map/ChangeMap";
import sideTools from "./mapWeight/sideTools.vue"
import mapTools from './mapWeight/js/mapTools.js'
export default {
inject:['getRightTree','getTreeByBsm'],
components:{
EsriMap,
MapTools,
ChangeMap,
sideTools
},
data(){
return{
viewId:"testMap",
layerUrl:"http://192.168.2.201:6080/arcgis/rest/services/%E4%BA%92%E8%81%94%E7%BD%91%E5%8A%A0%E4%B8%8D%E5%8A%A8%E4%BA%A7/XA_%E4%B8%8D%E5%8A%A8%E4%BA%A7/MapServer",
dialogVisible:false,
selectResLayerId:null,
features:[],
resultLayers:[],
results:[],
inputBsm:"",
fieldName:"BDCDYH",
heighGraphic:null,
isShowCondition:false,
totalResults:0,
activeName:"tab0",
bottomResultDialog:false
}
},
mixins:[mapLayerManager,findTask,mapTools],
mounted(){
var query = this.$route.query
var self = this;
setTimeout(function () {
if(query && JSON.stringify(query) != "{}"){
//self.addGeoByBsm(query.bsm,query.type,self.viewId);
if(query.type == 'zd'){
self.getRightTree(query.bsm,'0,1,2')
}else if(query.type == 'zrz'){
self.getTreeByBsm(query.bsm,'zrz','0,1,2');
}
}
},500);
},
methods:{
addLayer(){
var self = this;
var view = maps[this.viewId];
// view.ui.remove('zoom');
view.ui.remove("attribution");
view.ui.move(["zoom"], "bottom-right");
loadModules([
"esri/layers/MapImageLayer"
]).then(([
MapImageLayer
])=>{
var mapImageLayer = new MapImageLayer({
url:self.layerUrl,
id:"testLayer",
spatialReference:view.spatialReference,
sublayers:[
{
id:19,
visible:true
},
{
id:8,
visible:true
},
{
id:10,
visible:true
}
]
});
view.map.add(mapImageLayer,1);
var query = self.$route.query;
if(query && JSON.stringify(query) != "{}"){
self.addGeoByBsm(query.bsm,query.type,self.viewId);
}
}).catch(err => {
throw(err);
})
},
//缩放至
toMap(attr){
var self = this;
if(attr.geometry){
this.extentToGraphic(attr,this.heighGraphic,this.viewId,function () {
self.heighGraphic = attr;
});
}else {
this.$message.warning("没有图形信息!!")
}
},
resultTabClick(row,column,evt){
var self = this;
if(row.geometry){
this.extentToGraphic(row,this.heighGraphic,this.viewId,function () {
self.heighGraphic = row;
});
}else {
this.$message.warning("没有图形信息!!")
}
},
//图层选择事件
selectLayerChange(){
var self = this;
this.features = [];
var layerAndResult = this.results.filter(function (item) {
return item.layerId == self.selectResLayerId;
})
if(layerAndResult){
this.features = layerAndResult[0].features;
}
},
//属性查询
doSearch(){
this.closeResultDialog();
var self = this;
if(!this.fieldName){
this.$message.warning(" 请选择要查询的字段!!!");
return;
}
if(this.fieldName == 'ZDDM'){
if(!this.inputBsm){
this.$message.warning("请输入宗地代码!!!");
return;
}else if(this.inputBsm.length != 19){
this.$message.warning("输入宗地代码有误,请重新输入!!!");
return;
}
} else if(this.fieldName == 'BDCDYH'){
if(!this.inputBsm){
this.$message.warning("请输入不动产单元号!!!");
return;
}else if(this.inputBsm.length != 28){
this.$message.warning("输入不动产单元有误,请重新输入!!!");
return;
}
}
this.isShowCondition = false;
this.findByPro(this.layerUrl,[8,10],this.fieldName,this.inputBsm,true,function (res) {
var resultes = res.results;
if(resultes && resultes.length > 0){
self.delIdentifyData(resultes);
if(!self.dialogVisible){
self.dialogVisible = true;
}
}else {
self.$message.warning("查询不到相关数据!!!");
}
});
},
//关闭查询结果
closeResultDialog(){
//关闭时清除查询结果 清除数据
this.results = [];
this.selectResLayerId =null;
this.features = [];
this.resultLayers = [];
this.heighGraphic = null;
//清除查询图层
this.clearSearchLayer(this.viewId);
this.dialogVisible = false;
},
closeBufferDialog(flag){
//关闭时清除查询结果 清除数据
this.results = [];
this.selectResLayerId =null;
this.features = [];
this.resultLayers = [];
this.heighGraphic = null;
//清除查询图层
this.clearSearchLayer(this.viewId);
this.bottomResultDialog = false;
if(!flag){
this.clearBufferLayer(this.viewId);
}
},
//处理数据
delIdentifyData(data){
var self = this;
self.results = [];
self.selectResLayerId =null;
self.features = [];
self.resultLayers = [];
this.heighGraphic = null;
//清除查询图层
this.clearSearchLayer(this.viewId);
this.totalResults = data.length;
for(var i = 0;i < data.length;i++){
var layerId = data[i].layerId;
var layer = self.getLayerById(layerId);
var layerResult = self.results.filter(function (item) {
return item.layerId == layerId;
})
if(layerResult && layerResult.length > 0){
var feature = data[i].feature,
attributes = {},
fieldAliases = layer.fieldAliases;
for(var key in feature.attributes){
if(!feature.attributes[key]){
delete feature.attributes[key]
}
}
layerResult[0].features.push(feature);
}else{
if(layer){
this.resultLayers.push({
id:layerId,
label:layer.layerLabel
})
var layerAndResult = {
layerId:layerId,
features:[],
label:layer.layerLabel
}
var feature = data[i].feature,
attributes = {},
fieldAliases = layer.fieldAliases;
for(var key in feature.attributes){
if(!feature.attributes[key]){
delete feature.attributes[key]
}
}
layerAndResult.features.push(feature);
self.results.push(layerAndResult);
}
}
}
self.selectResLayerId = self.resultLayers.length > 0 ? self.resultLayers[0].id : null;
this.selectLayerChange();
this.addSearchResultToMap(this.results,this.viewId);
},
getLayerById(layerId){
var parseLayers = JSON.parse(JSON.stringify(layers));
var layer = parseLayers.filter(function (item) {
return item.id == layerId;
})
if(layer){
return layer[0];
}
return null;
},
//展示查询数据结果
}
}
</script>
<style scoped lang="less">
.testMap{
height: 100%;
width: 100%;
position: relative;
.mapTools{
position: absolute;
top: 12px;
z-index: 99;
right: 21px;
}
.searchDiv{
position: absolute;
top: 12px;
left: 7px;
width: 25%;
max-height: 100%;
/deep/ .el-input-group__append{
background-color: #409eff;
color: white;
}
.searchCondition{
width: 100%;
line-height: 60px;
background-color: #FFFFFF;;
border-radius: 4px;
margin-top: 6px;
box-shadow: 0px 1px 1px 1px rgba(0, 0, 0, 0.12);
position: relative;
ul{
//height: 40px;
display: inline-flex;
width: 100%;
li{
width: 50%;
text-align: center;
}
li :hover{
cursor:pointer
}
}
i{
font-size: 24px;
margin-right: 3px;
position: relative;
top: 2px;
}
span{
font-size: 14px;
color: #4A4A4A;
}
.iconzongdidaima{
color: #44AEFF;
}
.iconbudongchandanyuanhao{
color: #F39835;
}
.active{
border-bottom: 2px solid #409eff;
padding-bottom: 10px;
}
}
.searchResult{
margin-top: 3px;
background: white;
border-radius: 4px;
max-height: 80%;
.-header{
line-height: 32px;
padding: 3px 20px;
background-color: #FFFFFF;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
.title{
font-size: 14px;
color: #6D7278;
}
.closeButton{
float: right;
font-size: 16px;
color: black;
}
.closeButton :hover{
cursor:pointer
}
}
/deep/ .el-card__header {
padding: 10px 20px;
}
.formTitle{
margin-right: 5px;
font-size: 14px;
}
.item{
p{
margin: 0px 3px;
font-size: 14px;
.title{
}
a{
float: right;
color: #519eff
}
}
.contentItem{
display: flex;
font-size: 14px;
width: 100%;
line-height: 30px;
align-items: center;
font-weight: 400;
.key{
width: 100px;
margin: 3px 0px;
text-align: right;
color: #505050;
}
.value{
width: calc(100% - 100px);
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
word-break:keep-all;
color: #999999;
}
}
}
/deep/ .el-card__body{
max-height: 363px;
overflow: auto;
}
}
}
.changeMap{
position: absolute;
bottom: 8px;
right: 52px;
}
.rightSide{
position: absolute;
top: 10%;
right: 21px;
}
/deep/ .esri-ui-bottom-right{
bottom: -17px;
}
.bottomResult{
position: absolute;
bottom: 0px;
height: 26%;
overflow: auto;
width: 96%;
background-color: #ffffff;
margin: 10px;
border-radius: 4px;
.closeButn{
position: relative;
float: right;
font-size: 18px;
color: #9B9B9B;
z-index: 16;
}
.closeButn :hover{
cursor:pointer;
}
/deep/ .el-tabs__header{
margin: 0 0 0px;
}
/deep/ .el-table td, .el-table th{
text-align: center;
}
/deep/ .el-tabs__nav :first{
margin-left: 33px;
}
/deep/ .el-tabs__item.is-active{
color: #505050;
background-color:#ffffff;
}
}
}
</style>