Use the date control table

1、js

{
            colkey : "BJQSRQ",
            name : "起始日期",
            renderData : function(rowindex,data, rowdata, column) {
                var df =  new Date().format("yyyy-MM");
                if(data){
                    df =  new Date(data).format("yyyy-MM");
                }
                var selfid = "bjqsrq"+rowindex+"pn"+thispageNow;
                if(datepa){
                    datepa.push(selfid);
                }
                var zt = $("#bjsqzt") .val ();
                 var DIS = '' ;
                 IF (== ZT '(filed review)' ) { 
                    DIS = 'Disabled' ; 
                } 
                var grzh rowdata.GRZH + = "" ; 
          // echo determination data, to ensure modify the data is not lost when the tab
var ISOK = saveData.has (grzh); IF (ISOK) { // there is a current data var dataobj = saveData.get (grzh); IF (dataobj) { DF = new new a Date (dataobj [ 'bjqsrq']) the format ( "the MM-YYYY." ); } } // /onchange="startDateOnChange(this)" return '<input type="text" id="'+selfid+'" nane="startMonthSelect" class="form-control" onClick="getCalendar(this)" readonly value="'+df+'"'+dis+'/>'; }

2, the database load is finished, initialize the date control

/**
 * 初始化日期控件
 */
function initDateTimePicker(){
    //var test = $("#testtesttest").datetimepicker();
    //datetimepicker、 datepicker 或 timepicker  bjjzrq1565684696055 bjjzrq1565684696053
    var lena = datepa.length;
    if(datepa){
        for(var i=0; i< lena;i++){
            var ids = datepa[i];
            var bst = ids.slice(0,3);
            var sDateSetVal = new Date();
            var eDateSetVal = newDATE ();
             IF (BST == 'BJJ' ) {
                 // overdue deadline 
                sDateSetVal = getLastYearYestdy (sDateSetVal,. 1 );
                 // eDateSetVal.setFullYear (sDateSetVal.getFullYear ()); // new new = DATE (); 
            } the else { 
                sDateSetVal = getLastYearYestdy (sDateSetVal, 2 ); 
            } 
            // the console.log (Lena [I]); 
            $ ( "#" + IDS) .datetimepicker ({ 
                Language:   'the CN-ZH', // Chinese: ' the CN-ZH ' 
                the format:' YYYY-mm ', //yyyy years, all as: 2016; mm: month, digits, a leading zero, such as: 04 
                startDate: sDateSetVal, // start time 
                endDate: eDateSetVal, // a Date Default: End time. 
                weekStart: 1, // from the week day began 
                AutoClose: to true , // whether to automatically shut down after the election, time 
                startView: 3, // selected view complete time displayed first 3 years starting from the view, selected month 
                minView: 3, // most accurate time from view start, selected month 
                todayHighlight: to true , // - today's date highlighted 
                forceParse: to true //When the selector is closed, whether to force the analytical value input box. That is, when the user input box incorrect date, the selector will try to parse the input value, and setting the correct value of the parsed input box according to a given format of the format 
            }). ON ( 'changeDate', function (EV) {
                 // Debugger 
                // var oldTimeStamp = ev.timeStamp; 
                // var olddate = dateFormatUtil (oldTimeStamp); 
                // the console.log (gridBjsq.getColumn ()); 
                // Get its parent parent of the node 
                var thistr = ev.currentTarget.parentNode.parentNode;
                 // var thistr.find SS = ( '[name = "startMonthSelect"]'); 

                var SIDS = ev.currentTarget.id;
                 var TBST = sids.slice (0,3 ); 
                
                var= thistr.childNodes thistd_sd [. 8 ];
                 var dateInput_sd thistd_sd.childNodes = [0 ];
                 var ip_startDate = dateInput_sd.value;
                 var thistd_ed thistr.childNodes = [. 9 ];
                 var dateInput_ed thistd_ed.childNodes = [0 ];
                 var ip_endDate = dateInput_ed .Value;
                 IF (ip_startDate> = ip_endDate) { 
                    layer.msg ( 'pay pay not be greater than the start date as of the date, please re-enter!', {icon:. 5 });
                     return  to false ; 
                } 

                //截至日期
                var sd_date = new Date(ip_startDate);
                var sd_year = sd_date.getFullYear();
                var sd_mon = sd_date.getMonth()+1;
                //var eval = ev.date.valueOf();
                var ed_date = new Date(ip_endDate);
                var ed_year = ed_date.getFullYear();
                var ed_mon = ed_date.getMonth()+1;
                //补缴期数
                var bjqs = Math.abs(ed_year - sd_year)*12 + Math.abs(ed_mon - sd_mon) + 1;
                //补缴期数
                var this_td = thistr.childNodes[10];
                this_td.id = 'td'+bjqs+ev.timeStamp;
                this_td.innerHTML = bjqs+'';
                this_td.innerText = bjqs+'';
                
                var thistd = thistr.childNodes[6];
                var thistd_input = thistd.childNodes[0];
                var bjce_value = thistd_input.value;
                //个人账号
                var td_grzh = thistr.childNodes[1];
                var td_iput_grzh = td_grzh.childNodes[0];
                var grzh = td_iput_grzh.value;
                var rowid = 0;
                debugger
                setValueChange(thistd_input,grzh,rowid,ip_startDate,ip_endDate,bjqs,'BJCE_INPUT');

            });
        }
    }
}

 

 

 

3, click on the date control, date display controls

/ * * 
 * 
 * @Param Self 
 * @Returns 
 * / 
function getCalendar (Self) {
     var SID = self.id;
     // the console.log ( "====" + SID); 
    // display the date and time picker. 
    $ ( "#" + SID) .datetimepicker ( 'Show' ); 
}

 

Guess you like

Origin www.cnblogs.com/ywf520/p/11387813.html
Recommended