a62e004b5c5f7c970cfb352d91c48a0ef6a23c8c.svn-base 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. const options = {
  2. url: "/arcgisApi/4.7/init.js"
  3. };
  4. import _default,* as esriLoader from "esri-loader";
  5. import {_getLngLat} from './mercatorToLngLat'
  6. import {getMyBiaoJi} from '../../../api/zhxxAPI.js'
  7. export function getBiaoJiList(_self,tableData){
  8. esriLoader.loadModules(["esri/Graphic","esri/geometry/Point","esri/geometry/SpatialReference",
  9. "dojo/domReady!"],options).then( (
  10. [Graphic,Point,SpatialReference]) => {
  11. var bjGraphicLayer = _self.mapObject.findLayerById("bjGraphicLayer");
  12. bjGraphicLayer.removeAll();
  13. bjGraphicLayer.visible = true;
  14. var symbol = {//
  15. type: "picture-marker",
  16. url: "/src/views/zongHeXinXiNew/assets/bjR.png",
  17. width: "16px",
  18. height: "34px"
  19. };
  20. var gra,pt,symbol;
  21. tableData.forEach((item)=>{
  22. if(item.lgtd && item.lttd){
  23. pt = new Point(item.lgtd,item.lttd,new SpatialReference(102100));
  24. gra = new Graphic({
  25. geometry:pt,
  26. symbol:symbol,
  27. attributes:item
  28. })
  29. bjGraphicLayer.add(gra);
  30. }
  31. });
  32. // getMyBiaoJi(_self.userId,'','','',1,10000).then((res)=>{
  33. // if(res.data.list){
  34. // res.data.list.forEach((item)=>{
  35. // if(item.lgtd && item.lttd){
  36. // pt = new Point(item.lgtd,item.lttd,new SpatialReference(102100));
  37. // gra = new Graphic({
  38. // geometry:pt,
  39. // symbol:symbol,
  40. // attributes:item
  41. // })
  42. // bjGraphicLayer.add(gra);
  43. // }
  44. // });
  45. // }
  46. // })
  47. }).catch(err => {
  48. console.error(err);
  49. });
  50. }
  51. export function biaojiHandler(_self,mapPoint){
  52. esriLoader.loadModules(["esri/Graphic","esri/geometry/Point","esri/geometry/SpatialReference",
  53. "dojo/domReady!"],options).then( (
  54. [Graphic,Point,SpatialReference]) => {
  55. var symbol = {//
  56. type: "picture-marker",
  57. url: "/src/views/zongHeXinXiNew/assets/bjR.png",
  58. width: "16px",
  59. height: "34px"
  60. };
  61. var gra = new Graphic({
  62. geometry:mapPoint,
  63. symbol:symbol,
  64. attributes:''
  65. });
  66. _self.viewObject.graphics.removeAll();
  67. _self.viewObject.graphics.add(gra);
  68. var longLat = _getLngLat({
  69. x:mapPoint.x,
  70. y:mapPoint.y
  71. })
  72. var str = "<div>"+
  73. "<div>"+
  74. "<div style='display: flex;padding: 2px;'>"+
  75. "<p style='font-size: 14px;padding: 5px;'>名称:</p>"+
  76. "<input type='text' id='nameId' style='height: 33px;width: 222px;'>"+
  77. "</div>"+
  78. "<div style='display: flex;padding: 2px;'>"+
  79. "<p style='font-size: 14px;padding: 5px;padding-top: 8px;'>经度:</p>"+
  80. "<input type='text' id='longId' style='height: 33px;width: 90px;'value='"+longLat.lng.toFixed(6)+"'>"+
  81. "<p style='font-size: 14px;padding: 5px;padding-top: 8px;'>纬度:</p>"+
  82. "<input type='text' id='latId' style='height: 33px;width: 90px;' value='"+longLat.lat.toFixed(6)+"'>"+
  83. "</div>"+
  84. "<div style='display: flex;padding: 2px;'>"+
  85. "<p style='font-size: 14px;padding: 5px;'>备注:</p>"+
  86. "<textarea id='noteId' rows='6' cols='28' style='width: 222px;'>"+
  87. "</textarea>"+
  88. "</div>"+
  89. "</div>"+
  90. "<div style='margin-top:10px;float: right;'>"+
  91. "<button type='button' style='margin-right: 20px;width: 50px;' @click='cancelHandler()'>取消</button>"+
  92. "<button type='button' style='width: 50px;' @click='submitHandler("+longLat.lng+","+longLat.lat+")'>保存</button>"+
  93. "</div>"+
  94. "</div>";
  95. _self.viewObject.popup.open({
  96. title:'新建标记',
  97. content: _self.initHtml(str),
  98. location:mapPoint
  99. });
  100. }).catch(err => {
  101. console.error(err);
  102. });
  103. }