master
lion 3 years ago
parent d3284dd3d6
commit ee4001251d

@ -24,7 +24,9 @@
"moment": "^2.29.4", "moment": "^2.29.4",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"ol": "^7.1.0",
"path-to-regexp": "2.4.0", "path-to-regexp": "2.4.0",
"proj4": "^2.8.0",
"table-excel": "^1.1.9", "table-excel": "^1.1.9",
"view-design": "^4.7.0", "view-design": "^4.7.0",
"vue": "2.6.10", "vue": "2.6.10",

@ -19,6 +19,8 @@
<!-- 天地图 --> <!-- 天地图 -->
<script src="http://api.tianditu.gov.cn/api?v=4.0&tk=82526d64e8504a0341f775c087863825" type="text/javascript"></script> <script src="http://api.tianditu.gov.cn/api?v=4.0&tk=82526d64e8504a0341f775c087863825" type="text/javascript"></script>
<!-- <script src="http://gisserver.tianditu.com/tiandituService/wms"></script> --> <!-- <script src="http://gisserver.tianditu.com/tiandituService/wms"></script> -->
<link rel="stylesheet" href="https://js.arcgis.com/3.41/esri/css/esri.css">
<script src="https://js.arcgis.com/3.41/"></script>
</head> </head>
<body> <body>
<noscript> <noscript>

