test.html 2.49 KB
{echo:JS::import('highcharts')}
{echo:JS::import('form');}
<script type="text/javascript" src="{url:@static/js/daterangepicker/moment.min.js}"></script>
<script type="text/javascript" src="{url:@static/js/daterangepicker/daterangepicker.js}"></script>
<link rel="stylesheet" href="{url:@static/js/daterangepicker/daterangepicker.css}" type="text/css" />

<div class="tools_bar clearfix">
    <form action="{url:/count/index}" method="post">
<span>时间:<input name="s_time" type="text" value="{$s_time}" class="middle " pattern="\d{4}-\d{2}-\d{2} -- \d{4}-\d{2}-\d{2}"  id="datepick"></span><a href="javascript:tools_submit();" id="condition" > 查询</a>
    </form>
</div>
<div id="chinaMap"></div>
<script type="text/javascript">
 $(document).ready(function() {
    $('#datepick').daterangepicker(
     {
        startDate: moment().subtract('days', 29),
        endDate: moment(),
        minDate: '2012-01-01',
        maxDate: moment(),
        dateLimit: { days: 60 },
        showDropdowns: true,
        showWeekNumbers: true,
        timePicker: false,
        timePickerIncrement: 1,
        timePicker12Hour: true,
        ranges: {
           '今天': [moment(), moment()],
           '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
           '最近7天': [moment().subtract('days', 6), moment()],
           '最近30天': [moment().subtract('days', 29), moment()],
           '上一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
        },
        opens: 'right',
        buttonClasses: ['btn btn-default'],
        applyClass: 'btn-small btn-primary',
        cancelClass: 'btn-small',
        format: 'YYYY-MM-DD',
        separator: ' -- ',
        locale: {
            applyLabel: '提交',
            cancelLabel:'重置',
            fromLabel: '起始',
            toLabel: '结束',
            customRangeLabel: '选择时间段',
            daysOfWeek: ['日', '一', '二', '三', '四', '五','六'],
            monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
            firstDay: 1
        }
     },
     function(start, end) {
      $('#reportrange span').html(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
     }
    );
    $('#reportrange span').html(moment().subtract('days', 29).format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
    });
</script>