时间控件可选为每月月末,其他时间不可选(帆软填报)

this._createCalendar = function(){
        debugger;
        var o = this.options;
        var self = this;
        if (this.options.need2BuildConfig === true && this.options.data) {
                this.options.data.resetStatus(this.createDependencePara4Data());
                var data = this.options.data.getData();
                if (data[0].data) {
                        if (data[0].data.startDate) {
                                var sd = new Date(data[0].data.startDate);
                                if (!FR.isInvalidDate(sd)) {
                                        o.startDate = FR.date2Str(sd, 'yyyy-MM-dd');
                                        this.std = this._createStartDate(o.startDate, o.format, this.viewMode);
                                }   
                        }
                        if (data[0].data.endDate) {
                                var ed = new Date(data[0].data.endDate);
                                if (!FR.isInvalidDate(ed)) {
                                        o.endDate = FR.date2Str(ed, 'yyyy-MM-dd');
                                        this.edd = this._createEndDate(o.endDate, o.format, this.viewMode);
                                }
                        }
                }
                this.options.rebuildConfig = false;
        }
        this.datepicker = new FR.DatePicker({
                renderEl: this.$view,
                viewMode: this.viewMode,
                date: FR.str2Date(this.editComp.val(), o.format),
                dateFormat: o.format,
                startDate: this.std,
                endDate: this.edd,
                onDateUpdate:function(){
                        if ($(':focus').length === 0) {
                                self.editComp.focus();
                        }
                        self.editComp.val(FR.date2Str(this.getValue(), o.format));
                        self.isValidateInput();
                        self.fireEvent(FR.Events.AFTEREDIT);
                }
        });

          this.datepicker._loadDateData = function (s, u) {
                  if (!u) {
            return
        }
        var g = u.getFullYear()
          , v = u.getMonth()
          , p = u.getDate();
        var t = new Date()
          , k = t.getFullYear()
          , w = t.getMonth()
          , a = t.getDate();
        this.cache.showYear = g;
        this.cache.showMonth = v;
        var x = this.options.startDate
           r = this.options.endDate;
        s.$title.text(Date._MN[v] + ", " + g);
        var b = new Date(u);
        b.setDate(b.getMonthDays() + 1);
        if ((r && b > r) || b.getFullYear() > this.CONSTS.MAXYEAR) {
            s.$nextm.addClass("disabled").removeClass("hover").data("disabled", true)
        } else {
            s.$nextm.removeClass("disabled").data("disabled", false)
        }
        var o = new Date(u);
        o.setDate(0);
        if ((x && o < x) || o.getFullYear() < this.CONSTS.MINYEAR) {
            s.$prevm.addClass("disabled").removeClass("hover").data("disabled", true)
        } else {
            s.$prevm.removeClass("disabled").data("disabled", false)
        }
        u.setDate(1);
        var l = (u.getDay() - this.CONSTS.FIRSTDAY) % 7;
        u.setDate(0 - l);
        u.setDate(u.getDate() + 1);
        var m = s.find("tbody").children().eq(0);
        for (var q = 0; q < 6; q++) {
            if (!m.length) {
                break
            }
            var d = m.children().eq(0);
            d.addClass("week wn").text(u.getWeekNumber());
            var e;
            for (var n = 0; n < 7; ++n,
            u.setDate(e + 1)) {
                d = d.next();
                debugger;
                d.removeClass().data("nav", this.CONSTS.NAV["day"]);
                if (!d.length) {
                    break
                }
                e = u.getDate();
                d.text(e);
                var h = (u.getMonth() == v);
                if (!h) {
                    d.addClass("oday").data("disabled", true);
                    continue
                }
                var c = false;
                if ((x != null && x > u) || (r != null && r < u)) {
                    d.addClass("day disabled");
                    c = true
                } else {
                    d.addClass("day")
                }
                d.data("disabled", c);
                if (!c) {
                    if (h && e == p) {
                        this.cache.selectedDate && this.cache.selectedDate.removeClass("selected");
                        d.addClass("selected");
                        this.cache.selectedDate = d;
                        this.cache.showDay = e
                    }
                    if (u.getFullYear() == k && u.getMonth() == w && e == a) {
                        d.addClass("today")
                    }
                    var f = u.getDay();
                    if ([0, 6].indexOf(f) != -1) {
                        d.addClass("weekend")
                    }
                }
            }
            m = m.next()
        }
         var tr = $('tr',s.find("tbody"));

      for(var i=tr.length-1;i>=0;i--){
            
                 var flag = true;
                var tds = $("td",tr.eq(i));
                for(var index=tds.length-1;index>=0;index--){
                        if(tds.eq(index).hasClass("day")){
                                tds.eq(index).addClass('first');
                                flag = false;
                                break;
                        }
                }
                if(!flag) break;
           
        }

        for( var i=0; i<tr.length; i++ ){
                var $days = $('td[class!="week wn"]',tr);
                for( var j=0; j<$days.length; j++ ){
                        var $day = $($days[j]);
                        if($day.hasClass("first")==false){
                                 $day.data("disabled",true);
                                $day.attr('class','oday');
                        }
                       
                }
        }
             
    }

        
        if (FR.Browser.isIE8() && this.$view.css('visibility') == 'hidden') {
                this.$view.css("visibility", "visible");
        } else {
                this.$view.show();
        }
        $(document).bind('mousedown', this, this.collapseIf);
        this.modifyPosition();
        
        debugger

        var tr = $('tbody>tr',this.datepicker.$datetable);


      for(var i=tr.length-1;i>=0;i--){
                 var flag = true;
                var tds = $("td",tr.eq(i));
                for(var index=tds.length-1;index>=0;index--){
                        if(tds.eq(index).hasClass("day")){
                                tds.eq(index).addClass('first');
                                flag = false;
                                break;
                        }
                }
                if(!flag) break;
        }

        for( var i=0; i<tr.length; i++ ){
                var $days = $('td[class!="week wn"]',tr);
                for( var j=0; j<$days.length; j++ ){
                        var $day = $($days[j]);
                        if($day.hasClass("first")==false){
                                 $day.data("disabled",true);
                                $day.attr('class','oday');
                        }
                       
                }
        }
        
}

你可能感兴趣的:(数据,bi,帆软)