|
|
@@ -29,7 +29,9 @@
|
|
|
<!-- 标题 -->
|
|
|
<div class="form-header">
|
|
|
<h1 class="form-title">
|
|
|
- <span class="title-dark">{{projectName||'工业互联网平台'}}</span>
|
|
|
+ <span class="title-dark">{{
|
|
|
+ projectName || '工业互联网平台'
|
|
|
+ }}</span>
|
|
|
</h1>
|
|
|
</div>
|
|
|
|
|
|
@@ -116,7 +118,8 @@
|
|
|
import {
|
|
|
login,
|
|
|
getCaptcha,
|
|
|
- getLatestVersion,logoByCode,
|
|
|
+ getLatestVersion,
|
|
|
+ logoByCode,
|
|
|
getParentIdListByDeptId
|
|
|
} from '@/api/login';
|
|
|
import xyy from '@/assets/xyy.jpg';
|
|
|
@@ -134,7 +137,7 @@
|
|
|
// 登录框方向, 0居中, 1居右, 2居左
|
|
|
xyy,
|
|
|
direction: 0,
|
|
|
- projectName:"",
|
|
|
+ projectName: '',
|
|
|
// 加载状态
|
|
|
loading: false,
|
|
|
// 表单数据
|
|
|
@@ -202,7 +205,7 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- getLogo() {
|
|
|
+ getLogo() {
|
|
|
logoByCode('logoCode').then((res) => {
|
|
|
this.projectName = res.logoName;
|
|
|
});
|
|
|
@@ -231,14 +234,21 @@
|
|
|
.then(async (res) => {
|
|
|
localStorage.setItem('userId', res.data.userId);
|
|
|
localStorage.setItem('accountId', res.data.accountId);
|
|
|
- // 用户信息
|
|
|
- if (res.data?.loginChangeGroupVOList.length > 0) {
|
|
|
+ // 用户信息:默认部门/角色取主所属部门(isMainGroup=1,后端以 t_main_user.group_id 为基准)
|
|
|
+ const groupList = res.data?.loginChangeGroupVOList || [];
|
|
|
+ const mainGroup = groupList.find((item) => item.isMainGroup == 1);
|
|
|
+ if (!mainGroup && groupList.length) {
|
|
|
+ this.$message.warning(
|
|
|
+ '登录接口未返回主所属部门(isMainGroup=1),已默认第一个部门,请后端确认'
|
|
|
+ );
|
|
|
+ }
|
|
|
+ const defaultGroup = mainGroup || groupList[0];
|
|
|
+ if (defaultGroup) {
|
|
|
setCurrentUser(
|
|
|
{
|
|
|
- currentGroupId: res.data.loginChangeGroupVOList[0].groupId,
|
|
|
+ currentGroupId: defaultGroup.groupId,
|
|
|
currentRoleId:
|
|
|
- res.data.loginChangeGroupVOList[0]
|
|
|
- .loginChangeRoleVOList[0].roleId
|
|
|
+ defaultGroup.loginChangeRoleVOList?.[0]?.roleId
|
|
|
},
|
|
|
this.form.remember
|
|
|
);
|