网站
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.
 
 
 

155 lines
6.0 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(resourceGet+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. initMap(data.data);
  27. }
  28. }
  29. initMap = function (dept) {
  30. document.getElementById("container").innerHTML = "";
  31. // 定义地图投影
  32. let projection = new ol.proj.Projection({
  33. code: "EPSG:3857",
  34. units: "degrees",
  35. });
  36. // 定义地图图层
  37. let aerial = new ol.layer.Tile({
  38. source: new ol.source.XYZ({
  39. url: "http://t{0-7}.tianditu.com/img_w/wmts?" +
  40. "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
  41. "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
  42. }),
  43. isGroup: true,
  44. name: "卫星影像图",
  45. });
  46. let yingxzi = new ol.layer.Tile({
  47. source: new ol.source.XYZ({
  48. url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
  49. }),
  50. isGroup: true,
  51. name: "天地图文字标注--卫星影像图",
  52. });
  53. //加载地图
  54. module.data.map = new ol.Map({
  55. controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]),
  56. layers: [aerial, yingxzi],
  57. projection: projection,
  58. target: "container",
  59. view: new ol.View({
  60. // center: mapCenterLocation, // 地图中心坐标
  61. zoom: 16,
  62. minZoom: 1, //地图缩小限制
  63. maxZoom: 18, //地图放大限制
  64. }),
  65. /*interactions: ol.interaction.defaults({
  66. doubleClickZoom: false, // 双击放大地图
  67. // mouseWheelZoom: false, // 鼠标滚轮放大地图
  68. // shiftDragZoom: false, // shift + 鼠标左键拖拽 放大地图
  69. })*/
  70. });
  71. if (module.data.propertyDetail && module.data.propertyDetail.theGeomJson) {
  72. const resourceDetail = new ol.layer.Vector({
  73. source: new ol.source.Vector({
  74. features: new ol.format.GeoJSON().readFeatures(module.data.propertyDetail.theGeomJson),
  75. }),
  76. name: 'resourceDetail',
  77. style: new ol.style.Style({
  78. fill: new ol.style.Fill({
  79. //矢量图层填充颜色,以及透明度
  80. color: "rgba(255, 255, 0, 0.3)",
  81. }),
  82. stroke: new ol.style.Stroke({
  83. //边界样式
  84. color: "#ffff00",
  85. width: 2,
  86. }),
  87. })
  88. });
  89. module.data.map.addLayer(resourceDetail);
  90. module.data.map.getView().setCenter(ol.extent.getCenter(resourceDetail.getSource().getExtent()));
  91. } else {
  92. module.data.map.getView().setCenter(ol.proj.fromLonLat([dept.lng, dept.lat]));
  93. }
  94. }
  95. module.webList = function (data) {
  96. if (data.code == 200) {
  97. var content = data.data;
  98. module.data.webList = content;
  99. var webData = template('webData', module.data);
  100. $("#webContent").html(webData);
  101. var titData = template('titData', module.data);
  102. $("#titContent").html(titData);
  103. }
  104. }
  105. module.assetDetail = function(data){
  106. if (data.code == 200) {
  107. var content = data.data;
  108. module.data.propertyDetail = content;
  109. tools.doGet(attachmentList, {
  110. tableId:content.id,
  111. tableName: 't_asset_resource',
  112. bizPath: 'asset'
  113. }, module.attachmentDetail , true);
  114. tools.doGet(treeselectSecond+content.deptId, {}, module.useContent , true);
  115. // var propertyDetailData = template('propertyDetailData', module.data);
  116. // $("#propertyDetailContent").html(propertyDetailData);
  117. // $('#dialog').css('display','block');
  118. }
  119. }
  120. module.attachmentDetail = function(data){
  121. if (data.code == 200) {
  122. var content = data.rows;
  123. var attachmentList = [];
  124. content.map(res=>{
  125. if (res.fileName.indexOf('png')>-1||res.fileName.indexOf('jpg')>-1){
  126. attachmentList.push(res);
  127. }
  128. })
  129. module.data.attachment = attachmentList;
  130. var propertyDetailData = template('propertyDetailData', module.data);
  131. $("#propertyDetailContent").html(propertyDetailData);
  132. $('#dialog').css('display','block');
  133. }
  134. }
  135. //获取地址栏参数
  136. function getQueryVariable(variable){
  137. var query = window.location.search.substring(1);
  138. var vars = query.split("&");
  139. for (var i=0;i<vars.length;i++) {
  140. var pair = vars[i].split("=");
  141. if(pair[0] == variable){return pair[1];}
  142. }
  143. return(false);
  144. }
  145. return module;
  146. });