diff --git a/src/api/eam/basic/classType/index.ts b/src/api/eam/basic/classType/index.ts index 89d153f..c7cd38a 100644 --- a/src/api/eam/basic/classType/index.ts +++ b/src/api/eam/basic/classType/index.ts @@ -51,4 +51,9 @@ export const exportClassType = async (params) => { // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/eam/class-type/get-import-template' }) +} + +// 查询厂区班组角色数据维护列表 +export const getClassTypeNoPage = async (params) => { + return await request.get({ url: `/eam/class-type/noPage`, params }) } \ No newline at end of file diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 2f54e5e..e58ffca 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,6 +4,7 @@ import { getAccessToken, removeToken } from '@/utils/auth' import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { getInfo, loginOut } from '@/api/login' import { getUserProfile } from '@/api/system/user/profile' +import { getClassTypeNoPage } from '@/api/eam/basic/classType' const { wsCache } = useCache() @@ -17,7 +18,8 @@ interface UserInfoVO { roles: string[] isSetUser: boolean user: UserVO - userSelfInfo:object + userSelfInfo: object + classType: object[] } export const useUserStore = defineStore('admin-user', { @@ -30,7 +32,8 @@ export const useUserStore = defineStore('admin-user', { avatar: '', nickname: '' }, - userSelfInfo:{} + userSelfInfo: {}, + classType: [] }), getters: { getPermissions(): string[] { @@ -45,8 +48,11 @@ export const useUserStore = defineStore('admin-user', { getUser(): UserVO { return this.user }, - getUserSelfInfo(): UserVO { + getUserSelfInfo(): UserVO { return this.userSelfInfo + }, + getClassTypeInfo(): object[] { + return this.classType } }, actions: { @@ -64,6 +70,12 @@ export const useUserStore = defineStore('admin-user', { this.roles = userInfo.roles this.user = userInfo.user this.isSetUser = true + this.classType = await getClassTypeNoPage({}); + this.classType = this.classType.filter(item => { + return this.userSelfInfo?.roles.some(role => { + return role.id == item.workerRoleId || role.id == item.engineerRoleId; + }); + }); wsCache.set(CACHE_KEY.USER, userInfo) wsCache.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus) }, diff --git a/src/views/eam/device/devicemaintenancejob/index.vue b/src/views/eam/device/devicemaintenancejob/index.vue index a90272a..c7ecf04 100644 --- a/src/views/eam/device/devicemaintenancejob/index.vue +++ b/src/views/eam/device/devicemaintenancejob/index.vue @@ -371,10 +371,14 @@ const judgeIsTheClassEngineerAndApply = (row,type) => { return false } }else if(row.status === 'APPLYPASS' && type == 'VERIFY'){ - return true + return userStore.classType.some(item => { + return item?.type == row.type && item?.factoryAreaNumber == row.factoryAreaNumber; + }); }else if(row.requestNumber == null || row.requestNumber == ''){ if(row.status === 'COMPLETED' && type == 'VERIFY'){ - return true + return userStore.classType.some(item => { + return item?.type == row.type && item?.factoryAreaNumber == row.factoryAreaNumber; + }); } } // 如果不是COMPLETED或APPLYPASS状态,或者COMPLETED状态下条件不满足,则默认返回false diff --git a/src/views/eam/device/techmaintenancejob/index.vue b/src/views/eam/device/techmaintenancejob/index.vue index 432b48a..b06c93b 100644 --- a/src/views/eam/device/techmaintenancejob/index.vue +++ b/src/views/eam/device/techmaintenancejob/index.vue @@ -345,10 +345,14 @@ const judgeIsTheClassEngineerAndApply = (row,type) => { return false } }else if(row.status === 'APPLYPASS' && type == 'VERIFY'){ - return true + return userStore.classType.some(item => { + return item?.type == row.type && item?.factoryAreaNumber == row.factoryAreaNumber; + }); }else if(row.requestNumber == null || row.requestNumber == ''){ if(row.status === 'COMPLETED' && type == 'VERIFY'){ - return true + return userStore.classType.some(item => { + return item?.type == row.type && item?.factoryAreaNumber == row.factoryAreaNumber; + }); } } // 如果不是COMPLETED或APPLYPASS状态,或者COMPLETED状态下条件不满足,则默认返回false diff --git a/src/views/eam/mold/moldmaintenancejob/index.vue b/src/views/eam/mold/moldmaintenancejob/index.vue index 6d88880..0795ce5 100644 --- a/src/views/eam/mold/moldmaintenancejob/index.vue +++ b/src/views/eam/mold/moldmaintenancejob/index.vue @@ -1169,10 +1169,14 @@ const judgeIsTheClassEngineerAndApply = (row,type) => { return false } }else if(row.status === 'APPLYPASS' && type == 'VERIFY'){ - return true + return userStore.classType.some(item => { + return item?.type == row.type && item?.factoryAreaNumber == row.factoryAreaNumber; + }); }else if(row.requestNumber == null || row.requestNumber == ''){ if(row.status === 'COMPLETED' && type == 'VERIFY'){ - return true + return userStore.classType.some(item => { + return item?.type == row.type && item?.factoryAreaNumber == row.factoryAreaNumber; + }); } } // 如果不是COMPLETED或APPLYPASS状态,或者COMPLETED状态下条件不满足,则默认返回false