MWF.xApplication.process = MWF.xApplication.process || {}; MWF.xApplication.process.Work = MWF.xApplication.process.Work || {}; MWF.xDesktop.requireApp("process.Work", "lp."+MWF.language, null, false); MWF.xApplication.process.Work.Processor = new Class({ Extends: MWF.widget.Common, Implements: [Options, Events], options: { "style": "default", "mediaNode": null, "opinion": "", "tabletWidth" : 0, "tabletHeight" : 0, "orgHeight" : 276, "maxOrgCountPerline" : 2, "isManagerProcess" : false //是否为管理员提交 }, initialize: function(node, task, options, form){ this.setOptions(options); this.path = "../x_component_process_Work/$Processor/"; this.cssPath = "../x_component_process_Work/$Processor/"+this.options.style+"/css.wcss"; this._loadCss(); this.task = task; this.node = $(node); this.selectedRoute = null; this.form = form; this.load(); }, load: function(){ if( layout.mobile ){ this.content = new Element("div").inject(this.node); }else{ this.content = this.node; } if( !this.form && this.options.isManagerProcess ){ this.managerProcessNoticeNode = new Element("div", {"styles": this.css.managerProcessNoticeNode, "html": MWF.xApplication.process.Work.LP.managerProcessNotice}).inject(this.content); this.managerLoginNode = new Element("div", {"styles": this.css.managerLoginNode, "text": MWF.xApplication.process.Work.LP.managerLogin }).inject(this.content); this.managerLoginNode.addEvent("click", function(ev){ this.managerLogin(ev); }.bind(this)); //var text = MWF.xApplication.process.Work.LP.managerLoginReturn.replace( "{user}", layout.session.user.name ); //this.managerLoginReturnNode = new Element("div", {"styles": this.css.managerLoginNode, "text": text }).inject(this.content); //this.managerLoginReturnNode.hide(); //this.managerPerson = layout.session.user.distinguishedName; //this.managerLoginReturnNode.addEvent("click", function(ev){ // this.managerLoginReturn(ev); //}.bind(this)) } this.routeOpinionTile = new Element("div", {"styles": this.css.routeOpinionTile, "text": MWF.xApplication.process.Work.LP.inputOpinion}).inject(this.content); this.routeOpinionArea = new Element("div", {"styles": this.css.routeOpinionArea}).inject(this.content); this.setOpinion(); if( this.form ){ if( layout.mobile ){ this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.content); this.orgsTile = new Element("div", {"styles": this.css.orgsTitle, "text": MWF.xApplication.process.Work.LP.selectPerson}).inject(this.orgsArea); this.orgsArea.hide(); }else{ this.orgsArea = new Element("div", {"styles": this.css.orgsArea}).inject(this.content); this.orgsTile = new Element("div", {"styles": this.css.orgsTitle, "text": MWF.xApplication.process.Work.LP.selectPerson}).inject(this.orgsArea); } } if( layout.mobile ){ this.buttonsArea = new Element("div", {"styles": this.css.buttonsArea}).inject(this.node); }else{ this.buttonsArea = new Element("div", {"styles": this.css.buttonsArea}).inject(this.content); } this.setButtons(); if( this.form ){ if( layout.mobile ){ this.getRouteGroupList(); if( this.hasDecisionOpinion ){ this.routeContainer = new Element("div", { "styles" : this.css.routeContainer }).inject(this.routeOpinionTile, "before"); this.routeGroupTitle = new Element("div", { "styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRouteGroup }).inject(this.routeContainer); this.routeGroupArea = new Element("div", { "styles": this.css.routeSelectorArea }).inject(this.routeContainer); this.routeSelectorTile = new Element("div", { "styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRoute }).inject(this.routeContainer); this.routeSelectorArea = new Element("div", { "styles": this.css.routeSelectorArea }).inject(this.routeContainer); this.setRouteGroupList(); }else{ this.routeSelectorTile = new Element("div", {"styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRoute}).inject(this.routeOpinionTile, "before"); this.routeSelectorArea = new Element("div", {"styles": this.css.routeSelectorArea}).inject(this.routeSelectorTile, "after"); this.setRouteList(); } }else{ this.getRouteGroupList(); if( this.hasDecisionOpinion ){ //if( this.getMaxOrgLength() > 1 ){ this.routeContainer = new Element("div", { "styles" : this.css.routeContainer }).inject(this.routeOpinionTile, "before"); this.routeLeftWarper = new Element("div", { "styles": this.getMaxOrgLength() > 1 ? this.css.routeLeftWarper : this.css.routeLeftWarper_single }).inject(this.routeContainer); this.routeGroupTitle = new Element("div", { "styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRouteGroup }).inject(this.routeLeftWarper); this.routeGroupArea = new Element("div", { "styles": this.css.routeSelectorArea_hasGroup }).inject(this.routeLeftWarper); this.routeRightWarper = new Element("div", { "styles": this.getMaxOrgLength() > 1 ? this.css.routeRightWarper : this.css.routeRightWarper_single }).inject(this.routeContainer); this.routeSelectorTile = new Element("div", { "styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRoute }).inject(this.routeRightWarper); this.routeSelectorArea = new Element("div", { "styles": this.css.routeSelectorArea_hasGroup }).inject(this.routeRightWarper); this.setRouteGroupList(); //}else{ // this.routeGroupTile = new Element("div", {"styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRoute }).inject(this.routeOpinionTile, "before"); // this.routeGroupArea = new Element("div", {"styles": this.css.routeSelectorArea_hasGroup_wide }).inject(this.routeGroupTile, "after"); // this.setRouteGroupList(); //} }else{ this.routeSelectorTile = new Element("div", {"styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRoute}).inject(this.routeOpinionTile, "before"); this.routeSelectorArea = new Element("div", {"styles": this.css.routeSelectorArea}).inject(this.routeSelectorTile, "after"); this.setRouteList(); } } }else{ //快速处理 this.routeSelectorTile = new Element("div", {"styles": this.css.routeSelectorTile, "text": MWF.xApplication.process.Work.LP.selectRoute}).inject(this.routeOpinionTile, "before"); this.routeSelectorArea = new Element("div", {"styles": this.css.routeSelectorArea}).inject(this.routeSelectorTile, "after"); this.setRouteList_noform(); this.setSize_noform(); } this.fireEvent("postLoad"); }, getRouteGroupList : function(){ if( this.routeGroupObject )return this.routeGroupObject; this.routeGroupObject = {}; this.routeGroupNameList = []; this.hasDecisionOpinion = false; var routeList = this.getRouteDataList(); routeList.each(function(route, i){ if( route.hiddenScriptText && this.form && this.form.Macro ){ //如果隐藏路由,返回 if( this.form.Macro.exec(route.hiddenScriptText, this).toString() === "true" )return; } if( route.displayNameScriptText && this.form && this.form.Macro ){ //如果有显示名称公式 route.displayName = this.form.Macro.exec(route.displayNameScriptText, this); }else{ route.displayName = route.name; } if( route.decisionOpinion ){ this.hasDecisionOpinion = true; var decisionOpinionList = route.decisionOpinion.split("#"); decisionOpinionList.each( function( decisionOption ){ this.routeGroupNameList.combine( [decisionOption] ); var d = this.splitByStartNumber( decisionOption ); if( !this.routeGroupObject[ d.name ] )this.routeGroupObject[ d.name ] = []; this.routeGroupObject[ d.name ].push( route ); }.bind(this)) }else{ var defaultName = MWF.xApplication.process.Work.LP.defaultDecisionOpinionName; this.routeGroupNameList.combine( [defaultName] ); if( !this.routeGroupObject[ defaultName ] )this.routeGroupObject[ defaultName ] = []; this.routeGroupObject[ defaultName].push( route ); } }.bind(this)); return this.routeGroupObject; }, splitByStartNumber : function( str ){ var obj = { name : "", order : "" }; for( var i=0; i