built-in-map.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * 覆写定位方法
  3. * @param {string} tabName 数据表名称
  4. * @param {string} fedId 要素Id
  5. */
  6. function CallMapLocation(tabName, fedId) {
  7. $('.jt-map-location-panel').css({
  8. position: 'relative',
  9. left: '0px',
  10. });
  11. $('.jt-map-location-panel').show();
  12. const frame = document.getElementById('frameWrapper');
  13. frame.contentWindow.location_tabName_feaId(tabName, fedId);
  14. }
  15. /**
  16. * 查询地块数据
  17. * @param {Object} obj 执行该事件的按钮
  18. * @param {string} tabName 数据表名称
  19. * @param {string} fldName 字段名称
  20. * @param {string} fldValue 字段值
  21. * @param {string} showFldName 展示字段名称
  22. * @param {string} domId 展示查询内容的容器
  23. */
  24. function queryPolygonFeatures(obj, tabName, fldName, fldValue, showFldName, domId) {
  25. let txt = $(obj).text();
  26. if (txt === '隐藏图斑') {
  27. $(obj).text("图斑");
  28. $(".jt-feature-data-row").remove();
  29. return;
  30. } else {
  31. $(obj).text("隐藏图斑");
  32. }
  33. var iData = {
  34. tabName: tabName,
  35. fldName: fldName,
  36. fldValue: fldValue,
  37. queryType: 'equal',
  38. showFldName: showFldName === undefined ? '' : showFldName,
  39. start: '1',
  40. count: '100',
  41. }
  42. sendAjax({
  43. url: 'appQueryFeatureData',
  44. data: iData,
  45. waitMessage: '查询中...',
  46. success: function(resData) {
  47. var data = resData[0];
  48. if (data.dataCount == 0) {
  49. muiAlert('未查询到任何数据!', '警告');
  50. } else {
  51. showPolygonQueryResult(data, domId);
  52. }
  53. },
  54. error: function(err) {
  55. muiAlertError(err);
  56. }
  57. })
  58. }
  59. /**
  60. * 地块数据展示
  61. * @param {JSON} jsonData 数据集
  62. * @param {string} domId 装载地块数据的容器
  63. */
  64. function showPolygonQueryResult(jsonData, domId) {
  65. let divRoot = $("#" + domId);
  66. /* 加入数据 */
  67. for (var i in jsonData.dataList) {
  68. var item = jsonData.dataList[i];
  69. var divItem = document.createElement('div');
  70. if (i % 2 == 0) {
  71. divItem.className = 'jt-feature-data-row jt-row-even-number';
  72. } else {
  73. divItem.className = 'jt-feature-data-row jt-row-odd-number';
  74. }
  75. divRoot.append(divItem);
  76. var html = "";
  77. html += "<span>" + item.feaNumber + "</span>";
  78. html += "<span>" + item.feaName + "</span>";
  79. html += "<span>" + item.feaArea + "亩</span>";
  80. html += "<button type='button' class='mui-btn app-icon app-icon-location'";
  81. html += " onclick = \"CallMapLocation('" + item.tabName + "','" + item.feaId + "')\" />"
  82. divItem.innerHTML = html;
  83. }
  84. }