论坛首页 Web前端技术论坛

Ht PageView

浏览 3446 次
锁定老帖子 主题:Ht PageView
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-04-06   最后修改:2011-04-06
Ext.namespace("Ext.s");Ext.s.JsonGrid=Ext.extend(Ext.grid.GridPanel,{frame:true,loadMask:{msg:"正在加载数据..."},stripeRows:true,viewConfig:{forceFit:true},autoScroll:true,withExportExcel:false,initComponent:function(){Ext.applyIf(this,{kid:'id',defaultSortDirection:'ASC',urlPagedQuery:"pagedQuery.do",urlLoadData:"loadData.do",urlSave:"save.do",urlRemove:"remove.do",pageSize:15});Ext.QuickTips.init();Ext.form.Field.prototype.msgTarget='side';this.buildColumnHeaders();this.buildColumnModel();this.buildRecord();this.buildDataStore();if(this.createHeader!==false){this.buildSelect();this.buildToolbar();this.buildBbar()}this.setBaseParams();Ext.sky.JsonGrid.superclass.initComponent.call(this);this.registerEvents()},registerEvents:function(){this.on('rowdblclick',this.edit,this);this.on('rowcontextmenu',this.contextmenu,this)},dropEvents:function(){this.un('rowdblclick',this.edit,this);this.un('rowcontextmenu',this.contextmenu,this)},getSelections:function(){return this.getSelectionModel().getSelections()},buildColumnHeaders:function(){this.sm=new Ext.grid.CheckboxSelectionModel();columnHeaders=new Array();columnHeaders[0]=new Ext.grid.RowNumberer();columnHeaders[1]=this.sm},buildColumnModel:function(){for(var i=0;i<this.formConfig.length;i++){var col=this.formConfig[i];if(col.hideGrid===true){continue}if(col.sortable==null){col.sortable=true}columnHeaders.push({header:col.fieldLabel,sortable:col.sortable,dataIndex:col.name,width:col.width,align:col.align,editor:col.editor,renderer:col.renderer})}this.cm=new Ext.grid.ColumnModel(columnHeaders);this.cm.defaultSortable=true;this.columnModel=this.cm},buildRecord:function(){this.dataRecord=Ext.data.Record.create(this.formConfig)},buildDataStore:function(){this.store=new Ext.data.Store({proxy:new Ext.data.HttpProxy({url:this.urlPagedQuery}),reader:new Ext.data.JsonReader({root:"result",totalProperty:"totalCount",id:this.kid},this.dataRecord),sortInfo:{field:this.defaultSortField?this.defaultSortField:this.kid,direction:this.defaultSortDirection},remoteSort:true})},buildSelect:function(){var checkItems=new Array();for(var i=0;i<this.formConfig.length;i++){var meta=this.formConfig[i];if(meta.showInSearchMenu===false){continue}var item=new Ext.menu.CheckItem({text:meta.fieldLabel,value:meta.name,checked:true,group:"filter",checkHandler:this.onMenuItemCheck.createDelegate(this)});checkItems[checkItems.length]=item}this.filterMenuButton=new Ext.Button({menu:{xtype:'menu',items:checkItems}});if(checkItems.length>0){this.filterMenuButton.setText(checkItems[0].text+':');this.store.baseParams.filterTxt=checkItems[0].value;this.store.baseParams.filterValue=''}this.filter=new Ext.form.TextField({'name':'filter'});this.filterButton=new Ext.Button({text:'查询',iconCls:"icon-search",handler:this.filterSearch.createDelegate(this)});this.clearButton=new Ext.Button({iconCls:"icon-clear",tooltip:"清空",handler:this.clearParams.createDelegate(this)});this.addButton=new Ext.Button({text:'新增',iconCls:'btn-add',tooltip:'新增',handler:this.add.createDelegate(this)});this.editButton=new Ext.Button({text:'修改',iconCls:'btn-edit',tooltip:'修改',handler:this.edit.createDelegate(this)});this.delButton=new Ext.Button({text:'删除',iconCls:'btn-del',disabledClass:'x-item-disabled',handler:this.del.createDelegate(this)});this.filter.on('specialkey',this.onFilterKey.createDelegate(this));this.excelButtonItems=null;if(this.withExportExcel){this.excelButtonItems=['-',{id:'excel',text:'导出Excel',iconCls:'excel',tooltip:'将表格导出到Excel',handler:this.exportExcel.createDelegate(this)}]}},buildToolbar:function(){this.tbar=new Ext.Toolbar([this.addButton,this.editButton,this.delButton,'->',this.filterMenuButton,this.filter,this.clearButton,this.filterButton])},buildBbar:function(){this.pageSizePlugin=new Ext.ux.PageSizePlugin();this.paging=new Ext.PagingToolbar({pageSize:this.pageSize,store:this.store,displayInfo:true,displayMsg:'显示第 {0} 条到 第{1} 条记录,一共 {2} 条',emptyMsg:"没有记录",plugins:[this.pageSizePlugin,new Ext.ux.ProgressBarPager()],items:this.excelButtonItems});this.store.load({params:{start:0,limit:this.paging.pageSize}});this.bbar=this.paging},exportExcel:function(grid){var tmpStore=this.store;var tmpParam=Ext.sky.clone(tmpStore.lastOptions);if(tmpParam&&tmpParam.params){delete(tmpParam.params[tmpStore.paramNames.start]);delete(tmpParam.params[tmpStore.paramNames.limit])}var tmpAllStore=new Ext.data.Store({proxy:tmpStore.proxy,reader:tmpStore.reader});tmpAllStore.load(tmpParam);if(!this.excelTitle){this.excelTitle=this.title}var config={store:null,title:this.excelTitle};tmpAllStore.on('load',function(store){config.store=store;var vExportContent=this.getExcelXml(false,config);if(Ext.isIE6||Ext.isIE7||Ext.isSafari||Ext.isSafari2||Ext.isSafari3){var fd=Ext.get('frmDummy');if(!fd){fd=Ext.DomHelper.append(Ext.getBody(),{tag:'form',method:'post',id:'frmDummy',action:'servlet/exportToExcel',target:'_blank',name:'frmDummy',cls:'x-hidden',cn:[{tag:'input',name:'exportContent',id:'exportContent',type:'hidden'},{tag:'input',name:'exportFileName',value:config.title,type:'hidden'}]},true)}fd.child('#exportContent').set({value:vExportContent});fd.dom.submit()}else{document.location='data:application/vnd.ms-excel;base64,'+Base64.encode(vExportContent)}},this)},setBaseParams:function(){},onMenuItemCheck:function(item,checked){if(checked){this.filterMenuButton.setText(item.text+':');this.filter.setValue('');this.store.baseParams.filterTxt=item.value;this.store.baseParams.filterValue=''}},filterSearch:function(){var filterTxt=this.store.baseParams.filterTxt;if(typeof filterTxt=='undefined'||filterTxt==''){Ext.Msg.alert('提示','请先选择搜索的字段');return}if(this.filter.getValue()!=''){if(this.filter.getValue().length>0){this.store.baseParams.filterValue=this.filter.getValue()}else if(this.filter.getValue().length()==0){this.store.baseParams.filterValue=''}}else{return}this.store.reload()},onFilterKey:function(field,e){var filterTxt=this.store.baseParams.filterTxt;if(typeof filterTxt=='undefined'||filterTxt==''){Ext.Msg.alert('提示','请先选择搜索的字段');return}if(e.getKey()==e.ENTER&&field.getValue().length>0){this.store.baseParams.filterValue=field.getValue()}else if(e.getKey()==e.BACKSPACE&&field.getValue().length()==0){this.store.baseParams.filterValue=''}else{return}this.store.reload()},checkOne:function(){var selections=this.getSelections();if(selections.length==0){Ext.MessageBox.alert("提示","请选择一条记录!");return false}else if(selections.length!=1){Ext.MessageBox.alert("提示","不能选择多行!");return false}return true},checkMany:function(){var selections=this.getSelections();if(selections.length==0){Ext.MessageBox.alert("提示","请至少选择一条记录!");return false}return true},add:function(){submitType="add";this.buildDlgSize();this.createForm();this.createDialog();this.dialog.setTitle("新增"+title)this.dialog.show(Ext.get("add"))},edit:function(){if(this.checkOne()){submitType="edit";this.buildDlgSize();this.createForm();if(lastCheckbox=this.isChecked()){Ext.destroy(lastCheckbox);dlgheight=dlgheight-25}this.createDialog();this.dialog.setTitle("修改"+title+"信息")this.dialog.show(Ext.get('edit'));this.formPanel.load({url:this.urlLoadData+"?"+this.kid+"="+this.getSelections()[0].get(this.kid)})}},batchDelete:function(url){if(this.checkMany()){Ext.Msg.confirm("提示","确定删除?",function(btn,text){if(btn=='yes'){var selections=this.getSelections();var ids=new Array();for(var i=0,len=selections.length;i<len;i++){try{ids[i]=selections[i].get(this.kid)}catch(e){}}Ext.Ajax.request({url:url+'?'+this.kid+'s='+ids,success:function(response){var j=Ext.util.JSON.decode(response.responseText);if(j.msg==null){Ext.ux.Toast.msg("提示","删除成功!")}else{Ext.ux.Toast.msg('操作提示',j.msg)}this.refresh()}.createDelegate(this),failure:function(response){var j=Ext.util.JSON.decode(response.responseText);if(j.msg==null){Ext.ux.Toast.msg("操作提示",j.msg)}else{Ext.MessageBox.alert('异常提示','操作失败,请联系管理员!')}}})}}.createDelegate(this))}},del:function(){this.batchDelete(this.urlRemove)},clearParams:function(){this.filter.reset();var filterTxt=this.store.baseParams.filterTxt;this.store.baseParams={};this.store.load({params:{start:0,limit:this.pageSizePlugin.getValue()}});this.store.baseParams.filterTxt=filterTxt;this.store.baseParams.filterValue=''},createForm:function(){var items=this.formConfig;var formItems=new Array();for(var i=0;i<items.length;i++){var item=items[i];if(item.showInForm===false){continue}formItems[formItems.length]=item}Ext.each(formItems,function(item){Ext.applyIf(item,{anchor:'95%'})});var reader=new Ext.data.JsonReader({},this.formConfig);this.formPanel=new Ext.form.FormPanel({defaultType:'textfield',labelAlign:'right',labelWidth:70,frame:true,autoScroll:true,reader:reader,url:this.urlSave,items:formItems})},buildDlgSize:function(){dlgwidth=''dlgheight=''title=''},createDialog:function(){this.dialog=new Ext.Window({layout:'fit',title:'详细信息',border:false,width:dlgwidth,height:dlgheight,buttonAlign:'center',resizable:false,modal:true,items:this.formPanel,keys:{key:Ext.EventObject.ENTER,fn:this.submit,scope:this},listeners:{'show':function(){this.findByType('textfield')[1].focus(false,600)}},buttons:[{text:'保存',tooltip:'保存',iconCls:"btn-save",handler:this.submit.createDelegate(this)},{text:'重置',tooltip:'重置',iconCls:"btn-reset",handler:this.dlgReload.createDelegate(this)},{text:'取消',tooltip:'取消',iconCls:"btn-cancel",handler:function(){this.dialog.close()}.createDelegate(this)}]})},checkboxSubmit:function(){if(lastCheckbox=this.isChecked()){var v=lastCheckbox.getValue();if(!v){this.dialog.close()}else{this.formPanel.getForm().reset();lastCheckbox.setValue(v);this.formPanel.findByType('textfield')[1].focus(true,true)}}else{this.dialog.close()}},doSubmit:function(txt){this.formPanel.getForm().submit({waitTitle:"请稍候",waitMsg:'提交数据,请稍候...',success:function(){if(submitType=="add"){this.checkboxSubmit()}else{this.dialog.close()}this.refresh();Ext.ux.Toast.msg("提示",txt+"成功!")},failure:function(e,f){if(f.result.msg!=null||f.result.msg!="undefined"){Ext.ux.Toast.msg("操作信息",f.result.msg)}else{Ext.MessageBox.alert('异常提示',txt+'失败,请联系管理员!')}},scope:this})},submit:function(){if(this.formPanel.getForm().isValid()){if(submitType=="add"){this.doSubmit("保存")}if(submitType=="edit"){Ext.Msg.confirm("提示","确定修改?",function(btn,text){if(btn=='yes'){this.doSubmit("修改")}}.createDelegate(this))}}},isChecked:function(){var boxArray=this.formPanel.findByType('checkbox');var lastCheckbox=boxArray[boxArray.length-1];if(lastCheckbox!=null&&lastCheckbox.getName()=='manyCheckBox'){return lastCheckbox}else{return false}return true},dlgReload:function(){if(submitType=="add"){if(lastCheckbox=this.isChecked()){var v=lastCheckbox.getValue();this.formPanel.getForm().reset();lastCheckbox.setValue(v)}else{this.formPanel.getForm().reset()}}if(submitType=="edit"){this.formPanel.load({url:this.urlLoadData+"?"+this.kid+"="+this.getSelections()[0].get(this.kid)})}this.formPanel.findByType('textfield')[1].focus(false,true)},onItemCheck:function(item,checked){if(checked){this.filterMenuButton.setText(item.text+':');this.filterTxt=item.value}},buildMenuItems:function(){this.adddateMenu=new Ext.menu.Item({id:'adddateMenu',text:'新增',iconCls:'btn-add',handler:this.add.createDelegate(this)});this.updateMenu=new Ext.menu.Item({iconCls:'btn-edit',id:'updateMenu',text:'修改',handler:this.edit.createDelegate(this)});this.removeMenu=new Ext.menu.Item({iconCls:'btn-del',id:'removeMenu',text:'删除',handler:this.del.createDelegate(this)})},buildMenuList:function(){this.menuList=[this.adddateMenu,this.updateMenu,'-',this.removeMenu]},contextmenu:function(grid,rowIndex,e){e.preventDefault();e.stopEvent();this.buildMenuItems();this.buildMenuList();if(this.disablemenu()){grid.getSelectionModel().selectRow(rowIndex)};this.grid_menu=new Ext.menu.Menu({id:'mainMenu',items:this.menuList});var coords=e.getXY();this.grid_menu.showAt([coords[0],coords[1]])},disablemenu:function(){var selections=this.getSelections();if(selections.length>1){var u=Ext.getCmp("updateMenu");if(u!=null){this.updateMenu.disable()}return false}return true},refresh:function(){this.store.reload()},onDestroy:function(){if(this.rendered){if(this.grid_menu){Ext.destroy(this.grid_menu)}if(this.dialog){Ext.destroy(this.dialog)}}Ext.sky.JsonGrid.superclass.onDestroy.call(this)}});
-------------------------------------------
Ext.ux.EasyComboBox=Ext.extend(Ext.form.ComboBox,{allowBlank:false,editable:false,maxHeight:200,valueField:'id',displayField:'name',triggerAction:'all',isAutoLoad:true,initComponent:function(){this.store=new Ext.data.Store({autoLoad:this.isAutoLoad,proxy:new Ext.data.HttpProxy({url:this.dataUrl}),reader:new Ext.data.JsonReader({root:"result",totalProperty:"totalCount",id:'id'},[{name:'id'},{name:'name'}])})Ext.ux.EasyComboBox.superclass.initComponent.call(this)}});Ext.reg("easycombo",Ext.ux.EasyComboBox);Ext.ux.EasyComboBox2=Ext.extend(Ext.form.ComboBox,{allowBlank:false,editable:false,maxHeight:200,valueField:'id',displayField:'name',triggerAction:'all',mode:"local",isAutoLoad:true,initComponent:function(){this.store=new Ext.data.SimpleStore({autoLoad:this.isAutoLoad,url:this.dataUrl,fields:["id","name"]})Ext.ux.EasyComboBox2.superclass.initComponent.call(this)}});Ext.reg("easycombo2",Ext.ux.EasyComboBox2);Ext.ux.EasyTreePanel=Ext.extend(Ext.tree.TreePanel,{border:false,autoScroll:true,rootVisible:false,isLoaded:false,initComponent:function(){this.loader=new Ext.tree.TreeLoader({url:this.dataUrl}),this.root=new Ext.tree.AsyncTreeNode({expanded:true,loaded:this.isLoaded}),Ext.ux.EasyTreePanel.superclass.initComponent.call(this);this.registerEvents()},clickNode:function(){},registerEvents:function(){this.on("contextmenu",this.contextmenu,this);this.on("expand",this.doExp,this);this.on("click",this.clickNode,this)},doExp:function(){if(this.isLoaded){this.root.reload();this.isLoaded=false}},clickNode:function(){},buildMenuItems:function(){this.refreshMenu=new Ext.menu.Item({text:"刷新",iconCls:"btn-refresh",handler:function(){this.root.reload()}.createDelegate(this)});this.expandMenu=new Ext.menu.Item({text:"展开",iconCls:"btn-expand",handler:function(){this.expandAll()}.createDelegate(this)});this.collapseMenu=new Ext.menu.Item({text:"收起",iconCls:"btn-collapse",handler:function(){this.collapseAll()}.createDelegate(this)})},buildMenuList:function(){this.menuList=[this.refreshMenu,'-',this.expandMenu,this.collapseMenu]},contextmenu:function(n,o){this.buildMenuItems();this.buildMenuList();this.treeMenu=new Ext.menu.Menu({items:this.menuList})this.treeMenu.showAt(o.getXY())}});Ext.reg("easytree",Ext.ux.EasyTreePanel);
----------------------------------------------
var MailFormView=function(b,c,a){return this.setup(b,c,a)};MailFormView.prototype.setup=function(d,j,a){var h=this.initToolbar();var e=new copyFieldItems();var g=new Ext.data.JsonReader({root:"data"},[{name:"mail.recipientids",mapping:"recipientids"},{name:"mail.copytoids",mapping:"copytoids"},{name:"mail.status",mapping:"status"},{name:"mail.fileids",mapping:"fileids"},{name:"mail.id",mapping:"id"},{name:"mail.recipientnames",mapping:"recipientnames"},{name:"mail.subject",mapping:"subject"},{name:"mail.importantflag",mapping:"importantflag"},{name:"mail.filenames",mapping:"filenames"},{name:"mail.content",mapping:"content"},{name:"mail.copytonames",mapping:"copytonames"}]);var b=new Ext.FormPanel({url:"talkpark/mail!save.do",id:"mailFormPanel",border:false,frame:true,autoHeight:true,reader:g,items:[{fieldLabel:"收件人ID列表用,分隔",name:"mail.recipientids",id:"mail.recipientids",xtype:"hidden"},{fieldLabel:"抄送人ID列表用,分开",name:"mail.copytoids",id:"mail.copytoids",xtype:"hidden"},{fieldLabel:"邮件状态",name:"mail.status",id:"mail.status",xtype:"hidden",value:1},{fieldLabel:"附件IDs",name:"mail.fileids",xtype:"hidden",id:"mail.fileids"},{fieldLabel:"BOXID",name:"boxId",xtype:"hidden",id:"mailBoxId"},{fieldLabel:"MailId",name:"mail.id",xtype:"hidden",id:"mail.id"},{fieldLabel:"操作",name:"replyBoxId",xtype:"hidden",id:"mail.replyBoxId"},{fieldLabel:"附件名称列表",name:"mail.filenames",xtype:"hidden",id:"mail.filenames"},{fieldLabel:"主题",xtype:"textfield",name:"mail.subject",id:"mail.subject",allowBlank:false,width:530,blankText:"邮件主题为必填"},{xtype:"container",layout:"column",height:32,defaultType:"textfield",items:[{xtype:"label",text:"收件人:",style:"padding-left:0px;padding-top:3px;",width:106},{width:280,fieldLabel:"收件人姓名列表",name:"mail.recipientnames",id:"mail.recipientnames",allowBlank:false,blankText:"请选择收件人",readOnly:true},{xtype:"button",text:"选择收件人",iconCls:"btn-mail_recipient",handler:function(){oa.sky.userSelector("mail.recipientids","mail.recipientnames")}},{xtype:"button",text:"清除收件人",iconCls:"icon-clear",handler:function(){var recipientids=Ext.getCmp('mail.recipientids');var recipientnames=Ext.getCmp('mail.recipientnames');recipientids.setValue("");recipientnames.setValue("")}},{xtype:"button",text:"我要抄送",iconCls:"btn-mail_copy",handler:function(){var k=Ext.getCmp("copyField");var copytonamesBlank=Ext.getCmp('mail.copytonames');copytonamesBlank.allowBlank=false;copytonamesBlank.blankText="请选择抄送人";k.show()}}]},{xtype:"container",id:"copyField",layout:"column",height:32,hidden:true,defaultType:"textfield",items:[e]},{xtype:"container",layout:"column",height:32,defaultType:"textfield",style:"padding-left:0px;",items:[{xtype:"label",text:"优先级:",style:"padding-left:0px;padding-top:3px;",width:105},{width:350,fieldLabel:"邮件优先级",hiddenName:"mail.importantflag",id:"mailImportantFlag",xtype:"combo",mode:"local",editable:false,value:"1",triggerAction:"all",store:[["1","一般"],["2","重要"],["3","非常重要"]]},{xtype:"checkbox",name:"sendMessage",boxLabel:"告诉他有信"}]},{xtype:"container",layout:"column",autoHeight:true,defaultType:"textfield",items:[{xtype:"label",text:"附件:",width:105},{xtype:"panel",width:355,layout:"column",name:"filenames.display",defaults:{border:false},id:"filenames.display",items:[{xtype:"label",height:40,id:"placeholder"}]},{xtype:"button",text:"上传",iconCls:"btn-upload",handler:function(){var k=App.createUploadDialog({file_cat:"talkpark",callback:uploadMailAttach});k.show()}}]},{fieldLabel:"内容",name:"mail.content",id:"mail.content",xtype:"htmleditor"}]});if(d!=null&&d!="undefined"){var i=Ext.getCmp("mail.id");i.setValue(d);if(a=="draft"){b.getForm().load({deferredRender:false,url:"talkpark/mail/get-mail!getMailInfo.do?",method:"post",params:{mailId:d,folderId:3,boxId:j},waitMsg:"正在载入数据...",success:function(k,m){var r=Ext.getCmp("mail.copytoids");if(r.value!=""&&r.value!=null){var l=Ext.getCmp("copyField");l.show()}var p=Ext.getCmp("mail.filenames").value;if(p!=""&&p!=null){var q=Ext.getCmp("filenames.display");var s=Ext.getCmp("placeholder");if(s!=null){s.hide()}var t=p.split(",");var o=Ext.getCmp("mail.fileids").value.split(",");for(var n=0;n<t.length;n++){q.add(new Ext.form.FieldSet({border:false,frame:false,id:"mailAttachDisplay"+o[n],columnWidth:0.5,html:'<IMG src="'+__ctxPath+'/images/flag/attachment.png">  '+t[n]+'  <A href="javascript:deleteAttach('+o[n]+')">删除</A>'}))}q.doLayout(true)}},failure:function(k,l){}})}else{if(a=="reply"){b.getForm().load({deferredRender:false,url:"talkpark/mail!optMail.do",method:"post",params:{mailId:d,boxId:j,opt:"回复"},waitMsg:"正在载入数据...",success:function(k,l){Ext.getCmp("mail.replyBoxId").setValue(j)},failure:function(k,l){}})}else{if(a=="forward"){var p=Ext.getCmp("mail.filenames").value;b.getForm().load({deferredRender:false,url:"talkpark/mail!optMail.do",method:"post",params:{mailId:d,opt:"转发"},waitMsg:"正在载入数据...",success:function(k,l){var p=Ext.getCmp("mail.filenames").value;if(p!=""&&p!=null){var q=Ext.getCmp("filenames.display");var s=Ext.getCmp("placeholder");if(s!=null){s.hide()}var t=p.split(",");var o=Ext.getCmp("mail.fileids").value.split(",");for(var n=0;n<t.length;n++){q.add(new Ext.form.FieldSet({border:false,frame:false,id:"mailAttachDisplay"+o[n],columnWidth:0.5,html:'<IMG src="'+__ctxPath+'/images/flag/attachment.png">  '+t[n]+'  <SPAN style="DISPLAY: none"><A href="javascript:deleteAttach('+o[n]+')">删除</A></SPAN>'}))}q.doLayout(true)}},failure:function(k,l){}})}}}}if(j!=null&&j!="undefined"){var f=Ext.getCmp("mailBoxId");f.setValue(j)}var c=new Ext.Panel({title:"发送邮件",iconCls:"menu-mail_send",autoScroll:true,tbar:h,id:"MailFormView",layout:"hbox",margins:"0 0 6 0",layoutConfig:{padding:"5",pack:"center",align:"middle"},defaults:{margins:"0 5 0 0"},items:[b]});return c};MailFormView.prototype.initToolbar=function(){var a=new Ext.Toolbar({height:30,items:[{text:"立即发送",iconCls:"btn-mail_send",handler:function(){var c=Ext.getCmp("mailFormPanel");var b=Ext.getCmp("mail.status");if(c.getForm().isValid()){b.setValue(1);c.getForm().submit({waitMsg:"正在发送邮件,请稍候...",success:function(d,e){Ext.Msg.confirm("操作信息","邮件发送成功!继续发邮件?",function(g){if(g=="yes"){c.getForm().reset()}else{var f=Ext.getCmp("centerTabPanel");f.remove("MailFormView")}})},failure:function(d,e){Ext.ux.Toast.msg("错误信息",e.result.msg)}})}}},{text:"存草稿",iconCls:"btn-mail_save",handler:function(){var c=Ext.getCmp("mail.status");c.setValue(0);var b=Ext.getCmp("mailFormPanel");if(b.getForm().isValid()){b.getForm().submit({waitMsg:"正在保存草稿,请稍候...",success:function(d,e){Ext.Msg.confirm("操作信息","草稿保存成功!继续发邮件?",function(g){if(g=="yes"){b.getForm().reset()}else{var f=Ext.getCmp("centerTabPanel");f.remove("MailFormView")}})},failure:function(d,e){Ext.ux.Toast.msg("错误信息",e.result.msg)}})}}},{text:"重置",iconCls:"reset",handler:function(){alert(0);var b=Ext.getCmp("mailFormPanel");b.getForm().reset()}},{text:"取消",iconCls:"btn-mail_remove",handler:function(){var b=Ext.getCmp("centerTabPanel");b.remove("MailFormView")}}]});return a};function copyFieldItems(){var a=[{xtype:"label",text:"抄送人:",style:"padding-left:0px;padding-top:3px;",width:105},{width:280,fieldLabel:"抄送人姓名列表",name:"mail.copytonames",id:"mail.copytonames",readOnly:true},{xtype:"button",text:"选择抄送人",iconCls:"btn-mail_recipient",handler:function(){oa.sky.userSelector("mail.copytoids","mail.copytonames")}},{xtype:"button",text:"清除抄送人",iconCls:"icon-clear",handler:function(){var copytoids=Ext.getCmp('mail.copytoids');var copytonames=Ext.getCmp('mail.copytonames');copytoids.setValue("");copytonames.setValue("")}},{xtype:"button",text:"取消抄送",iconCls:"btn-delete_copy",handler:function(){var b=Ext.getCmp("copyField");var c=Ext.getCmp("mail.copytoids");var u=Ext.getCmp("mail.copytonames");c.setValue("");u.setValue("");u.allowBlank=true;u.blankText="";b.hide()}}];return a}function uploadMailAttach(d){var a=Ext.getCmp("mail.fileids");var c=Ext.getCmp("mail.filenames");var e=Ext.getCmp("filenames.display");var f=Ext.getCmp("placeholder");if(f!=null){f.hide()}for(var b=0;b<d.length;b++){if(a.getValue()!=""){a.setValue(a.getValue()+",");c.setValue(c.getValue()+",")}a.setValue(a.getValue()+d[b].fileId);c.setValue(c.getValue()+d[b].filename);e.add(new Ext.form.FieldSet({id:"mailAttachDisplay"+d[b].fileId,columnWidth:1,html:'<IMG src="'+__ctxPath+'/images/flag/attachment.png">  '+d[b].filename+'  <A href="javascript:deleteAttach('+d[b].fileId+')">删除</A>'}))}e.doLayout(true)}function deleteAttach(f){var b=Ext.getCmp("mail.fileids").value.split(",");var j=Ext.getCmp("mail.filenames").value.split(",");var h="";var d="";for(var c=0;c<b.length;c++){if(b[c]!=f){h+=b[c]+",";d+=j[c]+","}}if(h!=""){h=h.substring(0,h.length-1);d=d.substring(0,d.length-1)}Ext.getCmp("mail.fileids").setValue(h);Ext.getCmp("mail.filenames").setValue(d);var e=Ext.getCmp("filenames.display");var a=Ext.getCmp("mailAttachDisplay"+f);e.remove(a);if(Ext.getCmp("mail.fileids").value==""){Ext.getCmp("placeholder").show()}e.doLayout(true);var g=Ext.getCmp("mail.id").value;if(g!=""&&g!="undefined"&&g!=null){Ext.Ajax.request({url:__ctxPath+"/talkpark/mail!addFileMail.do",method:"post",params:{mailId:g,fileId:f,fileIds:h,filenames:d},success:function(){Ext.ux.Toast.msg("信息提示","成功删除记录!")}})}else{Ext.Ajax.requesta({url:__ctxPath+"/docs/file-attach!delete.do",params:{id:f},method:"post",success:function(){Ext.ux.Toast.msg("信息提示","成功删除所选记录!")}})}}
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics