Index: ssts-web/src/main/webapp/systemmanage/orgUnitExtView.js =================================================================== diff -u -r17241 -r18171 --- ssts-web/src/main/webapp/systemmanage/orgUnitExtView.js (.../orgUnitExtView.js) (revision 17241) +++ ssts-web/src/main/webapp/systemmanage/orgUnitExtView.js (.../orgUnitExtView.js) (revision 18171) @@ -89,6 +89,68 @@ OrgUnitTableManager.moveDownOrgUnit(id, function(){reloadTreeAndTable();}); } + +/** + * 处理设置自动同步用户后的事件 + * @param synWin 自动同步的窗口 + * @param checkTimeId 要检验的时间的组件id + */ +function handleSetAutoSyncOrgUnit(synWin, checkTimeId) { + var timeSet = Ext.getCmp(checkTimeId); + if (!timeSet.isValid()){ + return; + } + DataSynchronizationTableManager.autoSync(timeSet.getValue(), 'orgUnit', { + callback:function(data){ + showResult(data); + synWin.close(); + reloadTreeAndTable(); + }, + errorHandler:function(msg){ + showResult('设置主动同步科室发生异常'); + synWin.close(); + }, + timeout:240000//超时时间4分钟 + }); +} + +/** + * 自动同步用户 + */ +function autoSyncOrgUnit(){ + var buttons = [ + {text: "确定", handler: function () {handleSetAutoSyncOrgUnit(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) { + handleSetAutoSyncOrgUnit(synWin, 'timeSet'); + } + } + } + }], + showLock:false, + buttons: buttons + }); + synWin.show(); +} + function syncOrgUnit() { Ext.MessageBox.confirm("请确认","是否确定要同步组织机构信息?",function(button, text){ if("yes" == button){ @@ -237,6 +299,14 @@ syncOrgUnit(); } },'-',{ + text : '自动同步组织机构数据', + tooltip:'自动同步组织机构数据', + iconCls:'icon_refresh', + hidden : !sstsConfig.showAutoSyn, + handler:function(){ + autoSyncOrgUnit(); + } + },'-',{ text:'添加', tooltip:'添加'+entityName, iconCls:'btn_ext_add',