MWF.xDesktop.requireApp("Template","MPopupForm",null,false);MWF.xApplication.cms=MWF.xApplication.cms||{};MWF.xApplication.cms.Module=MWF.xApplication.cms.Module||{};MWF.xApplication.cms.Module.ImportForm=new Class({Extends:MPopupForm,Implements:[Options,Events],options:{style:"cms",width:"650",height:"300",hasTop:true,hasIcon:false,draggable:true,title:"数据导入"},initialize:function(e,t,i,s){MWF.xDesktop.requireApp("cms.Module","$ExcelForm.lp."+MWF.language,null,false);this.lp=MWF.xApplication.cms.Module.ExcelForm.lp;this.setOptions(i);this.data=t;this.explorer=e;this.app=this.explorer.app;this.container=this.app.content;this.action=MWF.Actions.get("x_cms_assemble_control");this.path="/x_component_cms_Module/$ExcelForm/";this.cssPath="/x_component_Template/$MPopupForm/"+this.options.style+"/css.wcss";this.load()},_createTableContent:function(){var e="
";this.formTableArea.set("html",e);MWF.xDesktop.requireApp("Template","MForm",null,false);this.form=new MForm(this.formTableArea,{},{isEdited:true,style:"cms",hasColon:true,itemTemplate:{url:{text:"下载模板"},file:{type:"button",value:"选择Excel文件",text:"选择文件",event:{click:function(){this.selectFile()}.bind(this)}}}},this.app);this.form.load()},_setCustom:function(){this.formTableContainer.setStyles({"margin-left":"60px",width:"520px"});this.formBottomNode.setStyles({"padding-right":"195px","padding-bottom":"20px"})},selectFile:function(){if(!this.uploadFileAreaNode){this.uploadFileAreaNode=new Element("div");var e='';this.uploadFileAreaNode.set("html",e);this.fileUploadNode=this.uploadFileAreaNode.getFirst();this.fileUploadNode.addEvent("change",function(){var e=s.files;if(e.length){var t=e.item(0);if(t.name.indexOf(" ")>-1){this.app.notice("上传的文件不能带空格","error");return false}this.file=t;this.formData=new FormData;this.formData.append("file",this.file);var i=this.formTableArea.getElement("[item='filename']");i.set("text",t.name)}}.bind(this))}var s=this.uploadFileAreaNode.getFirst();s.click()},ok:function(e){if(!this.formData){this.app.notice("请先选择Excel文件","error")}else{this.action.importDocumentFormExcel(this.data.id,function(){this.formData=null;this.file=null}.bind(this),null,this.formData,this.file)}}});MWF.xApplication.cms.Module.ExportForm=new Class({Extends:MPopupForm,Implements:[Options,Events],options:{style:"cms",width:"850",height:"700",maxAction:true,hasTop:true,hasIcon:false,hasBottom:true,draggable:true,title:"数据导出"},initialize:function(e,t,i,s){MWF.xDesktop.requireApp("cms.Module","$ExcelForm.lp."+MWF.language,null,false);this.lp=MWF.xApplication.cms.Module.ExcelForm.lp;this.setOptions(i);this.data=t;this.explorer=e;this.app=this.explorer.app;this.container=this.app.content;this.action=MWF.Actions.get("x_cms_assemble_control");this.path="/x_component_cms_Module/$ExcelForm/";this.cssPath="/x_component_Template/$MPopupForm/"+this.options.style+"/css.wcss";this.load()},_setCustom:function(){},_createTableContent:function(){this.formTableArea.setStyles({"margin-left":"20px","margin-right":"20px"});var e={application:this.data.importViewAppId,viewName:this.data.importViewId,isTitle:"yes",select:"multi"};MWF.xDesktop.requireApp("query.Query","Viewer",function(){this.view=new MWF.xApplication.query.Query.Viewer(this.formTableArea,e,{onSelect:function(){this.fireEvent("select")}.bind(this)})}.bind(this))},_setNodesSize:function(e,t,i,s){this.formTableArea.setStyles({height:s+"px"});if(this.view&&this.view.node&&this.view.viewAreaNode)this.view.setContentHeight()}});