| 1 |
- 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(t,e,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=e;this.explorer=t;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 t="<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='margin-top: 20px; '>"+"<tr><td styles='formTableTitle' lable='url' width='20%'></td>"+" <td styles='formTableValue' item='url' colspan='3' width='80%'></td></tr>"+"<tr><td styles='formTableTitle' lable='file' ></td>"+" <td styles='formTableValue' colspan='3'><div item='filename'></div><div item='file'></div></td></tr>"+"</table>";this.formTableArea.set("html",t);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 t='<input name="file" type="file" accept="csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />';this.uploadFileAreaNode.set("html",t);this.fileUploadNode=this.uploadFileAreaNode.getFirst();this.fileUploadNode.addEvent("change",function(){var t=s.files;if(t.length){var e=t.item(0);this.file=e;this.formData=new FormData;this.formData.append("file",this.file);var i=this.formTableArea.getElement("[item='filename']");i.set("text",e.name)}}.bind(this))}var s=this.uploadFileAreaNode.getFirst();s.click()},ok:function(t){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(t,e,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=e;this.explorer=t;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 t={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,t,{onSelect:function(){this.fireEvent("select")}.bind(this)})}.bind(this))},_setNodesSize:function(t,e,i,s){this.formTableArea.setStyles({height:s+"px"});if(this.view&&this.view.node&&this.view.viewAreaNode)this.view.setContentHeight()}});
|