| 1 |
- MWF.require("MWF.widget.Mask",null,false);MWF.xApplication.process=MWF.xApplication.process||{};MWF.xApplication.process.TaskCenter=MWF.xApplication.process.TaskCenter||{};MWF.xDesktop.requireApp("process.TaskCenter","lp.zh-cn",null,false);MWF.xApplication.process.TaskCenter.ProcessStarter=new Class({Extends:MWF.widget.Common,Implements:[Options,Events],options:{style:"default",workData:null},initialize:function(t,e,s){this.setOptions(s);this.path="/x_component_process_TaskCenter/$ProcessStarter/";this.cssPath="/x_component_process_TaskCenter/$ProcessStarter/"+this.options.style+"/css.wcss";this._loadCss();MWF.xDesktop.requireApp("process.TaskCenter","$ProcessStarter."+MWF.language,null,false);this.lp=MWF.xApplication.process.TaskCenter.ProcessStarter.lp;this.data=t;this.app=e},load:function(){this.getOrgAction(function(){if(this.app.desktop.session.user.distinguishedName){this.orgAction.getPerson(function(t){this.identitys=t.data.woIdentityList||[];if(this.identitys.length){if(this.identitys.length==1){var e={title:this.data.name+"-"+this.lp.unnamed,identity:this.identitys[0].name};if(this.options.workData){e.data=this.options.workData}this.mask=new MWF.widget.Mask({style:"desktop"});this.mask.loadNode(this.app.content);this.getWorkAction(function(){this.workAction.startWork(function(t){this.mask.hide();this.fireEvent("started",[t.data,e.title,this.data.name]);if(this.app.refreshAll)this.app.refreshAll();this.app.notice(this.lp.processStarted,"success")}.bind(this),null,this.data.id,e)}.bind(this))}else{this.createMarkNode();this.createAreaNode();this.createStartNode();this.areaNode.inject(this.markNode,"after");this.areaNode.fade("in");this.setStartNodeSize();this.setStartNodeSizeFun=this.setStartNodeSize.bind(this);this.app.addEvent("resize",this.setStartNodeSizeFun);this.fireEvent("selectId")}}else{var s=this.lp.noIdentitys.replace("{name}",this.app.desktop.session.user.name);this.app.notice(s,"error")}}.bind(this),null,this.app.desktop.session.user.distinguishedName)}}.bind(this))},createMarkNode:function(){this.markNode=new Element("div#mark",{styles:this.css.markNode,events:{mouseover:function(t){t.stopPropagation()},mouseout:function(t){t.stopPropagation()}}}).inject(this.app.content)},createAreaNode:function(){this.areaNode=new Element("div#area",{styles:this.css.areaNode})},createStartNode:function(){this.createNode=new Element("div",{styles:this.css.createNode}).inject(this.areaNode);this.createNewNode=new Element("div",{styles:this.css.createNewNode}).inject(this.createNode);this.createCloseNode=new Element("div",{styles:this.css.createCloseNode}).inject(this.createNode);this.createCloseNode.addEvent("click",function(t){this.cancelStartProcess(t)}.bind(this));this.formNode=new Element("div",{styles:this.css.formNode}).inject(this.createNode);var t='<table width="100%" height="90%" border="0" cellPadding="0" cellSpacing="0">'+'<tr><td colSpan="2" style="height: 50px; line-height: 50px; text-align: center; font-size: 24px; font-weight: bold">'+this.lp.start+" - "+this.data.name+"</td></tr>"+'<tr><td colSpan="2" style="height: 40px; color: #0044cc; line-height: 40px; text-align: center; font-size: 18px; font-weight: bold">'+this.lp.selectStartIdentity+"</td></tr>"+'<tr><td colSpan="2" id="form_startIdentity"></td></tr>'+"</table>";this.formNode.set("html",t);this.identityArea=this.formNode.getElementById("form_startIdentity");var s=this;this.identitys.each(function(t){var e=new MWF.xApplication.process.TaskCenter.ProcessStarter.Identity(this.identityArea,t,this,this.css);e.node.store("identity",e);e.node.addEvents({mouseover:function(){this.setStyles(s.css.identityNode_over);this.getFirst().getLast().setStyles(s.css.identityInforNameTextNode_over);this.getFirst().getNext().getFirst().setStyles(s.css.identityTitleNode_over);this.getFirst().getNext().getNext().getFirst().setStyles(s.css.identityTitleNode_over)},mouseout:function(){this.setStyles(s.css.identityNode);this.getFirst().getLast().setStyles(s.css.identityInforNameTextNode);this.getFirst().getNext().getFirst().setStyles(s.css.identityTitleNode);this.getFirst().getNext().getNext().getFirst().setStyles(s.css.identityTitleNode)},click:function(){var t=this.retrieve("identity");if(t){s.okStartProcess(t.data.distinguishedName)}}})}.bind(this))},getOrgAction:function(t){if(!this.orgAction){this.orgAction=MWF.Actions.get("x_organization_assemble_control");if(t)t()}else{if(t)t()}},setStartNodeSize:function(){var t=this.app.content.getSize();var e=this.app.content.getSize();this.markNode.setStyles({width:""+e.x+"px",height:""+e.y+"px"});this.areaNode.setStyles({width:""+t.x+"px",height:""+t.y+"px"});var s=t.y*.7;var i=t.y*.3/2;this.createNode.setStyles({height:""+s+"px","margin-top":""+i+"px"});var n=this.identitys.length;if(n>2)n=2;var o=n*294;this.formNode.setStyles({width:""+o+"px"});o=o+60;this.createNode.setStyles({width:""+o+"px"})},cancelStartProcess:function(t){this.markNode.destroy();this.areaNode.destroy()},okStartProcess:function(t){var e={title:this.data.name+"-"+this.lp.unnamed,identity:t};if(this.options.workData){e.data=this.options.workData}if(!e.identity){this.departmentSelArea.setStyle("border-color","red");this.app.notice(this.lp.selectStartId,"error")}else{this.mask=new MWF.widget.Mask({style:"desktop"});this.mask.loadNode(this.areaNode);this.getWorkAction(function(){this.workAction.startWork(function(t){this.mask.hide();this.markNode.destroy();this.areaNode.destroy();this.fireEvent("started",[t.data,e.title,this.data.name]);this.app.refreshAll();this.app.notice(this.lp.processStarted,"success")}.bind(this),null,this.data.id,e)}.bind(this))}},getWorkAction:function(t){if(!this.workAction){this.workAction=MWF.Actions.get("x_processplatform_assemble_surface");if(t)t()}else{if(t)t()}}});MWF.xApplication.process.TaskCenter.ProcessStarter.Identity=new Class({initialize:function(t,e,s,i){this.container=$(t);this.data=e;this.starter=s;this.action=this.starter.orgAction;this.style=i;this.load()},load:function(){this.node=new Element("div",{styles:this.style.identityNode}).inject(this.container);var t=new Element("div",{styles:this.style.identityInforNameNode}).inject(this.node);var e=this.action.getPersonIcon(this.starter.app.desktop.session.user.id);var s="<img width='50' height='50' border='0' src='"+e+"'></img>";var i=new Element("div",{styles:this.style.identityInforPicNode,html:s}).inject(t);var n=new Element("div",{styles:this.style.identityInforNameTextNode,text:this.data.name}).inject(t);var o=new Element("div",{styles:this.style.identityDepartmentNode}).inject(this.node);var a=new Element("div",{styles:this.style.identityTitleNode,text:MWF.xApplication.process.TaskCenter.LP.unit}).inject(o);this.unitTextNode=new Element("div",{styles:this.style.identityTextNode}).inject(o);if(this.data.woUnit)this.unitTextNode.set({text:this.data.woUnit.levelName,title:this.data.woUnit.levelName});var r=new Element("div",{styles:this.style.identityDutyNode}).inject(this.node);var d=new Element("div",{styles:this.style.identityTitleNode,text:MWF.xApplication.process.TaskCenter.LP.duty}).inject(r);this.dutyTextNode=new Element("div",{styles:this.style.identityTextNode}).inject(r);var h=[];var l=[];this.data.woUnitDutyList.each(function(t){h.push(t.name);if(t.woUnit)l.push(t.name+"("+t.woUnit.levelName+")")}.bind(this));this.dutyTextNode.set({text:h.join(", "),title:l.join(", ")})}});
|