s-gk.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!--<管块查询>-->
  2. <form id="s_cz_div" class="layui-form">
  3. <div id='layers' class="layui-form-item">
  4. <label class="layui-form-label">选择图层</label>
  5. <div class="layui-input-block"></div>
  6. </div>
  7. <div id='gkTypes' class="layui-form-item">
  8. <label class="layui-form-label">选择宽×高</label>
  9. <div class="layui-input-block"></div>
  10. </div>
  11. <div class="layui-form-item">
  12. <div class="layui-input-block" style="text-align: right;">
  13. <button id="query" type="button" class="layui-btn layui-btn-normal">查&nbsp;&nbsp;询</button>
  14. <button type="reset" class="layui-btn layui-btn-primary">重&nbsp;&nbsp;置</button>
  15. </div>
  16. </div>
  17. </form>
  18. <script type="text/javascript">
  19. let lyrs = CONST_VALUES.GX_Datas;
  20. //debugger;
  21. let checkboxStr = "<input type='checkbox' name='THENAME' title='THETITLE' id='THEID' lay-skin='primary' dataSetName='THEDATASETNAME' dataSourceName='THEWS'>";
  22. for (let index = 0; index < lyrs.length; index++) {
  23. const lyr = lyrs[index];
  24. //debugger;
  25. if (lyr.name.indexOf("管线") < 0)
  26. continue;
  27. let dom = checkboxStr.replace('THENAME', lyr.name);
  28. dom = dom.replace('THETITLE', lyr.name);
  29. dom = dom.replace('THEID', lyr.id);
  30. dom = dom.replace('THEWS', lyr.dataSourceName);
  31. dom = dom.replace('THEDATASETNAME', lyr.dataSetName);
  32. //debugger;
  33. $("#layers .layui-input-block").append(dom);
  34. }
  35. const czs = CONST_VALUES.GX_GK;
  36. let radioStr = "<input type='radio' name='GUANKUAI' title='THETITLE' id='THEID'>";
  37. for (let index = 0; index < czs.length; index++) {
  38. const cz = czs[index];
  39. let dom = radioStr.replace('THETITLE', cz);
  40. dom = dom.replace('THEID', cz);
  41. $("#gkTypes .layui-input-block").append(dom);
  42. }
  43. $("#s_cz_div #query").click(function(obj) {
  44. //debugger;
  45. let cz = $('input[name="GUANKUAI"]:checked').val();
  46. if (cz == undefined) {
  47. layer.msg('请选择一种管径!', {
  48. icon: 7
  49. });
  50. return;
  51. }
  52. cz = $('input[name="GUANKUAI"]:checked')[0].id;
  53. let layers = $("#layers input:checked");
  54. if (layers.length == 0) {
  55. layer.msg('请至少选择一个图层!', {
  56. icon: 7
  57. });
  58. return;
  59. }
  60. for (let index = 0; index < layers.length; index++) {
  61. let checked = layers[index].checked;
  62. if (!checked)
  63. continue;
  64. let ws = layers[index].attributes.dataSourceName.value;
  65. let dataSetName = layers[index].attributes.dataSetName.value;
  66. //debugger;
  67. let sql = "SmID > 0"
  68. if (cz !== "全部") {
  69. let wh = cz.split('×');
  70. let w = wh[0];
  71. let h = wh[1];
  72. sql += " AND SSPIPEWIDTH = " + w + " AND SSPIPEHEIGHT " + h;
  73. }
  74. query(layers[index].title, dataSetName, ws, sql);
  75. }
  76. });
  77. let query = function(subtitleP, dataSetNameP, wsP, sqlP) {
  78. let thatsubtitleP = subtitleP;
  79. let dataSource = wsP;
  80. let urlTmp = CONST_VALUES.GX_Datas_BaseUrl + "/datasources/" + wsP +
  81. "/datasets/" + dataSetNameP + "/features.json";
  82. $.get(urlTmp, function(e) {
  83. const count = e.featureCount;
  84. //console.info("e.featureCount" + e.featureCount);
  85. Q.queryBySql(dataSetNameP, wsP, sqlP, 0, 2000, function(rs) {
  86. if (rs.result == undefined) return;
  87. panels.createResultPanelWithDataGrid({
  88. subTitle: thatsubtitleP,
  89. features: rs.result.features.features,
  90. title: "按管块查询结果",
  91. count: count,
  92. dataSetName: dataSetNameP,
  93. dataSourceName: dataSource
  94. },
  95. function() {
  96. //debugger;
  97. });
  98. });
  99. });
  100. }
  101. </script>