/** * Created by Administrator on 2021/4/5. */ define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function ($, template, Tools) { //数据存储 var module = { data: { propertyList:'', map: '', // 地图图层 }, }; var tools = new Tools(); module.init = function (page) { tools.doGet(resourceGet+getQueryVariable('id'), {translate_dict: 1}, module.assetDetail , true); tools.doGet(webList, {}, module.webList , true); // var map = new BMapGL.Map('container'); // 创建Map实例 // map.centerAndZoom(new BMapGL.Point(116.320938,39.950026), 18); // 初始化地图,设置中心点坐标和地图级别 // map.enableScrollWheelZoom(false); // 开启鼠标滚轮缩放 }; module.useContent = function (data) { if (data.code == 200) { module.data.phone = data.data.phone; module.data.leader = data.data.leader; var propertyDetailData = template('propertyDetailData', module.data); $("#propertyDetailContent").html(propertyDetailData); initMap(data.data); } } initMap = function (dept) { 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([]), layers: [aerial, yingxzi], projection: projection, target: "container", view: new ol.View({ center: ol.proj.fromLonLat([dept.lng, dept.lat]), // 地图中心坐标 zoom: 16, minZoom: 1, //地图缩小限制 maxZoom: 18, //地图放大限制 }), /*interactions: ol.interaction.defaults({ doubleClickZoom: false, // 双击放大地图 // mouseWheelZoom: false, // 鼠标滚轮放大地图 // shiftDragZoom: false, // shift + 鼠标左键拖拽 放大地图 })*/ }); if (module.data.propertyDetail && module.data.propertyDetail.theGeomJson) { const resourceDetail = new ol.layer.Vector({ source: new ol.source.Vector({ features: new ol.format.GeoJSON().readFeatures(module.data.propertyDetail.theGeomJson), }), name: 'resourceDetail', style: new ol.style.Style({ fill: new ol.style.Fill({ //矢量图层填充颜色,以及透明度 color: "rgba(255, 255, 0, 0.3)", }), stroke: new ol.style.Stroke({ //边界样式 color: "#ffff00", width: 2, }), }) }); module.data.map.addLayer(resourceDetail); module.data.map.getView().setCenter(ol.extent.getCenter(resourceDetail.getSource().getExtent())); } } module.webList = function (data) { if (data.code == 200) { var content = data.data; module.data.webList = content; var webData = template('webData', module.data); $("#webContent").html(webData); var titData = template('titData', module.data); $("#titContent").html(titData); } } module.assetDetail = function(data){ if (data.code == 200) { var content = data.data; module.data.propertyDetail = content; tools.doGet(attachmentList, { tableId:content.id, tableName: 't_asset_resource', bizPath: 'asset' }, module.attachmentDetail , true); tools.doGet(treeselectSecond+content.deptId, {}, module.useContent , true); // var propertyDetailData = template('propertyDetailData', module.data); // $("#propertyDetailContent").html(propertyDetailData); // $('#dialog').css('display','block'); } } module.attachmentDetail = function(data){ if (data.code == 200) { var content = data.rows; var attachmentList = []; content.map(res=>{ if (res.fileName.indexOf('png')>-1||res.fileName.indexOf('jpg')>-1){ attachmentList.push(res); } }) module.data.attachment = attachmentList; var propertyDetailData = template('propertyDetailData', module.data); $("#propertyDetailContent").html(propertyDetailData); $('#dialog').css('display','block'); } } //获取地址栏参数 function getQueryVariable(variable){ var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i