Scdp.define('Violation.view.ViolationView', {
extend: 'Scdp.bootstrap.mvc.AbstractCrudView',
modulePath: 'com/csnt/scdp/bizmodules/modules/projectViolation/violation',
initView: function () { // 页面初始化执行的方法
var me = this;
function isLeapYear (Year) { //判断 润年 平年
var yyyy=Number(Year);
if (((yyyy % 4)==0) && ((yyyy % 100)!=0) || ((yyyy % 400)==0)) {
return true;
} else {
return false;
}
}
var month=[];
var year=[];
$.each(me.year,function(i,o){ //循环月
var yyyy=o;
var flag=isLeapYear(yyyy);
if(flag) {
returnMonth(yyyy,flag);
}else{
returnMonth(yyyy,flag);
}
year.push({'text':yyyy+"年",'children':month});
});
function returnMonth(yyyy,flag){
month = [
{'text': '1月', 'children': me.returnDay(yyyy,1)},
];
if(flag){
month.push({'text': '2月', 'children': me.returnDay(yyyy,2,true)});
}else{
month.push({'text': '2月', 'children': me.returnDay(yyyy,2,false)});
}
month.push(
{'text': '3月', 'children': me.returnDay(yyyy,3)},
{'text': '4月', 'children': me.returnDay(yyyy,4)},
{'text': '5月', 'children': me.returnDay(yyyy,5)},
{'text': '6月', 'children': me.returnDay(yyyy,6)},
{'text': '7月', 'children': me.returnDay(yyyy,7)},
{'text': '8月', 'children': me.returnDay(yyyy,8)},
{'text': '9月', 'children': me.returnDay(yyyy,9)},
{'text': '10月', 'children': me.returnDay(yyyy,10)},
{'text': '11月', 'children': me.returnDay(yyyy,11)},
{'text': '12月', 'children': me.returnDay(yyyy,12)}
);
return month;
}
$("ul[itemId='treeMenu']").tree({
data: year
});
$("ul[itemId='treeMenu']").tree('collapseAll');
},
returnDay: function (yyyy,month,falg) {
var me = this;
return me.day(yyyy,month,falg);
},
validator: function () {
var me = this;
},
year:['2005','2006','2007','2008','2009','2010','2011','2012','2013','2014','2015','2016','2017','2018','2019','2020'],
day: function (yyyy,month,falg) { //
var day=[
{'id':yyyy+'-'+month+'-'+1,'text':'1日'},
{'id':yyyy+'-'+month+'-'+2,'text':'2日'},
{'id':yyyy+'-'+month+'-'+3,'text':'3日'},
{'id':yyyy+'-'+month+'-'+4,'text':'4日'},
{'id':yyyy+'-'+month+'-'+5,'text':'5日'},
{'id':yyyy+'-'+month+'-'+6,'text':'6日'},
{'id':yyyy+'-'+month+'-'+7,'text':'7日'},
{'id':yyyy+'-'+month+'-'+8,'text':'8日'},
{'id':yyyy+'-'+month+'-'+9,'text':'9日'},
{'id':yyyy+'-'+month+'-'+10,'text':'10日'},
{'id':yyyy+'-'+month+'-'+11,'text':'11日'},
{'id':yyyy+'-'+month+'-'+12,'text':'12日'},
{'id':yyyy+'-'+month+'-'+13,'text':'13日'},
{'id':yyyy+'-'+month+'-'+14,'text':'14日'},
{'id':yyyy+'-'+month+'-'+15,'text':'15日'},
{'id':yyyy+'-'+month+'-'+16,'text':'16日'},
{'id':yyyy+'-'+month+'-'+17,'text':'17日'},
{'id':yyyy+'-'+month+'-'+18,'text':'18日'},
{'id':yyyy+'-'+month+'-'+19,'text':'19日'},
{'id':yyyy+'-'+month+'-'+20,'text':'20日'},
{'id':yyyy+'-'+month+'-'+21,'text':'21日'},
{'id':yyyy+'-'+month+'-'+22,'text':'22日'},
{'id':yyyy+'-'+month+'-'+23,'text':'23日'},
{'id':yyyy+'-'+month+'-'+24,'text':'24日'},
{'id':yyyy+'-'+month+'-'+25,'text':'25日'},
{'id':yyyy+'-'+month+'-'+26,'text':'26日'},
{'id':yyyy+'-'+month+'-'+27,'text':'27日'},
{'id':yyyy+'-'+month+'-'+28,'text':'28日'}
];
if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
day.push(
{'id':yyyy+'-'+month+'-'+29,'text':'29日'},
{'id':yyyy+'-'+month+'-'+30,'text':'30日'},
{'id':yyyy+'-'+month+'-'+31,'text':'31日'}
);
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
day.push(
{'id':yyyy+'-'+month+'-'+29,'text':'29日'},
{'id':yyyy+'-'+month+'-'+30,'text':'30日'}
);
} else if (month == 2) {
if(falg){
day.push(
{'id':yyyy+'-'+month+'-'+29,'text':'29日'}
);
}
}
return day;
}
});