• extjs日期控件使用


    pp.priceApplyQuery.FORMAT_TIME  = 'Y-m-d H:i:s'; //格式化时间字符串
    

      支持 查询,修改,增加

    //验证日期
    Ext.apply(Ext.form.VTypes, {
        priceApplyQuery_dateRange: function(val, field){ 
            if(field.dateRange){
                var beginId = field.dateRange.begin;
                this.beginField = Ext.getCmp(beginId);
                var endId = field.dateRange.end;
                this.endField = Ext.getCmp(endId);
                beginDate = this.beginField.getValue();
                var endDate = this.endField.getValue();
                var typeName = field.dateRange.type;
            }
            if(beginDate <= endDate){
                if(typeName == "query"){
                      if(new Date(endDate).getTime()-new Date(beginDate).getTime()>3600*1000*24*30){
                            this.priceApplyQuery_dateRangeText = "查询时长不能超过30天!";
                            return false;  
                         }else{
                             return true;  
                         }
                }else if(typeName =="add" || typeName == "update"){
                     var nowDate = new Date();
                    if(new Date(beginDate).getTime()<nowDate.getTime()){
                            this.priceApplyQuery_dateRangeText = "启用时间不能小于当前时间!";
                            return false;
                      }else{
                          return true;
                      }
                }else{
                   return true;
                }  
            }else{
                this.priceApplyQuery_dateRangeText = "开始时间不能大于结束时间!";
                return false;  
            }
        }
    });
    

      

    pp.priceApplyQuery.formatDefaultDate = function(isBegin,format,type) {
        var nowDate = new Date();
        if(isBegin) {
            if(type == "query"){
                nowDate.setHours(0);
                nowDate.setSeconds(0);
                nowDate.setMinutes(0);
            }
        } else {
            nowDate.setHours(23);
            nowDate.setSeconds(59);
            nowDate.setMinutes(59);
        }
        return Ext.Date.format(nowDate,format);
    };
    {
                xtype:'datetimefield_date97',
                name:'q_time_beginDate', 
                id:'priceApplyQuery_beginDate_query',
                fieldLabel:'开始',
              columnWidth:0.6,
                  labelWidth:40,
                format:'Y-m-d H:i:s',
                dateConfig: {
                    el: 'priceApplyQuery_beginDate_query-inputEl',
                    dateFmt: 'yyyy-MM-dd HH:mi:ss'
                },
                editable:false,
                allowBlank:false ,
                time:true,
                value:pp.priceApplyQuery.formatDefaultDate(true,pp.priceApplyQuery.FORMAT_TIME,"query" ),
                dateRange: {begin: 'priceApplyQuery_beginDate_query', end: 'priceApplyQuery_endDate_query',type:'query'},  
                vtype: 'priceApplyQuery_dateRange' 
    
            },{
                xtype:'datetimefield_date97',
                id:'priceApplyQuery_endDate_query',
                name:'q_time_endDate',
               columnWidth:0.6,
                labelWidth:40,
                fieldLabel:'结束',
                format:'Y-m-d H:i:s',
                dateConfig: {
                    el: 'priceApplyQuery_endDate_query-inputEl',
                    dateFmt: 'yyyy-MM-dd HH:mi:ss'
                },
                editable:false,
                allowBlank:false,
                value:pp.priceApplyQuery.formatDefaultDate(false,pp.priceApplyQuery.FORMAT_TIME ,"query" ) ,
                dateRange: {begin: 'priceApplyQuery_beginDate_query', end: 'priceApplyQuery_endDate_query' ,type:'query' },  
                vtype: 'priceApplyQuery_dateRange' 
            }
    

      

  • 相关阅读:
    汉语-词语-转世:百科
    汉语-词语-往生:百科
    中缀表达式值
    车厢调度(train.cpp)
    字符串匹配问题
    计算(calc.cpp)
    2、括弧匹配检验
    2058 括号序列
    7909:统计数字
    1007. 计算余数
  • 原文地址:https://www.cnblogs.com/zfzf1/p/7760020.html
Copyright © 2020-2023  润新知