1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348 |
- MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
- MWF.xDesktop.requireApp("Selector", "package", null, false);
- MWF.xDesktop.requireApp("Template", "MForm", null, false);
- MWF.xApplication.Attendance.MyDetail = new Class({
- Extends: MWF.widget.Common,
- Implements: [Options, Events],
- options: {
- "style": "default"
- },
- initialize: function(node, app, actions, options){
- this.setOptions(options);
- this.app = app;
- this.path = "../x_component_Attendance/$MyDetail/";
- this.cssPath = "../x_component_Attendance/$MyDetail/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.actions = actions;
- this.node = $(node);
- },
- load: function(){
- //options = {
- // "name": "直接主管",
- // "personName": this.workContext.getWork().creatorPerson
- //}
- //return this.org.getPersonAttribute(options);
- this.loadTab();
- },
- loadTab : function(){
- this.tabNode = new Element("div",{"styles" : this.css.tabNode }).inject(this.node);
- this.detailArea = new Element("div",{"styles" : this.app.css.tabPageContainer }).inject(this.tabNode);
- //this.selfHolidayArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode)
- this.detailStaticArea = new Element("div",{"styles" : this.app.css.tabPageContainer }).inject(this.tabNode);
- //this.selfHolidayStaticArea = 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, this.app.lp.myDetail, false);
- this.detailPage.contentNodeArea.set("class","detailPage");
- this.detailPage.addEvent("show",function(){
- this.detailPage.tabNode.addClass( "mainColor_border" );
- this.detailPage.textNode.addClass( "mainColor_color" );
- if( !this.detailExplorer ){
- this.detailExplorer = new MWF.xApplication.Attendance.MyDetail.Explorer( this.detailArea, this );
- this.detailExplorer.load();
- }
- }.bind(this)).addEvent("hide", function(){
- this.detailPage.tabNode.removeClass( "mainColor_border" );
- this.detailPage.textNode.removeClass( "mainColor_color" );
- }.bind(this));
- //this.selfHolidayPage = this.tabs.addTab(this.selfHolidayArea, "我的休假明细", false);
- //this.selfHolidayPage.contentNodeArea.set("class","selfHolidayPage");
- //this.selfHolidayPage.addEvent("show",function(){
- // if( !this.selfHoliday ){
- // this.selfHoliday = new MWF.xApplication.Attendance.MyDetail.SelfHoliday( this.selfHolidayArea, this );
- // this.selfHoliday.load();
- // }
- //}.bind(this))
- this.detailStaticPage = this.tabs.addTab(this.detailStaticArea, this.app.lp.myDetailStatic, false);
- this.detailStaticPage.contentNodeArea.set("class","detailStaticPage");
- this.detailStaticPage.addEvent("show",function(){
- this.detailStaticPage.tabNode.addClass( "mainColor_border" );
- this.detailStaticPage.textNode.addClass( "mainColor_color" );
- if( !this.detailStaticExplorer ){
- this.detailStaticExplorer = new MWF.xApplication.Attendance.MyDetail.DetailStaticExplorer( this.detailStaticArea, this );
- this.detailStaticExplorer.load();
- }
- }.bind(this)).addEvent("hide", function(){
- this.detailStaticPage.tabNode.removeClass( "mainColor_border" );
- this.detailStaticPage.textNode.removeClass( "mainColor_color" );
- }.bind(this));
- //this.selfHolidayStaticPage = this.tabs.addTab(this.selfHolidayStaticArea, "我的休假统计", false);
- //this.selfHolidayStaticPage.contentNodeArea.set("class","selfHolidayStaticPage");
- //this.selfHolidayStaticPage.addEvent("show",function(){
- // if( !this.selfHolidayStaticExplorer ){
- // this.selfHolidayStaticExplorer = new MWF.xApplication.Attendance.MyDetail.SelfHolidayStaticExplorer( this.selfHolidayStaticArea, this );
- // this.selfHolidayStaticExplorer.load();
- // }
- //}.bind(this))
- this.tabs.pages[0].showTab();
- }.bind(this));
- }
- });
- MWF.xApplication.Attendance.MyDetail.Explorer = new Class({
- Extends: MWF.xApplication.Attendance.Explorer,
- Implements: [Options, Events],
- initialize: function(node, parent, options){
- this.setOptions(options);
- this.parent = parent;
- this.app = parent.app;
- this.css = parent.css;
- this.path = parent.path;
- this.actions = parent.actions;
- this.node = $(node);
- this.preMonthDate = new Date();
- //this.preMonthDate.decrement("month", 1);
- 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.loadConfig();
- this.loadFilter();
- this.loadContentNode();
- this.setNodeScroll();
- var month = (this.preMonthDate.getMonth()+1).toString();
- if( month.length == 1 )month = "0"+month;
- var filterData = {
- cycleYear : this.preMonthDate.getFullYear().toString(),
- cycleMonth : month
- };
- this.loadView( filterData );
- },
- loadConfig : function(){
- this.config = {};
- var v;
- //需要判断申述类型listSetting2020年6月16日 by gee
- this.configSetting = new Object(null);
- this.actions.listSetting(function(json){
- var data = json.data;
- if(!!data){
- json.data.map(function(e){
- this.configSetting[e.configCode]=e;
- }.bind(this));
- v = this.configSetting.APPEALABLE.configValue;
- }else{
- v = null;
- }
- }.bind(this),null,false);
- /*this.actions.getSettingCode( "APPEALABLE", function(json){
- v = json.data ? json.data.configValue : null;
- },null, false);*/
- if( !v ){
- this.config.APPEALABLE = true;
- }else{
- this.config.APPEALABLE = (v != "false" )
- }
- },
- loadFilter: function(){
- var lp = MWF.xApplication.Attendance.LP;
- this.fileterNode = new Element("div.fileterNode", {
- "styles" : this.app.css.fileterNode
- }).inject(this.node);
- var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='filterTable' style='width: 900px;'>"+
- "<tr>" +
- " <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",html);
- MWF.xDesktop.requireApp("Template", "MForm", function(){
- this.form = new MForm( this.fileterNode, {}, {
- style: "attendance",
- isEdited : true,
- itemTemplate : {
- cycleYear : {
- text : lp.annuaal,
- "type" : "select",
- "selectValue" : function(){
- var years = [];
- var year = new Date().getFullYear();
- for(var i=0; i<6; i++ ){
- years.push( year-- );
- }
- return years;
- },
- "event" : {
- "change" : function( item, ev ){
- var values = this.getDateSelectValue();
- item.form.getItem( "date").resetItemOptions( values , values )
- }.bind(this)
- }
- },
- cycleMonth : {
- text : lp.months,
- "type" : "select",
- "defaultValue" : function(){
- var month = (new Date().getMonth() + 1 ).toString();
- return month.length == 1 ? "0"+month : month;
- },
- "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
- "event" : {
- "change" : function( item, ev ){
- var values = this.getDateSelectValue();
- item.form.getItem( "date").resetItemOptions( values , values )
- }.bind(this)
- }
- },
- date : { text : lp.date, "type" : "select", "selectValue" : function(){
- var year = this.preMonthDate.getFullYear() ;
- var month = this.preMonthDate.getMonth() ;
- var date = new Date(year, month, 1);
- var days = [];
- days.push("");
- while (date.getMonth() === month) {
- var d = date.getDate().toString();
- if( d.length == 1 )d = "0"+d;
- days.push( d );
- date.setDate(date.getDate() + 1);
- }
- return days;
- }.bind(this)
- },
- isAbsent : { text: lp.absent, "type" : "select", "selectValue" : ["","true","false"], "selectText" : lp.absendSelectText },
- isLate : { text: lp.late, "type" : "select", "selectValue" : ["","true","false"], "selectText" : lp.lateSelectText },
- isLackOfTime : { text: lp.lackOfTime, "type" : "select", "selectValue" : ["","true","false"], "selectText" : lp.truefalseSelectText },
- action : { "value" : lp.query, type : "button", className : "filterButton", clazz:"mainColor_bg", event : {
- click : function(){
- var result = this.form.getResult(false,null,false,true,false);
- /* var year = this.preMonthDate.getFullYear().toString();
- var month = (this.preMonthDate.getMonth()+1).toString();
- if( month.length == 1 )month = "0"+month;
- result.cycleYear = year;
- result.cycleMonth = month;*/
- if( typeOf( result.isAbsent ) == "string" )result.isAbsent = this.getBoolean( result.isAbsent );
- if( typeOf( result.isLate ) == "string" )result.isLate = this.getBoolean( result.isLate );
- if( typeOf( result.isLackOfTime ) == "string" )result.isLackOfTime = this.getBoolean( result.isLackOfTime );
- if( result.date && result.date !="" ){
- if( !result.cycleMonth ){
- this.app.notice( this.lp.mustSelectMonth, "error");
- return;
- }
- result.q_date = result.cycleYear + "-" + result.cycleMonth + "-" + result.date;
- }
- this.loadView( result );
- }.bind(this)
- }}
- }
- }, this.app, this.app.css);
- this.form.load();
- }.bind(this), true);
- },
- getDateSelectValue : function(){
- if( this.form ){
- var year = parseInt(this.form.getItem("cycleYear").getValue());
- var month = parseInt(this.form.getItem("cycleMonth").getValue())-1;
- }else{
- var year = (new Date()).getFullYear() ;
- var month = (new Date()).getMonth() ;
- }
- var date = new Date(year, month, 1);
- var days = [];
- days.push("");
- while (date.getMonth() === month) {
- var d = date.getDate().toString();
- if( d.length == 1 )d = "0"+d;
- days.push( d );
- date.setDate(date.getDate() + 1);
- }
- return days;
- },
- //loadFilter2 : function(){
- // this.fileterNode = new Element("div.fileterNode", {
- // "styles" : this.css.fileterNode
- // }).inject(this.node)
- //
- // var table = new Element("table", {
- // "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.filterTable, "class" : "filterTable"
- // }).inject( this.fileterNode );
- // var tr = new Element("tr").inject(table);
- //
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : this.preMonthDate.format(this.app.lp.dateFormatMonth) }).inject(tr);
- //
- // //this.createYearSelectTd( tr )
- // //this.createMonthSelectTd( tr )
- // this.createDateSelectTd( tr )
- // this.createIsAbsent(tr)
- // this.createIsLate( tr )
- // //this.createIsLeaveEarlier( tr )
- // this.createLackOfTimeCount(tr)
- // this.createActionTd( tr )
- //},
- //createYearSelectTd : function( tr ){
- // var _self = this;
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "年度" }).inject(tr);
- // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // this.cycleYear = new MDomItem( td, {
- // "name" : "cycleYear",
- // "type" : "select",
- // "selectValue" : function(){
- // var years = [];
- // var year = new Date().getFullYear();
- // for(var i=0; i<6; i++ ){
- // years.push( year-- );
- // }
- // return years;
- // },
- // "event" : {
- // "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
- // }
- // }, true, this.app );
- // this.cycleYear.load();
- //},
- //createMonthSelectTd : function( tr ){
- // var _self = this;
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "月份" }).inject(tr);
- // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // this.cycleMonth = new MDomItem( td, {
- // "name" : "cycleMonth",
- // "type" : "select",
- // "defaultValue" : function(){
- // var month = (new Date().getMonth() + 1 ).toString();
- // return month.length == 1 ? "0"+month : month;
- // },
- // "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
- // "event" : {
- // "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
- // }
- // }, true, this.app );
- // this.cycleMonth.load();
- //},
- //createDateSelectTd : function( tr ){
- // var _self = this;
- // if( tr ){
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "日期" }).inject(tr);
- // this.dateSelecterTd = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // }
- // if( this.q_date ){
- // this.dateSelecterTd.empty();
- // }
- // this.q_date = new MDomItem( this.dateSelecterTd, {
- // "name" : "q_date",
- // "type" : "select",
- // "selectValue" : function(){
- // var year = _self.cycleYear ? parseInt(_self.cycleYear.getValue()) : _self.preMonthDate.getFullYear() ;
- // var month = _self.cycleMonth ? (parseInt(_self.cycleMonth.getValue())-1) : _self.preMonthDate.getMonth() ;
- // var date = new Date(year, month, 1);
- // var days = [];
- // days.push("");
- // while (date.getMonth() === month) {
- // var d = date.getDate().toString();
- // if( d.length == 1 )d = "0"+d
- // days.push( d );
- // date.setDate(date.getDate() + 1);
- // }
- // return days;
- // }
- // }, true, this.app );
- // this.q_date.load();
- //},
- //createIsAbsent: function(tr){
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "缺勤" }).inject(tr);
- // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // this.isAbsent = new MDomItem( td, {
- // "name" : "isAbsent",
- // "type" : "select",
- // "selectValue" : ["","true","false"],
- // "selectText" : ["","缺勤","未缺勤"],
- // }, true, this.app );
- // this.isAbsent.load();
- //},
- ////createIsLeaveEarlier: function(tr){
- //// var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "早退" }).inject(tr);
- //// var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- //// this.isLeaveEarlier = new MDomItem( td, {
- //// "name" : "isLeaveEarlier",
- //// "type" : "select",
- //// "selectValue" : ["-1","true","false"],
- //// "selectText" : ["","早退","未早退"],
- //// }, true, this.app );
- //// this.isLeaveEarlier.load();
- ////},
- //createLackOfTimeCount: function(tr){
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "工时不足" }).inject(tr);
- // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // this.isLackOfTime = new MDomItem( td, {
- // "name" : "isLackOfTime",
- // "type" : "select",
- // "selectValue" : ["","true","false"],
- // "selectText" : ["","是","否"],
- // }, true, this.app );
- // this.isLackOfTime.load();
- //},
- //createIsLate: function(tr){
- // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "迟到" }).inject(tr);
- // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // this.isLate = new MDomItem( td, {
- // "name" : "isLate",
- // "type" : "select",
- // "selectValue" : ["","true","false"],
- // "selectText" : ["","迟到","未迟到"],
- // }, true, this.app );
- // this.isLate.load();
- //},
- //createActionTd : function( tr ){
- // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
- // var input = new Element("button",{
- // "text" : "查询",
- // "styles" : this.css.filterButton
- // }).inject(td);
- // input.addEvent("click", function(){
- // //var filterData = {
- // // cycleYear : this.cycleYear.getValue(),
- // // cycleMonth : this.cycleMonth.getValue()
- // //}
- // var result = this.form.getResult(false, null,false,true,false);
- // var year = this.preMonthDate.getFullYear().toString();
- // var month = (this.preMonthDate.getMonth()+1).toString();
- // if( month.length == 1 )month = "0"+month;
- // var filterData = {
- // cycleYear : year,
- // cycleMonth : month
- // }
- // if( this.isAbsent && this.isAbsent.getValue()!=""){
- // filterData.isAbsent = this.getBoolean( this.isAbsent.getValue() );
- // }
- // if( this.isLeaveEarlier && this.isLeaveEarlier.getValue()!=""){
- // filterData.isLeaveEarlier = this.getBoolean( this.isLeaveEarlier.getValue());
- // }
- // if( this.isLate && this.isLate.getValue()!="" ){
- // filterData.isLate = this.getBoolean( this.isLate.getValue());
- // }
- // if( this.isLackOfTime && this.isLackOfTime.getValue()!=""){
- // filterData.isLackOfTime = this.getBoolean( this.isLackOfTime.getValue());
- // }
- // if( this.q_date && this.q_date.getValue()!="" ){
- // filterData.q_date = year + "-" + month + "-" + this.q_date.getValue();
- // }
- // this.loadView( filterData );
- // }.bind(this))
- //},
- getBoolean : function( value ){
- if( value === "true" )return true;
- if( value === "false" )return false;
- return value;
- },
- //selecePerson: function(){
- // var options = {
- // "type": "person",
- // "title": "选择人员",
- // "count" : "1",
- // "onComplete": function(items){
- // var names = [];
- // items.each(function(item){
- // names.push(item.data.name);
- // }.bind(this));
- // this.q_empName.setValue( names.join(",") )
- // }.bind(this)
- // };
- // var selector = new MWF.O2Selector(this.app.content, options);
- //},
- loadContentNode: function(){
- this.elementContentNode = new Element("div.elementContentNode", {
- "styles": this.css.elementContentNode
- }).inject(this.node);
- this.app.addEvent("resize", function(){this.setContentSize();}.bind(this));
- this.elementContentNode.addEvent("scroll", function () {
- var scroll = this.elementContentNode.getScroll();
- if(this.fileterNode)this.fileterNode.scrollTo(scroll.x);
- }.bind(this));
- },
- loadView : function( filterData ){
- this.elementContentNode.empty();
- if( this.view )delete this.view;
- this.view = new MWF.xApplication.Attendance.MyDetail.View(this.elementContentNode, this.app,this );
- this.view.filterData = filterData;
- this.view.load();
- this.setContentSize();
- },
- setContentSize: function(){
- var tabNodeSize = this.parent.tabs ? this.parent.tabs.tabNodeContainer.getSize() : {"x":0,"y":0};
- var fileterNodeSize = this.fileterNode ? this.fileterNode.getSize() : {"x":0,"y":0};
- var nodeSize = this.parent.node.getSize();
- var pt = this.elementContentNode.getStyle("padding-top").toFloat();
- var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
- //var filterSize = this.filterNode.getSize();
- var height = nodeSize.y-tabNodeSize.y-pt-pb-fileterNodeSize.y-20;
- this.elementContentNode.setStyle("height", ""+height+"px");
- this.pageCount = (height/40).toInt()+5;
- if (this.view && this.view.items.length<this.pageCount){
- this.view.loadElementList(this.pageCount-this.view.items.length);
- }
- }
- });
- MWF.xApplication.Attendance.MyDetail.SelfHoliday = new Class({
- Extends: MWF.xApplication.Attendance.MyDetail.Explorer,
- loadView : function( filterData ){
- this.elementContentNode.empty();
- if( this.view )delete this.view;
- this.view = new MWF.xApplication.Attendance.MyDetail.SelfHolidayView(this.elementContentNode, this.app,this );
- this.view.filterData = filterData;
- this.view.load();
- this.setContentSize();
- }
- });
- MWF.xApplication.Attendance.MyDetail.DetailStaticExplorer = new Class({
- Extends: MWF.xApplication.Attendance.MyDetail.Explorer,
- /* load: function(){
- //this.loadFilter();
- this.loadContentNode();
- this.setNodeScroll();
- debugger;
- var filterData = {
- cycleYear : this.preMonthDate.getFullYear().toString(),
- cycleMonth : this.preMonthDate.format(this.app.lp.dateFormatOnlyMonth)
- };
- this.loadView( filterData );
- },*/
- loadFilter : function(){
- this.fileterNode = new Element("div.fileterNode", {
- "styles" : this.app.css.fileterNode
- }).inject(this.node);
- this.loadFilterStyle(function( css ){
- this.filterFormCss = css;
- var table = new Element("table", {
- "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.app.css.filterTable, "class" : "filterTable"
- }).inject( this.fileterNode );
- table.setStyle("width","360px");
- var tr = new Element("tr").inject(table);
- this.createYearSelectTd( tr );
- this.createMonthSelectTd( tr );
- this.createActionTd( tr );
- }.bind(this));
- },
- createYearSelectTd : function( tr ){
- var _self = this;
- var td = new Element("td", { "styles" : this.app.css.filterTableTitle, "text" : this.app.lp.annuaal }).inject(tr);
- var td = new Element("td", { "styles" : this.app.css.filterTableValue }).inject(tr);
- this.yearString = new MDomItem( td, {
- "name" : "yearString",
- "type" : "select",
- "selectValue" : function(){
- var years = [];
- var year = new Date().getFullYear();
- for(var i=0; i<6; i++ ){
- years.push( year-- );
- }
- return years;
- }
- }, true, this.app, this.filterFormCss );
- this.yearString.load();
- },
- createMonthSelectTd : function( tr ){
- var _self = this;
- var td = new Element("td", { "styles" : this.app.css.filterTableTitle, "text" : MWF.xApplication.Attendance.LP.months }).inject(tr);
- var td = new Element("td", { "styles" : this.app.css.filterTableValue }).inject(tr);
- this.cycleMonth = new MDomItem( td, {
- "name" : "cycleMonth",
- "type" : "select",
- "selectValue" :["01","02","03","04","05","06","07","08","09","10","11","12"],
- "defaultValue" : function(){
- var month = (new Date().getMonth() + 1 ).toString();
- return month.length == 1 ? "0"+month : month;
- },
- "event" : {
- "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
- }
- }, true, this.app, this.filterFormCss );
- this.cycleMonth.load();
- },
- createActionTd : function( tr ){
- var td = new Element("td", { "styles" : this.app.css.filterTableValue }).inject(tr);
- var input = new Element("button",{
- "text" : MWF.xApplication.Attendance.LP.query,
- "styles" : this.app.css.filterButton
- }).inject(td);
- input.addClass("mainColor_bg");
- debugger;
- input.addEvent("click", function(){
- var year = this.yearString.getValue("year");
- var month = this.cycleMonth.getValue("month");
- if(year && year!=""){
- }else{
- year = this.preMonthDate.getFullYear().toString();
- }
- if(month && month!=""){
- }else{
- month = (this.preMonthDate.getMonth()+1).toString();
- }
- /*var year = this.preMonthDate.getFullYear().toString();
- var month = (this.preMonthDate.getMonth()+1).toString();*/
- debugger;
- if( month.length == 1 )month = "0"+month;
- var filterData = {
- cycleYear : year,
- cycleMonth : month
- };
- if( this.isAbsent && this.isAbsent.getValue()!="" ){
- filterData.isAbsent = this.isAbsent.getValue();
- }
- if( this.isLeaveEarlier && this.isLeaveEarlier.getValue()!=""){
- filterData.isLeaveEarlier = this.isLeaveEarlier.getValue();
- }
- if( this.isLate && this.isLate.getValue()!="" ){
- filterData.isLate = this.isLate.getValue();
- }
- if( this.q_date && this.q_date.getValue()!="" ){
- filterData.q_date = year + "-" + month + "-" + this.q_date.getValue();
- }
- this.loadView( filterData );
- }.bind(this))
- },
- loadView : function( filterData ){
- this.elementContentNode.empty();
- if( this.view )delete this.view;
- this.view = new MWF.xApplication.Attendance.MyDetail.DetailStaticView(this.elementContentNode, this.app,this );
- this.view.filterData = filterData;
- this.view.listItemUrl = this.path+"listItem_detailStatic.json";
- this.view.load();
- this.setContentSize();
- }
- });
- MWF.xApplication.Attendance.MyDetail.SelfHolidayStaticExplorer = new Class({
- Extends: MWF.xApplication.Attendance.MyDetail.Explorer,
- loadView : function( filterData ){
- this.elementContentNode.empty();
- if( this.view )delete this.view;
- this.view = new MWF.xApplication.Attendance.MyDetail.SelfHolidayStaticView(this.elementContentNode, this.app,this );
- this.view.filterData = filterData;
- this.view.load();
- this.setContentSize();
- }
- });
- MWF.xApplication.Attendance.MyDetail.View = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.View,
- _createItem: function(data){
- return new MWF.xApplication.Attendance.MyDetail.Document(this.table, data, this.explorer, this);
- },
- _getCurrentPageData: function(callback, count){
- if(!count)count=100;
- var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
- var filter = this.filterData || {};
- filter.key = this.sortField || this.sortFieldDefault || "";
- filter.order = this.sortType || this.sortTypeDefault || "";
- filter.q_empName = layout.desktop.session.user.distinguishedName;
- this.actions.listDetailFilterNext( id, count, filter, function(json){
- var data = json.data;
- data.each(function(d){
- d.APPEALABLE = this.explorer.config.APPEALABLE;
- }.bind(this));
- json.data = data;
- if( callback )callback(json);
- }.bind(this));
- //this.actions.listDetailFilterUser( filter, function(json){
- // if( callback )callback(json);
- //}.bind(this))
- },
- _removeDocument: function(documentData, all){
- },
- _createDocument: function(){
- },
- _openDocument: function( documentData ){
- }
- });
- MWF.xApplication.Attendance.MyDetail.SelfHolidayView = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.View,
- _createItem: function(data){
- return new MWF.xApplication.Attendance.MyDetail.SelfHolidayDocument(this.table, data, this.explorer, this);
- },
- _getCurrentPageData: function(callback, count){
- var filter = this.filterData || {};
- filter.q_empName = layout.desktop.session.user.distinguishedName;
- this.actions.listDetailFilterUser( filter, function(json){
- if( callback )callback(json);
- }.bind(this))
- },
- _removeDocument: function(documentData, all){
- },
- _createDocument: function(){
- },
- _openDocument: function( documentData ){
- }
- });
- MWF.xApplication.Attendance.MyDetail.DetailStaticView = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.View,
- _createItem: function(data){
- return new MWF.xApplication.Attendance.MyDetail.DetailStaticDocument(this.table, data, this.explorer, this);
- },
- _getCurrentPageData: function(callback, count){
- var filter = this.filterData || {};
- filter.key = this.sortField || this.sortFieldDefault || "";
- filter.order = this.sortType || this.sortTypeDefault || "";
- filter.q_empName = layout.desktop.session.user.distinguishedName;
- if( filter.cycleMonth == "" )filter.cycleMonth="(0)";
- /*var month = (new Date().getMonth()+1).toString();
- if( month.length == 1 )month = "0"+month;
- filter.cycleMonth = month;*/
- debugger;
- this.actions.listStaticMonthPerson( filter.q_empName, filter.cycleYear,filter.cycleMonth, function(json){
- if( callback )callback(json);
- }.bind(this))
- },
- _removeDocument: function(documentData, all){
- },
- _createDocument: function(){
- },
- _openDocument: function( documentData ){
- }
- });
- MWF.xApplication.Attendance.MyDetail.SelfHolidayStaticView = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.View,
- _createItem: function(data){
- return new MWF.xApplication.Attendance.MyDetail.SelfHolidayStaticDocument(this.table, data, this.explorer, this);
- },
- _getCurrentPageData: function(callback, count){
- var filter = this.filterData || {};
- this.actions.listDetailFilterUser( filter, function(json){
- if( callback )callback(json);
- }.bind(this))
- },
- _removeDocument: function(documentData, all){
- },
- _createDocument: function(){
- },
- _openDocument: function( documentData ){
- }
- });
- MWF.xApplication.Attendance.MyDetail.Document = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.Document,
- appeal :function(){
- if(this.explorer.configSetting.APPEAL_AUDIFLOWTYPE.configValue=="BUILTIN"){
- var form = new MWF.xApplication.Attendance.MyDetail.Appeal( this.explorer, this.data );
- form.create();
- }else{
- this.loadProcess(this.explorer.configSetting.APPEAL_AUDIFLOW_ID.configValue,{record:this.data} ,null);
- }
- },
- loadProcess: function(id, processData, latest){
- this.getProcess(id, function(process){
- MWF.xDesktop.requireApp("process.TaskCenter", "ProcessStarter", function(){
- var starter = new MWF.xApplication.process.TaskCenter.ProcessStarter(process, this.app, {
- "latest" : latest || false,
- "workData" : processData,
- "onStarted": function(data, title, processName){
- this.afterStartProcess(data, title, processName);
- }.bind(this)
- });
- starter.load();
- }.bind(this));
- }.bind(this));
- },
- afterStartProcess: function(data, title, processName){
- var workInfors = [];
- var currentTask = [];
- var createUnit = "";
- var workId = "";
- debugger;
- data.each(function(work){
- debugger;
- if (work.currentTaskIndex !== -1) currentTask.push(work.taskList[work.currentTaskIndex].work);
- workInfors.push(this.getStartWorkInforObj(work));
- createUnit = work.taskList[work.currentTaskIndex].creatorUnit;
- workId = work.taskList[work.currentTaskIndex].work;
- }.bind(this));
- if (currentTask.length===1){
- var options = {"workId": currentTask[0], "appId": currentTask[0]};
- this.app.desktop.openApplication(null, "process.Work", options);
- debugger;
- this.createStartWorkResault(workInfors, title, processName, false,createUnit,workId);
- }else{
- this.createStartWorkResault(workInfors, title, processName, true,createUnit,workId);
- }
- },
- createStartWorkResault: function(workInfors, title, processName, isopen,createUnit,workId){
- var data = {};
- data["appealDescription"] = this.app.lp.appealAuditFlow+":"+processName;
- data["workId"] = workId;
- if(createUnit !=""){
- data["unitName"] = createUnit;
- }
- debugger;
- this.createAppeal(data);
- if(!layout.desktop.message)return;
- var content = "";
- workInfors.each(function(infor){
- var users = [];
- infor.users.each(function(uname){
- users.push(MWF.name.cn(uname));
- });
- content += "<div><b>"+this.app.lp.nextActivity+"<font style=\"color: #ea621f\">"+infor.activity+"</font>, "+this.app.lp.nextUser+"<font style=\"color: #ea621f\">"+users.join(", ")+"</font></b>";
- if (infor.currentTask && isopen){
- content += " <span value=\""+infor.currentTask+"\">"+this.app.lp.deal+"</span></div>";
- }else{
- content += "</div>";
- }
- }.bind(this));
- var t = workInfors[0].title || title;
- var msg = {
- "subject": this.app.lp.processStarted,
- "content": "<div>"+this.app.lp.processStartedMessage+"“["+processName+"]"+t+"”</div>"+content
- };
- var tooltip = layout.desktop.message.addTooltip(msg);
- var item = layout.desktop.message.addMessage(msg);
- this.setStartWorkResaultAction(tooltip);
- this.setStartWorkResaultAction(item);
- },
- getStartWorkInforObj: function(work){
- var title = "";
- var users = [];
- var currentTask = "";
- work.taskList.each(function(task, idx){
- title = task.title;
- users.push(task.person+"("+task.creatorUnit + ")");
- if (work.currentTaskIndex===idx) currentTask = task.id;
- }.bind(this));
- return {"activity": work.fromActivityName, "users": users, "currentTask": currentTask, "title" : title };
- },
- setStartWorkResaultAction: function(item){
- var node = item.node.getElements("span");
- node.setStyles(this.css.dealStartedWorkAction);
- var _self = this;
- node.addEvent("click", function(e){
- var options = {"taskId": this.get("value"), "appId": this.get("value")};
- _self.app.desktop.openApplication(e, "process.Work", options);
- });
- },
- getProcess: function(id, callback){
- this.action = new o2.xDesktop.Actions.RestActions("", "x_processplatform_assemble_surface", "");
- this.action.actions = {"getProces": {"uri": "/jaxrs/process/{id}/complex"}};
- this.action.invoke({"name": "getProces", "async": false, "parameter": {"id": id}, "success": function(json){
- if (callback) callback(json.data);
- }.bind(this)});
- },
- createAppeal: function(data){
- this.app.restActions.createAppeal(this.data.id, data, function (json) {
- }.bind(this));
- },
- seeAppeal : function(){
- if(this.data.appealInfos[0].appealAuditInfo){
- if(this.data.appealInfos[0].appealAuditInfo.workId){
- var workid = this.data.appealInfos[0].appealAuditInfo.workId;
- var options = {"workId":workid, "appId": "process.Work"+workid};
- this.app.desktop.openApplication(null, "process.Work", options);
- return;
- }
- }
- var form = new MWF.xApplication.Attendance.MyDetail.Appeal( this.explorer, this.data );
- form.open();
- }
- });
- MWF.xApplication.Attendance.MyDetail.SelfHolidayDocument = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.Document
- });
- MWF.xApplication.Attendance.MyDetail.DetailStaticDocument = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.Document
- });
- MWF.xApplication.Attendance.MyDetail.SelfHolidayStaticDocument = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.Document
- });
- MWF.xApplication.Attendance.MyDetail.Appeal = new Class({
- Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
- options : {
- "width": 700,
- "height": 500,
- "hasTop" : true,
- "hasBottom" : true,
- "title" : MWF.xApplication.Attendance.LP.apealApplyForm,
- "draggable" : true,
- "closeAction" : true,
- },
- _createTableContent: function(){
- var appLp = MWF.xApplication.Attendance.LP;
- var _self = this;
- if( this.isNew ){
- this.detailData = this.data;
- // this.data = this.detailData || {};
- // this._open();
- }else{
- this.detailData = this.data;
- this.app.restActions.getAppeal(this.detailData.id, function(json){
- this.data = json.data;
- this.data.onDutyTime = this.detailData.onDutyTime;
- this.data.offDutyTime = this.detailData.offDutyTime;
- }.bind(this),null,false);
- if(!this.data)this.data = this.detailData || {};
- }
- var d = this.data;
- var status = [];
- if(d.isGetSelfHolidays && ( d.selfHolidayDayTime == appLp.wholeDay || d.selfHolidayDayTime == "全天")) {
- status.push( appLp.levelAsked )
- }else if( d.isAbnormalDuty && (d.abnormalDutyDayTime == appLp.wholeDay || d.abnormalDutyDayTime == "全天")){
- status.push( appLp.abNormalDuty )
- }else if(d.isLackOfTime ) {
- status.push( appLp.lackOfTime )
- }else{
- if( d.isGetSelfHolidays && ( d.selfHolidayDayTime == appLp.am || d.selfHolidayDayTime == "上午" ) ){
- status.push( appLp.levelAsked )
- }else if(d.isLate){
- status.push( appLp.late )
- }else if(d.isAbsent && ["上午","全天",appLp.am, appLp.wholeDay].contains(d.absentDayTime) ){
- status.push( appLp.absent )
- }else if( d.isAbnormalDuty && ["上午","全天",appLp.am, appLp.wholeDay].contains(d.abnormalDutyDayTime)){
- status.push( appLp.abNormalDuty )
- }
- if( d.isGetSelfHolidays && ( d.selfHolidayDayTime == "下午" || d.selfHolidayDayTime == appLp.pm ) ){
- status.push( appLp.levelAsked );
- //}else if(d.isLeaveEarlier){
- // status.push( '早退')
- }else if(d.isAbsent && ( d.absentDayTime == "下午" || d.absentDayTime == appLp.pm ) ){
- status.push( appLp.abNormalDuty)
- }else if(d.isAbnormalDuty && ( d.abnormalDutyDayTime == "下午" || d.abnormalDutyDayTime == appLp.pm ) ){
- status.push( appLp.abNormalDuty )
- }
- }
- this.data.statusShow = status.unique().join();
- var appealStatus = appLp.draft;
- if (d.status == 0 ) {
- appealStatus = appLp.todo
- } else if (d.status == 1) {
- appealStatus = appLp.approve
- } else if (d.status == -1) {
- appealStatus = appLp.deny
- }
- //if (d.appealStatus == 1) {
- // appealStatus = "申诉中"
- //} else if (d.appealStatus == -1) {
- // appealStatus = "申诉未通过"
- //} else if (d.appealStatus == 9) {
- // appealStatus = "申诉通过"
- //}
- this.data.appealStatusShow = appealStatus;
- //var auditors = this.getAuditor();
- var identityList = this.getIdentity();
- var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
- "<tr><td style='width: 85px;' styles='formTableTitle'>"+appLp.employeeName+"</td>"+
- " <td style='width: 165px;' styles='formTableValue'>"+this.data.empName.split("@")[0]+"</td>" +
- " <td style='width: 85px;' styles='formTableTitle' lable='recordDateString'></td>"+
- " <td style='width: 165px;' styles='formTableValue' item='recordDateString'></td></tr>"
- +"<tr><td styles='formTableTitle' lable='onDutyTime'></td>"+
- " <td styles='formTableValue' item='onDutyTime'></td>" +
- ((this.data.signProxy=="2"||this.data.signProxy=="3")?
- " <td styles='formTableTitle' lable='morningOffDutyTime'></td>"+
- " <td styles='formTableValue' item='morningOffDutyTime'></td></tr>" +
- "<tr><td styles='formTableTitle' lable='afternoonOnDutyTime'></td>"+
- " <td styles='formTableValue' item='afternoonOnDutyTime'></td>" : ""
- ) +
- " <td styles='formTableTitle' lable='offDutyTime'></td>"+
- " <td styles='formTableValue' item='offDutyTime'></td></tr>" +
- ( this.isNew ?
- "<tr><td styles='formTableTitle' lable='statusShow'></td>"+
- " <td styles='formTableValue' item='statusShow'></td>" +
- " <td styles='formTableTitle' lable='appealStatusShow'></td>"+
- " <td styles='formTableValue' item='appealStatusShow'></td></tr>"
- :
- "<tr><td styles='formTableTitle' lable='appealStatusShow'></td>"+
- " <td styles='formTableValue' item='appealStatusShow' colspan='3'></td></tr>"
- )
- +
- ( ( this.isNew && identityList.identities.length > 1 ) ?
- "<tr><td styles='formTableTitle' lable='identity'></td>"+
- " <td styles='formTableValue' item='identity' colspan='3'></td></tr>" : ""
- ) +
- "<tr><td styles='formTableTitle' lable='appealReason'></td>"+
- " <td styles='formTableValue' item='appealReason' colspan='3'></td></tr>" +
- "<tr contain='selfHolidayType'><td styles='formTableTitle' lable='selfHolidayType'></td>"+
- " <td styles='formTableValue' item='selfHolidayType' colspan='3'></td></tr>" +
- "<tr contain='address'><td styles='formTableTitle' lable='address'></td>"+
- " <td styles='formTableValue' item='address' colspan='3'></td></tr>" +
- "<tr contain='startTime'><td styles='formTableTitle' lable='startTime'></td>"+
- " <td styles='formTableValue' item='startTime' colspan='3'></td></tr>" +
- "<tr contain='endTime'><td styles='formTableTitle' lable='endTime'></td>"+
- " <td styles='formTableValue' item='endTime' colspan='3'></td></tr>" +
- "<tr contain='appealDescription'><td styles='formTableTitle' lable='appealDescription'></td>"+
- " <td styles='formTableValue' item='appealDescription' colspan='3'></td></tr>" +
- "</table>";
- this.formTableArea.set("html",html);
- var lp = this.app.lp.schedule;
- var signProxy = this.data.signProxy||1;
- this.document = new MForm( this.formTableArea, this.data, {
- style : "attendance",
- isEdited : this.isEdited || this.isNew,
- itemTemplate : {
- recordDateString : { text: appLp.recordDate, type : "innertext"},
- onDutyTime : { text:appLp.onDutyTime, type : "innertext"},
- morningOffDutyTime : { text:signProxy==1?"":lp.signProxy[signProxy].middayRestStartTime, type : "innertext"},
- afternoonOnDutyTime : { text:signProxy==1?"":lp.signProxy[signProxy].middayRestEndTime, type : "innertext"},
- offDutyTime : { text: appLp.offDutyTime, type : "innertext"},
- statusShow : { text: appLp.attendanceStatus, type : "innertext" },
- appealStatusShow : { text: appLp.appealStatus, type : "innertext"},
- //processPerson1 : {
- // text : "审核人", type : "select", selectValue : auditors, selectText : function(){
- // var array = [];
- // auditors.each( function( a ){ array.push(a.split("@")[0] ) } );
- // return array;
- // }
- //},
- appealReason : {
- notEmpty : true,
- text: appLp.appealReason,
- type : "select",
- selectValue : appLp.appealReasonSelectText,
- event : { change : function(mdi){
- _self.switchFieldByAppealReason(mdi.getValue());
- }}
- },
- identity : {
- notEmpty : true,
- text: appLp.selectDepartment,
- type : "radio",
- defaultValue : function(){
- return identityList.identities[0];
- }.bind(this),
- selectText : identityList.units,
- selectValue : identityList.identities
- },
- address : { text: appLp.address },
- selfHolidayType : {
- text: appLp.leaveType,
- type : "select",
- selectValue : appLp.leaveTypeSelectText
- },
- startTime : { text: appLp.startTime, tType : "datetime" },
- endTime : { text: appLp.endTime, tType : "datetime" },
- appealDescription : { text:appLp.appealDescriptoin }
- }
- }, this.app,this.css);
- this.document.load();
- _self.switchFieldByAppealReason(this.data.appealReason);
- //createFormNode.set("html", html);
- //this.setScrollBar(this.createTableContainer)
- // this.cancelActionNode = new Element("div", {
- // "styles": this.css.createCancelActionNode,
- // "text": appLp.cancel
- // }).inject(this.formNode);
- // this.cancelActionNode.addEvent("click", function(e){
- // this.cancelCreate(e);
- // }.bind(this));
- //
- // if( this.isNew || this.isEdited ){
- // this.createOkActionNode = new Element("div", {
- // "styles": this.css.createOkActionNode,
- // "text": appLp.ok
- // }).inject(this.formNode);
- // this.createOkActionNode.addEvent("click", function(e){
- // this.okCreate(e);
- // }.bind(this));
- // }
- },
- switchFieldByAppealReason : function( ar ){
- var lp = MWF.xApplication.Attendance.LP;
- var tempField = ["selfHolidayType","startTime","endTime","address","appealDescription"];
- var showField = [];
- if( ar == lp.temporaryLeave ){
- showField = ["selfHolidayType","startTime","endTime"];
- }else if( ar == lp.out ){
- showField = ["address","startTime","endTime"];
- }else if( ar == lp.businessTrip ){
- showField = ["address","startTime","endTime","appealDescription"];
- }else if( ar == lp.other ){
- showField = ["appealDescription"];
- }
- tempField.each( function( f ){
- this.formTableArea.getElement("[contain='"+f+"']").setStyle("display", showField.contains(f) ? "" : "none" );
- if( this.isNew || this.isEdited )this.document.items[f].options.notEmpty = (showField.contains(f) ? true : false )
- }.bind(this))
- },
- getIdentity : function(){
- var identityList = { identities : [], units : [] };
- this.app.personActions.getPerson( function( json ){
- json.data.woIdentityList.each( function( id ){
- var unit = id.woUnit;
- identityList.identities.push( id.distinguishedName );
- identityList.units.push( unit.name );
- }.bind(this))
- }.bind(this), null, false );
- return identityList;
- },
- getAuditor : function(){
- var lp = MWF.xApplication.Attendance.LP;
- //获取设置
- var setting = {};
- var result = [];
- this.app.restActions.listSetting(function(json){
- json.data.each(function( d ){
- setting[d.configCode] = d;
- }.bind(this))
- }.bind(this),null,false);
- if( setting.APPEAL_AUDITOR_TYPE && setting.APPEAL_AUDITOR_TYPE.configValue!="" && setting.APPEAL_AUDITOR_VALUE && setting.APPEAL_AUDITOR_VALUE.configValue!=""){
- if( setting.APPEAL_AUDITOR_TYPE.configValue == lp.reportTo || setting.APPEAL_AUDITOR_TYPE.configValue == "汇报对象" ) {
- var d = {"personList": [layout.desktop.session.user.distinguishedName] };
- this.app.orgActions.listPersonSupDirectValue( d, function( json ){
- var superior = json.data.personList;
- if( !superior || !superior[0] ){
- this.app.notice( lp.noReportToNotice, "error");
- }else{
- var p = superior[0];
- if( p.split("@")[ p.split("@").length - 1].toLowerCase() == "i" ){
- result.push( this.getPersonByIdentity( p ) )
- }else{
- result.push( p )
- }
- }
- }.bind(this), null, false );
- }else if( setting.APPEAL_AUDITOR_TYPE.configValue == "所属部门职位" || setting.APPEAL_AUDITOR_TYPE.configValue == lp.unitDuty ){
- this.app.personActions.getPerson( function( json ){
- json.data.woIdentityList.each( function( id ){
- var unit = id.woUnit;
- var d = {"name": setting.APPEAL_AUDITOR_VALUE.configValue, "unit": unit.distinguishedName};
- this.app.orgActions.getDutyValue( d, function( js ){
- var ids = js.data ? js.data.identityList : [];
- if ( typeOf( ids ) == "array" && ids[0] ) {
- ids.each( function( id ){
- result = result.concat( this.getPersonByIdentity( id ) );
- }.bind(this));
- }else{
- var text = lp.noUnitDutyNotice.replace("{unit}",unit.name).replace("{duty}",setting.APPEAL_AUDITOR_VALUE.configValue);
- this.app.notice( text, "error");
- // this.app.notice("系统中没有配置"+unit.name+"的"+setting.APPEAL_AUDITOR_VALUE.configValue+"职位,请联系管理员", "error");
- }
- }.bind(this),null ,false)
- }.bind(this))
- }.bind(this), null, false );
- }else if( setting.APPEAL_AUDITOR_TYPE.configValue == "人员属性" || setting.APPEAL_AUDITOR_TYPE.configValue == lp.personAttribute ){
- this.app.personActions.getPerson( function( json ){
- var attribute = setting.APPEAL_AUDITOR_VALUE.configValue;
- json.data.woPersonAttributeList.each( function( attr ){
- if( attr.name == attribute ){
- var p = attr.attributeList[0];
- if( p ){
- if( p.split("@")[ p.split("@").length - 1].toLowerCase() == "i" ){
- result.push( this.getPersonByIdentity( p ) )
- }else{
- result.push( p )
- }
- }
- }
- })
- }.bind(this),null ,false);
- if( result.length == 0 ){
- var text = lp.noPersonAttribute.replace("{att}", setting.APPEAL_AUDITOR_VALUE.configValue);
- this.app.notice( text, "error");
- }
- }else if( setting.APPEAL_AUDITOR_TYPE.configValue == "指定人" || setting.APPEAL_AUDITOR_TYPE.configValue == lp.assignedPerson){
- var p = setting.APPEAL_AUDITOR_TYPE.configValue;
- if( p.split("@")[ p.split("@").length - 1].toLowerCase() == "i" ){
- result.push( this.getPersonByIdentity( p ) )
- }else{
- result.push( p )
- }
- }
- }else{
- this.app.personActions.getPerson( function( json ){
- var attribute = lp.directLeader;
- json.data.woPersonAttributeList.each( function( attr ){
- if( attr.name == attribute ){
- var p = attr.attributeList[0];
- if( p ){
- if( p.split("@")[ p.split("@").length - 1].toLowerCase() == "i" ){
- result.push( this.getPersonByIdentity( p ) )
- }else{
- result.push( p )
- }
- }
- }
- })
- }.bind(this),null ,false);
- this.app.notice(lp.noDirectLeader, "error");
- }
- return result;
- },
- getPersonByIdentity : function( identity ){
- var d = {"identityList":[ identity ]};
- var result = [];
- this.app.orgActions.listPersonWithIdentityValue( d, function (js){
- result = js.data.personList;
- }.bind(this), null, false);
- return result;
- },
- ok: function(e){
- var data = this.document.getResult(true,",",true,false,true);
- if (data ) {
- var start = data.startTime;
- var end = data.endTime;
- if (start != "" && end != "") {
- var starTime = new Date(start.replace(/-/g, "/"));
- var endTime = new Date(end.replace(/-/g, "/"));
- if (starTime >= endTime) {
- this.app.notice( MWF.xApplication.Attendance.LP.holiday.beginGreateThanEndNotice, "error");
- return;
- }
- }
- this._ok( data )
- }
- //}else{
- // this.app.notice( "请填写申诉原因和具体描述", "error");
- //}
- },
- _ok: function( data ){
- this.app.restActions.createAppeal(this.data.id, data, function (json) {
- if (json.type == "ERROR") {
- this.app.notice(json.message, "error");
- } else {
- if( this.formMaskNode )this.formMaskNode.destroy();
- if( this.formAreaNode )this.formAreaNode.destroy();
- if (this.explorer && this.explorer.view)this.explorer.view.reload();
- this.app.notice( MWF.xApplication.Attendance.LP.createAppealNotice, "success");
- }
- }.bind(this));
- },
- selectDateTime : function( el, timeOnly, isTme, baseDate ){
- var opt = {
- "style": "xform",
- "timeOnly": timeOnly,
- "isTime": isTme,
- "target": this.app.content
- };
- if( baseDate )opt.baseDate = baseDate;
- MWF.require("MWF.widget.Calendar", function(){
- var calendar = new MWF.widget.Calendar( el, opt );
- calendar.show();
- }.bind(this));
- },
- //getProcessPerson : function( callback ){
- // this.getUnitByPerson( function( unitData ){
- // this.app.restActions.listPermission( function(json){
- // if( json.data.length == 0 ){
- // this.app.notice( "系统未配置考勤员,请联系管理员!", "error");
- // return;
- // }
- // var unitManager, topUnitManager, processer;
- // json.data.each( function( d ){
- // if( d.unitName == unitData.name ){
- // unitManager = d.adminName;
- // }
- // if(d.unitName == unitData.topUnit ){
- // topUnitManager = d.adminName;
- // }
- // })
- // processer = unitManager || topUnitManager;
- // if( !processer ){
- // this.app.notice( "未设置您所在部门和公司的考勤管理员,请联系系统管理员!", "error");
- // }else{
- // if(callback)callback(processer)
- // }
- // }.bind(this))
- // }.bind(this));
- //},
- getUnitByPerson : function( callback ){
- var data = {"personList": [layout.desktop.session.user.distinguishedName] };
- this.app.orgActions.listUnitWithPerson( function( json ){
- if( json.data.length > 0 ){
- if(callback)callback( json.data );
- }else{
- this.app.notice( MWF.xApplication.Attendance.LP.noDepartment, "error");
- }
- }.bind(this), function(){
- this.app.notice( MWF.xApplication.Attendance.LP.noDepartment, "error");
- }.bind(this), data, false )
- }
- });
|