diff --git a/infoport/homestead.html b/infoport/homestead.html
index 3631e82..c67e262 100644
--- a/infoport/homestead.html
+++ b/infoport/homestead.html
@@ -13,7 +13,8 @@
-
+
+
@@ -125,11 +126,6 @@
-
diff --git a/infoport/static/js/project/homestead.js b/infoport/static/js/project/homestead.js
index 8129e1a..639532a 100644
--- a/infoport/static/js/project/homestead.js
+++ b/infoport/static/js/project/homestead.js
@@ -19,22 +19,14 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
dictValue:'',
dictLabel:'全部'
}],
- propertyDetail:{}
+ propertyDetail:{},
+ map: '', // 地图图层
+ homesteadLayer: '', // 宅基地图层
},
};
var tools = new Tools();
module.init = function (page) {
- //资产列表
- tools.doGet(zjdzdxxList, {
- deptId: 100,
- translate_dict: 1,
- houseOwnership:1,
- pageNum: 1,
- pageSize: 10,
- }, module.assetList , true);
-
- tools.doGet(treeselectSecond+'100', {}, module.useContent, true);
tools.doGet(treeselect, {}, module.treeselect , true);
tools.doGet(webList, {}, module.webList , true);
// tools.doGet(webDeptType+'land_status', {}, module.webDeptType , true);
@@ -47,6 +39,8 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
module.data.leader = data.data.leader;
var propertyDetailData = template('propertyDetailData', module.data);
$("#propertyDetailContent").html(propertyDetailData);
+ module.data.map.getView().setCenter(ol.proj.fromLonLat([data.data.lng, data.data.lat]));
+ module.data.map.getView().setZoom(13);
}
}
@@ -87,12 +81,53 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
})
}
module.data.propertyList = content;
+ // 添加宅基地图层
+ addHomesteadLayer(content);
// $('#page_s1').html('共' + 10 + '页')
var propertyData = template('propertyData', module.data);
$("#propertyContent").html(propertyData);
}
}
+ // 添加宅基地图层
+ addHomesteadLayer = function (content) {
+ if (module.data.homesteadLayer) {
+ module.data.map.removeLayer(module.data.homesteadLayer);
+ module.data.homesteadLayer = '';
+ }
+ let features = [];
+ content.forEach(item => {
+ if (item.theGeomJson != null && item.theGeomJson !== '') {
+ const iconFeature = new ol.Feature({
+ geometry: new ol.geom.MultiPolygon(JSON.parse(item.theGeomJson).coordinates),
+ // name: item.centerName,
+ // centerDeptId: item.deptId,
+ level: 'homestead',
+ });
+ features.push(iconFeature);
+ }
+ });
+ const vectorSource = new ol.source.Vector({
+ features: features,
+ });
+ module.data.homesteadLayer = new ol.layer.Vector({
+ source: vectorSource,
+ name: 'homesteadLayer',
+ style: new ol.style.Style({
+ fill: new ol.style.Fill({
+ //矢量图层填充颜色,以及透明度
+ color: "rgba(22, 233, 15, 0.3)",
+ }),
+ stroke: new ol.style.Stroke({
+ //边界样式
+ color: "#16E90F",
+ width: 2,
+ }),
+ })
+ });
+ module.data.map.getLayers().insertAt(3, module.data.homesteadLayer);
+ }
+
openDialog = function(id){
tools.doGet(zjdzdxxGet+id, {translate_dict: 1}, module.assetDetail , true);
}
@@ -143,9 +178,71 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
$("#treeselectContent").html(treeselectData);
var treeselectSecondData = template('treeselectSecondData', module.data);
$("#treeselectSecondContent").html(treeselectSecondData);
+ initMap(data.data[0]);
+ //资产列表
+ tools.doGet(zjdzdxxList, {
+ deptId: 100,
+ translate_dict: 1,
+ houseOwnership:1,
+ pageNum: 1,
+ pageSize: 10,
+ }, module.assetList , true);
+ tools.doGet(treeselectSecond+'100', {}, module.useContent, true);
}
}
+ initMap = function (dept) {
+ let mapCenterLocation;
+ if (dept.lng && dept.lat) {
+ mapCenterLocation = [dept.lng, dept.lat];
+ } else {
+ mapCenterLocation = [116.391461, 39.902359];
+ }
+
+ document.getElementById("container").innerHTML = "";
+ // 定义地图投影
+ let projection = new ol.proj.Projection({
+ code: "EPSG:3857",
+ units: "degrees",
+ });
+ // 定义地图图层
+ let aerial = new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ url: "http://t{0-7}.tianditu.com/img_w/wmts?" +
+ "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
+ "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
+ }),
+ isGroup: true,
+ name: "卫星影像图",
+ });
+ let yingxzi = new ol.layer.Tile({
+ source: new ol.source.XYZ({
+ url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
+ }),
+ isGroup: true,
+ name: "天地图文字标注--卫星影像图",
+ });
+ //加载地图
+ module.data.map = new ol.Map({
+ controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([new ol.control.FullScreen()]),
+ layers: [aerial, yingxzi],
+ projection: projection,
+ target: "container",
+ view: new ol.View({
+ center: ol.proj.fromLonLat(mapCenterLocation), // 地图中心坐标
+ zoom: 13,
+ minZoom: 1, //地图缩小限制
+ maxZoom: 18, //地图放大限制
+ // extent: [13481224.75161,5667110.83528,13811063.06278,5880284.11416]
+ }),
+ /*interactions: ol.interaction.defaults({
+ doubleClickZoom: false, // 双击放大地图
+ // mouseWheelZoom: false, // 鼠标滚轮放大地图
+ // shiftDragZoom: false, // shift + 鼠标左键拖拽 放大地图
+ })*/
+ });
+ }
+
selectChange = function(){
// tools.doGet(treeselectSecond+$('#treeselectContent').val(), {}, module.selectSecondChange , true);
if ($('#treeselectContent').val() == 100){
diff --git a/infoport/static/js/project/resource.js b/infoport/static/js/project/resource.js
index 7956d4b..5003a3a 100644
--- a/infoport/static/js/project/resource.js
+++ b/infoport/static/js/project/resource.js
@@ -20,22 +20,12 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
}],
propertyDetail:{},
map: '', // 地图图层
- resourceLayer: '', // 资产图层
+ resourceLayer: '', // 资源图层
},
};
var tools = new Tools();
module.init = function (page) {
- //资产列表
- tools.doGet(resourceList, {
- deptId: 187,
- translate_dict: 1,
- pageNum: 1,
- pageSize: 10,
- }, module.assetList , true);
-
-
- tools.doGet(treeselectSecond+'100', {}, module.useContent, true);
tools.doGet(treeselect, {}, module.treeselect , true);
tools.doGet(webList, {}, module.webList , true);
// tools.doGet(webDeptType+'use_code', {}, module.webDeptType , true);
@@ -90,7 +80,7 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
})
}
module.data.propertyList = content;
- // 添加资产图层
+ // 添加资源图层
addResourceLayer(content);
// $('#page_s1').html('共' + 10 + '页')
var propertyData = template('propertyData', module.data);
@@ -98,7 +88,7 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
}
}
- // 添加资产图层
+ // 添加资源图层
addResourceLayer = function (content) {
if (module.data.resourceLayer) {
module.data.map.removeLayer(module.data.resourceLayer);
@@ -106,7 +96,7 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
}
let features = [];
content.forEach(item => {
- if (item.theGeom != null && item.theGeom !== '') {
+ if (item.theGeomJson != null && item.theGeomJson !== '') {
const iconFeature = new ol.Feature({
geometry: new ol.geom.MultiPolygon(JSON.parse(item.theGeomJson).coordinates),
// name: item.centerName,
@@ -188,6 +178,14 @@ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function
var treeselectSecondData = template('treeselectSecondData', module.data);
$("#treeselectSecondContent").html(treeselectSecondData);
initMap(data.data[0]);
+ //资产列表
+ tools.doGet(resourceList, {
+ deptId: 100,
+ translate_dict: 1,
+ pageNum: 1,
+ pageSize: 10,
+ }, module.assetList , true);
+ tools.doGet(treeselectSecond+'100', {}, module.useContent, true);
}
}