text: MWF.xApplication.Execution=MWF.xApplication.Execution||{},MWF.xDesktop.requireApp("Template","MPopupForm",null,!1),MWF.xDesktop.requireApp("Template","MForm",null,!1),MWF.xDesktop.requireApp("Execution","Attachment",null,!1),MWF.xDesktop.requireApp("Execution","ReportAttachment",null,!1),MWF.xApplication.Execution.WorkReport=new Class({Extends:MPopupForm,Implements:[Options,Events],options:{style:"default",width:"100%",height:"100%",hasTop:!0,hasIcon:!1,hasBottom:!0,title:"",draggable:!1,closeAction:!0,isNew:!1,isEdited:!0},initialize:function(t,e,i,s){this.setOptions(s),this.explorer=t,this.app=t.app||t,this.lp=this.app.lp.WorkReport,this.actions=this.app.restActions,this.path="../x_component_Execution/$WorkReport/",this.cssPath=this.path+this.options.style+"/css.wcss",this._loadCss(),this.options.title=this.lp.title,this.data=i||{},this.actions=e},load:function(){if(this.options.isNew?this.create():this.options.isEdited?this.edit():this.open(),this.setContentSize(),this.setContentSizeFun=this.setContentSize.bind(this),this.app.addEvent("resize",this.setContentSizeFun),this.workReportData){if(this.completeProgressContentDiv){var t=this.completeProgressContentDiv.getElements(".completeProgressLineDiv");t.setStyles({background:"#ccc"});var e=parseInt(this.workReportData.progressPercent/10);t.each((function(t,i){i<e&&t.setStyles({background:"#369"})}))}this.completeSelect&&this.completeSelect.set("value",this.workReportData.isWorkCompleted?"yes":"no")}},setContentSize:function(){var t=this.app.content.getSize();this.reportContentInforHeight=t.y-this.formTopNode.getSize().y,this.prevReportInforListDiv&&this.prevReportInforListDiv.setStyles({height:this.reportContentInforHeight+"px"})},reload:function(t){},createTopNode:function(){this.formTopNode||(this.formTopNode=new Element("div.formTopNode",{styles:this.css.formTopNode}).inject(this.formNode),this.formTopIconNode=new Element("div",{styles:this.css.formTopIconNode}).inject(this.formTopNode),this.formTopTextNode=new Element("div.formTopTextNode",{styles:this.css.formTopTextNode,text:this.lp.topTitle+(this.data.title?"-"+this.data.title:"")}).inject(this.formTopNode),this.options.closeAction&&(this.formTopCloseActionNode=new Element("div",{styles:this.css.formTopCloseActionNode}).inject(this.formTopNode),this.formTopCloseActionNode.addEvent("click",function(){this.close()}.bind(this))),this.formTopContentNode=new Element("div",{styles:this.css.formTopContentNode}).inject(this.formTopNode),this._createTopContent())},_createTopContent:function(){},createContent:function(){if(this.formContentNode=new Element("div.formContentNode",{styles:this.css.formContentNode}).inject(this.formNode),this.formTableContainer=new Element("div.formTableContainer",{styles:this.css.formTableContainer}).inject(this.formContentNode),this.formTableArea=new Element("div.formTableArea",{styles:this.css.formTableArea}).inject(this.formTableContainer),this.reportLinksDiv=new Element("div.reportLinksDiv",{styles:this.css.reportLinksDiv,text:this.lp.reportLinks}).inject(this.formTableArea).addEvents({click:function(){this.createPrevReport()}.bind(this)}),this.titleDiv=new Element("div.titleDiv",{styles:this.css.titleDiv,text:this.lp.topTitle+(this.data.title?"-"+this.data.title:""),title:this.lp.topTitle+(this.data.title?"-"+this.data.title:"")}).inject(this.formTableArea),this.centerWorkDiv=new Element("div.centerWorkDiv",{styles:this.css.centerWorkDiv}).inject(this.formTableArea),this.centerWorkTitleDiv=new Element("div.centerWorkTitleDiv",{styles:this.css.tabTitleDiv,text:this.lp.title}).inject(this.centerWorkDiv),this.tableContentDiv=new Element("div.tableContentDiv").inject(this.formTableArea),this.options.workReportId&&(this.workReportId=this.options.workReportId),this.workId=this.data.workId,this.processStatus="",this.processIdentity="",this.options.from&&"drafter"==this.options.from?this.actions.workReportDrafter(this.data.workId,function(t){t.type&&"success"==t.type&&(this.workReportData=t.data,t.data.id&&(this.workReportId=t.data.id),t.data.currentProcessorIdentityList&&(this.processIdentity=t.data.currentProcessorIdentityList),t.data.processStatus&&(this.processStatus=t.data.processStatus))}.bind(this),null,!1):(this.actions.getWorkReport(this.data.workReportId,function(t){"success"==t.type&&(this.workReportData=t.data,t.data.id&&(this.workReportId=t.data.id))}.bind(this),null,!1),this.workReportData.currentProcessorIdentityList&&(this.processIdentity=this.workReportData.currentProcessorIdentityList),this.workReportData.processStatus&&(this.processStatus=this.workReportData.processStatus)),this.data.workId&&this.actions.getTask(this.workId,function(t){t.data&&(this.workData=t.data)}.bind(this),null,!1),this.data.workId&&this.actions.getBaseWorkDetails(this.workId,function(t){this.workData.workSplitAndDescription=t.data.workDetail,this.workData.specificActionInitiatives=t.data.progressAction,this.workData.cityCompanyDuty=t.data.dutyDescription,this.workData.milestoneMark=t.data.landmarkDescription,this.workData.importantMatters=t.data.majorIssuesDescription}.bind(this),null,!1),this._createTableContent(),this.workReportData.title&&(this.titleDiv.set("text",this.workReportData.title.length>50?this.workReportData.title.substr(0,50)+"...":this.workReportData.title),this.titleDiv.set("title",this.workReportData.title)),this.workData.okrWorkAuthorizeRecords&&(this.appointContentDiv=new Element("div.appointContentDiv",{styles:this.css.appointContentDiv}).inject(this.formTableArea),this.appointContentTitleDiv=new Element("div.appointContentTitleDiv",{styles:this.css.tabTitleDiv,text:this.lp.appointTitle}).inject(this.appointContentDiv),this.appointContentInfor=new Element("div.appointContentInfor",{styles:this.css.appointContentInfor}).inject(this.appointContentDiv),this.workData.okrWorkAuthorizeRecords.each(function(t){if("AUTHORIZE"==t.operationType){var e=t.source.split("@")[0]+this.lp.appointFor+t.target.split("@")[0];e+="("+t.operationTime+") ",e+="意见："+t.opinion}if("TACKBACK"==t.operationType){e=t.source.split("@")[0]+this.lp.appointBack;e+="("+t.operationTime+") ",e+="意见："+t.opinion}this.appointRecordDiv=new Element("div.appointRecordDiv",{styles:this.css.appointRecordDiv,text:e}).inject(this.appointContentInfor)}.bind(this))),this.reportContentDiv=new Element("div.centerWorkDiv",{styles:this.css.reportContentDiv}).inject(this.formTableArea),this.reportContentTitleDiv=new Element("div.reportContentTitleDiv",{styles:this.css.tabTitleDiv,text:this.lp.reportContentTitle}).inject(this.reportContentDiv),this.reportContentInfor=new Element("div.reportContentInfor",{styles:this.css.reportContentInfor}).inject(this.reportContentDiv),this.contentTitle1=new Element("div.contentTitle1",{styles:this.css.contentTitle,text:this.lp.contentTitle1+"："}).inject(this.reportContentInfor),this.workReportData.processStatus==this.lp.activityName.drafter&&this.workReportData.isReporter?this.contentTextarea1=new Element("textarea.contentTextarea1",{styles:this.css.contentTextarea,text:this.workReportData.progressDescription?this.workReportData.progressDescription:""}).inject(this.reportContentInfor):this.contentTextStr1=new Element("div.contentTextStr1",{styles:this.css.contentTextStr,text:this.workReportData.progressDescription?this.workReportData.progressDescription:""}).inject(this.reportContentInfor),this.contentTitle2=new Element("div.contentTitle2",{styles:this.css.contentTitle,text:this.lp.contentTitle2+"："}).inject(this.reportContentInfor),this.workReportData.processStatus==this.lp.activityName.drafter&&this.workReportData.isReporter?this.contentTextarea2=new Element("textarea.contentTextarea2",{styles:this.css.contentTextarea,text:this.workReportData.workPlan?this.workReportData.workPlan:""}).inject(this.reportContentInfor):this.contentTextStr2=new Element("div.contentTextStr2",{styles:this.css.contentTextStr,text:this.workReportData.workPlan?this.workReportData.workPlan:""}).inject(this.reportContentInfor),this.completeDiv=new Element("div.completeDiv",{styles:this.css.completeDiv}).inject(this.reportContentInfor),this.completeTextSpan=new Element("span.completeTextSpan",{styles:this.css.completeTextSpan,text:this.lp.isCompleted}).inject(this.completeDiv),this.workReportData.processStatus==this.lp.activityName.drafter&&this.workReportData.isReporter||this.workReportData.processStatus==this.lp.activityName.manager&&(this.processIdentity==this.app.identity||this.processIdentity.indexOf(this.app.identity)>-1))this.completeSelect=new Element("select.completeSelect",{styles:this.css.completeSelect}).inject(this.completeDiv),this.completeSelectOption=new Element("option.completeSelectOption",{text:this.lp.isCompletedNoOption,value:"no"}).inject(this.completeSelect),this.completeSelectOption=new Element("option.completeSelectOption",{text:this.lp.isCompletedYesOption,value:"yes"}).inject(this.completeSelect),this.completeSelect.addEvents({change:function(){if("yes"==this.completeSelect.get("value")){(t=this.completeProgressContentDiv.getElements(".completeProgressLineDiv")).setStyles({background:"#369"}),this.completePercentRateSpan.set("text","100%")}else{var t;this.completePercentRateSpan.set("text",parseInt(this.workReportData.progressPercent)+"%"),(t=this.completeProgressContentDiv.getElements(".completeProgressLineDiv")).setStyles({background:"#ccc"});var e=parseInt(this.workReportData.progressPercent/10);t.each((function(t,i){i<e&&t.setStyles({background:"#369"})}))}}.bind(this)});else{var t=this.workReportData.isWorkCompleted?this.lp.isCompletedYesOption:this.lp.isCompletedNoOption;this.completeTextSpan.set("text",this.completeTextSpan.get("text")+" "+t)}if(this.completePercentSpan=new Element("span.completePercentSpan",{styles:this.css.completePercentSpan,text:this.lp.completePercent}).inject(this.completeDiv),this.completePercentRateSpan=new Element("span.completePercentRateSpan",{id:"completePercentRateSpan",styles:this.css.completePercentRateSpan,text:parseInt(this.workReportData.progressPercent)+"%"}).inject(this.completeDiv),this.workReportData.processStatus==this.lp.activityName.drafter&&this.workReportData.isReporter||this.workReportData.processStatus==this.lp.activityName.manager&&(this.processIdentity==this.app.identity||this.processIdentity.indexOf(this.app.identity)>-1)){this.completeProgressDiv=new Element("div.completeProgressDiv",{styles:this.css.completeProgressDiv}).inject(this.completeDiv),this.completeProgressContentDiv=new Element("div.completeProgressContentDiv",{styles:this.css.completeProgressContentDiv}).inject(this.completeProgressDiv);var e=this;for(i=0;i<11;i++){var s=new Element("div.completeProgressPointDiv",{styles:this.css.completeProgressPointDiv,position:i}).inject(e.completeProgressContentDiv);if(s.setStyles({left:50*i+"px"}),s.addEvents({click:function(){e.selectProgress(parseInt(this.get("position")),"point")}}),i<10){var o=new Element("div.completeProgressLineDiv",{styles:this.css.completeProgressLineDiv,position:i}).inject(e.completeProgressContentDiv);o.setStyles({left:50*i+"px"}),o.addEvents({click:function(){e.selectProgress(parseInt(this.get("position"))+1,"line")}})}}for(this.completeProgressTextDiv=new Element("div.completeProgressTextDiv",{styles:this.css.completeProgressTextDiv}).inject(this.completeProgressDiv),i=0;i<11;i++)new Element("lable.tmpCompletePercentTextSpan",{styles:this.css.tmpCompletePercentTextSpan,text:10*i+"%"}).inject(this.completeProgressTextDiv)}this.reportAttachment=new Element("div.reportAttachment",{item:"reportAttachments"}).inject(this.reportContentInfor),this.reportAttachment.setStyles({width:"95%"});var n=!1;this.workReportData.processStatus==this.lp.activityName.drafter&&this.workReportData.isReporter&&(n=!0),this.reportAttachmentArea=this.formTableArea.getElement("[item='reportAttachments']"),this.loadReportAttachment(this.reportAttachmentArea,n);this.workReportData.needAdminAudit&&this.createAdminContent(),this.workReportData&&this.workReportData.activityName!=this.lp.activityName.drafter&&this.workReportData.activityName!=this.lp.activityName.manager&&(this.reportContentDiv=new Element("div.centerWorkDiv",{styles:this.css.reportContentDiv}).inject(this.formTableArea),this.reportContentTitleDiv=new Element("div.reportContentTitleDiv",{styles:this.css.tabTitleDiv,text:this.lp.leaderContentTitle}).inject(this.reportContentDiv),this.reportContentInfor=new Element("div.reportContentInfor",{styles:this.css.reportContentInfor}).inject(this.reportContentDiv),this.getLeaderOpinions(),this.workReportData.processStatus==this.lp.activityName.leader&&this.workReportData.isReadLeader&&this.processIdentity.indexOf(this.app.identity)>-1&&(this.contentTextarea4=new Element("textarea.contentTextarea4",{styles:this.css.contentTextarea,text:this.leaderOpinionDrafter?this.leaderOpinionDrafter:""}).inject(this.reportContentInfor))),this.workReportData&&this.workReportData.status==this.lp.statuArchive&&(this.contentTextarea1&&this.contentTextarea1.destroy(),this.contentTextarea2&&this.contentTextarea2.destroy(),this.contentTextarea3&&this.contentTextarea3.destroy(),this.contentTextarea4&&this.contentTextarea4.destroy())},selectProgress:function(t,e){var i=this.completeProgressContentDiv.getElements(".completeProgressLineDiv");i.setStyles({background:"#ccc"}),i.each((function(e,i){i<t&&e.setStyles({background:"#369"})})),this.completePercentRateSpan.set("text",10*t+"%"),10==t&&this.completeSelect&&this.completeSelect.set("value","yes"),t<10&&this.completeSelect&&this.completeSelect.set("value","no")},getLeaderOpinions:function(){var t=this.workReportData.processLogs;this.leaderTitle=[],this.leaderValue=[],t&&t.each(function(t){t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.drafter&&t.processorIdentity==this.app.identity?this.leaderOpinionDrafter=t.opinion:t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.effect&&(this.leaderTitle.push(t.processorIdentity.split("@")[0]+"("+t.processTimeStr+")"),this.leaderValue.push(t.opinion))}.bind(this)),this.reportLeaderOpinionsDiv=new Element("div.reportLeaderOpinionsDiv",{styles:this.css.reportLeaderOpinionsDiv}).inject(this.reportContentInfor);for(var e=0;e<this.leaderTitle.length;e++){var i=new Element("div.reportLeaderContentDiv",{styles:this.css.reportLeaderContentDiv}).inject(this.reportLeaderOpinionsDiv);new Element("div.reportLeaderTitleDiv",{styles:this.css.reportLeaderTitleDiv,text:this.leaderTitle[e]+":"}).inject(i),new Element("div.reportLeaderValueDiv",{styles:this.css.reportLeaderValueDiv,text:this.leaderValue[e]}).inject(i)}},createPrevReport:function(){this.prevReportDiv&&this.prevReportDiv.destroy(),this.prevReportDiv=new Element("div.prevReportDiv",{styles:this.css.prevReportDiv}).inject(this.formTableContainer),this.prevReportTopDiv=new Element("div.prevReportTopDiv",{styles:this.css.prevReportTopDiv}).inject(this.prevReportDiv),this.prevReportTopTitleDiv=new Element("div.prevReportTopTitleDiv",{styles:this.css.prevReportTopTitleDiv,text:this.lp.reportLinks+"："}).inject(this.prevReportTopDiv),this.prevReportTopCloseDiv=new Element("div.prevReportTopCloseDiv",{styles:this.css.prevReportTopCloseDiv}).inject(this.prevReportTopDiv).addEvents({click:function(){this.prevReportDiv.destroy()}.bind(this)}),this.prevReportListDiv=new Element("div.prevReportListDiv",{styles:this.css.prevReportListDiv}).inject(this.prevReportDiv),this.actions.getWorkReportList(this.workReportData.workId,function(t){t.type&&"success"==t.type&&t.data&&t.data.each(function(t){var e=t.createTime.split(" ")[0],i=t.id,s=new Element("li.prevReportListLi",{styles:this.css.prevReportListLi,id:i,text:e+"-"+t.shortTitle}).inject(this.prevReportListDiv).addEvents({mouseover:function(){s.setStyle("background-color","#3c76c1")}.bind(this),mouseout:function(){i!=this.currentPrevReportLinkId&&s.setStyle("background-color","")}.bind(this),click:function(){this.prevReportTopCloseDiv.setStyle("display","none"),this.expandWorkReportInfor(s)}.bind(this)})}.bind(this))}.bind(this),null,!1)},createPrevReportInfor:function(t){this.prevReportInforDiv&&this.prevReportInforDiv.destroy(),this.prevReportInforDiv=new Element("div.prevReportInforDiv",{styles:this.css.prevReportInforDiv}).inject(this.formTableContainer),this.prevReportInforTopDiv=new Element("div.prevReportInforTopDiv",{styles:this.css.prevReportInforTopDiv}).inject(this.prevReportInforDiv),this.prevReportInforTopCloseDiv=new Element("div.prevReportInforTopCloseDiv",{styles:this.css.prevReportInforTopCloseDiv}).inject(this.prevReportInforTopDiv).addEvents({click:function(){this.prevReportDiv.destroy(),this.prevReportInforDiv.destroy()}.bind(this)}),this.prevReportInforListDiv=new Element("div.prevReportInforListDiv",{styles:this.css.prevReportInforListDiv}).inject(this.prevReportInforDiv),this.prevReportInforListDiv.setStyles({height:this.reportContentInforHeight+"px"}),this.actions.getWorkReport(t,function(e){if("success"==e.type){var i=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv),s=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.contentTitle1+":"}).inject(i),o=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv,text:e.data.progressDescription}).inject(i);i=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv),s=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.contentTitle2+":"}).inject(i),o=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv,text:e.data.workPlan}).inject(i),s=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.contentTitle2+":"}).inject(i);var n=e.data.isWorkCompleted?" "+this.lp.isCompletedYesOption+" ":" "+this.lp.isCompletedNoOption+" ";n=(n=this.lp.isCompleted+":"+n)+" "+this.lp.completePercent+" "+parseInt(e.data.progressPercent)+"%",s.set("text",n),e.data.needAdminAudit&&(i=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv),s=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.adminContentTitle+":"}).inject(i),o=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv,text:e.data.adminSuperviseInfo?e.data.adminSuperviseInfo:""}).inject(i)),i=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv),s=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.leaderContentTitle+":"}).inject(i),o=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv}).inject(i);var r=new Element("div.reportLeaderOpinionsDiv",{styles:this.css.reportLeaderOpinionsDiv}).inject(o),a=e.data.processLogs;this.preLeaderTitle=[],this.preLeaderValue=[],a&&a.each(function(t){t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.drafter&&t.processorIdentity==this.app.identity?this.leaderOpinionDrafter=t.opinion:t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.effect&&(this.preLeaderTitle.push(t.processorIdentity.split("@")[0]+"("+t.processTimeStr+")"),this.preLeaderValue.push(t.opinion))}.bind(this));for(var p=0;p<this.preLeaderTitle.length;p++){var l=new Element("div.reportLeaderContentDiv",{styles:this.css.reportLeaderContentDiv}).inject(r);l.setStyle("border-bottom","1px dashed #3c76c1");new Element("div.reportLeaderTitleDiv",{styles:this.css.reportLeaderTitleDiv,text:this.preLeaderTitle[p]+":"}).inject(l),new Element("div.reportLeaderValueDiv",{styles:this.css.reportLeaderValueDiv,text:this.preLeaderValue[p]}).inject(l)}i=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv),s=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.attachment+":"}).inject(i),o=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv}).inject(i),this.loadPreReportAttachment(o,t)}}.bind(this),null,!1),this.setScrollBar(this.prevReportInforListDiv)},loadPreReportAttachment:function(t,e){this.attachment=new MWF.xApplication.Execution.ReportAttachment(t,this.app,this.actions,this.app.lp,{documentId:e,isNew:this.options.isNew,isEdited:!1,size:"min"}),this.attachment.load()},expandWorkReportInfor:function(t){this.currentPrevReportLinkId=t.get("id"),this.prevReportListDiv.getElements("li").setStyle("background-color",""),t.setStyle("background-color","#3c76c1"),this.createPrevReportInfor(this.currentPrevReportLinkId),this.prevReportInforDiv.setStyle("display","")},createAdminContent:function(){this.reportContentDiv=new Element("div.centerWorkDiv",{styles:this.css.reportContentDiv}).inject(this.formTableArea),this.reportContentTitleDiv=new Element("div.reportContentTitleDiv",{styles:this.css.tabTitleDiv,text:this.lp.adminContentTitle}).inject(this.reportContentDiv),this.reportContentInfor=new Element("div.reportContentInfor",{styles:this.css.reportContentInfor}).inject(this.reportContentDiv),this.workReportData.processStatus==this.lp.activityName.manager&&this.workReportData.isWorkAdmin?this.contentTextarea3=new Element("textarea.contentTextarea3",{styles:this.css.contentTextarea,value:this.workReportData.adminSuperviseInfo?this.workReportData.adminSuperviseInfo:""}).inject(this.reportContentInfor):this.contentTextStr3=new Element("div.contentTextStr3",{styles:this.css.contentTextStr,text:this.workReportData.adminSuperviseInfo?this.workReportData.adminSuperviseInfo:""}).inject(this.reportContentInfor)},_createTableContent:function(){this.tableContentDiv.set("html","<table style='width:95%; margin:10px 40px; margin-bottom: 0px;' border='0'><tr>   <td styles='formTableTitle' lable='deployPerson' width='10%'></td>   <td styles='formTableValue' item='deployPerson' width='20%'></td>   <td styles='formTableTitle' lable='timeLimit' width='10%'></td>   <td styles='formTableValue' item='timeLimit' width='20%'></td>   <td styles='formTableTitle' lable='' width='10%'></td>   <td styles='formTableValue' item='' width='20%'></td></tr><tr>   <td styles='formTableTitle' lable='dutyDepartment'></td>   <td styles='formTableValue' item='dutyDepartment'></td>   <td styles='formTableTitle' lable='dutyPerson'></td>   <td styles='formTableValue' item='dutyPerson'></td>   <td styles='formTableTitle' lable='reportCycle'></td>   <td styles='formTableValue'><span item='reportCycle'></span><span item='reportDay'></span></td></tr><tr>   <td styles='formTableTitle' lable='secondDepartment'></td>   <td styles='formTableValue' item='secondDepartment'></td>   <td styles='formTableTitle' lable='secondPerson'></td>   <td styles='formTableValue' item='secondPerson'></td>   <td styles='formTableTitle' lable='readReader'></td>   <td styles='formTableValue' item='readReader'></td></tr></table><div id='expandIcon' style='text-align: center; cursor:pointer;'><img style='width:20px;height:10px;' src='../x_component_Execution/$WorkReport/default/icon/expand.gif'></div><table id='workDetails' style='width:95%; margin:0px 40px; display:none' border='0'><tr>   <td styles='formTableTitle' lable='workSplitAndDescription' width='10%' valign='top'></td>   <td styles='formTableValue' item='workSplitAndDescription' colspan='5'></td></tr><tr>   <td styles='formTableTitle' lable='specificActionInitiatives' valign='top'></td>   <td styles='formTableValue' item='specificActionInitiatives' colspan='5'></td></tr><tr>   <td styles='formTableTitle' lable='milestoneMark' valign='top'></td>   <td styles='formTableValue' item='milestoneMark' colspan='5'></td></tr><tr>   <td styles='formTableValue' colspan='6'>       <div styles='formTableValueDiv' item='attachments'></div>   </td><tr></table><div id='foldIcon' style='text-align: center; cursor:pointer;display:none;'><img style='width:20px;height:10px;' src='../x_component_Execution/$WorkReport/default/icon/fold.gif'></div>"),this.expandDiv=this.tableContentDiv.getElementById("expandIcon"),this.foldDiv=this.tableContentDiv.getElementById("foldIcon"),this.workDetailsTab=this.tableContentDiv.getElementById("workDetails"),this.expandDiv&&this.expandDiv.addEvents({click:function(){this.workDetailsTab&&this.workDetailsTab.setStyle("display",""),this.expandDiv.setStyle("display","none"),this.foldDiv.setStyle("display","")}.bind(this)}),this.foldDiv&&this.foldDiv.addEvents({click:function(){this.workDetailsTab&&this.workDetailsTab.setStyle("display","none"),this.expandDiv.setStyle("display",""),this.foldDiv.setStyle("display","none")}.bind(this)}),this.loadForm()},loadForm:function(){this.form=new MForm(this.formTableArea,this.workData,{style:"execution",isEdited:this.isEdited||this.isNew,itemTemplate:this.getItemTemplate(this.lp)},this.app),this.form.load(),this.attachmentArea=this.formTableArea.getElement("[item='attachments']"),this.loadAttachment(this.attachmentArea)},getItemTemplate:function(t){return _self=this,{workType:{text:t.workType+":",selectValue:t.workTypeValue.split(",")},workLevel:{text:t.workLevel+":",type:"select",notEmpty:!0,selectValue:t.workLevelValue.split(",")},timeLimit:{text:t.timeLimit+":",tType:"date",name:"completeDateLimitStr",notEmpty:!0},reportCycle:{text:t.reportCycle+":",type:"select",notEmpty:!0,selectText:t.reportCycleText.split(",")},reportDay:{type:"select",name:"reportDayInCycle",selectValue:this.workData.reportCycle&&this.workData.reportCycle!=t.reportCycleText.split(",")[0]?t.monthDayValue.split(","):t.weekDayValue.split(","),selectText:this.workData.reportCycle&&this.workData.reportCycle!=t.reportCycleText.split(",")[0]?t.monthDayText.split(","):t.weekDayText.split(",")},dutyDepartment:{text:t.dutyDepartment+":",type:"org",orgType:"unit",name:"responsibilityUnitName"},dutyPerson:{text:t.dutyPerson+":",type:"org",orgType:"identity",count:1,name:"responsibilityIdentity",notEmpty:!0},secondDepartment:{text:t.secondDepartment+":",type:"org",orgType:"unit",name:"cooperateUnitNameList",value:this.workData.cooperateUnitNameList?this.workData.cooperateUnitNameList.join(","):""},secondPerson:{text:t.secondPerson+":",type:"org",orgType:"identity",name:"cooperateIdentityList",value:this.workData.cooperateIdentityList?this.workData.cooperateIdentityList.join(","):"",count:0},readReader:{text:t.readReader+":",type:"org",orgType:"identity",name:"readLeaderIdentityList",value:this.workData.readLeaderIdentityList?this.workData.readLeaderIdentityList.join(","):"",count:0},deployPerson:{text:t.deployPerson,name:"deployerIdentity",type:"org",orgType:"identity"},subject:{text:t.subject+":",name:"title",notEmpty:!0},workSplitAndDescription:{text:t.workSplitAndDescription+":",type:"textarea",name:"workDetail",notEmpty:!0},specificActionInitiatives:{text:t.specificActionInitiatives+":",type:"textarea",name:"progressAction"},cityCompanyDuty:{text:t.cityCompanyDuty+":",type:"textarea",name:"dutyDescription"},milestoneMark:{text:t.milestoneMark+":",type:"textarea",name:"landmarkDescription"},importantMatters:{text:t.importantMatters+":",type:"textarea",name:"majorIssuesDescription"}}},loadAttachment:function(t){this.attachment=new MWF.xApplication.Execution.Attachment(t,this.app,this.actions,this.app.lp,{documentId:this.data.workId,isNew:this.options.isNew,isEdited:this.options.isEdited}),this.attachment.load()},loadReportAttachment:function(t,e){this.attachment=new MWF.xApplication.Execution.ReportAttachment(t,this.app,this.actions,this.app.lp,{documentId:this.workReportId,isNew:this.options.isNew,isEdited:e,size:this.workReportData.processStatus==this.lp.activityName.drafter?"max":"min",onQueryUploadAttachment:function(){var t={};t.workId=this.workReportData.workId,t.id=this.workReportData.id,this.workReportData.processStatus==this.lp.activityName.drafter&&(t.progressDescription=this.contentTextarea1.value,t.workPlan=this.contentTextarea2.value),this.actions.saveWorkReport(t,function(t){"success"==t.type&&(this.attachment.isQueryUploadSuccess=!0)}.bind(this),function(t,e,i){this.attachment.isQueryUploadSuccess=!1}.bind(this),!1)}.bind(this)}),this.attachment.load()},readDone:function(){this.actions.readDone(this.data.todoId,function(t){this.app.notice(this.lp.prompt.readDone,"success"),this.fireEvent("reloadView",t),this.close()}.bind(this),function(t){}.bind(this))},save:function(){this.createShade();var t={};t.workId=this.workReportData.workId,t.id=this.workReportData.id;var e;return e=parseInt(this.completePercentRateSpan.get("text").replace("%","")),this.workReportData.processStatus==this.lp.activityName.drafter?(t.progressDescription=this.contentTextarea1.value,t.workPlan=this.contentTextarea2.value,t.isWorkCompleted="yes"==this.completeSelect.get("value"),t.progressPercent=e):this.workReportData.processStatus==this.lp.activityName.manager?(t.adminSuperviseInfo=this.contentTextarea3.value,t.isWorkCompleted="yes"==this.completeSelect.get("value"),t.progressPercent=e):this.workReportData.processStatus==this.lp.activityName.leader&&(t.opinion=this.contentTextarea4.value),t.progressDescription&&t.progressDescription.length>600||t.workPlan&&t.workPlan.length>600?(this.app.notice("字数不能大于600","error"),this.destroyShade(),!1):void this.actions.saveWorkReport(t,function(t){"success"==t.type&&(this.app.notice(this.lp.information.saveSuccess,"success"),this.destroyShade())}.bind(this),function(t,e,i){var s=i;t&&(errorMessage=t.responseText);var o=JSON.parse(errorMessage);o.message?this.app.notice(o.message,"error"):this.app.notice(s,"error"),this.destroyShade()}.bind(this),!0)},submit:function(t){if(this.contentTextarea1&&""==this.contentTextarea1.value)return this.app.notice(this.lp.contentTitle1+this.lp.checkEmpty,"error"),!1;if(this.contentTextarea2&&""==this.contentTextarea2.value)return this.app.notice(this.lp.contentTitle2+this.lp.checkEmpty,"error"),!1;var e={};e.workId=this.workReportData.workId,e.id=this.workReportData.id;var i;if(i=parseInt(this.completePercentRateSpan.get("text").replace("%","")),this.workReportData.processStatus==this.lp.activityName.drafter?(e.progressDescription=this.contentTextarea1.value,e.workPlan=this.contentTextarea2.value,e.isWorkCompleted="yes"==this.completeSelect.get("value"),e.progressPercent=i):this.workReportData.processStatus==this.lp.activityName.manager?(e.adminSuperviseInfo=this.contentTextarea3.value,e.isWorkCompleted="yes"==this.completeSelect.get("value"),e.progressPercent=i):this.workReportData.processStatus==this.lp.activityName.leader&&(e.opinion=this.contentTextarea4.value),e.progressDescription&&e.progressDescription.length>600)return this.app.notice("字数不能大于600","error"),!1;if(e.workPlan&&e.workPlan.length>600)return this.app.notice("字数不能大于600","error"),!1;if(this.completeSelect&&"yes"==this.completeSelect.get("value")){var s=this;this.app.confirm("warn",t,s.lp.submitWarn.warnTitle,s.lp.submitWarn.warnContent,300,150,(function(){s.createShade(),s.actions.submitWorkReport(e,function(t){"success"==t.type&&(s.app.notice(s.lp.prompt.submitWorkReport,"success"),s.fireEvent("reloadView",t),s.close()),s.destroyShade()}.bind(s),function(t,e,i){var o=i;t&&(errorMessage=t.responseText);var n=JSON.parse(errorMessage);n.message?s.app.notice(n.message,"error"):s.app.notice(o,"error"),s.destroyShade()}.bind(s),!0),this.close()}),(function(){this.close()}))}else this.createShade(),this.actions.submitWorkReport(e,function(t){"success"==t.type&&(this.app.notice(this.lp.prompt.submitWorkReport,"success"),this.fireEvent("reloadView",t),this.close()),this.destroyShade()}.bind(this),function(t,e,i){var s=i;t&&(errorMessage=t.responseText);var o=JSON.parse(errorMessage);o.message?this.app.notice(o.message,"error"):this.app.notice(s,"error"),this.destroyShade()}.bind(this),!0)},_createBottomContent:function(){(this.processIdentity==this.app.identity||this.processIdentity.indexOf(this.app.identity)>-1)&&(this.submitActionNode=new Element("div.submitActionNode",{styles:this.css.formCancelActionNode,text:this.lp.bottomAction.submit}).inject(this.formBottomNode).addEvents({click:function(t){this.submit(t)}.bind(this)})),(this.processIdentity==this.app.identity||this.processIdentity.indexOf(this.app.identity)>-1)&&(this.saveActionNode=new Element("div.saveActionNode",{styles:this.css.formCancelActionNode,text:this.lp.bottomAction.save}).inject(this.formBottomNode).addEvents({click:function(){this.save()}.bind(this)})),this.options.isRead&&(this.readActionNode=new Element("div.readActionNode",{styles:this.css.formCancelActionNode,text:this.lp.bottomAction.readDone}).inject(this.formBottomNode),this.readActionNode.addEvent("click",function(t){this.readDone(t)}.bind(this))),this.cancelActionNode=new Element("div.formCancelActionNode",{styles:this.css.formCancelActionNode,text:this.lp.bottomAction.close}).inject(this.formBottomNode),this.cancelActionNode.addEvent("click",function(t){this.cancel(t)}.bind(this)),this.workReportData&&this.workReportData.status==this.lp.statuArchive&&(this.submitActionNode&&this.submitActionNode.destroy(),this.saveActionNode&&this.saveActionNode.destroy(),this.readActionNode&&this.readActionNode.destroy())},createShade:function(t,e){var i=this.formAreaNode||this.container||this.app,s=t||i,o=e||"loading...";this.shadeDiv&&this.shadeDiv.destroy(),this.shadeTxtDiv&&this.shadeTxtDiv.destroy(),this.shadeDiv=new Element("div.shadeDiv").inject(s),this.inforDiv=new Element("div.inforDiv",{styles:{height:"16px",display:"inline-block",position:"absolute","background-color":"#000000","border-radius":"3px",padding:"5px 10px"}}).inject(this.shadeDiv),this.loadImg=new Element("img.loadImg",{styles:{width:"16px",height:"16px",float:"left"},src:this.path+"default/icon/loading.gif"}).inject(this.inforDiv),this.shadeTxtSpan=new Element("span.shadeTxtSpan").inject(this.inforDiv),this.shadeTxtSpan.set("text",o),this.shadeDiv.setStyles({width:"100%",height:"100%",position:"absolute",opacity:"0.6","background-color":"#cccccc","z-index":"999"}),this.shadeTxtSpan.setStyles({color:"#ffffff","font-size":"12px",display:"inline-block","line-height":"16px","padding-left":"5px"});var n=s.getSize().x,r=s.getSize().y;this.shadeDiv.setStyles({left:s.getLeft()-i.getLeft()+"px",top:s.getTop()-i.getTop()+"px",width:n+"px",height:r+"px"}),"absolute"==s.getStyle("position")&&this.shadeDiv.setStyles({left:"0px",top:"0px"}),this.inforDiv.setStyles({left:n/2+"px",top:r/2+"px"})},destroyShade:function(){this.shadeDiv&&this.shadeDiv.destroy()},showErrorMessage:function(t,e,i){var s,o=i;if(t&&(s=t.responseText),""!=s){var n=JSON.parse(s);n.message?this.notice(n.message,"error"):this.notice(o,"error")}else this.notice(o,"error")}});