| 1 |
- MWF.xApplication.Execution=MWF.xApplication.Execution||{};MWF.xDesktop.requireApp("Template","Explorer",null,false);MWF.xDesktop.requireApp("Template","MForm",null,false);MWF.xDesktop.requireApp("Execution","Attachment",null,false);MWF.xDesktop.requireApp("Execution","ReportAttachment",null,false);MWF.xApplication.Execution.WorkReport=new Class({Extends:MWF.xApplication.Template.Explorer.PopupForm,Implements:[Options,Events],options:{style:"default",width:"100%",height:"100%",hasTop:true,hasIcon:false,hasBottom:true,title:"",draggable:false,closeAction:true,isNew:false,isEdited:true},initialize:function(t,e,i,s){this.setOptions(s);this.explorer=t;this.app=t.app;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()}else if(this.options.isEdited){this.edit()}else{this.open()}},reload:function(t){},createTopNode:function(){if(!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);if(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(){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);if(this.options.workReportId){this.workReportId=this.options.workReportId}this.workId=this.data.workId;this.processStatus="";this.processIdentity="";if(this.options.from&&this.options.from=="drafter"){this.actions.workReportDrafter(this.data.workId,function(t){if(t.type&&t.type=="success"){this.workReportData=t.data;if(t.data.id){this.workReportId=t.data.id}if(t.data.currentProcessorIdentity){this.processIdentity=t.data.currentProcessorIdentity}if(t.data.processStatus){this.processStatus=t.data.processStatus}}}.bind(this),null,false)}else{this.actions.getWorkReport(this.data.workReportId,function(t){if(t.type=="success"){this.workReportData=t.data;if(t.data.id){this.workReportId=t.data.id}}}.bind(this),null,false);if(this.workReportData.currentProcessorIdentity){this.processIdentity=this.workReportData.currentProcessorIdentity}if(this.workReportData.processStatus){this.processStatus=this.workReportData.processStatus}}if(this.data.workId){this.actions.getTask(this.workId,function(t){if(t.data){this.workData=t.data}}.bind(this),null,false)}if(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,false)}this._createTableContent();if(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)}if(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){var e=t.delegatorName+this.lp.appointFor+t.targetName;e+="("+t.delegateDateTime+") ";e+="委派意见:"+t.delegateOpinion;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);if(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)}else{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);if(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)}else{this.contentTextStr2=new Element("div.contentTextStr2",{styles:this.css.contentTextStr,text:this.workReportData.workPlan?this.workReportData.workPlan:""}).inject(this.reportContentInfor)}this.reportAttachment=new Element("div.reportAttachment",{item:"reportAttachments"}).inject(this.reportContentInfor);this.reportAttachment.setStyles({width:"95%"});var t=false;if(this.workReportData.processStatus==this.lp.activityName.drafter&&this.workReportData.isReporter){t=true}this.reportAttachmentArea=this.formTableArea.getElement("[item='reportAttachments']");this.loadReportAttachment(this.reportAttachmentArea,t);var e={};e.workReportId="";if(this.workReportData.needAdminAudit){this.createAdminContent()}if(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();if(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)}else{}}if(this.workReportData&&this.workReportData.status==this.lp.statuArchive){if(this.contentTextarea1)this.contentTextarea1.destroy();if(this.contentTextarea2)this.contentTextarea2.destroy();if(this.contentTextarea3)this.contentTextarea3.destroy();if(this.contentTextarea4)this.contentTextarea4.destroy()}},getLeaderOpinions:function(){var t=this.workReportData.processLogs;this.leaderTitle=[];this.leaderValue=[];if(t){t.each(function(t){if(t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.drafter&&t.processorIdentity==this.app.identity){this.leaderOpinionDrafter=t.opinion}else{if(t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.effect){this.leaderTitle.push(t.processorIdentity+"("+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);var s=new Element("div.reportLeaderTitleDiv",{styles:this.css.reportLeaderTitleDiv,text:this.leaderTitle[e]+":"}).inject(i);var o=new Element("div.reportLeaderValueDiv",{styles:this.css.reportLeaderValueDiv,text:this.leaderValue[e]}).inject(i)}},createPrevReport:function(){if(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){if(t.type&&t.type=="success"&&t.data){t.data.each(function(t){var e=t.createTime.split(" ")[0];var i=t.id;var 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(){if(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,false)},createPrevReportInfor:function(t){if(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.actions.getWorkReport(t,function(t){if(t.type=="success"){var e=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv);var i=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.contentTitle1+":"}).inject(e);var s=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv,text:t.data.progressDescription}).inject(e);e=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv);i=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.contentTitle2+":"}).inject(e);s=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv,text:t.data.workPlan}).inject(e);if(t.data.needAdminAudit){e=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv);i=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.adminContentTitle+":"}).inject(e);s=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv,text:t.data.adminSuperviseInfo?t.data.adminSuperviseInfo:""}).inject(e)}e=new Element("div.prevContentDiv",{styles:this.css.prevContentDiv}).inject(this.prevReportInforListDiv);i=new Element("div.prevContentTitleDiv",{styles:this.css.prevContentTitleDiv,text:this.lp.leaderContentTitle+":"}).inject(e);s=new Element("div.prevContentValueDiv",{styles:this.css.prevContentValueDiv}).inject(e);var o=new Element("div.reportLeaderOpinionsDiv",{styles:this.css.reportLeaderOpinionsDiv}).inject(s);var r=t.data.processLogs;this.preLeaderTitle=[];this.preLeaderValue=[];if(r){r.each(function(t){if(t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.drafter&&t.processorIdentity==this.app.identity){this.leaderOpinionDrafter=t.opinion}else{if(t.activityName==this.lp.activityName.leader&&t.processStatus==this.lp.status.effect){this.preLeaderTitle.push(t.processorIdentity+"("+t.processTimeStr+")");this.preLeaderValue.push(t.opinion)}}}.bind(this))}for(var n=0;n<this.preLeaderTitle.length;n++){var a=new Element("div.reportLeaderContentDiv",{styles:this.css.reportLeaderContentDiv}).inject(o);a.setStyle("border-bottom","1px dashed #3c76c1");var p=new Element("div.reportLeaderTitleDiv",{styles:this.css.reportLeaderTitleDiv,text:this.preLeaderTitle[n]+":"}).inject(a);var l=new Element("div.reportLeaderValueDiv",{styles:this.css.reportLeaderValueDiv,text:this.preLeaderValue[n]}).inject(a)}}}.bind(this),null,false)},expandWorkReportInfor:function(t){this.currentPrevReportLinkId=t.get("id");var e=this.prevReportListDiv.getElements("li");e.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);if(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)}else{this.contentTextStr3=new Element("div.contentTextStr3",{styles:this.css.contentTextStr,text:this.workReportData.adminSuperviseInfo?this.workReportData.adminSuperviseInfo:""}).inject(this.reportContentInfor)}},_createTableContent:function(){var t="<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.tableContentDiv.set("html",t);this.expandDiv=this.tableContentDiv.getElementById("expandIcon");this.foldDiv=this.tableContentDiv.getElementById("foldIcon");this.workDetailsTab=this.tableContentDiv.getElementById("workDetails");if(this.expandDiv){this.expandDiv.addEvents({click:function(){if(this.workDetailsTab)this.workDetailsTab.setStyle("display","");this.expandDiv.setStyle("display","none");this.foldDiv.setStyle("display","")}.bind(this)})}if(this.foldDiv){this.foldDiv.addEvents({click:function(){if(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){_self=this;return{workType:{text:t.workType+":",selectValue:t.workTypeValue.split(",")},workLevel:{text:t.workLevel+":",type:"select",notEmpty:true,selectValue:t.workLevelValue.split(",")},timeLimit:{text:t.timeLimit+":",tType:"date",name:"completeDateLimitStr",notEmpty:true},reportCycle:{text:t.reportCycle+":",type:"select",notEmpty:true,selectText:t.reportCycleText.split(","),className:"inputSelectUnformatWidth",event:{change:function(e,i){if(e.get("value")==t.reportCycleText.split(",")[0]){this.form.getItem("reportDay").resetItemOptions(t.weekDayValue.split(","),t.weekDayText.split(","))}else if(e.get("value")==t.reportCycleText.split(",")[1]){this.form.getItem("reportDay").resetItemOptions(t.monthDayValue.split(","),t.monthDayText.split(","))}}.bind(this)}},reportDay:{type:"select",name:"reportDayInCycle",notEmpty:true,aa:function(){}.bind(this),selectValue:!this.data.reportCycle||this.data.reportCycle==t.reportCycleText.split(",")[0]?t.weekDayValue.split(","):t.monthDayValue.split(","),selectText:!this.data.reportCycle||this.data.reportCycle==t.reportCycleText.split(",")[0]?t.weekDayText.split(","):t.monthDayText.split(","),className:"inputSelectUnformatWidth"},dutyDepartment:{text:t.dutyDepartment+":",tType:"department",name:"responsibilityOrganizationName",notEmpty:true,event:{change:function(t){var e=t.getValue();if(e){_self.getDepartmentLeader(e,function(t){_self.form.getItem("dutyPerson").setValue(t)})}}}},dutyPerson:{text:t.dutyPerson+":",tType:"identity",count:1,name:"responsibilityIdentity",notEmpty:true},secondDepartment:{text:t.secondDepartment+":",tType:"department",name:"cooperateOrganizationName",count:0,event:{change:function(t){var e=t.getValue();if(e){var i=e.split(",");var s="";for(var o=0;o<i.length;o++){if(i[o]!=""){_self.getDepartmentLeader(i[o],function(t){if(s=="")s=t;else s=s+","+t})}}_self.form.getItem("secondPerson").setValue(s)}}}},secondPerson:{text:t.secondPerson+":",tType:"identity",name:"cooperateIdentity",count:0},readReader:{text:t.readReader+":",tType:"identity",name:"readLeaderIdentity",count:0},deployPerson:{text:t.deployPerson,name:"deployerIdentity"},subject:{text:t.subject+":",name:"title",notEmpty:true},workSplitAndDescription:{text:t.workSplitAndDescription+":",type:"textarea",name:"workDetail",notEmpty:true},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;if(this.workReportData.processStatus==this.lp.activityName.drafter){t.progressDescription=this.contentTextarea1.value;t.workPlan=this.contentTextarea2.value}this.actions.saveWorkReport(t,function(t){if(t.type=="success"){this.attachment.isQueryUploadSuccess=true}}.bind(this),function(t,e,i){this.attachment.isQueryUploadSuccess=false}.bind(this),false)}.bind(this)});this.attachment.load()},readDone:function(){this.actions.readDone(this.data.todoId,function(t){this.app.notice(t.userMessage,"success");this.fireEvent("reloadView",t);this.close()}.bind(this),function(t){}.bind(this))},save:function(){var t={};t.workId=this.workReportData.workId;t.id=this.workReportData.id;if(this.workReportData.processStatus==this.lp.activityName.drafter){t.progressDescription=this.contentTextarea1.value;t.workPlan=this.contentTextarea2.value}else if(this.workReportData.processStatus==this.lp.activityName.manager){t.adminSuperviseInfo=this.contentTextarea3.value}else if(this.workReportData.processStatus==this.lp.activityName.leader){t.opinion=this.contentTextarea4.value}this.actions.saveWorkReport(t,function(t){if(t.type=="success"){this.app.notice(this.lp.information.saveSuccess,"success")}}.bind(this),function(t,e,i){var s=i;if(t)errorMessage=t.responseText;var o=JSON.parse(errorMessage);if(o.userMessage){this.app.notice(o.userMessage,"error")}else{this.app.notice(s,"error")}}.bind(this))},submit:function(){if(this.contentTextarea1){if(this.contentTextarea1.value==""){this.app.notice(this.lp.contentTitle1+this.lp.checkEmpty,"error");return false}}if(this.contentTextarea2){if(this.contentTextarea2.value==""){this.app.notice(this.lp.contentTitle2+this.lp.checkEmpty,"error");return false}}var t={};t.workId=this.workReportData.workId;t.id=this.workReportData.id;if(this.workReportData.processStatus==this.lp.activityName.drafter){t.progressDescription=this.contentTextarea1.value;t.workPlan=this.contentTextarea2.value}else if(this.workReportData.processStatus==this.lp.activityName.manager){t.adminSuperviseInfo=this.contentTextarea3.value}else if(this.workReportData.processStatus==this.lp.activityName.leader){t.opinion=this.contentTextarea4.value}this.actions.submitWorkReport(t,function(t){if(t.type=="success"){this.app.notice(t.userMessage,"success");this.fireEvent("reloadView",t);this.close()}}.bind(this),function(t,e,i){var s=i;if(t)errorMessage=t.responseText;var o=JSON.parse(errorMessage);if(o.userMessage){this.app.notice(o.userMessage,"error")}else{this.app.notice(s,"error")}}.bind(this))},_createBottomContent:function(){if(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(){this.submit()}.bind(this)})}if(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)})}if(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));if(this.workReportData&&this.workReportData.status==this.lp.statuArchive){if(this.submitActionNode)this.submitActionNode.destroy();if(this.saveActionNode)this.saveActionNode.destroy();if(this.readActionNode)this.readActionNode.destroy()}}});
|