| 1 |
- MWF.xDesktop.requireApp("Attendance","Explorer",null,false);MWF.xDesktop.requireApp("Selector","package",null,false);MWF.xApplication.Attendance.UnitDetail=new Class({Extends:MWF.widget.Common,Implements:[Options,Events],options:{style:"default"},initialize:function(t,e,i,a){this.setOptions(a);this.app=e;this.path="/x_component_Attendance/$UnitDetail/";this.cssPath="/x_component_Attendance/$UnitDetail/"+this.options.style+"/css.wcss";this._loadCss();this.actions=i;this.node=$(t)},load:function(){this.loadTab()},loadTab:function(){this.tabNode=new Element("div",{styles:this.css.tabNode}).inject(this.node);this.detailArea=new Element("div",{styles:this.css.tabPageContainer}).inject(this.tabNode);this.detailStaticArea=new Element("div",{styles:this.css.tabPageContainer}).inject(this.tabNode);MWF.require("MWF.widget.Tab",function(){this.tabs=new MWF.widget.Tab(this.tabNode,{style:"attendance"});this.tabs.load();this.detailPage=this.tabs.addTab(this.detailArea,"部门出勤明细",false);this.detailPage.contentNodeArea.set("class","detailPage");this.detailPage.addEvent("show",function(){if(!this.detailExplorer){this.detailExplorer=new MWF.xApplication.Attendance.UnitDetail.Explorer(this.detailArea,this);this.detailExplorer.load()}}.bind(this));this.detailStaticPage=this.tabs.addTab(this.detailStaticArea,"部门出勤率统计",false);this.detailStaticPage.contentNodeArea.set("class","detailStaticPage");this.detailStaticPage.addEvent("show",function(){if(!this.detailStaticExplorer){this.detailStaticExplorer=new MWF.xApplication.Attendance.UnitDetail.DetailStaticExplorer(this.detailStaticArea,this);this.detailStaticExplorer.load()}}.bind(this));this.tabs.pages[0].showTab()}.bind(this))}});MWF.xApplication.Attendance.UnitDetail.Explorer=new Class({Extends:MWF.xApplication.Attendance.Explorer,Implements:[Options,Events],initialize:function(t,e,i){this.setOptions(i);this.parent=e;this.app=e.app;this.lp=this.app.lp;this.css=e.css;this.path=e.path;this.actions=e.actions;this.node=$(t);this.initData();if(!this.peopleActions)this.peopleActions=new MWF.xAction.org.express.RestActions},initData:function(){this.toolItemNodes=[]},reload:function(){this.node.empty();this.load()},load:function(){this.loadFilter();this.loadContentNode();this.setNodeScroll()},loadFilter:function(){this.fileterNode=new Element("div.fileterNode",{styles:this.css.fileterNode}).inject(this.node);var t="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='filterTable'>"+"<tr>"+" <td styles='filterTableValue' lable='q_unitName'></td>"+" <td styles='filterTableTitle' item='q_unitName'></td>"+" <td styles='filterTableTitle' lable='cycleYear'></td>"+" <td styles='filterTableValue' item='cycleYear'></td>"+" <td styles='filterTableTitle' lable='cycleMonth'></td>"+" <td styles='filterTableValue' item='cycleMonth'></td>"+" <td styles='filterTableTitle' lable='date'></td>"+" <td styles='filterTableValue' item='date'></td>"+" <td styles='filterTableTitle' lable='isAbsent'></td>"+" <td styles='filterTableValue' item='isAbsent'></td>"+" <td styles='filterTableTitle' lable='isLate'></td>"+" <td styles='filterTableValue' item='isLate'></td>"+" <td styles='filterTableTitle' lable='isLackOfTime'></td>"+" <td styles='filterTableValue' item='isLackOfTime'></td>"+" <td styles='filterTableValue' item='action'></td>"+"</tr>"+"</table>";this.fileterNode.set("html",t);MWF.xDesktop.requireApp("Template","MForm",function(){this.form=new MForm(this.fileterNode,{},{isEdited:true,itemTemplate:{q_unitName:{text:"部门",type:"org",orgType:"unit",notEmpty:true,style:{"min-width":"200px"}},cycleYear:{text:"年度",type:"select",selectValue:function(){var t=[];var e=(new Date).getFullYear();for(var i=0;i<6;i++){t.push(e--)}return t},event:{change:function(t,e){var i=this.getDateSelectValue();t.form.getItem("date").resetItemOptions(i,i)}.bind(this)}},cycleMonth:{text:"月份",type:"select",defaultValue:function(){var t=((new Date).getMonth()+1).toString();return t.length==1?"0"+t:t},selectValue:["","01","02","03","04","05","06","07","08","09","10","11","12"],event:{change:function(t,e){var i=this.getDateSelectValue();t.form.getItem("date").resetItemOptions(i,i)}.bind(this)}},date:{text:"日期",type:"select",selectValue:this.getDateSelectValue.bind(this)},isAbsent:{text:"缺勤",type:"select",selectValue:["","true","false"],selectText:["","缺勤","未缺勤"]},isLate:{text:"迟到",type:"select",selectValue:["","true","false"],selectText:["","迟到","未迟到"]},isLackOfTime:{text:"工时不足",type:"select",selectValue:["","true","false"],selectText:["","是","否"]},action:{value:"查询",type:"button",className:"filterButton",event:{click:function(){var t=this.form.getResult(true,",",true,true,false);if(!t)return;if(typeOf(t.isAbsent)=="string")t.isAbsent=this.getBoolean(t.isAbsent);if(typeOf(t.isLate)=="string")t.isLate=this.getBoolean(t.isLate);if(typeOf(t.isLackOfTime)=="string")t.isLackOfTime=this.getBoolean(t.isLackOfTime);if(t.date&&t.date!=""){t.q_date=t.cycleYear+"-"+t.cycleMonth+"-"+t.date}this.loadView(t)}.bind(this)}}}},this.app,this.css);this.form.load()}.bind(this),true)},getDateSelectValue:function(){if(this.form){var t=parseInt(this.form.getItem("cycleYear").getValue());var e=parseInt(this.form.getItem("cycleMonth").getValue())-1}else{var t=(new Date).getFullYear();var e=(new Date).getMonth()}var i=new Date(t,e,1);var a=[];a.push("");while(i.getMonth()===e){var n=i.getDate().toString();if(n.length==1)n="0"+n;a.push(n);i.setDate(i.getDate()+1)}return a},getBoolean:function(t){if(t==="true")return true;if(t==="false")return false;return t},loadContentNode:function(){this.elementContentNode=new Element("div",{styles:this.css.elementContentNode}).inject(this.node);this.app.addEvent("resize",function(){this.setContentSize()}.bind(this))},loadView:function(t){this.elementContentNode.empty();if(this.view)delete this.view;this.view=new MWF.xApplication.Attendance.UnitDetail.View(this.elementContentNode,this.app,this);this.view.filterData=t;this.view.load();this.setContentSize()},setContentSize:function(){var t=this.parent.tabs?this.parent.tabs.tabNodeContainer.getSize():{x:0,y:0};var e=this.fileterNode?this.fileterNode.getSize():{x:0,y:0};var i=this.parent.node.getSize();var a=this.elementContentNode.getStyle("padding-top").toFloat();var n=this.elementContentNode.getStyle("padding-bottom").toFloat();var l=i.y-t.y-a-n-e.y-20;this.elementContentNode.setStyle("height",""+l+"px");this.pageCount=(l/40).toInt()+5;if(this.view&&this.view.items.length<this.pageCount){this.view.loadElementList(this.pageCount-this.view.items.length)}}});MWF.xApplication.Attendance.UnitDetail.DetailStaticExplorer=new Class({Extends:MWF.xApplication.Attendance.UnitDetail.Explorer,loadFilter:function(){this.fileterNode=new Element("div.fileterNode",{styles:this.css.fileterNode}).inject(this.node);var t="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' style='width: 660px;font-size: 14px;color:#666'>"+"<tr>"+" <td styles='filterTableValue' lable='q_unitName'></td>"+" <td styles='filterTableTitle' item='q_unitName'></td>"+" <td styles='filterTableTitle' lable='cycleYear'></td>"+" <td styles='filterTableValue' item='cycleYear'></td>"+" <td styles='filterTableTitle' lable='cycleMonth'></td>"+" <td styles='filterTableValue' item='cycleMonth'></td>"+" <td styles='filterTableValue' item='action'></td>"+"</tr>"+"</table>";this.fileterNode.set("html",t);MWF.xDesktop.requireApp("Template","MForm",function(){this.form=new MForm(this.fileterNode,{},{isEdited:true,itemTemplate:{q_unitName:{text:"部门",type:"org",orgType:"unit",notEmpty:true,style:{"min-width":"200px"}},cycleYear:{text:"年度",type:"select",selectValue:function(){var t=[];var e=(new Date).getFullYear();for(var i=0;i<6;i++){t.push(e--)}return t}},cycleMonth:{text:"月份",notEmpty:true,type:"select",defaultValue:function(){var t=((new Date).getMonth()+1).toString();return t.length==1?"0"+t:t},selectValue:["","01","02","03","04","05","06","07","08","09","10","11","12"]},action:{value:"查询",type:"button",className:"filterButton",event:{click:function(){var t=this.form.getResult(true,",",true,true,false);if(!t)return;this.loadView(t)}.bind(this)}}}},this.app,this.css);this.form.load()}.bind(this),true)},loadView:function(t){this.elementContentNode.empty();if(this.view)delete this.view;this.view=new MWF.xApplication.Attendance.UnitDetail.DetailStaticView(this.elementContentNode,this.app,this);this.view.filterData=t;this.view.listItemUrl=this.path+"listItem_detailStatic.json";this.view.load();this.setContentSize()}});MWF.xApplication.Attendance.UnitDetail.View=new Class({Extends:MWF.xApplication.Attendance.Explorer.View,_createItem:function(t){return new MWF.xApplication.Attendance.UnitDetail.Document(this.table,t,this.explorer,this)},_getCurrentPageData:function(e,t){if(!t)t=20;var i=this.items.length?this.items[this.items.length-1].data.id:"(0)";var a=this.filterData||{};this.actions.listDetailFilterNext(i,t,a,function(t){if(e)e(t)}.bind(this))},_removeDocument:function(t,e){},_createDocument:function(){},_openDocument:function(t){}});MWF.xApplication.Attendance.UnitDetail.DetailStaticView=new Class({Extends:MWF.xApplication.Attendance.Explorer.View,_createItem:function(t){return new MWF.xApplication.Attendance.UnitDetail.DetailStaticDocument(this.table,t,this.explorer,this)},_getCurrentPageData:function(e,t){var i=this.filterData||{};this.actions.listPersonMonthStaticByUnit(i.q_unitName,i.cycleYear,i.cycleMonth,function(t){if(e)e(t)}.bind(this))},_removeDocument:function(t,e){},_createDocument:function(){},_openDocument:function(t){}});MWF.xApplication.Attendance.UnitDetail.Document=new Class({Extends:MWF.xApplication.Attendance.Explorer.Document});MWF.xApplication.Attendance.UnitDetail.DetailStaticDocument=new Class({Extends:MWF.xApplication.Attendance.Explorer.Document});
|