Compare commits
2 Commits
6b1fc28b4b
...
70a015cb01
Author | SHA1 | Date |
---|---|---|
gongjiale | 70a015cb01 | |
gongjiale | 1427424073 |
|
@ -16,6 +16,7 @@ const state = () => ({
|
|||
username: '',
|
||||
realName: '',
|
||||
deptName: '',
|
||||
deptId: '',
|
||||
userId: '',
|
||||
avatar: '',
|
||||
role: 0, // 用户管理员权限
|
||||
|
@ -28,6 +29,7 @@ const getters = {
|
|||
role: (state) => state.role,
|
||||
userId: (state) => state.userId,
|
||||
deptName: (state) => state.deptName,
|
||||
deptId: (state) => state.deptId,
|
||||
}
|
||||
const mutations = {
|
||||
/**
|
||||
|
@ -70,6 +72,9 @@ const mutations = {
|
|||
setDeptName(state, name) {
|
||||
state.deptName = name
|
||||
},
|
||||
setDeptId(state, name) {
|
||||
state.deptId = name
|
||||
},
|
||||
/**
|
||||
* @author chuzhixin 1204505056@qq.com
|
||||
* @description 设置头像
|
||||
|
@ -143,6 +148,7 @@ const actions = {
|
|||
commit('setRole', res.data.data.roleIdList.length)
|
||||
commit('setUserId', res.data.data.id)
|
||||
commit('setDeptName', res.data.data.deptName)
|
||||
commit('setDeptId', res.data.data.deptId)
|
||||
// TODO 获取用户信息,后续执行部分操作
|
||||
// let { username, avatar, roles, ability } = data
|
||||
// if (username && roles && Array.isArray(roles)) {
|
||||
|
@ -175,7 +181,7 @@ const actions = {
|
|||
* @param {*} { commit, dispatch }
|
||||
*/
|
||||
async resetAll({ dispatch }) {
|
||||
debugger
|
||||
|
||||
await dispatch('setAccessToken', '')
|
||||
await dispatch('acl/setFull', false, {
|
||||
root: true,
|
||||
|
|
|
@ -45,7 +45,6 @@ router.beforeEach(async (to, from, next) => {
|
|||
})
|
||||
console.log('验证白名单', routesWhiteList)
|
||||
if (routesWhiteList.indexOf(to.path) !== -1) {
|
||||
debugger
|
||||
next()
|
||||
} else {
|
||||
// 这里是一个单点登录的入口
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
import mybus from '@/myplugins/mybus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue'
|
||||
import { useStore } from 'vuex'
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const selectedKeys = ref([])
|
||||
|
@ -126,6 +127,12 @@
|
|||
children: 'children',
|
||||
title: 'name',
|
||||
}
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const user = ref({
|
||||
deptName: store.getters['user/deptName'],
|
||||
deptId: store.getters['user/deptId'],
|
||||
})
|
||||
const showKey = ref(0)
|
||||
const treeData = ref([])
|
||||
const init = () => {
|
||||
|
@ -138,7 +145,7 @@
|
|||
if (select === '123') {
|
||||
select = ''
|
||||
}
|
||||
// debugger
|
||||
|
||||
console.log(
|
||||
'获取url中的select=====================>',
|
||||
router.currentRoute.value.query.select
|
||||
|
@ -177,8 +184,34 @@
|
|||
const sortArr = ['全部能力目录', '市级', '区级', '企业', '其他']
|
||||
treeData.value.sort((a, b) => {
|
||||
return sortArr.indexOf(a.key) - sortArr.indexOf(b.key)
|
||||
})
|
||||
let deptId=user.value.deptId
|
||||
treeData.value.forEach((child) => {
|
||||
let childern=child.children
|
||||
childern.forEach((childs) => {//第一层:市级
|
||||
if(childs.key==deptId ){
|
||||
childs.show=true
|
||||
child.show=true
|
||||
mybus.emit('paramsGetResources', [childs.key])
|
||||
selectId.value =childs.key
|
||||
}
|
||||
if(childs.children && childs.children.length>0){//第二层 区级
|
||||
let qu=childs.children
|
||||
qu.forEach((qu) => {
|
||||
if(qu.key==deptId ){
|
||||
qu.show=true
|
||||
childs.show=true
|
||||
child.show=true
|
||||
mybus.emit('paramsGetResources', [qu.key])
|
||||
selectId.value = qu.key
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
console.log('左侧树结构数据======================>', treeData.value)
|
||||
|
||||
showKey.value++
|
||||
})
|
||||
}
|
||||
|
@ -188,6 +221,7 @@
|
|||
})
|
||||
// 生成children
|
||||
const generateChildren = (val, obj) => {
|
||||
|
||||
if (val.dataList.length > 0) {
|
||||
val.dataList.forEach((child) => {
|
||||
let children = {
|
||||
|
@ -197,12 +231,14 @@
|
|||
total: child.deptCount,
|
||||
key: child.deptId,
|
||||
}
|
||||
|
||||
obj.children.push(children)
|
||||
})
|
||||
}
|
||||
}
|
||||
// 区级特殊处理
|
||||
const generateChildren2 = (val, obj) => {
|
||||
|
||||
if (val.dataList.length > 0) {
|
||||
val.dataList.forEach((dis) => {
|
||||
let children = {
|
||||
|
@ -222,6 +258,7 @@
|
|||
select: false,
|
||||
key: child.deptId,
|
||||
}
|
||||
|
||||
children.children.push(children2)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue