网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

165 regels
6.4 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "paging", 'dateTime', 'swiper'], function ($, template, Tools) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. propertyList:'',
  9. map: '', // 地图图层
  10. },
  11. };
  12. var tools = new Tools();
  13. module.init = function (page) {
  14. tools.doGet(assetGet+getQueryVariable('id'), {translate_dict: 1}, module.assetDetail , true);
  15. tools.doGet(webList, {}, module.webList , true);
  16. // var map = new BMapGL.Map('container'); // 创建Map实例
  17. // map.centerAndZoom(new BMapGL.Point(116.320938,39.950026), 18); // 初始化地图,设置中心点坐标和地图级别
  18. // map.enableScrollWheelZoom(false); // 开启鼠标滚轮缩放
  19. };
  20. module.useContent = function (data) {
  21. if (data.code == 200) {
  22. module.data.phone = data.data.phone;
  23. module.data.leader = data.data.leader;
  24. var propertyDetailData = template('propertyDetailData', module.data);
  25. $("#propertyDetailContent").html(propertyDetailData);
  26. setTimeout(() => {
  27. initMap(data.data);
  28. }, 500);
  29. }
  30. }
  31. initMap = function (dept) {
  32. document.getElementById("container").innerHTML = "";
  33. // 定义地图投影
  34. let projection = new ol.proj.Projection({
  35. code: "EPSG:3857",
  36. units: "degrees",
  37. });
  38. // 定义地图图层
  39. let aerial = new ol.layer.Tile({
  40. source: new ol.source.XYZ({
  41. url: "http://t{0-7}.tianditu.com/img_w/wmts?" +
  42. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  43. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
  44. }),
  45. isGroup: true,
  46. name: "卫星影像图",
  47. });
  48. let yingxzi = new ol.layer.Tile({
  49. source: new ol.source.XYZ({
  50. url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
  51. }),
  52. isGroup: true,
  53. name: "天地图文字标注--卫星影像图",
  54. });
  55. //加载地图
  56. module.data.map = new ol.Map({
  57. controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]),
  58. layers: [aerial, yingxzi],
  59. projection: projection,
  60. target: "container",
  61. view: new ol.View({
  62. center: ol.proj.fromLonLat([dept.lng, dept.lat]), // 地图中心坐标
  63. zoom: 16,
  64. minZoom: 1, //地图缩小限制
  65. maxZoom: 18, //地图放大限制
  66. }),
  67. /*interactions: ol.interaction.defaults({
  68. doubleClickZoom: false, // 双击放大地图
  69. // mouseWheelZoom: false, // 鼠标滚轮放大地图
  70. // shiftDragZoom: false, // shift + 鼠标左键拖拽 放大地图
  71. })*/
  72. });
  73. if (module.data.propertyDetail && module.data.propertyDetail.theGeom) {
  74. const permanentLayer = new ol.layer.Vector({
  75. source: new ol.source.Vector({
  76. features: new ol.format.GeoJSON().readFeatures(module.data.propertyDetail.theGeom),
  77. }),
  78. name: 'permanentDetail',
  79. style: new ol.style.Style({
  80. image: new ol.style.Icon({
  81. //设置图标偏移
  82. anchor: [0.5, 1],
  83. //标注样式的起点位置
  84. anchorOrigin: "top-right",
  85. //X方向单位:分数
  86. anchorXUnits: "fraction",
  87. //Y方向单位:像素
  88. anchorYUnits: "pixels",
  89. //偏移起点位置的方向
  90. offsetOrigin: "top-right",
  91. //透明度
  92. opacity: 0.9,
  93. //图片路径
  94. src: '/infoport/static/images/zc_icon.png',
  95. })
  96. })
  97. });
  98. module.data.map.addLayer(permanentLayer);
  99. module.data.map.getView().setCenter(ol.extent.getCenter(permanentLayer.getSource().getExtent()));
  100. }
  101. }
  102. module.webList = function (data) {
  103. if (data.code == 200) {
  104. var content = data.data;
  105. module.data.webList = content;
  106. var webData = template('webData', module.data);
  107. $("#webContent").html(webData);
  108. var titData = template('titData', module.data);
  109. $("#titContent").html(titData);
  110. $('#ewm').attr('src', 'static/images/'+content.top.bz);
  111. }
  112. }
  113. module.assetDetail = function(data){
  114. if (data.code == 200) {
  115. var content = data.data;
  116. module.data.propertyDetail = content;
  117. tools.doGet(attachmentList, {
  118. tableId:content.id,
  119. tableName: 't_asset_permanent',
  120. bizPath: 'asset'
  121. }, module.attachmentDetail , true);
  122. tools.doGet(treeselectSecond+content.deptId, {}, module.useContent , true);
  123. // var propertyDetailData = template('propertyDetailData', module.data);
  124. // $("#propertyDetailContent").html(propertyDetailData);
  125. // $('#dialog').css('display','block');
  126. }
  127. }
  128. module.attachmentDetail = function(data){
  129. if (data.code == 200) {
  130. var content = data.rows;
  131. var attachmentList = [];
  132. content.map(res=>{
  133. if (res.fileName.indexOf('png')>-1||res.fileName.indexOf('jpg')>-1){
  134. attachmentList.push(res);
  135. }
  136. })
  137. module.data.attachment = attachmentList;
  138. var propertyDetailData = template('propertyDetailData', module.data);
  139. $("#propertyDetailContent").html(propertyDetailData);
  140. $('#dialog').css('display','block');
  141. }
  142. }
  143. //获取地址栏参数
  144. function getQueryVariable(variable){
  145. var query = window.location.search.substring(1);
  146. var vars = query.split("&");
  147. for (var i=0;i<vars.length;i++) {
  148. var pair = vars[i].split("=");
  149. if(pair[0] == variable){return pair[1];}
  150. }
  151. return(false);
  152. }
  153. return module;
  154. });