t-segs-ms.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <form id="s_cz_div" class="layui-form">
  2. <div id='layers' class="layui-form-item">
  3. <label class="layui-form-label">选择图层</label>
  4. <div class="layui-input-block"></div>
  5. </div>
  6. <div id='segCount' class="layui-form-item">
  7. <label class="layui-form-label">选择分段数</label>
  8. <div class="layui-input-block">
  9. <input type="radio" name="segs" value="5" title="5段">
  10. <input type="radio" name="segs" value="10" title="10段" checked>
  11. </div>
  12. </div>
  13. <div class="layui-form-item">
  14. <div class="layui-input-block" style="text-align: right;">
  15. <button id="tj" type="button" class="layui-btn layui-btn-normal">统&nbsp;&nbsp;计</button>
  16. <button type="reset" class="layui-btn layui-btn-primary">重&nbsp;&nbsp;置</button>
  17. </div>
  18. </div>
  19. </form>
  20. <script type="text/javascript">
  21. let lyrs = CONST_VALUES.GX_Datas;
  22. //debugger;
  23. let checkboxStr = "<input type='checkbox' name='THENAME' title='THETITLE' id='THEID' lay-skin='primary' dataSetName='THEDATASETNAME' dataSourceName='THEWS'>";
  24. for (let index = 0; index < lyrs.length; index++) {
  25. const lyr = lyrs[index];
  26. //debugger;
  27. if (lyr.name.indexOf("管线") < 0)
  28. continue;
  29. var dom = checkboxStr.replace('THENAME', lyr.name);
  30. dom = dom.replace('THETITLE', lyr.name);
  31. dom = dom.replace('THEID', lyr.id);
  32. dom = dom.replace('THEWS', lyr.dataSourceName);
  33. dom = dom.replace('THEDATASETNAME', lyr.dataSetName);
  34. //debugger;
  35. $("#layers .layui-input-block").append(dom);
  36. }
  37. $("#s_cz_div #tj").click(function(obj) {
  38. const layers = $("#layers input:checked");
  39. const seg = $("#segCount input:checked").val();
  40. if (layers.length == 0) {
  41. layer.msg('请至少选择一个图层!', {
  42. icon: 7
  43. });
  44. return;
  45. }
  46. var selectLayers = "";
  47. var xAxis = [];
  48. for (let index = 0; index < layers.length; index++) {
  49. var checked = layers[index].checked;
  50. if (!checked)
  51. continue;
  52. selectLayers += mapDatas.getLayerNameByCaption(layers[index].name) + ","
  53. xAxis.push(layers[index].name);
  54. }
  55. $.ajax({
  56. url: "statistics/spatialstatistics/segs/ms?tbNames=" + selectLayers + "&segCount=" + seg,
  57. success: function(result) {
  58. panels.createResultPanelWithChart(xAxis, /**/
  59. result, "按埋深统计", "单位:米", "埋深", "长度", "bar",
  60. function() {
  61. //debugger;
  62. });
  63. },
  64. error: function() {
  65. layer.msg('统计报错!', {
  66. icon: 7
  67. });
  68. }
  69. });
  70. });
  71. </script>