| 1 |
- MWF.xDesktop.requireApp("Attendance","Explorer",null,false);MWF.xDesktop.requireApp("Selector","package",null,false);MWF.xDesktop.requireApp("Template","Explorer",null,false);MWF.xApplication.Attendance.SelfHoliday=new Class({Extends:MWF.xApplication.Attendance.Explorer,Implements:[Options,Events],initialize:function(t,e,i,l){this.setOptions(l);this.app=e;this.path="/x_component_Attendance/$SelfHoliday/";this.cssPath="/x_component_Attendance/$SelfHoliday/"+this.options.style+"/css.wcss";this._loadCss();this.actions=i;this.node=$(t);this.initData();if(!this.personActions)this.personActions=new MWF.xAction.org.express.RestActions},load:function(){this.loadToolbar();this.loadFilter();this.loadContentNode();this.loadView();this.setNodeScroll()},loadFilter:function(){this.fileterNode=new Element("div.fileterNode",{styles:this.css.fileterNode}).inject(this.node);this._loadFilterContent()},exportExcel:function(){var t=new MWF.xApplication.Attendance.SelfHoliday.ExportExcelForm(this);t.edit()},_loadFilterContent:function(){var e=this;var t="<table bordr='0' cellpadding='5' cellspacing='0' styles='formTable' width='950'>"+"<tr>"+" <td styles='formTableTitle' lable='q_topUnitName'></td>"+" <td styles='formTableValue' item='q_topUnitName'></td>"+" <td styles='formTableTitle' lable='q_unitName'></td>"+" <td styles='formTableValue' item='q_unitName'></td>"+" <td styles='formTableTitle' lable='q_empName'></td>"+" <td styles='formTableValue' item='q_empName'></td>"+" <td styles='formTableValue' item='action'></td>"+"</tr>"+"</table>";this.fileterNode.set("html",t);MWF.xDesktop.requireApp("Template","MForm",function(){this.filter=new MForm(this.fileterNode,{},{style:"filter",isEdited:true,itemTemplate:{q_topUnitName:{text:"选择公司",type:"org",orgType:"unit",style:{"min-width":"200px"}},q_unitName:{text:"选择部门",type:"org",orgType:"unit",style:{"min-width":"250px"}},q_empName:{text:"选择人员",type:"org",orgType:"person",style:{"min-width":"100px"}},action:{type:"button",value:"查询",event:{click:function(){var t=e.filter.getResult(true,",",true,true,true);this.loadView(t)}.bind(this)}}}},this.app,this.css);this.filter.load()}.bind(this),true)},loadView:function(t){this.elementContentNode.empty();this.view=new MWF.xApplication.Attendance.SelfHoliday.View(this.elementContentNode,this.app,this,this.viewData,this.options.searchKey);this.view.filterData=t;this.view.load();this.setContentSize()},createDocument:function(){if(this.view)this.view._createDocument()}});MWF.xApplication.Attendance.SelfHoliday.View=new Class({Extends:MWF.xApplication.Attendance.Explorer.View,_createItem:function(t){return new MWF.xApplication.Attendance.SelfHoliday.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 l=this.filterData||{};this.actions.listSelfHolidayFilterNext(i,t,l,function(t){if(e)e(t)})},_removeDocument:function(t,e){this.actions.deleteSelfHoliday(t.id,function(t){this.explorer.view.reload();this.app.notice(this.app.lp.deleteDocumentOK,"success")}.bind(this))},_createDocument:function(){var t=new MWF.xApplication.Attendance.SelfHoliday.Form(this.explorer);t.create()},_openDocument:function(t){var e=new MWF.xApplication.Attendance.SelfHoliday.Form(this.explorer,t);e.open()}});MWF.xApplication.Attendance.SelfHoliday.Document=new Class({Extends:MWF.xApplication.Attendance.Explorer.Document});MWF.xApplication.Attendance.SelfHoliday.ExportExcelForm=new Class({Extends:MWF.xApplication.Attendance.Explorer.PopupForm,_createTableContent:function(){var t="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+"<tr><td colspan='2' styles='formTableHead'>导出员工休假记录</td></tr>"+"<tr>"+" <td styles='formTableTitle' lable='startDate'></td>"+" <td styles='formTableValue' item='startDate'></td>"+"</tr>"+"<tr>"+" <td styles='formTableTitle' lable='endDate'></td>"+" <td styles='formTableValue' item='endDate'></td>"+"</tr>"+"</table>";this.formTableArea.set("html",t);MWF.xDesktop.requireApp("Template","MForm",function(){this.form=new MForm(this.formTableArea,{q_empName:layout.desktop.session.user.distinguishedName},{isEdited:true,itemTemplate:{startDate:{text:"开始日期",tType:"date"},endDate:{text:"结束日期",tType:"date"}}},this.app);this.form.load()}.bind(this),true)},_ok:function(t,e){this.app.restActions.exportSelfHoliday(t.startDate,t.endDate,function(t){if(e)e(t)}.bind(this));this.close()}});MWF.xApplication.Attendance.SelfHoliday.Form=new Class({Extends:MWF.xApplication.Attendance.Explorer.PopupForm,options:{width:600,height:450,hasTop:true,hasBottom:true,title:"",draggable:true,closeAction:true},_createTableContent:function(){var t="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+"<tr><td colspan='2' styles='formTableHead'>员工休假记录</td></tr>"+"<tr><td styles='formTabelTitle' lable='unitName'></td>"+" <td styles='formTableValue' item='unitName'></td></tr>"+"<tr><td styles='formTabelTitle' lable='employeeName'></td>"+" <td styles='formTableValue' item='employeeName'></td></tr>"+"<tr><td styles='formTabelTitle' lable='leaveType'></td>"+" <td styles='formTableValue' item='leaveType'></td></tr>"+"<tr><td styles='formTabelTitle' lable='startTime'></td>"+" <td styles='formTableValue' item='startTime'></td></tr>"+"<tr><td styles='formTabelTitle' lable='endTime'></td>"+" <td styles='formTableValue' item='endTime'></td></tr>"+"<tr><td styles='formTabelTitle' lable='leaveDayNumber'></td>"+" <td styles='formTableValue' item='leaveDayNumber'></td></tr>"+"</table>";this.formTableArea.set("html",t);MWF.xDesktop.requireApp("Template","MForm",function(){this.form=new MForm(this.formTableArea,this.data,{isEdited:this.isEdited||this.isNew,itemTemplate:{unitName:{text:"部门",type:"org",orgType:"unit",notEmpty:true},employeeName:{text:"员工姓名",type:"org",orgType:"person",notEmpty:true},leaveType:{text:"休假类型",type:"select",notEmpty:true,selectValue:"带薪年休假,带薪病假,带薪福利假,扣薪事假,其他".split(",")},startTime:{text:"开始时间",tType:"datetime",notEmpty:true},endTime:{text:"结束时间",tType:"datetime",notEmpty:true},leaveDayNumber:{text:"休假天数",tType:"number",notEmpty:true}}},this.app);this.form.load()}.bind(this),true)},_ok:function(t,e){this.app.restActions.saveSelfHoliday(t,function(t){if(e)e(t)}.bind(this))}});
|