123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <!--日期查询-->
- <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='czTypes' class="layui-form-item">
- <label class="layui-form-label">日期范围</label>
- <div class="layui-input-block">
- <input type="text" autocomplete="off" id="startDate" class="layui-input layui-input-inline" style="width: 99px;" placeholder="开始日期">
- <input type="text" autocomplete="off" id="endDate" class="layui-input layui-input-inline" style="width: 99px;" placeholder="结束日期">
- </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">
- layui.use('laydate', function() {
- let laydate = layui.laydate;
- //执行一个laydate实例
- laydate.render({
- elem: '#startDate' //指定元素
- });
- laydate.render({
- elem: '#endDate' //指定元素
- });
- });
- let lyrs = CONST_VALUES.GX_Datas;
- //debugger;
- let checkboxStr = "<input type='checkbox' name='THENAME' title='THETITLE' id='THEID' lay-skin='primary' dataSetName='THEDATASETNAME' dataSourceName='THEWS'>";
- for (let index = 0; index < lyrs.length; index++) {
- const lyr = lyrs[index];
- //debugger;
- // if (lyr.name.indexOf("管线") < 0)
- // continue;
- let dom = checkboxStr.replace('THENAME', lyr.name);
- dom = dom.replace('THETITLE', lyr.name);
- dom = dom.replace('THEID', lyr.id);
- dom = dom.replace('THEWS', lyr.dataSourceName);
- dom = dom.replace('THEDATASETNAME', lyr.dataSetName);
- //debugger;
- $("#layers .layui-input-block").append(dom);
- }
- $("#s_cz_div #query").click(function(obj) {
- let layers = $("#layers input:checked");
- if (layers.length == 0) {
- layer.msg('请至少选择一个图层!', {
- icon: 7
- });
- return;
- }
- let startDate = $("#startDate").val();
- let endDate = $("#endDate").val();
- 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 (startDate != undefined && startDate.length > 0) {
- sql += " AND MSRQ >= '" + startDate + "'";
- }
- if (endDate != undefined && endDate.length > 0) {
- sql += " AND MSRQ <= '" + endDate + "'";
- }
- query(layers[index].title, dataSetName, ws, sql);
- }
- });
- let query = function(subtitleP, dataSetNameP, wsP, sqlP) {
- let thatsubtitleP = subtitleP;
- let dataSource = wsP;
- let urlTmp = CONST_VALUES.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>
|