|
|
@@ -16,13 +16,51 @@ Ext.define('saas.view.core.tab.Controller', {
|
|
|
tab.tabView = tab.add(view);
|
|
|
},
|
|
|
|
|
|
- onTabChange: function() {
|
|
|
+ onTabChange: function(component) {
|
|
|
var me = this,
|
|
|
- tab = me.getView(),
|
|
|
- tabView = tab.tabView;
|
|
|
+ tabPanel = me.getView(),
|
|
|
+ tabView = tabPanel.tabView;
|
|
|
|
|
|
if(typeof tabView.refresh == 'function') {
|
|
|
tabView.refresh();
|
|
|
}
|
|
|
+
|
|
|
+ if(!component.resetCloseClick) {
|
|
|
+ component.tab.onCloseClick = function() {
|
|
|
+ var me = this;
|
|
|
+
|
|
|
+ if (me.fireEvent('beforeclose', me) !== false) {
|
|
|
+ if (me.tabBar) {
|
|
|
+ if(typeof tabView.isDirty == 'function' && tabView.isDirty()) {
|
|
|
+ showConfirm('提示', '表单数据有修改,确定要退出吗?')
|
|
|
+ .then(function(yes) {
|
|
|
+ if(yes == 'yes') {
|
|
|
+ if (me.tabBar.closeTab(me) === false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ if (me.tabBar.closeTab(me) === false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(typeof tabView.isDirty == 'function' && tabView.isDirty()) {
|
|
|
+ showConfirm('提示', '表单数据有修改,确定要退出吗?')
|
|
|
+ .then(function(yes) {
|
|
|
+ if(yes == 'yes') {
|
|
|
+ me.fireClose();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ me.fireClose();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ component.resetCloseClick = true;
|
|
|
+ }
|
|
|
}
|
|
|
});
|