// /** // * 打开/切换到新页签 // * @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 { // panel.viewConfig = config; // mainTab.setActiveTab(panel); // } // } // /** // * 重设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; // } // /** // * 显示toast提示(无需用户操作) // * @param content: 内容 // * @param title: 标题 // * // */ // function showToast(content, title) { // Ext.toast({ // html: content, // title: title, // closable: false, // align: 't', // slideDUration: 400, // maxWidth: 400 // }); // } // /** // * 显示警告(需要选择是、否) // * @param title: 标题 // * @param message: 内容 // * @return : Promise // */ // 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() // }); // } // /** // * 判断字符串是否日期字符串 // * 需要满足格式 yyyy-MM-dd hh:mm:ss // * 或者yyyy-M-d h:m:s // * @param str: 字符串 // * @returns Boolean // */ // function isDateString(str) { // return (/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/).test(str); // } // function getCurrentUse() { // if(typeof saas == 'undefined') { // return JSON.parse(window.localStorage["app-state-session"]).account; // }else { // return saas.util.State.get('session').account; // } // }