| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- /**
- * 打开/切换到新页签
- * @param xtype: view xtype
- * @param title: 标题
- * @param id: id
- * @param config: 绑定到view的其他配置
- */
- function openTab(xtype, title, id, config) {
- var mainTab = Ext.getCmp('main-tab-panel');
- var panel = mainTab.query('[tabId="' + id + '"]')[0];
- if(!panel) {
- panel = Ext.create('saas.view.core.tab.Panel', {
- tabId: id,
- title: title,
- viewType: xtype,
- viewConfig: config
- });
- Ext.suspendLayouts();
- mainTab.setActiveTab(mainTab.add(panel));
- Ext.resumeLayouts(true);
- }else {
- mainTab.setActiveTab(panel);
- }
- }
- /**
- * 显示toast提示
- * @param content: 内容
- * @param title: 标题
- *
- */
- function showToast(content, title) {
- Ext.toast({
- html: content,
- title: title,
- closable: false,
- align: 't',
- slideDUration: 400,
- maxWidth: 400
- });
- }
- /**
- * 重设tab标题
- */
- function refreshTabTitle(id, title) {
- var currentTab = getCurrentTab();
- currentTab.tabId = id;
- currentTab.setTitle(title);
- }
- /**
- * 获得当前Tab
- */
- function getCurrentTab() {
- var mainTab = Ext.getCmp('main-tab-panel');
- var currentTab = mainTab.getActiveTab();
- return currentTab;
- }
- function showConfirm(title, message) {
- return new Ext.Promise(function (resolve, reject) {
- Ext.MessageBox.confirm(title, message, function(buttonId) {
- return resolve(buttonId);
- });
- })
- }
- function warnMsg(msg, fn){
- Ext.MessageBox.show({
- title: '提示',
- msg: msg,
- buttons: Ext.Msg.YESNO,
- icon: Ext.Msg.WARNING,
- fn: fn
- });
- }
- function deleteWarn(msg, fn){
- Ext.MessageBox.show({
- title: '提示',
- msg: msg || '确定要删除当前表单?',
- buttons: Ext.Msg.YESNO,
- icon: Ext.Msg.WARNING,
- fn: fn,
- renderTo: Ext.getCmp('main-tab-panel').getActiveTab().getEl()
- });
- }
|