| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- Ext.define('erp.view.ma.LogoSet',{
- extend: 'Ext.Viewport',
- layout: 'fit',
- hideBorders: true,
- initComponent : function(){
- var me = this;
- Ext.apply(me, {
- items: [{
- xtype: "window",
- title:'上传Logo',
- autoShow: true,
- closable: false,
- maximizable : true,
- width: 605,
- height: 300,
- layout: 'fit',
- items: [{
- xtype:'form',
- frame:true,
- layout:'vbox',
- fieldDefaults : {
- margin : '2 2 2 2',
- fieldStyle : "background:#FFFAFA;color:#515151;",
- labelAlign : "right",
- blankText : $I18N.common.form.blankText
- },
- items:[{
- xtype: 'filefield',
- columnWidth:1,
- name: 'file',
- labelWidth:300,
- labelSeparator:'',
- fieldLabel:'<div style="color:blue;padding-left:10px;">Logo目前只支持小于8K图片(像素:85*30)</div>',
- allowBlank: false,
- buttonOnly:true,
- buttonConfig:{
- text:'选择图片',
- iconCls:'x-button-icon-pic'
- },
- listeners: {
- change: function(field){
- field.ownerCt.upload(field);
- }
- }
- },{
- xtype: 'image',
- width: 85,
- height: 30,
- id:'logo',
- margins:'30 255 50 255'
- }],
- upload: function(field){
- if(field.ownerCt.down('image').hidden){
- field.ownerCt.getForm().submit({
- url: basePath + 'ma/logo/save.action',
- waitMsg:'正在上传',
- success: function(fp, o){
- if(o.result.success){
- Ext.Msg.alert('提示','更新成功');
- var logo=Ext.getCmp('logo');
- logo.show();
- logo.setSrc(basePath+'ma/logo/get.action');
- }else Ext.Msg.alert('提示','上传失败,请检查文件大小及格式!');
-
- },
- failure:function(fp,o){
- Ext.Msg.alert('提示','上传失败,请检查文件大小及格式!');
- }
-
- });
- }else Ext.Msg.alert('提示','已存在Logo,请先删除!');
-
- },
- }],
- buttonAlign:'center',
- buttons:[{
- text: $I18N.common.button.erpDeleteButton,
- iconCls: 'x-button-icon-delete',
- cls: 'x-btn-gray',
- width: 60,
- handler: function(btn){
- var logo=Ext.getCmp('logo');
- if(!logo.src) alert('未上传任何logo,无法删除!');
- else {
- Ext.Ajax.request({
- url: basePath + 'ma/logo/del.action',
- success: function(fp, o){
- Ext.Msg.alert('提示','删除成功!');
- logo.hide();
- }
- })
- }
- }
- },{
- text: $I18N.common.button.erpCloseButton,
- iconCls: 'x-button-icon-close',
- cls: 'x-btn-gray',
- width: 60,
- handler: function(btn){
- var main = parent.Ext.getCmp("content-panel");
- if(main){
- main.getActiveTab().close();
- }
- }
- }]
- }]
- });
- me.callParent(arguments);
- }
- });
|