diff --git a/modules/core/src/main/java/com/jeesite/common/shiro/filter/FormFilter.java b/modules/core/src/main/java/com/jeesite/common/shiro/filter/FormFilter.java index 3eaadd7c..b983e44e 100644 --- a/modules/core/src/main/java/com/jeesite/common/shiro/filter/FormFilter.java +++ b/modules/core/src/main/java/com/jeesite/common/shiro/filter/FormFilter.java @@ -497,7 +497,7 @@ public class FormFilter extends org.apache.shiro.web.filter.authc.FormAuthentica } if (SWITCH_OFFICE && User.USER_TYPE_EMPLOYEE.equals(user.getUserType())) { data.put("switchOffice", "true"); - data.put("officeCode", EmpUtils.getCurrentOfficeCode()); + data.put("officeCode", session.getAttribute("officeCode")); data.put("officeName", EmpUtils.getCurrentOfficeName()); } data.put("desktopUrl", desktopUrl != null ? desktopUrl : Global.getConfig("sys.index.desktopUrl")); diff --git a/modules/core/src/main/resources/views/include/sysIndex/topMenuOffice.html b/modules/core/src/main/resources/views/include/sysIndex/topMenuOffice.html index 316024ca..b3dac4d6 100644 --- a/modules/core/src/main/resources/views/include/sysIndex/topMenuOffice.html +++ b/modules/core/src/main/resources/views/include/sysIndex/topMenuOffice.html @@ -3,7 +3,7 @@ ${officeName!} -
<#form:treeselect id="switchOfficeSelect" title="${text('部门切换')}" allowClear="false" +
<#form:treeselect id="switchOfficeSelect" title="${text('部门切换')}" allowClear="true" url="${ctx}/sys/empUser/officeListData?isShowCode=true" callbackFuncName="switchOfficeSelectCallback" fieldNames="{'id':'officeCode','name':'fullName'}"/>
@@ -12,14 +12,12 @@ $('#switchOfficeSelectButton').click(); }); function switchOfficeSelectCallback(id, act, index, layero, nodes){ - if (act == 'ok'){ + if (act == 'ok' || act == 'clear'){ var officeCode = $('#switchOfficeSelectCode').val(); - if (officeCode != ''){ - js.ajaxSubmit("${ctx}/sys/empUser/switchOffice/"+officeCode, function(data){ - js.showMessage(data.message); - js.window.location.reload(); - }); - } + js.ajaxSubmit("${ctx}/sys/empUser/switchOffice" + (officeCode != '' ? "/"+officeCode : ""), function(data){ + js.showMessage(data.message); + js.window.location.reload(); + }); } }