登录后不指定默认当前部门编号

This commit is contained in:
thinkgem
2025-02-15 16:39:08 +08:00
parent dddad4d113
commit 9c5db77a65
2 changed files with 7 additions and 9 deletions

View File

@@ -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"));

View File

@@ -3,7 +3,7 @@
<a href="javascript:" id="switchOffice">
<i class="fa icon-grid" style="font-size:12px;"></i> ${officeName!}
</a>
<div class="hide"><#form:treeselect id="switchOfficeSelect" title="${text('部门切换')}" allowClear="false"
<div class="hide"><#form:treeselect id="switchOfficeSelect" title="${text('部门切换')}" allowClear="true"
url="${ctx}/sys/empUser/officeListData?isShowCode=true" callbackFuncName="switchOfficeSelectCallback"
fieldNames="{'id':'officeCode','name':'fullName'}"/>
</div>
@@ -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();
});
}
}
</script>