/** * 右下角消息提示类型2 */ Ext.define('erp.view.core.window.Msg', { extend: 'Ext.window.Window', alias: 'widget.msg', frame: true, closable: false, bodyStyle: 'background: #E0EEEE', width: 400, height: 320, clientY: 465, renderTo: Ext.getBody(), x: screen.width - 400 -10, y: screen.height - 465 - 10, tools: [{ type: 'close', handler: function(btn){ var me = arguments[2].ownerCt; me.fireEvent('close', me); me.destroy(); } }], autoClose: true,//自动关闭 closeAction: 'destroy', autoCloseTime: 8000, isError: true,//是否为出错提示 initComponent: function() { this.autoCloseTime = this.autoCloseTime || 8000; this.addEvents({ 'close': true }); if(!this.isError){ this.buttons = null; this.clientY = 430; } if (this.autoCloseTime <= 3000) {// fast slide in and out this.width = 300; this.height = 150; this.x = screen.width - 300 -10; this.y = screen.height - 150 - 10; this.clientY = 300; this.context = '' + this.context + ''; } this.title = '
 ' + this.title + '
'; this.callParent(arguments); this.updatePosition(); this.insertMsg(this.context); var me = this; if(me.autoClose){//自动关闭 setTimeout(function(){ me.destroy(); }, me.autoCloseTime); } }, buttons: [{ width: 100, style: { marginLeft: '3px' }, text: '发送错误报告', cls: 'x-btn-blue', handler: function(btn){ var me = btn.ownerCt.ownerCt; me.sendError(); me.close(); } },{ width: 60, style: { marginLeft: '3px' }, text: '帮助', cls: 'x-btn-blue', handler: function(btn){ var me = btn.ownerCt.ownerCt; me.help(); me.close(); } },{ width: 60, style: { marginLeft: '3px' }, text: '关 闭', cls: 'x-btn-blue', handler: function(btn){ var me = btn.ownerCt.ownerCt; me.fireEvent('close', me); me.destroy(); } }], updatePosition: function(){ var count = Ext.ComponentQuery.query('msg').length; this.setPosition(screen.width - this.width - count*30 - 10, screen.height - this.clientY - 10); this.show(); this.el.slideIn('r', { duration: 500 }); }, insertMsg: function(msg){ this.insert(0, { xtype: 'panel', height: '100%', autoScroll: true, html: '
' + msg + '
' }); }, sendError: function(){ }, help: function(){ } });