Index: ssts-web/src/main/webapp/systemmanage/userExtView.js =================================================================== diff -u -r14537 -r18171 --- ssts-web/src/main/webapp/systemmanage/userExtView.js (.../userExtView.js) (revision 14537) +++ ssts-web/src/main/webapp/systemmanage/userExtView.js (.../userExtView.js) (revision 18171) @@ -164,6 +164,68 @@ Ext.MessageBox.alert('提示','检测服务器失败'); } } + +/** + * 处理设置自动同步用户后的事件 + * @param synWin 自动同步的窗口 + * @param checkTimeId 要检验的时间的组件id + */ +function handleSetAutoSyncUser(synWin, checkTimeId) { + var timeSet = Ext.getCmp(checkTimeId); + if (!timeSet.isValid()){ + return; + } + DataSynchronizationTableManager.autoSync(timeSet.getValue(), 'user', { + callback:function(data){ + showResult(data); + synWin.close(); + reloadTreeAndTable(); + }, + errorHandler:function(msg){ + showResult('设置主动同步用户发生异常'); + synWin.close(); + }, + timeout:240000//超时时间4分钟 + }); +} + +/** + * 自动同步用户 + */ +function autoSyncUser(){ + var buttons = [ + {text: "确定", handler: function () {handleSetAutoSyncUser(synWin, 'timeSet');}}, + {text: "取消", handler: function (obj) {synWin.close();}} + ]; + var synWin = new Ext.Window({ + title:"设置自动同步时间", + width: 400, + height: 120, + // plain: true, + modal: true, + layout: "form", + bodyStyle: "padding-top: 10px; padding-left:10px;", + items:[{ + xtype: "textfield", + id : 'timeSet', + regex: /^[1-9]\d*$/, + regexText: '请输入大于零的整数!', + fieldLabel : "时间(分)", + emptyText : "输入分钟....", + listeners: { + specialkey: function(field, e){ + if (e.getKey() === e.ENTER) { + handleSetAutoSyncUser(synWin, 'timeSet'); + } + } + } + }], + showLock:false, + buttons: buttons + }); + synWin.show(); +} + function syncUser() { Ext.MessageBox.confirm("请确认","是否确定要同步用户信息?",function(button, text){ if("yes" == button){ @@ -310,6 +372,14 @@ syncUser(); } },'-',{ + text : '自动同步用户数据', + tooltip:'自动同步用户数据', + iconCls:'icon_refresh', + hidden : !sstsConfig.showAutoSyn, + handler:function(){ + autoSyncUser(); + } + },'-',{ text:'添加', tooltip:'添加'+entityName, iconCls:'btn_ext_add',