diff --git a/front/src/store/modules/user.js b/front/src/store/modules/user.js index 0030845b..7bdda586 100644 --- a/front/src/store/modules/user.js +++ b/front/src/store/modules/user.js @@ -2,7 +2,7 @@ * @author chuzhixin 1204505056@qq.com * @description 登录、获取用户信息、退出登录、清除accessToken逻辑,不建议修改 */ -import { getUserInfo, login, logout } from '@/api/user' +import { getUserInfo, login, logout, getRole } from '@/api/user' import { getAccessToken, removeAccessToken, @@ -20,6 +20,7 @@ const state = () => ({ userId: '', avatar: '', role: 0, // 用户管理员权限 + roleList: [], // 用户管理员权限 }) const getters = { accessToken: (state) => state.accessToken, @@ -27,6 +28,7 @@ const getters = { realName: (state) => state.realName, avatar: (state) => state.avatar, role: (state) => state.role, + roleList: (state) => state.roleList, userId: (state) => state.userId, deptName: (state) => state.deptName, deptId: (state) => state.deptId, @@ -64,6 +66,9 @@ const mutations = { setRole(state, role) { state.role = role }, + setRoleList(state, role) { + state.roleList = role + }, // 设置用户userId setUserId(state, id) { state.userId = id @@ -146,6 +151,14 @@ const actions = { commit('setUsername', res.data.data.username) commit('setRealname', res.data.data.realName) commit('setRole', res.data.data.roleIdList.length) + // 获取角色数据 + const roleArr = [] + res.data.data.roleIdList.map((val) => { + getRole(val).then((role) => { + roleArr.push(role.data.data.name) + }) + }) + commit('setRoleList', roleArr) commit('setUserId', res.data.data.id) commit('setDeptName', res.data.data.deptName) commit('setDeptId', res.data.data.deptId) @@ -181,7 +194,6 @@ const actions = { * @param {*} { commit, dispatch } */ async resetAll({ dispatch }) { - await dispatch('setAccessToken', '') await dispatch('acl/setFull', false, { root: true, diff --git a/front/src/views/detailsAll/components/Algorithm/AlgorithmUsageMode.vue b/front/src/views/detailsAll/components/Algorithm/AlgorithmUsageMode.vue index 6044f467..8d93cad0 100644 --- a/front/src/views/detailsAll/components/Algorithm/AlgorithmUsageMode.vue +++ b/front/src/views/detailsAll/components/Algorithm/AlgorithmUsageMode.vue @@ -8,8 +8,7 @@ > -
+
@@ -97,12 +96,14 @@ - + {{ item.people.value }} @@ -112,12 +113,14 @@ - + {{ item.phone.value }} @@ -169,7 +172,15 @@ import { ref, defineProps, watch } from 'vue' import { message } from 'ant-design-vue' import { useRouter } from 'vue-router' + import { useStore } from 'vuex' const router = useRouter() + const store = useStore() + const role = ref(false) + store.getters['user/roleList'].map((val) => { + if (val === '运维管理员') { + role.value = true + } + }) const approveStatus = ref('通过') const whoShow1 = ref(whoShow) diff --git a/front/src/views/detailsAll/components/Application/ApplicationOwningDepartmentAndServiceProvider.vue b/front/src/views/detailsAll/components/Application/ApplicationOwningDepartmentAndServiceProvider.vue index 08762a55..34d7c050 100644 --- a/front/src/views/detailsAll/components/Application/ApplicationOwningDepartmentAndServiceProvider.vue +++ b/front/src/views/detailsAll/components/Application/ApplicationOwningDepartmentAndServiceProvider.vue @@ -8,8 +8,7 @@ >
-
+
{ + if (val === '运维管理员') { + role.value = true + } + }) const approveStatus = ref('通过') const whoShow1 = ref(whoShow) let dataFrom = ref({ diff --git a/front/src/views/detailsAll/components/Business/BusinessUsageMode.vue b/front/src/views/detailsAll/components/Business/BusinessUsageMode.vue index 401726db..16b0e1cc 100644 --- a/front/src/views/detailsAll/components/Business/BusinessUsageMode.vue +++ b/front/src/views/detailsAll/components/Business/BusinessUsageMode.vue @@ -7,8 +7,7 @@ :type="dataFrom.englishTitle" >
-
+
@@ -52,12 +51,14 @@ - + {{ item.people.value }} @@ -67,12 +68,14 @@ - + {{ item.phone.value }} @@ -124,7 +127,15 @@ import { ref, defineProps, watch } from 'vue' import { message } from 'ant-design-vue' import { useRouter } from 'vue-router' + import { useStore } from 'vuex' const router = useRouter() + const store = useStore() + const role = ref(false) + store.getters['user/roleList'].map((val) => { + if (val === '运维管理员') { + role.value = true + } + }) const approveStatus = ref('通过') const whoShow1 = ref(whoShow) let dataFrom = ref({ diff --git a/front/src/views/detailsAll/components/Developer/DeveloperOwningDepartmentAndServiceProvider.vue b/front/src/views/detailsAll/components/Developer/DeveloperOwningDepartmentAndServiceProvider.vue index b62cba8c..c6a1b31c 100644 --- a/front/src/views/detailsAll/components/Developer/DeveloperOwningDepartmentAndServiceProvider.vue +++ b/front/src/views/detailsAll/components/Developer/DeveloperOwningDepartmentAndServiceProvider.vue @@ -7,8 +7,7 @@ :type="dataFrom.englishTitle" >
-
+
@@ -40,6 +39,7 @@