注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

前端开发那点事儿

冒犯之处,敬请谅解。

 
 
 

日志

 
 
 
 

JS时间段查询  

2013-07-17 09:45:01|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
JS时间段查询 - Diligent - PHP开发那些事儿
   

 var grid = new Ext.grid.GridPanel({
        store: ds
        ,title: '录音记录'
        ,sm: sm
        ,cm: cm
        ,loadMask: {msg:'正在加载数据,请稍侯...'}
        ,viewConfig: {
            forceFit: true
        }
        ,tbar: [{
            xtype: 'buttongroup'
                ,columns: 19
                ,items: [{
                    text: '<span style="font-weight: bold;">前三天</span>'
                    ,iconCls: 'clock'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        var currentDate = new Date();
                        currentDate.setDate(currentDate.getDate() - 3);
                        currentDate.setHours(0);
                        currentDate.setMinutes(0);
                        currentDate.setSeconds(0);
                        currentDate.setMilliseconds(0);
                        fromTime = currentDate.getTime() / 1000;
                        
                        var currentDate = new Date();
                        currentDate.setDate(currentDate.getDate() - 1);
                        currentDate.setHours(23);
                        currentDate.setMinutes(59);
                        currentDate.setSeconds(59);
                        currentDate.setMilliseconds(999);
                        
                        toTime = currentDate.getTime() / 1000;
                        num = '';
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:前三天</div>');
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">本周</span>'
                    ,iconCls: 'clock4'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        var currentDate = new Date();
                        currentDate.setDate(currentDate.getDate() -
                                (currentDate.getDay() == 0 ? 6 : (currentDate.getDay() - 1)));
                        currentDate.setHours(0);
                        currentDate.setMinutes(0);
                        currentDate.setSeconds(0);
                        currentDate.setMilliseconds(0);

                        fromTime = currentDate.getTime() / 1000;
                        
                        var currentDate = new Date();
                        currentDate.setDate(currentDate.getDate() +
                                (currentDate.getDay() == 0 ? 0 : (7 - currentDate.getDay())));
                        currentDate.setHours(23);
                        currentDate.setMinutes(59);
                        currentDate.setSeconds(59);
                        currentDate.setMilliseconds(999);

                        toTime = currentDate.getTime() / 1000;
                        num = '';
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:本周</div>');
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">上周</span>'
                    ,iconCls: 'clock5'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        var currentDate = new Date();
                        currentDate.setDate(currentDate.getDate() - 7 -
                                (currentDate.getDay() == 0 ? 6 : (currentDate.getDay() - 1)));
                        currentDate.setHours(0);
                        currentDate.setMinutes(0);
                        currentDate.setSeconds(0);
                        currentDate.setMilliseconds(0);
                        fromTime = currentDate.getTime() / 1000;
                        
                        var currentDate = new Date();
                        currentDate.setDate(currentDate.getDate() - 7 +
                                (currentDate.getDay() == 0 ? 0 : (7 - currentDate.getDay())));
                        currentDate.setHours(23);
                        currentDate.setMinutes(59);
                        currentDate.setSeconds(59);
                        currentDate.setMilliseconds(999);
                        toTime = currentDate.getTime() / 1000;
                        num = '';
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:上周</div>');
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">本月</span>'
                    ,iconCls: 'clock6'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:本月</div>');
                        
                        fromTime = Date.parse(getFirstDateString(' 00:00:00')) / 1000;
                        toTime = Date.parse(getLastDateString(' 23:59:59')) / 1000;
                        num = '';
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">上月</span>'
                    ,iconCls: 'clock7'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:上月</div>');
                        
                        fromTime = Date.parse(getPreviousFirstDateString(' 00:00:00')) / 1000;
                        toTime = Date.parse(getPreviousLastDateString(' 23:59:59')) / 1000;
                        num = '';
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }

                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">本季度</span>'
                    ,iconCls: 'clock2'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        var startMonthArr = [0,0,0,3,3,3,6,6,6,9,9,9];
                        var currentDate = new Date();
                        currentDate.setMonth(startMonthArr[currentDate.getMonth()]);
                        currentDate.setDate(1);
                        currentDate.setHours(0);
                        currentDate.setMinutes(0);
                        currentDate.setSeconds(0);
                        currentDate.setMilliseconds(0);
                        fromTime = currentDate.getTime() / 1000;

                        var endMonthArr = [2,2,2,5,5,5,8,8,8,11,11,11];
                        var currentDate = new Date();
                        currentDate.setMonth(endMonthArr[currentDate.getMonth()] + 1);
                        currentDate.setDate(0);
                        currentDate.setHours(23);
                        currentDate.setMinutes(59);
                        currentDate.setSeconds(59);
                        currentDate.setMilliseconds(999);
                        toTime = currentDate.getTime() / 1000;
                        num = '';
                        
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:本季度</div>');
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">上季度</span>'
                    ,iconCls: 'clock3'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        var startMonthArr = [0,0,0,3,3,3,6,6,6,9,9,9];
                        var currentDate = new Date();
                        currentDate.setMonth(startMonthArr[currentDate.getMonth()] - 3);
                        currentDate.setDate(1);
                        currentDate.setHours(0);
                        currentDate.setMinutes(0);
                        currentDate.setSeconds(0);
                        currentDate.setMilliseconds(0);
                        fromTime = currentDate.getTime() / 1000;

                        var endMonthArr = [2,2,2,5,5,5,8,8,8,11,11,11];
                        var currentDate = new Date();
                        currentDate.setMonth(endMonthArr[currentDate.getMonth()] + 1 - 3);
                        currentDate.setDate(0);
                        currentDate.setHours(23);
                        currentDate.setMinutes(59);
                        currentDate.setSeconds(59);
                        currentDate.setMilliseconds(999);
                        toTime = currentDate.getTime() / 1000;
                        num = '';
                        
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:上季度</div>');
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">导出</span>'
                    ,iconCls: 'export'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        grid.getBottomToolbar().items.itemAt(0).update('<div class="wukong_tbar">查询范围:本月</div>');
                        
                        fromTime = Date.parse(getFirstDateString(' 00:00:00')) / 1000;
                        toTime = Date.parse(getLastDateString(' 23:59:59')) / 1000;
                        num = '';
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;">播放</span>'
                    ,iconCls: 'listen'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        var address = "./mediafiles/play.asx";
                        var newBoFangWin = new Ext.Window({
                            modal: true
                            ,closable: true
                            ,width: 368
                            ,autoHeight: true
                            ,html: "<object name='MediaPlayer1' id='MediaPlayer1' width='350' height='68' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' align='baseline' border='0' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>    <param name='invokeURLs' value='0'>    <param name='FileName' value='"+address+"'>"+
                                "<param name='ShowControls' value='0>" +
                                "<param name='ShowPositionControls' value='0'>" +
                                "<param name='ShowAudioControls' value='1'>" +
                                "<param name='ShowTracker' value='1'>" +
                                "<param name='ShowDisplay' value='0'>" +
                                "<param name='ShowStatusBar' value='1'>" +
                                "<param name='Volume' value='100'>" +
                                "<param name='AutoSize' value='1'>" +
                                "<param name='ShowGotoBar' value='0'>" +
                                "<param name='ShowCaptioning' value='0'>" +
                                "<param name='AutoStart' value='0'>" +
                                "<param name='PlayCount' value='1'>" +
                                "<param name='AnimationAtStart' value='0'>" +
                                "<param name='TransparentAtStart' value='0'>" +
                                "<param name='AllowScan' value='0'>" +
                                "<param name='EnableContextMenu' value='0'>" +
                                "<param name='ClickToPlay' value='1'>" +
                                "<param name='DefaultFrame' value='datawindow'>" +
                                "<embed src='http://evanwukong.blog.163.com/blog/"+ address + "' align='baseline' border='0'" +
                                    "width='350'" +
                                    "height='68'" +
                                    "type='application/x-mplayer2'" +
                                    "pluginspage='http://www.microsoft.com/isapi/redir.dll?prd=windows&amp;sbp=mediaplayer&amp;ar=media&amp;sba=plugin&amp;'" +
                                    "name='MediaPlayer'" +
                                    "id='MediaPlayer'" +
                                    "showcontrols='1'" +
                                    "showpositioncontrols='0'" +
                                    "showaudiocontrols='1'" +
                                    "showtracker='1'" +
                                    "showdisplay='0'" +
                                    "showstatusbar='1'" +
                                    "autosize='0'" +
                                    "showgotobar='0'" +
                                    "showcaptioning='0'" +
                                    "autostart='0'" +
                                    "autorewind='0'" +
                                    "volume='100'" +
                                    "animationatstart='0'" +
                                    "transparentatstart='0'" +
                                    "allowscan='1'" +
                                    "enablecontextmenu='1'" +
                                    "clicktoplay='1'" +
                                    "defaultframe='datawindow'" +
                                    "invokeurls='0'></embed></object>"
                            ,tools: [{
                                id: 'close'
                                ,handler:function(e,t,p){
                                    if(window.ActiveXObject){
                                        window.document.getElementById('MediaPlayer1').stop();//解决ext在IE中销毁window慢的问题  
                                    }
                                    newBoFangWin.close();
                                }
                            }]   
                        });
                        newBoFangWin.show();
                    }
                },{xtype: 'tbseparator'},{
                    text: '<span style="font-weight: bold;color: orangeRed;">刷新</span>'
                    ,scale: 'large'
                    ,style: 'text-align: center;padding: 2px;'
                    ,handler: function(){
                        num = '';
                        storeSetUrl(ds,gurl + '&f=' + fromTime + '&t=' + toTime);
                    }
                
                }]
            }]
        ,bbar: ['<div class="wukong_tbar">查询范围:全部</div>','->',pager]
    });
  评论这张
 
阅读(586)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017