123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- MWF.xApplication.Attendance = MWF.xApplication.Attendance || {};
- MWF.require("MWF.xAction.org.express.RestActions", null,false);
- MWF.xDesktop.requireApp("Attendance", "lp."+MWF.language, null, false);
- MWF.xDesktop.requireApp("Attendance", "Common", null, false);
- MWF.xDesktop.requireApp("Attendance", "UnitIndex", null, false);
- MWF.xApplication.Attendance.UnitDingdingIndex = new Class({
- Extends: MWF.xApplication.Attendance.UnitIndex,
- Implements: [Options, Events],
- options: {
- "style": "default"
- },
- loadData : function( callback, unit, year, month, async ){
- this.statusColor = {
- "resultNormal" : "#4A90E2", //绿色,正常
- "leaveEarlyTimes":"#AC71E3", //蓝色,早退
- "lateTimes":"#F5A623", //黄色,迟到
- "seriousLateTimes" : "#c45f17",//严重迟到
- "notSignedCount":"#FF8080", //粉红色,未签到
- "absenteeismTimes" : "#8B572A"//矿工
- };
- if( !unit )unit = this.unit;
- if( !year )year = this.year;
- if( !month )month = this.month;
- if( this.data[ unit + year + month ] ) {
- if(callback)callback();
- }else{
- var action = o2.Actions.load("x_attendance_assemble_control");
- action.DingdingAttendanceStatisticAction.unitMonth(unit, year, month, function(json){
- var d = json.data || {};
- var data = this.data[ unit + year + month ] = {};
- var totals = data.totalData = {
- resultNormal: d.resultNormal || 0,
- lateTimes: d.lateTimes || 0,
- leaveEarlyTimes: d.leaveEarlyTimes || 0,
- absenteeismTimes: d.absenteeismTimes || 0,
- seriousLateTimes: d.seriousLateTimes || 0,
- notSignedCount: d.notSignedCount || 0
- }
- var total = 0;
- for( var n in totals ){
- total += totals[n];
- }
- data.rateData = {
- resultNormal : (!totals.resultNormal || !total) ? 0 : ((totals.resultNormal/total * 100).toFixed(2) + "%"),
- lateTimes : (!totals.lateTimes || !total) ? 0 : ((totals.lateTimes/total * 100).toFixed(2) + "%"),
- leaveEarlyTimes : (!totals.leaveEarlyTimes || !total) ? 0 : ((totals.leaveEarlyTimes/total * 100).toFixed(2) + "%"),
- absenteeismTimes : (!totals.absenteeismTimes || !total) ? 0 : ((totals.absenteeismTimes/total * 100).toFixed(2) + "%"),
- seriousLateTimes : (!totals.seriousLateTimes || !total) ? 0 : ((totals.seriousLateTimes/total * 100).toFixed(2) + "%"),
- notSignedCount : (!totals.notSignedCount || !total) ? 0 : ((totals.notSignedCount/total* 100).toFixed(2) + "%")
- }
- if(callback)callback();
- }.bind(this), null, async);
- }
- },
- loadDetail : function(){
- this.detailArea.empty();
- this.detailNode = new Element("div",{
- "styles" : this.css.detailNode
- }).inject(this.detailArea);
- this.detailTitleNode = new Element("div",{
- "styles" : this.css.detailTitleNode,
- "text" : this.lp.attendanceStatisic
- }).inject(this.detailNode)
- var table = new Element("table", {
- "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.table, "class" : "editTable"
- }).inject( this.detailNode );
- var tr = new Element("tr", { "styles" : this.css.listHeadNode }).inject(table);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.name }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.onDutyTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.offDutyTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.resultNormal }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.lateTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.seriousLateTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.leaveEarlyTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.absenteeismTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.notSignedCount }).inject(tr);
- var action = o2.Actions.load("x_attendance_assemble_control");
- action.DingdingAttendanceStatisticAction.personMonthWithUnit(this.unit, this.year, this.month, function(json){
- var data = json.data || [];
- data.sort( function(a, b){
- return b.workDayCount - a.workDayCount;
- });
- data.each(function( d ){
- var tr = new Element("tr").inject(table);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.o2User.split("@")[0] }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.onDutyTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.offDutyTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.resultNormal }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.lateTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.seriousLateTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.leaveEarlyTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.absenteeismTimes }).inject(tr);
- var td = new Element("td", { "styles" : this.css.tableValue , "text": d.notSignedCount }).inject(tr);
- }.bind(this))
- }.bind(this));
-
- }
- });
|