mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-21 09:56:54 +08:00
v3.0.0
This commit is contained in:
@@ -24,15 +24,15 @@ export const useRoleStore = defineStore({
|
||||
},
|
||||
// 选中
|
||||
addCheckedData(data) {
|
||||
if (this.checkedData.some((e) => e == data)) {
|
||||
if (this.checkedData.some((e) => e === data)) {
|
||||
return;
|
||||
}
|
||||
this.checkedData.push(data);
|
||||
},
|
||||
// 选中本级以及子级
|
||||
addCheckedDataAndChildren(data) {
|
||||
let findIndex = this.checkedData.findIndex((val) => val == data.menuId);
|
||||
if (data.menuId && findIndex == -1) {
|
||||
let findIndex = this.checkedData.findIndex((val) => val === data.menuId);
|
||||
if (data.menuId && findIndex === -1) {
|
||||
this.addCheckedData(data.menuId);
|
||||
}
|
||||
if (data.children) {
|
||||
@@ -47,8 +47,8 @@ export const useRoleStore = defineStore({
|
||||
},
|
||||
// 取消选中本级以及子级
|
||||
deleteCheckedDataAndChildren(data) {
|
||||
let findIndex = this.checkedData.findIndex((val) => val == data.menuId);
|
||||
if (findIndex != -1) {
|
||||
let findIndex = this.checkedData.findIndex((val) => val === data.menuId);
|
||||
if (findIndex !== -1) {
|
||||
this.deleteCheckedData(findIndex);
|
||||
}
|
||||
if (data.children) {
|
||||
@@ -83,7 +83,7 @@ export const useRoleStore = defineStore({
|
||||
}
|
||||
// 选中父级
|
||||
let parentIndex = this.checkedData.findIndex((e) => parentModule.menuId === e);
|
||||
if (parentModule.menuId && parentIndex == -1) {
|
||||
if (parentModule.menuId && parentIndex === -1) {
|
||||
this.addCheckedData(parentModule.menuId);
|
||||
}
|
||||
// 如果上级还有上级 则进行递归
|
||||
|
||||
@@ -35,6 +35,8 @@ export const useUserStore = defineStore({
|
||||
administratorFlag: true,
|
||||
//上次登录ip
|
||||
lastLoginIp: '',
|
||||
//上次登录ip地区
|
||||
lastLoginIpRegion: '',
|
||||
//上次登录 设备
|
||||
lastLoginUserAgent: '',
|
||||
//上次登录时间
|
||||
@@ -120,6 +122,7 @@ export const useUserStore = defineStore({
|
||||
this.departmentName = data.departmentName;
|
||||
this.administratorFlag = data.administratorFlag;
|
||||
this.lastLoginIp = data.lastLoginIp;
|
||||
this.lastLoginIpRegion = data.lastLoginIpRegion;
|
||||
this.lastLoginUserAgent = data.lastLoginUserAgent;
|
||||
this.lastLoginTime = data.lastLoginTime;
|
||||
|
||||
@@ -143,10 +146,10 @@ export const useUserStore = defineStore({
|
||||
if (_.isEmpty(this.getTagNav)) this.tagNav = [];
|
||||
// name唯一标识
|
||||
let name = route.name;
|
||||
if (!name || name == HOME_PAGE_NAME) {
|
||||
if (!name || name === HOME_PAGE_NAME) {
|
||||
return;
|
||||
}
|
||||
let findTag = (this.tagNav || []).find((e) => e.menuName == name);
|
||||
let findTag = (this.tagNav || []).find((e) => e.menuName === name);
|
||||
if (findTag) {
|
||||
// @ts-ignore
|
||||
findTag.fromMenuName = from.name;
|
||||
@@ -173,9 +176,9 @@ export const useUserStore = defineStore({
|
||||
this.tagNav = [];
|
||||
this.clearKeepAliveIncludes();
|
||||
} else {
|
||||
let findIndex = (this.tagNav || []).findIndex((e) => e.menuName == menuName);
|
||||
let findIndex = (this.tagNav || []).findIndex((e) => e.menuName === menuName);
|
||||
if (closeAll) {
|
||||
if (findIndex == -1) {
|
||||
if (findIndex === -1) {
|
||||
this.tagNav = [];
|
||||
this.clearKeepAliveIncludes();
|
||||
} else {
|
||||
@@ -197,12 +200,12 @@ export const useUserStore = defineStore({
|
||||
router.push({ path });
|
||||
} else {
|
||||
// 寻找tagNav
|
||||
let index = this.getTagNav.findIndex((e) => e.menuName == route.name);
|
||||
if (index == -1) {
|
||||
let index = this.getTagNav.findIndex((e) => e.menuName === route.name);
|
||||
if (index === -1) {
|
||||
router.push({ name: HOME_PAGE_NAME });
|
||||
} else {
|
||||
let tagNav = this.getTagNav[index];
|
||||
if (tagNav.fromMenuName && this.getTagNav.some((e) => e.menuName == tagNav.fromMenuName)) {
|
||||
if (tagNav.fromMenuName && this.getTagNav.some((e) => e.menuName === tagNav.fromMenuName)) {
|
||||
router.push({ name: tagNav.fromMenuName, query: tagNav.fromMenuQuery });
|
||||
} else {
|
||||
// 查询左侧tag
|
||||
@@ -261,7 +264,7 @@ function buildMenuParentIdListMap(menuTree) {
|
||||
function recursiveBuildMenuParentIdListMap(menuList, parentMenuList, menuParentIdListMap) {
|
||||
for (const e of menuList) {
|
||||
// 顶级parentMenuList清空
|
||||
if (e.parentId == 0) {
|
||||
if (e.parentId === 0) {
|
||||
parentMenuList = [];
|
||||
}
|
||||
let menuIdStr = e.menuId.toString();
|
||||
|
||||
Reference in New Issue
Block a user