123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <!--<管径查询>-->
- <form id="s_cz_div" class="layui-form">
- <div id='layers' class="layui-form-item">
- <label class="layui-form-label">选择图层</label>
- <div class="layui-input-block"></div>
- </div>
- <div id='gjTypes' class="layui-form-item">
- <label class="layui-form-label">选择管径</label>
- <div class="layui-input-block"></div>
- </div>
- <div class="layui-form-item">
- <div class="layui-input-block" style="text-align: right;">
- <button id="query" type="button" class="layui-btn layui-btn-normal">查 询</button>
- <button type="reset" class="layui-btn layui-btn-primary">重 置</button>
- </div>
- </div>
- </form>
- <script type="text/javascript">
- let lyrs = CONST_VALUES.GX_Datas;
- //debugger;
- let checkboxStr = "<input type='radio' lay-filter='layer' name='THENAME' title='THETITLE' value='THEVALUE' id='THEID' lay-skin='primary' datatype='THETYPE' dataSetName='THEDATASETNAME' dataSourceName='THEWS'>";
- for (let index = 0; index < lyrs.length; index++) {
- const lyr = lyrs[index];
- //debugger;
- if (lyr.name.indexOf("管线") < 0)
- continue;
- var dom = checkboxStr.replace('THETITLE', lyr.name);
- dom = dom.replace('THEID', lyr.id);
- dom = dom.replace('THEVALUE', lyr.tableName);
- dom = dom.replace('THETYPE', lyr.dataType);
- dom = dom.replace('THEWS', lyr.dataSourceName);
- dom = dom.replace('THEDATASETNAME', lyr.dataSetName);
- //debugger;
- $("#layers .layui-input-block").append(dom);
- }
- layui.use('form', function () {
- var form = layui.form;
- //监听多选框点击事件 主要是通过 lay-filter="sex" 来监听
- form.on('radio(layer)', function (data) {
- $("#gjTypes .layui-input-block").html("");
- layui.layer.close(panels.lastResultPanelIndex);
- layui.layer.closeAll();
- var value = data.value; // 当前选中的value值
- $.ajax({
- url: "statistics/spatialstatistics/allGj?tbNames=" + value,
- success: function(result) {
- let checkboxStr = "<input type='checkbox' lay-filter='gjType' name='THENAME' title='THETITLE' id='THEID' lay-skin='primary'dataSetName='THEDATASETNAME' dataSourceName='THEWS'>";
- for (let i = 0; i < result.length; i++) {
- let dom = checkboxStr.replace('THENAME', result[i]["gj"]);
- dom = dom.replace('THETITLE', result[i]["gj"]);
- dom = dom.replace('THEID', i+1);
- //debugger;
- $("#gjTypes .layui-input-block").append(dom);
- }
- form.render();
- layui.use('form', function () {
- var form = layui.form;
- form.on('checkbox(gjType)', function (data) {
- layui.layer.close(panels.lastResultPanelIndex);
- layui.layer.closeAll();
- });
- });
- },
- error: function() {
- layer.msg('查询管径报错!', {
- icon: 7
- });
- }
- });
- });
- });
- // const czs = CONST_VALUES.GX_GJ;
- // let radioStr = "<input type='radio' name='GUANJING' title='THETITLE' id='THEID'>";
- // for (let index = 0; index < czs.length; index++) {
- // const cz = czs[index];
- // let dom = radioStr.replace('THETITLE', cz);
- // dom = dom.replace('THEID', cz);
- //
- // $("#gjTypes .layui-input-block").append(dom);
- // }
- $("#s_cz_div #query").click(function(obj) {
- //debugger;
- // let cz = $('input[name="GUANJING"]:checked').val();
- //
- // if (cz == undefined) {
- // layer.msg('请选择一种管径!', {
- // icon: 7
- // });
- // return;
- // }
- // cz = $('input[name="GUANJING"]:checked')[0].id;
- // let layers = $("#layers input:checked");
- // if (layers.length == 0) {
- // layer.msg('请至少选择一个图层!', {
- // icon: 7
- // });
- // return;
- // }
- // for (let index = 0; index < layers.length; index++) {
- // let checked = layers[index].checked;
- // if (!checked)
- // continue;
- // let ws = layers[index].attributes.dataSourceName.value;
- // let dataSetName = layers[index].attributes.dataSetName.value;
- //
- // //debugger;
- // let sql = "SmID > 0"
- // if (cz !== "全部") {
- // sql += " AND GJ = '" + cz + "'";
- // }
- // query(layers[index].title, dataSetName, ws, sql);
- // }
- let cz = $('input[name="THENAME"]:checked').val();
- if (cz == undefined) {
- layer.msg('请选择一个图层!', {
- icon: 7
- });
- return;
- }
- var ws = $('input[name="THENAME"]:checked')[0].attributes.dataSourceName.value;
- var dataSetName = $('input[name="THENAME"]:checked')[0].attributes.dataSetName.value;
- var title = $('input[name="THENAME"]:checked')[0].attributes.title.value;
- var czTypes = $("#gjTypes input:checked");
- if (czTypes.length == 0) {
- layer.msg('请至少选择一种管径!', {
- icon: 7
- });
- return;
- }
- var czs = "";
- for (let index = 0; index < czTypes.length; index++) {
- var checked = czTypes[index].checked;
- if (!checked)
- continue;
- //console.log(czTypes[index]);
- var czType = czTypes[index].attributes.name.value;
- if(index < czTypes.length -1 ){
- czs += "'" + czType + "',";
- }
- else{
- czs += "'" + czType + "'";
- }
- }
- let sql = "SmID > 0"
- if (czs != "") {
- sql += " AND GJ in (" + czs + ")";
- }
- query(title, dataSetName, ws, sql);
- });
- let query = function(subtitleP, dataSetNameP, wsP, sqlP) {
- let thatsubtitleP = subtitleP;
- let dataSource = wsP;
- let urlTmp = URL_CONFIG.GX_Datas_BaseUrl + "/datasources/" + wsP +
- "/datasets/" + dataSetNameP + "/features.json";
- // $.get(urlTmp, function(e) {
- // const count = e.featureCount;
- //console.info("e.featureCount" + e.featureCount);
- Q.queryBySql(dataSetNameP, wsP, sqlP, 0, 2000000, "", function(rs) {
- if (rs.result == undefined) return;
- panels.createResultPanelWithDataGrid({
- subTitle: thatsubtitleP,
- features: rs.result.features.features,
- title: "按管径查询结果",
- //count: count,
- dataSetName: dataSetNameP,
- dataSourceName: dataSource
- }, function() {
- //debugger;
- });
- });
- // });
- }
- </script>
|