<div class="mini-fit" id="calendardiv"></div>
总体功能是有一个人员列表的点击事件,点击后动态加载日历控件,动态渲染每一天考勤信息。当前问题是如下边两张图片,第一个人4号有考勤状态,但是第二人4号没有考勤状态,显示4就行,但是还是显示的上个人的考勤状态。
function quanyueUserGridClick(e) { $.post("Ajax.ashx?method=GetStaffCurMonthMachineRecord",{ Pl_StaffId: e.record.Pl_StaffId, Pl_OrganizationId:e.record.Pl_OrganizationId, StartDay: mini.formatDate(e.record.StartDay, 'yyyy-MM-dd'),EndDay: mini.formatDate(e.record.EndDay, 'yyyy-MM-dd'),curYearMonth:mini.formatDate(curYearMonth, 'yyyy-MM-dd'),nextYearMonth: mini.formatDate(nextYearMonth, 'yyyy-MM-dd') }, function (data) { var o = mini.decode(data); var calendar = '<divid="' + e.record.Pl_StaffId + '"class="mini-calendar" width="100%" height="100%"ondrawdate="onDrawDate"></div>'; $("#calendardiv").html(""); setTimeout(function () { $("#calendardiv").append(calendar); mini.parse(calendar); mini.get(e.record.Pl_StaffId).setViewDate(curYearMonth); }, 1000); //得到考勤记录表 if (o.length > 0) { selectDateGridList =o; } }); } functiononDrawDate(e) { vardate = e.date; if(date.getTime() < curYearMonth.getTime() || date.getTime() >=nextYearMonth.getTime()) { e.allowSelect = false; } else{ e.allowSelect = true; } if(selectDateGridList != null&& selectDateGridList.length > 0) { for (vari = 0; i < selectDateGridList.length; i++) { if (date.getTime() ==selectDateGridList.Date.getTime()) { //如果考勤状态有数据,[size=12.6667px]日历[size=12.6667px]显示考勤状态(如缺勤、请假) if(selectDateGridList.DateState != ""){e.dateHtml =selectDateGridList.DateState;} else{//正常显示 //e.dateHtml = date; } } else { //正常显示 // e.dateHtml = date; } } } else{ //正常显示 // e.dateHtml = date; } }
|