Showing
1 changed file
with
60 additions
and
6 deletions
| @@ -3,20 +3,38 @@ | @@ -3,20 +3,38 @@ | ||
| 3 | <fieldset class="layui-elem-field layui-field-title"> | 3 | <fieldset class="layui-elem-field layui-field-title"> |
| 4 | <legend>{:$title}</legend> | 4 | <legend>{:$title}</legend> |
| 5 | </fieldset> | 5 | </fieldset> |
| 6 | + | ||
| 6 | <div class="demoTable"> | 7 | <div class="demoTable"> |
| 7 | - <div class="layui-inline"> | 8 | + <form class="layui-form" action=""> |
| 9 | + <div class="layui-form-item"> | ||
| 10 | + <label class="layui-form-label">导出节点</label> | ||
| 11 | + <div class="layui-input-inline "> | ||
| 12 | + <select id="tag" name="tag" lay-filter="tag"> | ||
| 13 | + <option value="1">获取指定日期得数据</option> | ||
| 14 | + <option value="2">获取指定时间段得数据</option> | ||
| 15 | + </select> | ||
| 16 | + </div> | ||
| 17 | + </div> | ||
| 18 | + </form> | ||
| 19 | + <div class="layui-inline" id="t1"> | ||
| 8 | <label class="layui-form-label">选择日期</label> | 20 | <label class="layui-form-label">选择日期</label> |
| 9 | <div class="layui-input-inline"> | 21 | <div class="layui-input-inline"> |
| 10 | <input type="text" class="layui-input" name="time" id="time" placeholder="请选择导出日期"> | 22 | <input type="text" class="layui-input" name="time" id="time" placeholder="请选择导出日期"> |
| 11 | </div> | 23 | </div> |
| 12 | </div> | 24 | </div> |
| 25 | + <div class="layui-inline" id="t2" style="display:none"> | ||
| 26 | + <label class="layui-form-label">选择日期</label> | ||
| 27 | + <div class="layui-input-inline"> | ||
| 28 | + <input type="text" class="layui-input" id="time2" placeholder="请选择导出时间段"> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 13 | <button class="layui-btn" id='sub' lay-filter="sub">导出</button> | 31 | <button class="layui-btn" id='sub' lay-filter="sub">导出</button> |
| 14 | </div> | 32 | </div> |
| 15 | </div> | 33 | </div> |
| 16 | {include file="common/foot"/} | 34 | {include file="common/foot"/} |
| 17 | <script> | 35 | <script> |
| 18 | layui.use(['table','form','laydate'], function() { | 36 | layui.use(['table','form','laydate'], function() { |
| 19 | - var table = layui.table,laydate = layui.laydate,$ = layui.jquery; | 37 | + var table = layui.table,laydate = layui.laydate,$ = layui.jquery,form = layui.form; |
| 20 | var ins22 = laydate.render({ | 38 | var ins22 = laydate.render({ |
| 21 | elem: '#time' | 39 | elem: '#time' |
| 22 | ,min: '2019-05-15' | 40 | ,min: '2019-05-15' |
| @@ -26,11 +44,47 @@ | @@ -26,11 +44,47 @@ | ||
| 26 | } | 44 | } |
| 27 | }); | 45 | }); |
| 28 | 46 | ||
| 47 | + //日期范围 | ||
| 48 | + laydate.render({ | ||
| 49 | + elem: '#time2' | ||
| 50 | + ,range: true | ||
| 51 | + }); | ||
| 52 | + | ||
| 53 | + //下拉框切换 | ||
| 54 | + form.on('select(tag)', function(data){ | ||
| 55 | + //console.log(data.value);return; | ||
| 56 | + //清空数据 | ||
| 57 | + switch(data.value){ | ||
| 58 | + case "2": | ||
| 59 | + $('#t1').hide(); | ||
| 60 | + $('#t2').show(); | ||
| 61 | + break; | ||
| 62 | + case "1": | ||
| 63 | + $('#t1').show(); | ||
| 64 | + $('#t2').hide(); | ||
| 65 | + break; | ||
| 66 | + default: | ||
| 67 | + $('#t1').show(); | ||
| 68 | + $('#t2').hide(); | ||
| 69 | + break; | ||
| 70 | + } | ||
| 71 | + }); | ||
| 72 | + | ||
| 29 | $('#sub').on('click', function() { | 73 | $('#sub').on('click', function() { |
| 30 | - if($('#time').val()) | ||
| 31 | - window.open('http://xt04.colorcun.com/index.php?service=App.Report.StatementStatisticsTask&date_time='+$('#time').val()); | ||
| 32 | - else | ||
| 33 | - window.open('http://xt04.colorcun.com/index.php?service=App.Report.StatementStatisticsTask&token='); | 74 | + |
| 75 | + var tag = $('#tag').val(); //标签 | ||
| 76 | + | ||
| 77 | + switch(tag){ | ||
| 78 | + case "2": | ||
| 79 | + date_time = $('#time2').val().replace(" - ", ","); | ||
| 80 | + break; | ||
| 81 | + case "1": | ||
| 82 | + date_time = $('#time').val();//t1值 | ||
| 83 | + break; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + window.open('http://xt04.colorcun.com/index.php?service=App.Report.StatementStatisticsTask&date_time='+date_time+'&tag='+tag); | ||
| 87 | + | ||
| 34 | }); | 88 | }); |
| 35 | }) | 89 | }) |
| 36 | </script> | 90 | </script> |
-
Please register or login to post a comment