@ -8,6 +8,14 @@ export function listall(data) {
}) })
} }
export function listMap(data) {
return request({
url: '/mapapi/arcgis/rest/services/hcdt/%E8%8B%8F%E5%B7%9E%E5%B8%82%E7%9F%A2%E9%87%8F%E5%9B%BE0916/MapServer',
method: 'get',
params:data
})
}
export function get(id) { export function get(id) {
return request({ return request({
url: '/api/admin/rain-inspection/show', url: '/api/admin/rain-inspection/show',

@ -1,5 +1,10 @@
<template> <template>
<el-dialog class="common-dialog" :title="title" :visible.sync="diaShow" @close="coloseDia" :width="width"> <el-dialog class="common-dialog" :title="title" :visible.sync="diaShow" @close="coloseDia" :width="width">
<div slot="title">
<span class="el-dialog__title">{{title}}</span>
<slot name="searchtype"></slot>
</div>
<div class="dialogConcent"> <div class="dialogConcent">
<el-scrollbar style="flex: 1"> <el-scrollbar style="flex: 1">
<slot name="content"></slot> <slot name="content"></slot>
@ -12,7 +17,7 @@
<slot name="footerbtn"></slot> <slot name="footerbtn"></slot>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>

@ -46,7 +46,6 @@ export const constantRoutes = [{
component: () => import('@/views/rain/inspection/maps'), component: () => import('@/views/rain/inspection/maps'),
hidden: true hidden: true
}, },
{ {
path: '/', path: '/',
component: Layout, component: Layout,
@ -68,7 +67,7 @@ export const constantRoutes = [{
* the routes that need to be dynamically loaded based on user roles * the routes that need to be dynamically loaded based on user roles
*/ */
export const asyncRoutes = [ export const asyncRoutes = [
// 404 page must be placed at the end !!! // 404 page must be placed at the end !!!
{ {
path: '*', path: '*',

@ -2,34 +2,32 @@
* 配置对象用于配置地图地址和其他通用配置 * 配置对象用于配置地图地址和其他通用配置
*/ */
var CONFIGS = [ const CONFIGS = [
// {
// title: "天地图",
{ // id: "M2",
title: "天地图", // type: "overlay",
id: "M2", // visible: true,
type: "overlay", // projection: "EPSG:4326",
visible: false, // layerType: "TD地图",
projection: "EPSG:4490", // opacity: 1,
layerType: "TD地图", // url: "http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=82526d64e8504a0341f775c087863825"
opacity: 1, // },
url: "http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=7f7a0ff731935a571d8d0fd3364b59ed" // {
}, // title: "遥感图",
{ // id: "M3",
title: "遥感图", // type: "overlay",
id: "M3", // visible: false,
type: "overlay", // projection: "EPSG:4490",
visible: false, // layerType: "TD地图",
projection: "EPSG:4490", // opacity: 1,
layerType: "TD地图", // url: "http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=82526d64e8504a0341f775c087863825"
opacity: 1, // },
url: "http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=7f7a0ff731935a571d8d0fd3364b59ed"
},
{ {
title: "水利图", title: "水利图",
id: "S1", id: "S1",
type: "overlay", type: "overlay",
visible: true, visible: false,
projection: "EPSG:4490", projection: "EPSG:4490",
layerType: "GIS地图", layerType: "GIS地图",
opacity: 1, opacity: 1,
@ -55,8 +53,16 @@ var CONFIGS = [
opacity: 1, opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/xmqyx4490/MapServer" url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/xmqyx4490/MapServer"
}, },
{
title: "路网",
id: "L1",
type: "overlay",
visible: true,
projection: "EPSG:4490",
layerType: "地图",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/dlzx/MapServer"
},
{ {
title: "主干管", title: "主干管",
id: "M4", id: "M4",
@ -117,130 +123,18 @@ var CONFIGS = [
layerType: "数据", layerType: "数据",
opacity: 1, opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysjszqtj/MapServer" url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysjszqtj/MapServer"
}, }
{
title: "雨水泵站",
id: "M10",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysjysbz/MapServer"
},
{
title: "立交泵站",
id: "M11",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysjljbz/MapServer"
},
{
title: "管网",
id: "M12",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysxzg/MapServer"
},
{
title: "管井",
id: "M13",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysjzggj/MapServer"
},
{
title: "管网",
id: "M14",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysxxqg/MapServer"
},
{
title: "管井",
id: "M15",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ysjxqgj/MapServer"
},
{
title: "已达标",
id: "M16",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/ydbq/MapServer"
},
{
title: "未达标",
id: "M17",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/wdbq/MapServer"
},
{
title: "巡查养护",
id: "M18",
type: "overlay",
visible: false,
projection: "EPSG:4490",
layerType: "数据",
opacity: 1,
url: "http://192.168.60.22:6080/arcgis/rest/services/szhd/xcyh/MapServer"
},
] ]
/**
* 后台接口
* */
//var testurls = "http://10.0.0.208:801";
var testurls = "";
var HCONFIGS = {
S_Pipe_Point: testurls + "/Search/S_Pipe_Point", //基本信息查询-雨水管井
S_Pipe_Line: testurls + "/Search/S_Pipe_Line", //基本信息查询-雨水管网
S_Dbq: testurls + "/Search/S_Dbq", //基本信息查询-达标区
S_Tctj: testurls + "/Search/S_Tctj",//图层统计
SearchMap: testurls + "/Search/SearchMap",//地图点击查询
GeomSearch: testurls + "/Search/GeomSearch",// 地图空间查询
GeomTj: testurls + "/Search/GeomTj",// 空间统计
G_Dictionaries: testurls + "/Interface/G_Dictionaries",// 获取字典
RoadSearch: testurls + "/Search/RoadSearch",// 道路查询 统计
}
/** /**
* 定义地图页面配置文件 * 定义地图页面配置文件
*/ */
// //
var MAPCONFIGS = { const MAPCONFIGS = {
Map_Code: "EPSG:4490",//坐标系名 Map_Code: "EPSG:4490",//坐标系名
// Map_extent: [390000, 3500000, 490000, 3360000], //范围框 // Map_extent: [390000, 3500000, 490000, 3360000], //范围框
Map_units: "degrees",//单位 m/degrees等 Map_units: "degrees",//单位 m/degrees等
@ -248,5 +142,10 @@ var MAPCONFIGS = {
Map_global: false, //全球 Map_global: false, //全球
MAP_center: [120.6126391, 31.3029816],//定义中心点 MAP_center: [120.6126391, 31.3029816],//定义中心点
Map_Zooms: [13, 23, 13],//定义地图初始层级、最大层级、最小层级 Map_Zooms: [13, 23, 13],//定义地图初始层级、最大层级、最小层级
Map_ID: "map",//地图标识ID Map_ID: "olMap",//地图标识ID
} }
export {
MAPCONFIGS,
CONFIGS
}

@ -1,750 +0,0 @@
proj4.defs("EPSG:4490", '+proj=longlat +ellps=GRS80 +no_defs')
/*自定义坐标系 命名、范围、单位等; */
var projection = new ol.proj.Projection({
// extent: MAPCONFIGS.Map_extent,
code: MAPCONFIGS.Map_Code,
units: MAPCONFIGS.Map_units,
axisOrientation: MAPCONFIGS.Map_axisOrientation,
global: MAPCONFIGS.Map_global,
});
ol.proj.addProjection(projection);
/**
*地图基本属性定义
**/
var ZJMAP;
var ClickMap = 0;//0点击地图 // 1 获取坐标 //2 测量 //3空间查询统计
var vectorLayer; //基本信息 ,统计等 查询结果层
var vectorLayer2; //定位展示
var vectorLayer3;
var vectorLayer1;
var source;//空间图层
var draw, drawtype, geomtype, geomdraw, radiusdraw;
var yxdtmap = true;
//页面加载完成后执行
$(document).ready(function () {
ZJMAP = new ol.Map({
view: new ol.View({
center: MAPCONFIGS.MAP_center,
zoom: MAPCONFIGS.Map_Zooms[0],
projection: projection,
maxZoom: MAPCONFIGS.Map_Zooms[1],
minZoom: MAPCONFIGS.Map_Zooms[2]
}),
layers: [],
target: MAPCONFIGS.Map_ID,
interactions: ol.interaction.defaults({
doubleClickZoom: false,
}),
});
//加载图层
ShowLayers();
//加载查询结果层
vectorLayer = new ol.layer.Image({
source: new ol.source.ImageVector({
source: new ol.source.Vector(),
style: new ol.style.Style({
image: new ol.style.Icon(
({
anchor: [0.5, 60],
anchorOrigin: 'top-right',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
offsetOrigin: 'top-right',
//透明度
opacity: 0.97,
//图标缩放比例
scale: 0.55,
//图标的url
src: '../image/标绘点.png'
})
),
fill: new ol.style.Fill({
color: 'rgba(255, 0, 0, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#FF4500',
width: 4
})
})
})
});
ZJMAP.addLayer(vectorLayer);
//加载查询结果层
vectorLayer2 = new ol.layer.Image({
source: new ol.source.ImageVector({
source: new ol.source.Vector(),
style: new ol.style.Style({
image: new ol.style.Icon(
({
anchor: [0.5, 60],
anchorOrigin: 'top-right',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
offsetOrigin: 'top-right',
//透明度
opacity: 0.97,
//图标缩放比例
scale: 0.55,
//图标的url
src: '../image/标绘点2.png'
})
),
fill: new ol.style.Fill({
color: 'rgba(255,255,102, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#FFFF66',
width: 4
})
//image: new ol.style.Icon(
// ({
// anchor: [0.5, 60],
// anchorOrigin: 'top-right',
// anchorXUnits: 'fraction',
// anchorYUnits: 'pixels',
// offsetOrigin: 'top-right',
// //透明度
// opacity: 0.97,
// //图标缩放比例
// scale: 0.55,
// //图标的url
// src: '../image/标绘点.png'
// })
//),
//fill: new ol.style.Fill({
// color: 'rgba(255, 0, 0, 0.2)'
//}),
//stroke: new ol.style.Stroke({
// color: '#000080',
// width: 4
//})
})
})
});
ZJMAP.addLayer(vectorLayer2);
vectorLayer3 = new ol.layer.Image({
source: new ol.source.ImageVector({
source: new ol.source.Vector(),
style: new ol.style.Style({
image: new ol.style.Icon(
({
anchor: [0.5, 60],
anchorOrigin: 'top-right',
anchorXUnits: 'fraction',
anchorYUnits: 'pixels',
offsetOrigin: 'top-right',
//透明度
opacity: 0.97,
//图标缩放比例
scale: 0.55,
//图标的url
src: '../image/标绘点.png'
})
),
fill: new ol.style.Fill({
color: 'rgba(255,255,102, 0.1)'
}),
stroke: new ol.style.Stroke({
color: '#FFFF66',
width: 4
})
})
})
});
ZJMAP.addLayer(vectorLayer3);
///临时图层
source = new ol.source.Vector({ wrapX: false });
vector = new ol.layer.Vector({
//数据源
source: source,
//样式
style: new ol.style.Style({
//样式填充
fill: new ol.style.Fill({
//填充颜色
color: 'rgba(37,241,239,0.2)'
}),
//笔触
stroke: new ol.style.Stroke({
//笔触颜色
color: '#264df6',
//笔触宽度
width: 2
}),
//图形样式,主要适用于点样式
image: new ol.style.Circle({
//半径大小
radius: 7,
//填充
fill: new ol.style.Fill({
//填充颜色
color: '#e81818'
})
})
})
});
ZJMAP.addLayer(vector);
var createLabelStyle = function (feature) {
return new ol.style.Style({
text: new ol.style.Text({
//位置
textAlign: 'center',
//基准线
textBaseline: 'bottom',
//文字样式
font: 'normal 16px 黑体',
//文本内容
text: feature.get('name'),
//文本填充样式(即文字颜色)
fill: new ol.style.Fill({ color: 'black' }),
stroke: new ol.style.Stroke({ color: 'white', width: 5 }),
offsetY: 20
})
});
}
var centerpoint = ol.proj.fromLonLat([0, 0]);
var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(centerpoint),
//名称属性
name: '',
});
iconFeature.setStyle(createLabelStyle(iconFeature));
//矢量标注的数据源
var vectorSource = new ol.source.Vector({
features: [iconFeature]
});
//矢量标注图层
vectorLayer1 = new ol.layer.Vector({
source: vectorSource
});
function addVectorLabel(coordinate, text) {
//新建一个要素 ol.Feature
var newFeature = new ol.Feature({
//几何信息
geometry: new ol.geom.Point(coordinate),
//名称属性
name: text
});
//设置要素的样式
newFeature.setStyle(createLabelStyle(newFeature));
//将新要素添加到数据源中
vectorSource.addFeature(newFeature);
}
ZJMAP.addLayer(vectorLayer1);
ZJMAP.on('click', function (evt) {
coordinate = evt.coordinate;
console.log(coordinate);
if (ClickMap == 0) { //点击获取数据
vectorLayer.getSource().getSource().clear();
vectorLayer2.getSource().getSource().clear();
vectorLayer3.getSource().getSource().clear();
var Cextent = new ol.geom.Circle(coordinate, 0.000003).getExtent();
var ply = Cextent[0] + " " + Cextent[1] + "," + Cextent[2] + " " + Cextent[1] + "," + Cextent[2] + " " + Cextent[3] + "," + Cextent[0] + " " + Cextent[3] + "," + Cextent[0] + " " + Cextent[1];
var layers = ZJMAP.getLayers().getArray();
var Tlayers = "";
for (i = 0; i < layers.length; i++) {
var Visible = layers[i].getVisible();
if (Visible) {
if (layers[i].get("layerType") == "数据") {
var title = layers[i].get("id");
if (title != "") {
Tlayers += layers[i].get("id") + ",";
}
}
}
}
console.log(Tlayers);
if (ply == "" || ply == null || Tlayers == "") {
console.log("请打开图层,点击地图!")
} else {
console.log("开始", Date())
$.post(HCONFIGS.SearchMap, { geom: ply, layers: Tlayers }, res => {
console.log("结束", Date())
var title = [];
var geom = [];
if (res.lcount != 0) {
for (i = 1; i <= res.lcount; i++) {
var b = { id: "L" + i, name: "管网" + i, type: "line", geom: res.data.line[i - 1].geom };
title.push(b);
}
geom.push(res.data.line[0].geom);
}
if (res.pcount != 0) {
for (i = 1; i <= res.pcount; i++) {
var b = { id: "P" + i, name: "管井" + i, type: "point", geom: res.data.point[i - 1].geom };
title.push(b);
}
if (geom == "") {
geom.push(res.data.point[0].geom);
}
}
if (res.dcount != 0) {
for (i = 1; i <= res.dcount; i++) {
var b = { id: "D" + i, name: "达标区" + i, type: "dbq", geom: res.data.dbq[i - 1].geom };
title.push(b);
}
if (geom == "") {
geom.push(res.data.dbq[0].geom);
}
}
if (res.ljcount != 0) {
for (i = 1; i <= res.ljcount; i++) {
var b = { id: "J" + i, name: "立交泵站" + i, type: "lj", geom: res.data.ljbz[i - 1].geom };
title.push(b);
}
if (geom == "") {
geom.push(res.data.ljbz[0].geom);
}
}
if (res.xcount != 0) {
for (i = 1; i <= res.xcount; i++) {
var b = { id: "X" + i, name: "巡查养护" + i, type: "xcyh", geom: res.data.xcyh[i - 1].geom };
title.push(b);
}
if (geom == "") {
geom.push(res.data.xcyh[0].geom);
}
}
if (geom != "") {
///绘制
MapShowClick(geom, false)
};
var ndata = {
"title": title,
"line": res.data.line,
"point": res.data.point,
"dbq": res.data.dbq,
"ljbz": res.data.ljbz,
"xcyh": res.data.xcyh,
"count": res.count
}
console.log(ndata);
app.tabShow(ndata)
})
}
}
else if (ClickMap == 1) { //点击获取坐标
var pit = "Point(" + coordinate[0] + " " + coordinate[1] + ")";
MapShowClick([pit], false);
vectorLayer1.getSource().clear();
var center = [coordinate[0], coordinate[1]];
addVectorLabel(center, "坐标:" + coordinate[0] + "," + coordinate[1]);
}
else if (ClickMap == 2) { //测量情况
}
else if (ClickMap == 3) { //空间查询
if (drawtype == "Circle") {
var len = vector.getSource().getFeatures().length;
if (len > 0) {
ZJMAP.removeInteraction(draw);
if (geomtype == "circle") {
var a = vector.getSource().getFeatures()[len - 1].getGeometry();
console.log(a);
geom = a.getCenter();
radiusdraw = a.getRadius();
var showlength = "半径:" + (radiusdraw / 0.0000089932).toFixed(2) + "m";
// showtext = "半径:" + radiusdraw + "m";
addVectorLabel(geom, showlength);
geomdraw = GetPolygon(geom)
console.log(geomdraw, radiusdraw)
} else {
var a = vector.getSource().getFeatures()[len - 1].getGeometry();
geomdraw = GetPolygon(a.A)
}
//if (geomdraw != "") {
// app.kjSearch();
// app.kjCensus();
//}
ClickMap = 0;
}
} else if (drawtype == "Polygon") {
var len = vector.getSource().getFeatures().length;
if (len > 0) {
ZJMAP.removeInteraction(draw);
var a = vector.getSource().getFeatures()[len - 1].getGeometry();
geomdraw = GetPolygon(a.A)
ClickMap = 0;
}
}
}
});
ZJMAP.on('dblclick', function (evt) {
if (ClickMap == 0) {
ZJMAP.removeInteraction(draw);
/* modify.setActive(false);*/
}
else if (ClickMap == 2) {
var points = evt.coordinate;
var center = [points[0], points[1]];
var showtext;
var len = vector.getSource().getFeatures().length;
ZJMAP.removeInteraction(draw);
if (drawtype == "LineString") {
if (vector.getSource().getFeatures()[len - 1].getGeometry().getLength()) {
showtext = vector.getSource().getFeatures()[len - 1].getGeometry().getLength();
showtext = showtext / 0.0000089932;
var showtextsp = showtext.toString().split(".");
showtext = showtextsp[0];
showtext += "m";
addVectorLabel(center, showtext);
}
} else if (drawtype == "Polygon") {
if (vector.getSource().getFeatures()[len - 1].getGeometry().getArea()) {
showtext = vector.getSource().getFeatures()[len - 1].getGeometry().getArea();
console.log(showtext);
showtext = showtext / (0.0000089932 * 0.0000089932 );
showtext = showtext.toFixed(2);
showtext += "㎡";
addVectorLabel(center, showtext);
}
}
ClickMap = 0;
} else if (ClickMap == 3) {
if (drawtype == "Polygon") {
var len = vector.getSource().getFeatures().length;
ZJMAP.removeInteraction(draw);
var a = vector.getSource().getFeatures()[len - 1].getGeometry();
geomdraw = GetPolygon(a.A)
//if (geomdraw != "") {
// app.kjSearch();
// app.kjCensus();
//}
ClickMap = 0;
}
}
})
});
////////////////////////////////////
//加载图层
function ShowLayers() {
//var a = [120, 31];
//a = ol.proj.fromLonLat(a, "EPSG:4490")
//console.log(a);
for (i = 0; i < CONFIGS.length; i++) {
var result = CONFIGS[i];
if (result.layerType == "TD地图") {
var layer = new ol.layer.Tile({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new ol.source.XYZ({
crossOrigin: 'anonymous',
url: result.url,
// projection: result.projection
})
})
ZJMAP.addLayer(layer);
///tile/6/33543/47426
}
if (result.layerType == "GIS地图") {
var projection = ol.proj.get(result.projection);
var origin = [-400.0, 399.9999999999998];
var resolutions = [0.0027465820824835565,0.0013732910412417782,6.866455206208891E-4,3.4332276031044456E-4,1.7166138015522228E-4,8.583069007761114E-5,4.291534503880557E-5,2.1457672519402785E-5,1.0728836259701392E-5];
var fullExtent = [118.63622216442072, 30.12564516975147, 122.81217622965288, 32.74305227616479];
var tileGrid = new ol.tilegrid.TileGrid({
tileSize: 256,
origin: origin,
extent: fullExtent,
resolutions: resolutions
});
var layer = new ol.layer.Tile({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new ol.source.XYZ({
tileGrid: tileGrid,
url: result.url,
projection: projection
})
})
ZJMAP.addLayer(layer);
///tile/6/33543/47426
}
else {
var layer = new ol.layer.Tile({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new ol.source.TileArcGISRest({
url: result.url,
projection: result.projection
}),
});
ZJMAP.addLayer(layer);
}
}
}
//选择取消图层
function checkLayers(id, bool) {
var layers = ZJMAP.getLayers().getArray();
for (i = 0; i < layers.length; i++) {
if (layers[i].get("id") == id) {
if (bool) {
layers[i].setVisible(true);
} else {
layers[i].setVisible(false);
}
}
}
}
//基本信息查询展示
function MapSearchShow(data, bool) {
vectorLayer.getSource().getSource().clear();
var features = [];
var format = new ol.format.WKT();
for (i = 0; i < data.length; i++) {
var feature = format.readFeature(data[i].geom, {});
features.push(feature);
}
vectorLayer.getSource().getSource().addFeatures(features);
if (bool) {
var extent = vectorLayer.getSource().getSource().getExtent();
ZJMAP.getView().fit(extent, {
duration: 1,
callback: null
})
}
}
//空间查询展示
function MapSearchShow2(data, bool) {
var features = [];
var format = new ol.format.WKT();
for (i = 0; i < data.length; i++) {
var feature = format.readFeature(data[i].geom, {});
features.push(feature);
}
vectorLayer.getSource().getSource().addFeatures(features);
}
function MapSearchShow3(data, bool) {
vectorLayer.getSource().getSource().clear();
vectorLayer3.getSource().getSource().clear();
console.log(data);
var features = [];
var rfeatures = [];
var format = new ol.format.WKT();
for (i = 0; i < data.length; i++) {
var feature = format.readFeature(data[i].geom, {});
if (data[i].layers == "road") {
features.push(feature);
} else {
rfeatures.push(feature);
}
}
vectorLayer.getSource().getSource().addFeatures(rfeatures);
vectorLayer3.getSource().getSource().addFeatures(features);
if (bool) {
var extent = vectorLayer3.getSource().getSource().getExtent();
ZJMAP.getView().fit(extent, {
duration: 1,
callback: null
})
}
}
//点击定位
function MapShowClick(geom, bool) {
vectorLayer2.getSource().getSource().clear();
var features = [];
var format = new ol.format.WKT();
for (i = 0; i < geom.length; i++) {
var feature = format.readFeature(geom[i], {});
features.push(feature);
}
vectorLayer2.getSource().getSource().addFeatures(features);
if (bool) {
var extent = vectorLayer2.getSource().getSource().getExtent();
ZJMAP.getView().fit(extent, {
duration: 1,
callback: null
})
}
}
//获取Polygon
function GetPolygon(points) {
var polygon = "";
for (i = 0; i < points.length; i++) {
var poly = points[i];
if (i == 0) {
polygon += poly + " ";
} else {
if (i % 2 == 0) {
//双数
polygon += poly + " ";
} else {
polygon += poly + ","
}
}
}
polygon = polygon.substring(0, polygon.length - 1);
return polygon;
}
//空间查询-绘制双击结束
function addInteraction(value, id, type) {
if (draw) {
vectorLayer1.getSource().clear();
drawtype = "";
geomtype = "";
source = null;
//设置矢量图层的数据源为空
vector.setSource(source);
ZJMAP.removeInteraction(draw);
};
//获取当前选择的绘图类型
//如果当前选择的绘图类型不为"None"的话,则进行相应绘图操作
//如果当前选择的绘图类型为"None"的话,则清空矢量数据源
if (value !== 'None') {
if (id == 2) {
ClickMap = 2;
drawtype = value;
}
else if (id == 3) {
ClickMap = 3;
drawtype = value;
geomtype = type;
} else {
ClickMap = 0;
}
//如果当前的矢量数据源为空的话,则重新创建和设置数据源
//因为当你选择的绘图类型为"None"时,会清空数据源
if (source == null) {
source = new ol.source.Vector({ wrapX: false });
vector.setSource(source);
}
if (geomtype == "box") {
//将交互绘图对象赋给draw对象
//初始化交互绘图对象
draw = new ol.interaction.Draw({
//数据源
source: source,
//绘制类型
type: value,
geometryFunction: ol.interaction.Draw.createBox()
});
} else {
draw = new ol.interaction.Draw({
//数据源
source: source,
//绘制类型
type: value,
});
}
//将draw对象添加到map中然后就可以进行图形绘制了
ZJMAP.addInteraction(draw);
} else {
//清空矢量数据源
source = null;
//设置矢量图层的数据源为空
vector.setSource(source);
ZJMAP.removeInteraction(draw);
}
}
//清空图层
function clearmap() {
ClickMap = 0;
if (draw) {
drawtype = "";
geomtype = "";
geomdraw = "";
source = null;
//设置矢量图层的数据源为空
vector.setSource(source);
ZJMAP.removeInteraction(draw);
};
vectorLayer1.getSource().clear();
vectorLayer.getSource().getSource().clear();
vectorLayer2.getSource().getSource().clear();
vectorLayer3.getSource().getSource().clear();
}

@ -1,132 +0,0 @@
<template>
<dialogShow :title="title" :is-show.sync="isShow" :width="width">
<template v-slot:content>
<div id="mapDiv" :style="{'width':'100%','height':divHeight}"></div>
</template>
</dialogShow>
</template>
<script>
import dialogShow from '@/components/dialogShow'
export default {
components: {
dialogShow
},
data() {
return {
title: "巡查点位",
width: '100%',
isShow: false,
divStyle: {
"width": "100%",
'height': '400px'
},
divHeight:"400px",
data: [
[120.63212, 31.26249, 'suzhouas',51],
[120.63212, 30.26249, 'suzhouwown2',50],
[120.55590234876, 31.320813249765, 'suzhouwown2',49],
],
map: null,
_CloudCollection: null,
lnglats: [],
markers: [],
zoom: 12
}
},
mounted() {
window.showInfo = this.showInfo;
this.getStyle()
},
methods: {
getStyle() {
var clientHeight = document.documentElement.clientHeight
console.log(clientHeight)
this.divHeight = clientHeight + 'px'
},
getMap(){
var that = this
setTimeout(function(){
that.onload()
},2000)
},
onload() {
if(!this.map){ 
this.map = new T.Map('mapDiv');
}
this.map.clearOverLays();
this.map.centerAndZoom(new T.LngLat(120.63212, 31.26249), this.zoom)
var imageURL = "/mapapi/arcgis/rest/services/szhd/ysxzgg/MapServer";
console.log(imageURL)
//
var lay = new T.TileLayer(imageURL, {minZoom: 1, maxZoom: 18});
//
this.map.addLayer(lay);
let lnglats = [];
//
var icon = new T.Icon({
iconUrl: "http://api.tianditu.gov.cn/img/map/markerA.png",
iconSize: new T.Point(19, 27),
iconAnchor: new T.Point(10, 25)
});
var arrayObj = new Array();
for (var i = 0; i < this.data.length; i++) {
var ll = new T.LngLat(this.data[i][0], this.data[i][1])
lnglats.push(ll)
var marker = new T.Marker(new T.LngLat(this.data[i][0], this.data[i][1]), {
icon: icon
});
var content = "<div>地址:" + this.data[i][2] + "</div>" +
"<div style='color:red' onClick='showInfo("+this.data[i][3]+")'>查看详情</div>"
this.map.addOverLay(marker); //
this.addClickHandler(content, marker);
arrayObj.push(marker);
}
//
var markers = new T.MarkerClusterer(this.map, {
markers: arrayObj
});
//
if (document.createElement('canvas').getContext) { //
this._CloudCollection = new T.CloudMarkerCollection(lnglats, {
color: 'blue',
SizeType: TDT_POINT_SIZE_SMALL
})
this.map.addOverLay(this._CloudCollection);
} else {
alert('此示例目前只有在IE9及以上浏览器打开');
}
},
//
addClickHandler(content, marker) {
var that = this
marker.addEventListener("click", function(e) {
that.openInfo(content, e)
});
},
//
openInfo(content, e) {
var point = e.lnglat;
this.marker = new T.Marker(point); //
var markerInfoWin = new T.InfoWindow(content, {
offset: new T.Point(0, -30)
}); //
this.map.openInfoWindow(markerInfoWin, point); //
},
showInfo(id){
this.$emit('showInfo',{id:id,type:1},'showform')
}
}
}
</script>
<style>
</style>

@ -0,0 +1,556 @@
<template>
<div>
<dialogShow :title="title" :is-show.sync="isShow" :width="width" @resetform="resetPointArr">
<template v-slot:searchtype>
<el-popover
placement="right"
width="400"
trigger="click">
<!-- <div>
<Input class="vm10" style="width: 200px; margin-right: 10px" v-model="searchFields.keyword"
placeholder="关键字搜索" />
<el-select class="vm10" v-model="searchFields.road_id" filterable remote reserve-keyword clearable
@focus="remoteRoad" placeholder="请输入关键词查找道路" :remote-method="remoteMethod" :loading="roadloading">
<el-option v-for="item in roadsList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.area_id" placeholder="请选择所属片区">
<el-option v-for="item in selects.areasList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.maintain_id" placeholder="请选择所属养护单位">
<el-option v-for="item in selects.maintainList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.status" placeholder="请选择状态">
<el-option v-for="item in selects.statusList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.unusual_type_id" placeholder="请选择异常类型">
<el-option v-for="item in selects.sunusualList" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.type" placeholder="请选择类型">
<el-option v-for="item in selects.typeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.end_type" placeholder="请选择结办类型">
<el-option v-for="item in selects.endTypeList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
<el-select class="vm10" filterable v-model="searchFields.ask_content_id" placeholder="请选择巡查内容">
<el-option v-for="item in selects.sequiementList" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
<el-date-picker class="vm10" v-model="datesearch" type="daterange" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd">
</el-date-picker>
<Button type="primary" @click="loadMap(false)" style="margin-left: 10px">查询</Button>
</div>
<el-button slot="reference">搜索</el-button>
-->
</el-popover>
</template>
<template v-slot:content>
<div class="wrapper">
<div class="chooseMap">
<div>
<el-radio-group v-model="showMap" @change="changeMap">
<el-radio v-for="item in mapRadioList" :label="item.id">{{item.title}}</el-radio>
</el-radio-group>
</div>
<div>
<el-checkbox-group v-model="checkList" @change="changeCheck">
<el-checkbox v-for="item in mapCheckList" :label="item.id">{{item.title}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="map" id="olMap"></div>
<!-- 弹框 -->
<div ref="popup" class="popup" v-show="shopPopup">
<div class="info">
<div class="address">地址{{nowAddress}}</div>
<div class="showinfo" @click='showInfo(nowId,types)'>查看详情</div>
</div>
</div>
<!-- 查看详情 -->
</div>
</template>
</dialogShow>
<showRainEquipmentInfo ref="showRainEquipmentInfo"></showRainEquipmentInfo>
<showRainSiteInfo ref="showRainSiteInfo"></showRainSiteInfo>
</div>
</template>
<script>
import "ol/ol.css";
import {Tile as TileLayer,Vector as VectorLayer } from "ol/layer";
import XYZ from "ol/source/XYZ";
import {TileArcGISRest} from "ol/source"
import tilegrid from "ol/tilegrid/TileGrid"
import { defaults as defaultControls } from "ol/control";
import {get as getprojection} from "ol/proj"
import {Projection,addProjection} from "ol/proj"
import Map from "ol/Map.js";
import View from "ol/View.js";
//
import { Vector as VectorSource } from "ol/source";
import * as olProj from "ol/proj";
import {Feature, Overlay} from "ol"
import { Point } from "ol/geom";
import { Style, Fill, Stroke, Circle as sCircle } from "ol/style";
import proj4 from 'proj4'
import {CONFIGS,MAPCONFIGS} from '@/views/rain/inspection/components/config'
import showRainEquipmentInfo from '@/views/rain/inspection/components/showRainEquipmentInfo'
import showRainSiteInfo from '@/views/rain/inspection/components/showRainSiteInfo'
import dialogShow from '@/components/dialogShow'
export default {
components: {
showRainEquipmentInfo,
showRainSiteInfo,
CONFIGS,
MAPCONFIGS,
dialogShow
},
data() {
return {
title: "巡查点位",
width: "100%",
isShow: false,
map: null,
shopPopup:false,
nowAddress:"",
nowId:"",
types:"",
showMap:"M2",
mapRadioList:[
{
id:"M2",
title:"天地图"
},{
id:"S1",
title:"水利图"
},{
id:"H1",
title:"河道图"
}
],
checkList:['M1','L1'],
mapCheckList:[
{
id:"M1",
title:"高清影像",
checked:true
},{
id:"L1",
title:"路网",
checked:true
}
],
configs :CONFIGS,
mapConfigs:MAPCONFIGS,
projection:"EPSG:4490",
featuresArr:[],
flagLayer:"",
pointArr:[
// [120.63212, 31.26249, 'suzhouas',51],
// [120.63212, 30.26249, 'suzhouwown2',50],
// [120.55590234876, 31.320813249765, 'suzhouwown2',49],
],
searchFields: {
is_export: 0,
is_auth:1
},
selects: {
sunusualList: [{
id: "",
value: "所有"
}],
areasList: [{
id: "",
name: "所有"
}],
typeList: [{
id: "",
name: "所有"
}, {
id: 1,
name: "日常雨水设施"
}, {
id: 2,
name: "在建工地"
}],
statusList: [{
id: "",
name: "所有"
}, {
id: 0,
name: "未审核"
}, {
id: 1,
name: "已审核"
}, {
id: 2,
name: "已办结"
}, {
id: 3,
name: "已退回"
}],
endTypeList: [{
id: 0,
name: "所有"
}, {
id: 1,
name: "养护转办"
}, {
id: 2,
name: "违法转办"
}],
sequiementList: [{
id: "",
value: "所有"
}],
maintainList: [{
id:"",
name:"所有"
}]
},
};
},
created() {
},
mounted() {
//
proj4.defs("EPSG:4490", '+proj=longlat +ellps=GRS80 +no_defs')
this.projection = new Projection({
code: this.mapConfigs.Map_Code,
units: this.mapConfigs.Map_units,
axisOrientation: this.mapConfigs.Map_axisOrientation,
global: this.mapConfigs.Map_global,
});
addProjection(this.projection);
// this.initMap();
},
watch:{
// pointArr(val){
// this.pointArr = val
// }
},
methods: {
showMaps(){
this.$nextTick(function () {
this.initMap();
})
},
initMap() {
let map = new Map({
target: "olMap",
view: new View({
center: this.mapConfigs.MAP_center, //
zoom: this.mapConfigs.Map_Zooms[0], //
maxZoom:this.mapConfigs.Map_Zooms[1],
minZoom:this.mapConfigs.Map_Zooms[2],
projection: this.projection,
}),
layers:[],
// interactions: defaultControls({
// doubleClickZoom: false,
// }),
});
this.map = map;
//
let url = "http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}";
url = `${url}&T=vec_c&tk=82526d64e8504a0341f775c087863825`;
let tdtLayer = new TileLayer({
title: "天地图",
id: "M2",
type: "overlay",
visible: true,
layerType: "TD地图",
opacity: 1,
source: new XYZ({
crossOrigin:'anonymous',
url: url,
projection:"EPSG:4326"
})
});
this.map.addLayer(tdtLayer);
this.ShowLayers()
this.setMarker()
this.addOverlay()
this.singleclick()
// this.map.layer2.setVisible(false)
},
//
ShowLayers() {
for (var i = 0; i < this.configs.length; i++) {
var result = this.configs[i];
if (result.layerType == "GIS地图") {
let projection = getprojection(result.projection);
let origin = [-400.0, 399.9999999999998];
let resolutions = [0.0027465820824835565,0.0013732910412417782,6.866455206208891E-4,3.4332276031044456E-4,1.7166138015522228E-4,8.583069007761114E-5,4.291534503880557E-5,2.1457672519402785E-5,1.0728836259701392E-5];
let fullExtent = [118.63622216442072, 30.12564516975147, 122.81217622965288, 32.74305227616479];
let tileGrid = new tilegrid({
tileSize: 256,
origin: origin,
extent: fullExtent,
resolutions: resolutions
});
let layer = new TileLayer({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new XYZ({
tileGrid: tileGrid,
url: result.url,
projection: projection
})
})
this.map.addLayer(layer);
}else {
let layer = new TileLayer({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new TileArcGISRest({
url: result.url,
projection: result.projection
}),
});
this.map.addLayer(layer);
}
}
},
//
setMarker() {
//
this.flagLayer = new VectorLayer({
source: new VectorSource()
});
//
this.map.addLayer(this.flagLayer);
// feature
for (let i = 0; i < this.pointArr.length; i++) {
// featurefeature
let feature = new Feature({
geometry: new Point([this.pointArr[i][0], this.pointArr[i][1]])
});
//
feature.set('address',this.pointArr[i][2])
feature.set('types',this.pointArr[i][4])
// ID
feature.setId(this.pointArr[i][3])
feature.setStyle(
new Style({
image: new sCircle({
fill: new Fill({
color: '#0f9b0f',
}),
radius: 6,
}),
})
);
this.featuresArr.push(feature);
} // for
this.flagLayer.getSource().addFeatures(this.featuresArr);
},
addOverlay() {
// Overlay
let elPopup = this.$refs.popup;
this.popup = new Overlay({
element: elPopup,
positioning: "bottom-center",
stopEvent: false,
offset: [0, -20],
});
this.map.addOverlay(this.popup);
},
singleclick() {
//
this.map.on("singleclick", (e) => {
//
let feature = this.map.forEachFeatureAtPixel(
e.pixel,
(feature) => feature
);
if (feature) {
this.shopPopup = true;
//
let coordinates = feature.getGeometry().getCoordinates();
this.nowAddress = feature.get('address');
this.nowId = feature.getId()
this.types = feature.get('types');
this.popup.setPosition(coordinates);
} else {
this.shopPopup = false;
}
});
},
showInfo(id,type){
//
if (type == 1) {
this.$refs.showRainEquipmentInfo.isShow = true
this.$refs.showRainEquipmentInfo.getEquipmentInfo(id)
this.$refs.showRainEquipmentInfo.infoId = id
this.$refs.showRainEquipmentInfo.formType = 'showform'
}
//
if (type == 2) {
this.$refs.showRainSiteInfo.isShow = true
this.$refs.showRainSiteInfo.getSiteInfo(id)
this.$refs.showRainSiteInfo.infoId = id
this.$refs.showRainSiteInfo.formType = 'showform'
}
},
changeMap(val){
for(var m of this.mapRadioList){
if(m.id==val){
console.log("val",val)
this.checkLayers(val,true)
}else{
this.checkLayers(m.id,false)
}
}
},
changeCheck(val){
if(val.length==0){
for(var m of this.mapCheckList){
this.checkLayers(m.id,false)
}
}else if(val.length==this.mapCheckList.length){
console.log(val)
for(var m of this.mapCheckList){
this.checkLayers(m.id,true)
}
}else{
for(var m of this.mapCheckList){
if(m.id==val[0]){
this.checkLayers(m.id,true)
}else{
this.checkLayers(m.id,false)
}
}
}
},
//
checkLayers(id, bool) {
let layers = this.map.getLayers().getArray();
for (let i = 0; i < layers.length; i++) {
if (layers[i].get("id") == id) {
if (bool) {
console.log(id)
layers[i].setVisible(true);
}else{
layers[i].setVisible(false);
}
}
}
},
loadMap(){
console.log(this.searchFields)
this.$emit('loadMap',this.searchFields)
},
resetPointArr(){
// this.map = null
// this.pointArr = []
// // this.featuresArr=[]
// // this.flagLayer.removeFeature(this.featuresArr);
// // this.map.removeLayer(this.flagLayer);
// let _that = this;
// this.flagLayer
// .getSource()
// .getFeatures()
// .forEach(function(feature) {
// _that.flagLayer.getSource().removeFeature(feature);
// });
// this.featuresArr = [];
// console.log(this.featuresArr);
// // this.flagLayer.getSource().removeFeature(this.features); //
// this.map.removeLayer(this.flagLayer);
// this.flagLayer.getSource().clear();
}
},
};
</script>
<style lang="scss" scoped>
.chooseMap{
position: absolute;
margin: 15px 20px;
// width: 350px;
background-color: #fff;
border-radius: 4px;
border: 0.8px solid hsla(0,0%,60%,.2);
z-index:99;
top: 0;
right: 0;
line-height: 40px;
// text-align: center;
padding:0 40px 0 20px;
}
.map {
width: 100vw;
height: 100vh;
}
.popup {
width: 200px;
background-color: white;
padding: 18px;
border-radius: 10px;
box-shadow: 0 0 15px rgb(177, 177, 177);
.info {
font-size: 14px;
text-align: left;
ul {
padding-left: 0;
}
.showinfo{
color:red;
cursor: pointer;
}
}
}
.common-dialog{
margin:0!important;
}
</style>

@ -457,5 +457,8 @@
transform: translate(0%,-50%); transform: translate(0%,-50%);
font-size: 60px; font-size: 60px;
} }
.files_check .el-upload.el-upload--picture-card {
display: none;
}
</style> </style>

@ -504,5 +504,8 @@
right: 1%; right: 1%;
transform: translate(0%, -50%); transform: translate(0%, -50%);
font-size: 60px; font-size: 60px;
}
.files_check .el-upload.el-upload--picture-card {
display: none;
} }
</style> </style>

@ -120,7 +120,7 @@
</div> </div>
</div> </div>
<mapShow ref="mapShow" @showInfo="showMapInfo(arguments)"></mapShow> <maps ref="maps" @loadMap="loadMap"></maps>
<!-- 初始选择 --> <!-- 初始选择 -->
<el-dialog title="雨管养护类型选择" :visible.sync="rainTypeVisible" width="60%"> <el-dialog title="雨管养护类型选择" :visible.sync="rainTypeVisible" width="60%">
<div class="dialogConcent"> <div class="dialogConcent">
@ -204,7 +204,7 @@
import showRainSiteInfo from '@/views/rain/inspection/components/showRainSiteInfo' import showRainSiteInfo from '@/views/rain/inspection/components/showRainSiteInfo'
import editEquipment from '@/views/rain/inspection/components/editEquipment' import editEquipment from '@/views/rain/inspection/components/editEquipment'
import editSite from '@/views/rain/inspection/components/editSite' import editSite from '@/views/rain/inspection/components/editSite'
import mapShow from '@/views/rain/inspection/components/mapShow' import maps from '@/views/rain/inspection/components/maps'
export default { export default {
components: { components: {
LxHeader, LxHeader,
@ -212,7 +212,7 @@
showRainSiteInfo, showRainSiteInfo,
editEquipment, editEquipment,
editSite, editSite,
mapShow maps
}, },
data() { data() {
return { return {
@ -221,7 +221,7 @@
baseurl: "", baseurl: "",
rainTypeVisible: false, rainTypeVisible: false,
rainType: 1, rainType: 1,
mapArr :[],
tableData: [], tableData: [],
paginations: { paginations: {
page: 1, page: 1,
@ -411,10 +411,6 @@
} }
}, },
methods: { methods: {
showMap(){
this.$refs.mapShow.isShow = true
this.$refs.mapShow.getMap()
},
initLoad() { initLoad() {
var that = this; var that = this;
var clientHeight = document.documentElement.clientHeight var clientHeight = document.documentElement.clientHeight
@ -462,6 +458,7 @@
}, },
load(is_export) { load(is_export) {
// return // return
this.mapArr = []
listall({ listall({
page: this.paginations.page, page: this.paginations.page,
page_size: this.paginations.page_size, page_size: this.paginations.page_size,
@ -483,6 +480,14 @@
if (m.rain_equipment_info) { if (m.rain_equipment_info) {
m.askName = m.rain_equipment_info.ask_content_detail ? m.rain_equipment_info.ask_content_detail : m.askName = m.rain_equipment_info.ask_content_detail ? m.rain_equipment_info.ask_content_detail :
"" ""
this.mapArr.push([
m.rain_equipment_info.longitude,m.rain_equipment_info.latitude,m.rain_equipment_info.address,m.id,m.type
])
}
if (m.building_site_info) {
this.mapArr.push([
m.building_site_info.building_site.longitude,m.building_site_info.building_site.latitude,m.building_site_info.building_site.address,m.id,m.type
])
} }
} }
this.tableData = response.data; this.tableData = response.data;
@ -492,6 +497,43 @@
reject(error) reject(error)
}); });
}, },
showMap(){
// this.loadMap()
console.log(this.mapArr)
// return
this.$refs.maps.pointArr = this.mapArr
this.$refs.maps.isShow = true
this.$refs.maps.showMaps()
this.$refs.maps.selects = this.selects
},
//
loadMap(search) {
console.log(search)
// return
this.mapArr = []
listall({
// page: this.paginations.page,
// page_size: this.paginations.page_size,
...this.searchFields
}).then(response => {
for (var m of response.data) {
if (m.rain_equipment_info) {
this.mapArr.push([
m.rain_equipment_info.longitude,m.rain_equipment_info.latitude,m.rain_equipment_info.address,m.id,m.type
])
}
if (m.building_site_info) {
this.mapArr.push([
m.building_site_info.building_site.longitude,m.building_site_info.building_site.latitude,m.building_site_info.building_site.address,m.id,m.type
])
}
}
}).catch(error => {
console.log(error)
reject(error)
});
},
handleCurrentChange(page) { handleCurrentChange(page) {
this.paginations.page = page; this.paginations.page = page;
this.load(); this.load();
@ -533,13 +575,6 @@
this.rainTypeVisible = false this.rainTypeVisible = false
this.rainType = 1 this.rainType = 1
}, },
showMapInfo(arr){
console.log(arr)
let obj = arr[0]
let type = arr[1]
this.showInfo(obj,type)
},
// //
showInfo(obj, formtype) { showInfo(obj, formtype) {
// //

@ -1,35 +1,393 @@
<template> <template>
<div> <dialogShow :title="title" :is-show.sync="isShow" :width="width" style="height:500px">
<div id="mapDiv"></div> <template v-slot:content style="height:500px">
<!-- <button @click = "open">点击画多边形</button> --> <div class="wrapper">
<div class="chooseMap">
<div>
<el-radio-group v-model="showMap" @change="changeMap">
<el-radio v-for="item in mapRadioList" :label="item.id">{{item.title}}</el-radio>
</el-radio-group>
</div>
<div>
<el-checkbox-group v-model="checkList" @change="changeCheck">
<el-checkbox v-for="item in mapCheckList" :label="item.id">{{item.title}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="map" id="olMap"></div>
<!-- 弹框 -->
<div ref="popup" class="popup" v-show="shopPopup">
<div class="info">
<div class="address">地址{{nowAddress}}</div>
<div class="showinfo" @click='showInfo(nowId)'>查看详情</div>
</div>
</div>
<!-- 查看详情 -->
<showRainEquipmentInfo ref="showRainEquipmentInfo"></showRainEquipmentInfo>
<showRainSiteInfo ref="showRainSiteInfo"></showRainSiteInfo>
</div> </div>
</template>
</dialogShow>
</template> </template>
<script> <script>
export default { import "ol/ol.css";
data(){ import {Tile as TileLayer,Vector as VectorLayer } from "ol/layer";
return{ import XYZ from "ol/source/XYZ";
} import {TileArcGISRest} from "ol/source"
}, import tilegrid from "ol/tilegrid/TileGrid"
created(){ import { defaults as defaultControls } from "ol/control";
import {get as getprojection} from "ol/proj"
}, import {Projection,addProjection} from "ol/proj"
mounted(){ import Map from "ol/Map.js";
this.loadmap() import View from "ol/View.js";
},
methods:{ //
loadmap(){ import { Vector as VectorSource } from "ol/source";
var map = new T.Map("mapDiv"); import * as olProj from "ol/proj";
// import {Feature, Overlay} from "ol"
map.centerAndZoom(new T.LngLat(116.40969, 39.94940), 12); import { Point } from "ol/geom";
// import { Style, Fill, Stroke, Circle as sCircle } from "ol/style";
map.enableScrollWheelZoom();
}
import proj4 from 'proj4'
import {CONFIGS,MAPCONFIGS} from '@/views/rain/inspection/components/config'
import showRainEquipmentInfo from '@/views/rain/inspection/components/showRainEquipmentInfo'
import showRainSiteInfo from '@/views/rain/inspection/components/showRainSiteInfo'
import dialogShow from '@/components/dialogShow'
export default {
components: {
showRainEquipmentInfo,
showRainSiteInfo,
CONFIGS,
MAPCONFIGS,
dialogShow
},
data() {
return {
title: "巡查点位",
width: "100%",
isShow: true,
map: null,
shopPopup:false,
nowAddress:"",
nowId:"",
showMap:"M2",
mapRadioList:[
{
id:"M2",
title:"天地图"
},{
id:"S1",
title:"水利图"
},{
id:"H1",
title:"河道图"
}
],
checkList:['M1','L1'],
mapCheckList:[
{
id:"M1",
title:"高清影像",
checked:true
},{
id:"L1",
title:"路网",
checked:true
}
],
configs :CONFIGS,
mapConfigs:MAPCONFIGS,
projection:"EPSG:4490",
featuresArr:[],
pointArr:[
[120.63212, 31.26249, 'suzhouas',51],
[120.63212, 30.26249, 'suzhouwown2',50],
[120.55590234876, 31.320813249765, 'suzhouwown2',49],
]
};
},
created() {
},
mounted() {
//
},
methods: {
showMap(){
this.$nextTick(function () {
this.initMap();
})
},
initMap() {
proj4.defs("EPSG:4490", '+proj=longlat +ellps=GRS80 +no_defs')
this.projection = new Projection({
code: this.mapConfigs.Map_Code,
units: this.mapConfigs.Map_units,
axisOrientation: this.mapConfigs.Map_axisOrientation,
global: this.mapConfigs.Map_global,
});
addProjection(this.projection);
let map = new Map({
target: "olMap",
view: new View({
center: this.mapConfigs.MAP_center, //
zoom: this.mapConfigs.Map_Zooms[0], //
maxZoom:this.mapConfigs.Map_Zooms[1],
minZoom:this.mapConfigs.Map_Zooms[2],
projection: this.projection,
}),
layers:[],
// interactions: defaultControls({
// doubleClickZoom: false,
// }),
});
this.map = map;
//
let url = "http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}";
url = `${url}&T=vec_c&tk=82526d64e8504a0341f775c087863825`;
let tdtLayer = new TileLayer({
title: "天地图",
id: "M2",
type: "overlay",
visible: true,
layerType: "TD地图",
opacity: 1,
source: new XYZ({
crossOrigin:'anonymous',
url: url,
projection:"EPSG:4326"
})
});
this.map.addLayer(tdtLayer);
this.ShowLayers()
this.setMarker()
this.addOverlay()
this.singleclick()
// this.map.layer2.setVisible(false)
},
//
ShowLayers() {
for (var i = 0; i < this.configs.length; i++) {
var result = this.configs[i];
if (result.layerType == "GIS地图") {
let projection = getprojection(result.projection);
let origin = [-400.0, 399.9999999999998];
let resolutions = [0.0027465820824835565,0.0013732910412417782,6.866455206208891E-4,3.4332276031044456E-4,1.7166138015522228E-4,8.583069007761114E-5,4.291534503880557E-5,2.1457672519402785E-5,1.0728836259701392E-5];
let fullExtent = [118.63622216442072, 30.12564516975147, 122.81217622965288, 32.74305227616479];
let tileGrid = new tilegrid({
tileSize: 256,
origin: origin,
extent: fullExtent,
resolutions: resolutions
});
let layer = new TileLayer({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new XYZ({
tileGrid: tileGrid,
url: result.url,
projection: projection
})
})
this.map.addLayer(layer);
}else {
let layer = new TileLayer({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new TileArcGISRest({
url: result.url,
projection: result.projection
}),
});
this.map.addLayer(layer);
}
}
},
//
setMarker() {
//
let flagLayer = new VectorLayer({
id:"pointer",
source: new VectorSource()
});
//
this.map.addLayer(flagLayer);
// feature
for (let i = 0; i < this.pointArr.length; i++) {
// featurefeature
let feature = new Feature({
geometry: new Point([this.pointArr[i][0], this.pointArr[i][1]])
});
//
feature.set('address',this.pointArr[i][2])
// ID
feature.setId(this.pointArr[i][3])
feature.setStyle(
new Style({
image: new sCircle({
fill: new Fill({
color: '#38ef7d',
}),
radius: 6,
}),
})
);
this.featuresArr.push(feature);
} // for
flagLayer.getSource().addFeatures(this.featuresArr);
},
addOverlay() {
// Overlay
let elPopup = this.$refs.popup;
this.popup = new Overlay({
element: elPopup,
positioning: "bottom-center",
stopEvent: false,
offset: [0, -20],
});
this.map.addOverlay(this.popup);
},
singleclick() {
//
this.map.on("singleclick", (e) => {
//
let feature = this.map.forEachFeatureAtPixel(
e.pixel,
(feature) => feature
);
if (feature) {
this.shopPopup = true;
//
let coordinates = feature.getGeometry().getCoordinates();
this.nowAddress = feature.get('address');
this.nowId = feature.getId()
this.popup.setPosition(coordinates);
} else {
this.shopPopup = false;
}
});
},
showInfo(id){
this.$refs.showRainEquipmentInfo.isShow = true
this.$refs.showRainEquipmentInfo.getEquipmentInfo(id)
this.$refs.showRainEquipmentInfo.infoId = id
this.$refs.showRainEquipmentInfo.formType = 'showform'
},
changeMap(val){
for(var m of this.mapRadioList){
if(val==m.id){
this.checkLayers(val,true)
}else{
this.checkLayers(m.id,false)
}
}
},
changeCheck(val){
if(val.length==0){
for(var m of this.mapCheckList){
this.checkLayers(m.id,false)
}
}else if(val.length==this.mapCheckList.length){
console.log(val)
for(var m of this.mapCheckList){
this.checkLayers(m.id,true)
}
}else{
for(var m of this.mapCheckList){
if(m.id==val[0]){
this.checkLayers(m.id,true)
}else{
this.checkLayers(m.id,false)
}
}
}
},
//
checkLayers(id, bool) {
var layers = this.map.getLayers().getArray();
for (let i = 0; i < layers.length; i++) {
if (layers[i].get("id") == id) {
if (bool) {
layers[i].setVisible(true);
}else{
layers[i].setVisible(false);
}
}
}
} }
}
},
};
</script> </script>
<style scoped> <style lang="scss" scoped>
#mapDiv {
height: 100vh; .chooseMap{
width: 100%; position: absolute;
margin: 15px 20px;
// width: 350px;
background-color: #fff;
border-radius: 4px;
border: 0.8px solid hsla(0,0%,60%,.2);
z-index:99;
top: 0;
right: 0;
line-height: 40px;
// text-align: center;
padding:0 40px 0 20px;
}
.map {
width: 100vw;
height: 100vh;
}
.popup {
width: 200px;
background-color: white;
padding: 18px;
border-radius: 10px;
box-shadow: 0 0 15px rgb(177, 177, 177);
.info {
font-size: 14px;
text-align: left;
ul {
padding-left: 0;
}
.showinfo{
color:red;
cursor: pointer;
} }
}
}
</style> </style>

@ -496,5 +496,8 @@
right: 1%; right: 1%;
transform: translate(0%, -50%); transform: translate(0%, -50%);
font-size: 60px; font-size: 60px;
}
.files_check .el-upload.el-upload--picture-card {
display: none;
} }
</style> </style>

@ -460,5 +460,8 @@
right: 1%; right: 1%;
transform: translate(0%, -50%); transform: translate(0%, -50%);
font-size: 60px; font-size: 60px;
}
.files_check .el-upload.el-upload--picture-card {
display: none;
} }
</style> </style>

@ -417,5 +417,8 @@
right: 1%; right: 1%;
transform: translate(0%, -50%); transform: translate(0%, -50%);
font-size: 60px; font-size: 60px;
}
.files_check .el-upload.el-upload--picture-card {
display: none;
} }
</style> </style>

@ -45,14 +45,14 @@ module.exports = {
}, },
//before: require('./mock/mock-server.js') //before: require('./mock/mock-server.js')
proxy: { proxy: {
'^/mapapi': { // '^/mapapi': {
//target: 'http://patrol.115.langye.net/', // //target: 'http://patrol.115.langye.net/',
target: "http://192.168.60.22:6080",//'http://192.168.60.100:9001/', // target: "http://172.17.50.65:6080",//'http://192.168.60.100:9001/',
changeOrigin: true, //配置跨域 // changeOrigin: true, //配置跨域
pathRewrite: { // pathRewrite: {
['^/mapapi']: 'http://192.168.60.22:6080' // ['^/mapapi']: 'http://172.17.50.65:6080'
} // }
}, // },
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
//target: 'http://patrol.115.langye.net/', //target: 'http://patrol.115.langye.net/',
target: process.env.VUE_APP_DOMAIN,//'http://192.168.60.100:9001/', target: process.env.VUE_APP_DOMAIN,//'http://192.168.60.100:9001/',

Loading…
Cancel
Save